diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2001-02-11 22:17:05 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2001-02-11 22:17:05 +0000 |
commit | 18f57966dd58cb32956332ab4ac235edd8d1d7ca (patch) | |
tree | 8db489f39dd27fa9e70faf0ede63786014764b63 | |
parent | fcdff42c2a08cb2136758c853d0d05328e22d8ca (diff) | |
download | fetchmail-18f57966dd58cb32956332ab4ac235edd8d1d7ca.tar.gz fetchmail-18f57966dd58cb32956332ab4ac235edd8d1d7ca.tar.bz2 fetchmail-18f57966dd58cb32956332ab4ac235edd8d1d7ca.zip |
Try to clean this up a little.
svn path=/trunk/; revision=3070
-rw-r--r-- | gssapi.c | 49 |
1 files changed, 21 insertions, 28 deletions
@@ -1,5 +1,5 @@ /* - * cram.c -- GSSAPI authentication (see RFC 1508) + * gssapi.c -- GSSAPI authentication (see RFC 1508) * * For license terms, see the file COPYING in this directory. */ @@ -171,36 +171,29 @@ int do_gssauth(int sock, char *command, char *hostname, char *username) return PS_AUTHFAIL; } to64frombits(buf1, send_token.value, send_token.length); - if (outlevel >= O_DEBUG) { - report(stdout, _("Requesting authorization as %s\n"), username); - report(stdout, "IMAP> %s\n",buf1); - } - strcat(buf1, "\r\n"); - SockWrite(sock, buf1, strlen(buf1)); - /* we should be done. Get status and finish up */ - do { - if (result = gen_recv(sock, buf1, sizeof buf1)) - return result; - } while(strncmp(buf1, tag, strlen(tag)) != 0); - if (strstr(buf1, "OK")) { - /* flush security context */ - if (outlevel >= O_DEBUG) - report(stdout, _("Releasing GSS credentials\n")); - maj_stat = gss_delete_sec_context(&min_stat, &context, &send_token); - if (maj_stat != GSS_S_COMPLETE) { - report(stderr, _("Error releasing credentials\n")); - return PS_AUTHFAIL; - } - /* send_token may contain a notification to the server to flush - * credentials. RFC 1731 doesn't specify what to do, and since this - * support is only for authentication, we'll assume the server - * knows enough to flush its own credentials */ - gss_release_buffer(&min_stat, &send_token); - return PS_SUCCESS; + suppress_tags = TRUE; + result = gen_transact(sock, buf1, strlen(buf)); + suppress_tags = FALSE; + + /* flush security context */ + if (outlevel >= O_DEBUG) + report(stdout, _("Releasing GSS credentials\n")); + maj_stat = gss_delete_sec_context(&min_stat, &context, &send_token); + if (maj_stat != GSS_S_COMPLETE) { + report(stderr, _("Error releasing credentials\n")); + return PS_AUTHFAIL; } + /* send_token may contain a notification to the server to flush + * credentials. RFC 1731 doesn't specify what to do, and since this + * support is only for authentication, we'll assume the server + * knows enough to flush its own credentials */ + gss_release_buffer(&min_stat, &send_token); - return PS_AUTHFAIL; + if (result) + return(result); + else + return(PS_SUCCESS); } #endif /* GSSAPI */ |