diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1998-01-18 06:04:54 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1998-01-18 06:04:54 +0000 |
commit | d71cb2abc85c55777928ce3f4084360101c9e2e6 (patch) | |
tree | fde622ce6620b0fb53e7b3065924491171583803 | |
parent | d1852f76ae3d7e7487ca4cf43f49bf91c5b3fcab (diff) | |
download | fetchmail-d71cb2abc85c55777928ce3f4084360101c9e2e6.tar.gz fetchmail-d71cb2abc85c55777928ce3f4084360101c9e2e6.tar.bz2 fetchmail-d71cb2abc85c55777928ce3f4084360101c9e2e6.zip |
Added smtpaddress option.
svn path=/trunk/; revision=1592
-rw-r--r-- | NEWS | 16 | ||||
-rw-r--r-- | driver.c | 21 | ||||
-rw-r--r-- | fetchmail.c | 4 | ||||
-rw-r--r-- | fetchmail.h | 1 | ||||
-rw-r--r-- | fetchmail.man | 6 | ||||
-rw-r--r-- | options.c | 26 | ||||
-rw-r--r-- | rcfile_l.l | 1 | ||||
-rw-r--r-- | rcfile_y.y | 5 | ||||
-rw-r--r-- | sample.rcfile | 1 |
9 files changed, 58 insertions, 23 deletions
@@ -18,12 +18,22 @@ ------------------------------------------------------------------------------ fetchmail-4.3.6 () * Improved RPM packaging with correct grouping and an icon. - -There are 262 people on fetchmail-friends and 102 on fetchmail-announce. +* Fixed another minor bug in handling of `expunge 0'. +* Kent Robotti sent a new version of fetchsetup. +* Scott Burson's tweak to allow USER=postmaster to work. +* Byrial Jensen's fix to handle NULs in mail correctly. +* Vojtech Pavlik's fix for simultaneous %F and %T. +* IMAP code can now deal with untagged responses during CAPABILITY + (at least one server issues the motd in a bunch of "* OK {ALERT]" lines + in response to the first command after connecting.) +* New --smtpaddress option from Henning P. Schmiedehausen allows you + to force the hostname used in MAIL FROM lines. + +There are 281 people on fetchmail-friends and 118 on fetchmail-announce. fetchmail-4.3.5 (Mon Dec 15 06:07:08 EST 1997) * Added Kent Robotti's fetchsetup configuration script. -* Corrected buggy handling of `expunge 0'. +* Corrected buggy handling of `expunge 0'. * RFC 1731 GSSAPI support from Brendan Cully <brendan@kublai.com>. * We no longer reveal the remotename in fetchmail's Received line, as this may be sensitive information. @@ -554,7 +554,7 @@ int num; /* index of message */ } *addrchain = NULL, **chainptr = &addrchain; char buf[MSGBUFSIZE+1], return_path[MSGBUFSIZE+1]; int from_offs, ctt_offs, env_offs, next_address; - char *headers, *received_for, *desthost, *rcv; + char *headers, *received_for, *destaddr, *rcv; int n, linelen, oldlen, ch, remaining, skipcount; char *cp; struct idlist *idp, *xmit_names; @@ -896,7 +896,7 @@ int num; /* index of message */ if (idp->val.num == XMIT_ACCEPT) good_addresses++; - desthost = "localhost"; + destaddr = "localhost"; length = strlen(ctl->mda) + 1; before = xstrdup(ctl->mda); @@ -1129,7 +1129,8 @@ int num; /* index of message */ * or MX but not a CNAME. Some listeners (like exim) * enforce this. */ - desthost = ctl->smtphost ? ctl->smtphost : "localhost"; + destaddr = ctl->smtpaddress ? ctl->smtpaddress : ( ctl->smtphost ? ctl->smtphost : "localhost"); + for (idp = xmit_names; idp; idp = idp->next) if (idp->val.num == XMIT_ACCEPT) { @@ -1137,9 +1138,9 @@ int num; /* index of message */ strcpy(addr, idp->id); else #ifdef HAVE_SNPRINTF - snprintf(addr, sizeof(addr)-1, "%s@%s", idp->id, desthost); + snprintf(addr, sizeof(addr)-1, "%s@%s", idp->id, destaddr); #else - sprintf(addr, "%s@%s", idp->id, desthost); + sprintf(addr, "%s@%s", idp->id, destaddr); #endif /* HAVE_SNPRINTF */ if (SMTP_rcpt(ctl->smtp_socket, addr) == SM_OK) @@ -1149,15 +1150,15 @@ int num; /* index of message */ bad_addresses++; idp->val.num = XMIT_ANTISPAM; error(0, 0, - "SMTP listener doesn't like recipient address `%s'", idp->id); + "SMTP listener doesn't like recipient address `%s@%s'", idp->id, destaddr); } } if (!good_addresses) { #ifdef HAVE_SNPRINTF - snprintf(addr, sizeof(addr)-1, "%s@%s", user, desthost); + snprintf(addr, sizeof(addr)-1, "%s@%s", user, destaddr); #else - sprintf(addr, "%s@%s", user, desthost); + sprintf(addr, "%s@%s", user, destaddr); #endif /* HAVE_SNPRINTF */ if (SMTP_rcpt(ctl->smtp_socket, addr) != SM_OK) @@ -1212,7 +1213,7 @@ int num; /* index of message */ { sprintf(buf+1, "for <%s@%s> (by default); ", - user, desthost); + user, destaddr); } else if (good_addresses == 1) { @@ -1220,7 +1221,7 @@ int num; /* index of message */ if (idp->val.num == XMIT_ACCEPT) break; /* only report first address */ sprintf(buf+1, "for <%s@%s> (%s); ", - idp->id, desthost, + idp->id, destaddr, MULTIDROP(ctl) ? "multi-drop" : "single-drop"); } else diff --git a/fetchmail.c b/fetchmail.c index 506c11e7..49c163c2 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -578,6 +578,7 @@ static int load_params(int argc, char **argv, int optind) memset(&def_opts, '\0', sizeof(struct query)); def_opts.smtp_socket = -1; + def_opts.smtpaddress = (char *)0; def_opts.server.protocol = P_AUTO; def_opts.server.timeout = CLIENT_TIMEOUT; @@ -1012,6 +1013,9 @@ void dump_params (struct query *ctl) printf(" (default)"); } printf("\n"); + if (ctl->smtpaddress) + printf(" Host part of MAIL FROM line will be %s\n", + ctl->smtpaddress); } if (ctl->preconnect) printf(" Server connection will be brought up with '%s.'\n", diff --git a/fetchmail.h b/fetchmail.h index 55162750..7ded5a4b 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -129,6 +129,7 @@ struct query struct idlist *mailboxes; /* list of mailboxes to check */ struct idlist *smtphunt; /* list of SMTP hosts to try forwarding to */ char *smtphost; /* actual SMTP host to point to */ + char *smtpaddress; /* address we want to force in the delivery messages */ char *mda; /* local MDA to pass mail to */ char *preconnect; /* pre-connection command to execute */ char *postconnect; /* post-connection command to execute */ diff --git a/fetchmail.man b/fetchmail.man index 83cb6f91..04232137 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -209,6 +209,12 @@ mailserver is asked to ship mail to. Hosts are tried in list order; the first one that is up becomes the forwarding or ETRN target for the current run. .TP +.B \-D domain, --smtpaddress domain +(Keyword: smtpaddress) +Specify the domain to be put in MAIL FROM lines shipped to SMTP. The +name of the SMTP server (as specified by --smtphost, or defaulted to +"localhost") is used when this is not specified. +.TP .B \-m, \--mda (Keyword: mda) You can force mail to be passed to an MDA directly (rather than @@ -44,16 +44,17 @@ #define LA_LIMIT 26 #define LA_FOLDER 27 #define LA_SMTPHOST 28 -#define LA_BATCHLIMIT 29 -#define LA_FETCHLIMIT 30 -#define LA_EXPUNGE 31 -#define LA_MDA 32 -#define LA_INTERFACE 33 -#define LA_MONITOR 34 -#define LA_YYDEBUG 35 -#define LA_QVIRTUAL 36 +#define LA_SMTPADDR 29 +#define LA_BATCHLIMIT 30 +#define LA_FETCHLIMIT 31 +#define LA_EXPUNGE 32 +#define LA_MDA 33 +#define LA_INTERFACE 34 +#define LA_MONITOR 35 +#define LA_YYDEBUG 36 +#define LA_QVIRTUAL 37 -/* options still left: CDgGhHjJoORTUwWxXYzZ */ +/* options still left: CgGhHjJoORTUwWxXYzZ */ static const char *shortoptions = "?Vcsvd:NqL:f:i:p:UP:A:t:E:Q:u:akKFnl:r:S:b:B:e:m:I:M:y"; @@ -94,6 +95,8 @@ static const struct option longoptions[] = { {"folder", required_argument, (int *) 0, LA_FOLDER }, {"smtphost", required_argument, (int *) 0, LA_SMTPHOST }, + {"smtpaddress", required_argument, (int *) 0, LA_SMTPADDR }, + {"batchlimit",required_argument, (int *) 0, LA_BATCHLIMIT }, {"fetchlimit",required_argument, (int *) 0, LA_FETCHLIMIT }, {"expunge", required_argument, (int *) 0, LA_EXPUNGE }, @@ -298,6 +301,10 @@ struct query *ctl; /* option record to be initialized */ ((cp = strtok((char *)NULL, ","))); ocount++; break; + case 'D': + case LA_SMTPADDR: + ctl->smtpaddress = xstrdup(optarg); + break; case 'b': case LA_BATCHLIMIT: c = atoi(optarg); @@ -390,6 +397,7 @@ struct query *ctl; /* option record to be initialized */ fputs(" -l, --limit don't fetch messages over given size\n", stderr); fputs(" -S, --smtphost set SMTP forwarding host\n", stderr); + fputs(" -D, --smtpaddress set SMTP delivery domain to use\n", stderr); fputs(" -b, --batchlimit set batch limit for SMTP connections\n", stderr); fputs(" -B, --fetchlimit set fetch limit for server connections\n", stderr); fputs(" -e, --expunge set max deletions between expunges\n", stderr); @@ -48,6 +48,7 @@ user(name)? { return USERNAME; } pass(word)? { return PASSWORD; } folder(s)? { return FOLDER; } smtp(host)? { return SMTPHOST; } +smtpaddress { return SMTPADDRESS; } mda { return MDA; } pre(connect)? { return PRECONNECT; } post(connect)? { return POSTCONNECT; } @@ -57,7 +57,7 @@ extern char * yytext; %token DEFAULTS POLL SKIP VIA AKA LOCALDOMAINS PROTOCOL %token AUTHENTICATE TIMEOUT KPOP KERBEROS4 -%token ENVELOPE QVIRTUAL USERNAME PASSWORD FOLDER SMTPHOST MDA +%token ENVELOPE QVIRTUAL USERNAME PASSWORD FOLDER SMTPHOST MDA SMTPADDRESS %token PRECONNECT POSTCONNECT LIMIT %token IS HERE THERE TO MAP WILDCARD %token BATCHLIMIT FETCHLIMIT EXPUNGE @@ -223,6 +223,7 @@ user_option : TO localnames HERE | PASSWORD STRING {current.password = xstrdup($2);} | FOLDER folder_list | SMTPHOST smtp_list + | SMTPADDRESS STRING {current.smtpaddress = xstrdup($2);} | MDA STRING {current.mda = xstrdup($2);} | PRECONNECT STRING {current.preconnect = xstrdup($2);} | POSTCONNECT STRING {current.postconnect = xstrdup($2);} @@ -433,6 +434,7 @@ static void record_current(void) if (cmd_opts.smtphunt) current.smtphunt = cmd_opts.smtphunt; FLAG_FORCE(mda); + FLAG_FORCE(smtpaddress); FLAG_FORCE(preconnect); FLAG_FORCE(postconnect); @@ -487,6 +489,7 @@ void optmerge(struct query *h2, struct query *h1) FLAG_MERGE(remotename); FLAG_MERGE(password); FLAG_MERGE(mda); + FLAG_MERGE(smtpaddress); FLAG_MERGE(preconnect); FLAG_MERGE(keep); diff --git a/sample.rcfile b/sample.rcfile index 2250b4d6..5f284631 100644 --- a/sample.rcfile +++ b/sample.rcfile @@ -44,6 +44,7 @@ # folder -- must be followed by remote folder names # password (or pass) -- must be followed by a password string # smtphost (or smtp) -- must be followed by host names +# smtpaddress -- must be followed by a host name # mda -- must be followed by an MDA command string # preconnect (or pre) -- must be followed by an executable command # postconnect (or post) -- must be followed by an executable command |