diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | cram.c | 10 | ||||
-rw-r--r-- | fetchmail.h | 2 | ||||
-rw-r--r-- | imap.c | 2 | ||||
-rw-r--r-- | odmr.c | 19 | ||||
-rw-r--r-- | pop3.c | 2 |
6 files changed, 31 insertions, 9 deletions
@@ -3,6 +3,9 @@ (The `lines' figures total .c, .h, .l, and .y files under version control.) * HMH's snprintf/strncat cleanup patch. +* Fixes for Debian bugs #101792, #101950. +* Updated Danish translation by Byrial Jensen. +* ODMR fixes from Matt Armstrong <matt@lickey.com>. fetchmail-5.8.8 (Wed Jun 20 17:22:26 EDT 2001), 20782 lines: @@ -13,7 +16,7 @@ fetchmail-5.8.8 (Wed Jun 20 17:22:26 EDT 2001), 20782 lines: * Fix for Debian bug #101500. * Updated Danish translation by Byrial Jensen. * Chris Maio's patch for POP3 with BSMTP. -* Patch from HMH resolves DEbian bug #101530. +* Patch from HMH resolves Debian bug #101530. There are 353 people on fetchmail-friends and 594 on fetchmail-announce. @@ -60,7 +60,7 @@ static void hmac_md5 (unsigned char *password, size_t pass_len, MD5Final (response, &ctx); } -int do_cram_md5 (int sock, char *command, struct query *ctl) +int do_cram_md5 (int sock, char *command, struct query *ctl, char *strip) /* authenticate as per RFC2195 */ { int result; @@ -69,6 +69,7 @@ int do_cram_md5 (int sock, char *command, struct query *ctl) unsigned char msg_id[768]; unsigned char response[16]; unsigned char reply[1024]; + unsigned char *respdata; gen_send (sock, "%s CRAM-MD5", command); @@ -84,7 +85,12 @@ int do_cram_md5 (int sock, char *command, struct query *ctl) return result; } - len = from64tobits (msg_id, buf1); + /* caller may specify a response prefix we should strip if present */ + respdata = buf1; + if (strncmp(buf1, strip, strlen(strip)) == 0) + respdata += strlen(strip); + len = from64tobits (msg_id, respdata); + if (len < 0) { report (stderr, _("could not decode BASE64 challenge\n")); return PS_AUTHFAIL; diff --git a/fetchmail.h b/fetchmail.h index 0c69349d..947b4ba6 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -555,7 +555,7 @@ int doETRN (struct query *); int doODMR (struct query *); /* authentication functions */ -int do_cram_md5(int sock, char *command, struct query *ctl); +int do_cram_md5(int sock, char *command, struct query *ctl, char *strip); int do_rfc1731(int sock, char *command, char *truename); int do_gssauth(int sock, char *command, char *hostname, char *username); int do_otp(int sock, char *command, struct query *ctl); @@ -341,7 +341,7 @@ static int imap_getauth(int sock, struct query *ctl, char *greeting) || ctl->server.authenticate == A_CRAM_MD5) && strstr(capabilities, "AUTH=CRAM-MD5")) { - if ((ok = do_cram_md5 (sock, "AUTHENTICATE", ctl))) + if ((ok = do_cram_md5 (sock, "AUTHENTICATE", ctl, NULL))) { /* SASL cancellation of authentication */ gen_send(sock, "*"); @@ -65,7 +65,7 @@ static int odmr_getrange(int sock, struct query *ctl, const char *id, *bytes = *countp = *newp = -1; /* authenticate via CRAM-MD5 */ - ok = do_cram_md5(sock, "AUTH", ctl); + ok = do_cram_md5(sock, "AUTH", ctl, "334 "); if (ok) return(ok); @@ -130,7 +130,14 @@ static int odmr_getrange(int sock, struct query *ctl, const char *id, * use select(2) to watch the read sides of both sockets and just * throw their data at each other. */ - smtp_sock = SockOpen(ctl->smtphost, SMTP_PORT, NULL, NULL); + /* + * FIXME: we hardcode "localhost" here because ODMR is fighting + * over the ETRN meaning of smtphost and the POP/IMAP meaning. + * ODMR needs both meanings, but there is only one config var. So + * for now ODMR always uses the "localhost" SMTP server to connect + * with locally. + */ + smtp_sock = SockOpen("localhost", SMTP_PORT, NULL, NULL); if (smtp_sock == -1) return(PS_SOCKET); else @@ -180,6 +187,12 @@ static int odmr_getrange(int sock, struct query *ctl, const char *id, return(0); } +static int odmr_logout(int sock, struct query *ctl) +/* send logout command */ +{ + return(gen_transact(sock, "QUIT")); +} + const static struct method odmr = { "ODMR", /* ODMR protocol */ @@ -201,7 +214,7 @@ const static struct method odmr = NULL, /* no way to fetch body */ NULL, /* no message trailer */ NULL, /* how to delete a message */ - NULL, /* log out, we're done */ + odmr_logout, /* log out, we're done */ FALSE, /* no, we can't re-poll */ }; @@ -274,7 +274,7 @@ static int pop3_getauth(int sock, struct query *ctl, char *greeting) (ctl->server.authenticate == A_CRAM_MD5 || ctl->server.authenticate == A_ANY)) { - ok = do_cram_md5(sock, "AUTH", ctl); + ok = do_cram_md5(sock, "AUTH", ctl, NULL); if (ok == PS_SUCCESS || ctl->server.authenticate != A_ANY) break; } |