aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--driver.c27
-rw-r--r--fetchmail.h7
-rw-r--r--imap.c2
-rw-r--r--pop3.c25
5 files changed, 40 insertions, 24 deletions
diff --git a/NEWS b/NEWS
index f720a434..f0160842 100644
--- a/NEWS
+++ b/NEWS
@@ -11,8 +11,9 @@ fetchmail-4.7.6 ():
* ' now works as a string quote in. fetchmailrc syntax, just like ".
* All bounce messages now use FQDN return paths.
* Check for background nmode before generating oversized-message mail. Duh!
+* Paul Murphy's improvements for SDPS.
-There are 262 people on fetchmail-friends and 343 on fetchmail-announce.
+There are 263 people on fetchmail-friends and 343 on fetchmail-announce.
fetchmail-4.7.5 (Sat Jan 9 17:01:13 EST 1999):
* Issue proper logout after running fetchmail -c
diff --git a/driver.c b/driver.c
index 6011c2a6..e68756f7 100644
--- a/driver.c
+++ b/driver.c
@@ -771,6 +771,16 @@ static int readheaders(int sock,
/* Check for MIME headers indicating possible 8-bit data */
ctl->mimemsg = MimeBodyType(msgblk.headers, ctl->mimedecode);
+#ifdef SDPS_ENABLE
+ if (ctl->server.sdps && sdps_envfrom)
+ {
+ /* We have the real envelope return-path, stored out of band by
+ * SDPS - that's more accurate than any header is going to be.
+ */
+ strcpy(msgblk.return_path, sdps_envfrom);
+ free(sdps_envfrom);
+ } else
+#endif /* SDPS_ENABLE */
/*
* If there is a Return-Path address on the message, this was
* almost certainly the MAIL FROM address given the originating
@@ -803,6 +813,16 @@ static int readheaders(int sock,
/* is this a multidrop box? */
if (MULTIDROP(ctl))
{
+#ifdef SDPS_ENABLE
+ if (ctl->server.sdps && sdps_envto)
+ {
+ /* We have the real envelope recipient, stored out of band by
+ * SDPS - that's more accurate than any header is going to be.
+ */
+ find_server_names(sdps_envto, ctl, &msgblk.recipients);
+ free(sdps_envto);
+ } else
+#endif /* SDPS_ENABLE */
if (env_offs > -1) /* We have the actual envelope addressee */
find_server_names(msgblk.headers + env_offs, ctl, &msgblk.recipients);
else if (received_for)
@@ -814,13 +834,6 @@ static int readheaders(int sock,
* hostnames go through.
*/
find_server_names(received_for, ctl, &msgblk.recipients);
-#ifdef SDPS_ENABLE
- else if (sdps_envto)
- {
- find_server_names(sdps_envto, ctl, &msgblk.recipients);
- free(sdps_envto);
- }
-#endif /* SDPS_ENABLE */
else
{
/*
diff --git a/fetchmail.h b/fetchmail.h
index 5dcd277c..243fd623 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -332,6 +332,10 @@ extern int pass; /* number of re-polling pass */
extern flag configdump; /* dump control blocks as Python dictionary */
extern const char *fetchmailhost;
/* either "localhost" or an FQDN */
+#ifdef SDPS_ENABLE
+extern char *sdps_envfrom;
+extern char *sdps_envto;
+#endif /* SDPS_ENABLE */
/* prototypes for globally callable functions */
@@ -472,9 +476,6 @@ void dump_config(struct runctl *runp, struct query *querylist);
int is_host_alias(const char *, struct query *);
char *host_fqdn(void);
char *rfc822timestamp(void);
-#ifdef SDPS_ENABLE
-char *sdps_envto;
-#endif /* SDPS_ENABLE */
void yyerror(const char *);
int yylex(void);
diff --git a/imap.c b/imap.c
index 9e131eef..00ec7911 100644
--- a/imap.c
+++ b/imap.c
@@ -14,7 +14,6 @@
#endif
#include "fetchmail.h"
#include "socket.h"
-#include "i18n.h"
#ifdef KERBEROS_V4
#ifdef KERBEROS_V5
@@ -31,6 +30,7 @@
#include <krb.h>
#endif
#endif /* KERBEROS_V4 */
+#include "i18n.h"
#ifdef GSSAPI
#include <gssapi/gssapi.h>
diff --git a/pop3.c b/pop3.c
index f5cb3b75..ea2d1422 100644
--- a/pop3.c
+++ b/pop3.c
@@ -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')));