diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1998-03-26 21:25:51 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1998-03-26 21:25:51 +0000 |
commit | a0893a20e50af2deb56e6cfee0b455e310a5805a (patch) | |
tree | 5870c8ae4543913dc9cd5a461ec6433017f65140 | |
parent | f27916a7f27f00e1d2325538e55923c505706527 (diff) | |
download | fetchmail-a0893a20e50af2deb56e6cfee0b455e310a5805a.tar.gz fetchmail-a0893a20e50af2deb56e6cfee0b455e310a5805a.tar.bz2 fetchmail-a0893a20e50af2deb56e6cfee0b455e310a5805a.zip |
Prevent pathological circular lists.
svn path=/trunk/; revision=1730
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | fetchmail.c | 13 | ||||
-rw-r--r-- | rcfile_y.y | 12 | ||||
-rw-r--r-- | uid.c | 2 |
4 files changed, 15 insertions, 13 deletions
@@ -16,6 +16,7 @@ ------------------------------------------------------------------------------ fetchmail-4.4.2 (): * Use TOP for POP3 retrieval to avoid marking messages seen. Duh! +* Another fix for command-line --smtphost option. fetchmail-4.4.1 (Tue Mar 24 00:01:20 EST 1998): * We now properly shroud IMAP passwords containing ", \, and SP. diff --git a/fetchmail.c b/fetchmail.c index a9bf2348..b968d21c 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -691,14 +691,13 @@ static int load_params(int argc, char **argv, int optind) || str_in_list(&ctl->server.akalist, argv[optind])) goto foundit; - ctl = hostalloc(&cmd_opts); - ctl->server.pollname = xstrdup(argv[optind]); + /* + * Allocate and link record without copying in command-line args; + * we'll do that with the optmerge call later on. + */ + ctl = hostalloc((struct query *)NULL); - /* avoid making pathological circular lists */ - ctl->server.localdomains = (struct idlist *)NULL; - ctl->localnames = (struct idlist *)NULL; - ctl->mailboxes = (struct idlist *)NULL; - ctl->smtphunt = (struct idlist *)NULL; + ctl->server.pollname = xstrdup(argv[optind]); foundit: ctl->active = TRUE; @@ -434,7 +434,8 @@ struct query *init; /* pointer to block containing initial values */ node = (struct query *) xmalloc(sizeof(struct query)); /* initialize it */ - memcpy(node, init, sizeof(struct query)); + if (init) + memcpy(node, init, sizeof(struct query)); /* append to end of list */ if (hosttail != (struct query *) 0) @@ -458,6 +459,11 @@ static void record_current(void) /* register current parameters and append to the host list */ { #define FLAG_FORCE(fld) if (cmd_opts.fld) current.fld = cmd_opts.fld + FLAG_FORCE(server.localdomains); + FLAG_FORCE(localnames); + FLAG_FORCE(mailboxes); + FLAG_FORCE(smtphunt); + FLAG_FORCE(server.via); FLAG_FORCE(server.protocol); #if INET6 @@ -484,10 +490,6 @@ static void record_current(void) FLAG_FORCE(remotename); FLAG_FORCE(password); - if (cmd_opts.mailboxes) - current.mailboxes = cmd_opts.mailboxes; - if (cmd_opts.smtphunt) - current.smtphunt = cmd_opts.smtphunt; FLAG_FORCE(mda); FLAG_FORCE(smtpaddress); FLAG_FORCE(antispam); @@ -277,7 +277,7 @@ int delete_str(struct idlist **idl, int num) void append_str_list(struct idlist **idl, struct idlist **nidl) /* append nidl to idl (does not copy *) */ { - if ((*nidl) == (struct idlist *)NULL) + if ((*nidl) == (struct idlist *)NULL || *nidl == *idl) return; else if ((*idl) == (struct idlist *)NULL) *idl = *nidl; |