From 2317a589968d7d906840dd2b1330174c6b1d7d0d Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 30 Apr 2009 14:00:07 +0000 Subject: [PATCH] Improve ask_userauth(). git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@659 7dcaeef0-15fb-0310-b436-a5af3365683c --- libssh/auth.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/libssh/auth.c b/libssh/auth.c index 235ec231..fbb073f5 100644 --- a/libssh/auth.c +++ b/libssh/auth.c @@ -36,17 +36,21 @@ /** \addtogroup ssh_auth * @{ */ -static int ask_userauth(SSH_SESSION *session){ - int ret=0; - enter_function(); - if(session->auth_service_asked) - ret = 0; - else if(ssh_service_request(session,"ssh-userauth")) - ret = -1; - else - session->auth_service_asked++; - leave_function(); - return ret; +static int ask_userauth(SSH_SESSION *session) { + int rc = 0; + + enter_function(); + + if (session->auth_service_asked) { + rc = 0; + } else if (ssh_service_request(session,"ssh-userauth")) { + rc = -1; + } else { + session->auth_service_asked++; + } + + leave_function(); + return rc; } static void burn(char *ptr){