aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1998-03-26 21:25:51 +0000
committerEric S. Raymond <esr@thyrsus.com>1998-03-26 21:25:51 +0000
commita0893a20e50af2deb56e6cfee0b455e310a5805a (patch)
tree5870c8ae4543913dc9cd5a461ec6433017f65140
parentf27916a7f27f00e1d2325538e55923c505706527 (diff)
downloadfetchmail-a0893a20e50af2deb56e6cfee0b455e310a5805a.tar.gz
fetchmail-a0893a20e50af2deb56e6cfee0b455e310a5805a.tar.bz2
fetchmail-a0893a20e50af2deb56e6cfee0b455e310a5805a.zip
Prevent pathological circular lists.
svn path=/trunk/; revision=1730
-rw-r--r--NEWS1
-rw-r--r--fetchmail.c13
-rw-r--r--rcfile_y.y12
-rw-r--r--uid.c2
4 files changed, 15 insertions, 13 deletions
diff --git a/NEWS b/NEWS
index 2c88a751..f1b371d2 100644
--- a/NEWS
+++ b/NEWS
@@ -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;
diff --git a/rcfile_y.y b/rcfile_y.y
index 49e85fc4..6bec2e54 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -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);
diff --git a/uid.c b/uid.c
index 8e51bb32..93fabcbd 100644
--- a/uid.c
+++ b/uid.c
@@ -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;