aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2001-06-24 14:17:11 +0000
committerEric S. Raymond <esr@thyrsus.com>2001-06-24 14:17:11 +0000
commit6006dd080700778ae0e7cefc4e56b5e800e8db1e (patch)
tree7907374655c39329c0c5da71a89afb857f9ceffd
parente7ec487d41279380def7df865214ae19c5e18399 (diff)
downloadfetchmail-6006dd080700778ae0e7cefc4e56b5e800e8db1e.tar.gz
fetchmail-6006dd080700778ae0e7cefc4e56b5e800e8db1e.tar.bz2
fetchmail-6006dd080700778ae0e7cefc4e56b5e800e8db1e.zip
First round of ODMR fixes.
svn path=/trunk/; revision=3372
-rw-r--r--NEWS5
-rw-r--r--cram.c10
-rw-r--r--fetchmail.h2
-rw-r--r--imap.c2
-rw-r--r--odmr.c19
-rw-r--r--pop3.c2
6 files changed, 31 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index 64128e43..9bd42513 100644
--- a/NEWS
+++ b/NEWS
@@ -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.
diff --git a/cram.c b/cram.c
index 01952f6b..da1bade5 100644
--- a/cram.c
+++ b/cram.c
@@ -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);
diff --git a/imap.c b/imap.c
index fe874831..cfc85fa6 100644
--- a/imap.c
+++ b/imap.c
@@ -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, "*");
diff --git a/odmr.c b/odmr.c
index bc694083..e97a755e 100644
--- a/odmr.c
+++ b/odmr.c
@@ -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 */
};
diff --git a/pop3.c b/pop3.c
index 771de46a..7f7bcb56 100644
--- a/pop3.c
+++ b/pop3.c
@@ -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;
}