aboutsummaryrefslogtreecommitdiffstats
path: root/cram.c
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 /cram.c
parente7ec487d41279380def7df865214ae19c5e18399 (diff)
downloadfetchmail-6006dd080700778ae0e7cefc4e56b5e800e8db1e.tar.gz
fetchmail-6006dd080700778ae0e7cefc4e56b5e800e8db1e.tar.bz2
fetchmail-6006dd080700778ae0e7cefc4e56b5e800e8db1e.zip
First round of ODMR fixes.
svn path=/trunk/; revision=3372
Diffstat (limited to 'cram.c')
-rw-r--r--cram.c10
1 files changed, 8 insertions, 2 deletions
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;