diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1999-01-30 17:26:08 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1999-01-30 17:26:08 +0000 |
commit | 89e719105e5b6f0b72eace2bb161516869b5593d (patch) | |
tree | 84dc8a186ac6da0c516317329699cfbe4bf664c7 /pop3.c | |
parent | 61345121e51771328803c9ee8fbe15e4177a25df (diff) | |
download | fetchmail-89e719105e5b6f0b72eace2bb161516869b5593d.tar.gz fetchmail-89e719105e5b6f0b72eace2bb161516869b5593d.tar.bz2 fetchmail-89e719105e5b6f0b72eace2bb161516869b5593d.zip |
SDPS changes from Paul Murphy.
svn path=/trunk/; revision=2356
Diffstat (limited to 'pop3.c')
-rw-r--r-- | pop3.c | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -37,7 +37,7 @@ static int pop3_phase; #define PHASE_LOGOUT 4 static int last; #ifdef SDPS_ENABLE -static flag sdps_enable = FALSE; +char *sdps_envfrom; char *sdps_envto; #endif /* SDPS_ENABLE */ @@ -122,14 +122,8 @@ int pop3_getauth(int sock, struct query *ctl, char *greeting) * If we see either, and we're in multidrop mode, try to use * the SDPS *ENV extension. */ - sdps_enable = (MULTIDROP(ctl) && strstr(greeting, "demon.")); - /* - * Use SDPS if configured, regardless of the greeting string - * returned from the POP server. (Users accessing demon by a - * POP3 proxy may need this) - */ - if (ctl->server.sdps) - sdps_enable = ctl->server.sdps; + if (!(ctl->server.sdps) && MULTIDROP(ctl) && strstr(greeting, "demon.")) + ctl->server.sdps = TRUE; #endif /* SDPS_ENABLE */ switch (ctl->server.protocol) { @@ -548,10 +542,11 @@ static int pop3_fetch(int sock, struct query *ctl, int number, int *lenp) * See http://www.demon.net/services/mail/sdps-tech.html * for a description of what we're parsing here. */ - if (sdps_enable) + if (ctl->server.sdps) { int linecount = 0; + sdps_envfrom = (char *)NULL; sdps_envto = (char *)NULL; gen_send(sock, "*ENV %d", number); do { @@ -560,11 +555,17 @@ static int pop3_fetch(int sock, struct query *ctl, int number, int *lenp) break; } linecount++; - if (linecount == 5) - { + switch (linecount) { + case 4: + /* No need to wrap envelope from address */ + sdps_envfrom = xmalloc(strlen(buf)+1); + strcpy(sdps_envfrom,buf); + break; + case 5: /* Wrap address with To: <> so nxtaddr() likes it */ sdps_envto = xmalloc(strlen(buf)+7); sprintf(sdps_envto,"To: <%s>",buf); + break; } } while (!(buf[0] == '.' && (buf[1] == '\r' || buf[1] == '\n' || buf[1] == '\0'))); |