diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2001-02-12 01:14:30 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2001-02-12 01:14:30 +0000 |
commit | 20dfee53954fb557cf867a053d4d5d29e9bedb89 (patch) | |
tree | 9bf6c2a6a3524c8b8a5779162c36e431c9d73569 /pop3.c | |
parent | d6c728ad218f79305ad759eba6d787d125c67ec3 (diff) | |
download | fetchmail-20dfee53954fb557cf867a053d4d5d29e9bedb89.tar.gz fetchmail-20dfee53954fb557cf867a053d4d5d29e9bedb89.tar.bz2 fetchmail-20dfee53954fb557cf867a053d4d5d29e9bedb89.zip |
Looks like we've got the new authentication logic done.
svn path=/trunk/; revision=3072
Diffstat (limited to 'pop3.c')
-rw-r--r-- | pop3.c | 40 |
1 files changed, 27 insertions, 13 deletions
@@ -211,40 +211,54 @@ int pop3_getauth(int sock, struct query *ctl, char *greeting) if (strchr(greeting, '<') && gen_transact(sock, "AUTH") == 0) { char buffer[10]; - flag has_cram = FALSE; -#if defined(KERBEROS_IV) +#if defined(GSSAPI) + flag has_gssapi = FALSE; +#endif /* defined(GSSAPI) */ +#if defined(KERBEROS_V4) || defined(KERBEROS_V5) flag has_kerberos = FALSE; -#endif /* defined(KERBEROS_IV) */ +#endif /* defined(KERBEROS_V4) || defined(KERBEROS_V5) */ + flag has_cram = FALSE; #ifdef OPIE_ENABLE flag has_opie = FALSE; #endif /* OPIE_ENABLE */ + /* determine what authentication methods we have available */ while ((ok = gen_recv(sock, buffer, sizeof(buffer))) == 0) { if (DOTLINE(buffer)) break; - if (strncasecmp(buffer, "CRAM-MD5", 8) == 0) - has_cram = TRUE; -#if defined(KERBEROS_IV) +#if defined(GSSAPI) + if (strncasecmp(buffer, "GSSAPI", 8) == 0) + has_gssapi = TRUE; +#endif /* defined(GSSAPI) */ +#if defined(KERBEROS_V4) || defined(KERBEROS_V5) if (strncasecmp(buffer, "KERBEROS_V4", 8) == 0) has_kerberos = TRUE; -#endif /* defined(KERBEROS_IV) */ +#endif /* defined(KERBEROS_V4) || defined(KERBEROS_V5) */ + if (strncasecmp(buffer, "CRAM-MD5", 8) == 0) + has_cram = TRUE; #ifdef OPIE_ENABLE if (strncasecmp(buffer, "X-OTP", 8) == 0) has_opie = TRUE; #endif /* OPIE_ENABLE */ } -#if defined(KERBEROS_IV) + +#if defined(GSSAPI) + if (has_kerberos) + return(do_gssauth(sock, "AUTH", + ctl->server.truename, ctl->remotename)); +#endif /* defined(GSSAPI) */ +#if defined(KERBEROS_V4) || defined(KERBEROS_V5) if (has_kerberos) return(do_rfc1731(sock, "AUTH", ctl->server.truename)); -#endif /* defined(KERBEROS_IV) */ +#endif /* defined(KERBEROS_V4) || defined(KERBEROS_V5) */ + if (has_cram) + return(do_cram_md5(sock, "AUTH", ctl)); #ifdef OPIE_ENABLE if (has_opie) - do_otp(sock, ctl) + do_otp(sock, "AUTH", ctl) #endif /* OPIE_ENABLE */ - if (has_cram) - return(do_cram_md5(sock, "AUTH", ctl)); - } + } /* ordinary validation, no one-time password or RPA */ ok = gen_transact(sock, "PASS %s", ctl->password); |