diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2012-11-09 15:45:24 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2012-11-09 15:45:24 +0100 |
commit | a319fb111f0aed2e66935bace03621e9fbcc1d96 (patch) | |
tree | da15795882131887e3c92d4718c5aafa5f521d3f /src | |
parent | 55a7c6b26d599459cb8d62638cddc137906d0536 (diff) | |
download | libpam-x2go-a319fb111f0aed2e66935bace03621e9fbcc1d96.tar.gz libpam-x2go-a319fb111f0aed2e66935bace03621e9fbcc1d96.tar.bz2 libpam-x2go-a319fb111f0aed2e66935bace03621e9fbcc1d96.zip |
slightly different logic for finding a proper return value
Diffstat (limited to 'src')
-rw-r--r-- | src/x2go-auth-check.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/x2go-auth-check.c b/src/x2go-auth-check.c index 8a3fb01..1b4ad8f 100644 --- a/src/x2go-auth-check.c +++ b/src/x2go-auth-check.c @@ -67,23 +67,24 @@ main (int argc, char * argv[]) printf ("4\n"); - int rc = -1; - if (ssh_connect (auth_check_ssh_session)) { - rc = ssh_userauth_password ( auth_check_ssh_session, NULL, password ); + int rc; + rc = ssh_connect (auth_check_ssh_session) + if ( rc != SSH_OK ) { + ssh_free(auth_check_ssh_session); + return -1; + } + + rc = ssh_userauth_password ( auth_check_ssh_session, NULL, password ); + if ( rc != SSH_AUTH_SUCCESS ) { ssh_disconnect(auth_check_ssh_session); + ssh_free(auth_check_ssh_session); + return -1 } - ssh_free(auth_check_ssh_session); printf ("5\n"); - int retval = -1; - if ( rc == SSH_AUTH_SUCCESS ) - { - retval = 0; - } - memset(password, 0, sizeof(password)); munlock(password, sizeof(password)); - return retval; + return 0; } |