aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2000-03-14 06:42:53 +0000
committerEric S. Raymond <esr@thyrsus.com>2000-03-14 06:42:53 +0000
commitff0976ad08b3dda64a55daf19892367e1367cf22 (patch)
tree108e1cae4ad4acbc17c069b975054ecfc47a52a4
parentf34b0b77094710429baf281a4f567aaff526a756 (diff)
downloadfetchmail-ff0976ad08b3dda64a55daf19892367e1367cf22.tar.gz
fetchmail-ff0976ad08b3dda64a55daf19892367e1367cf22.tar.bz2
fetchmail-ff0976ad08b3dda64a55daf19892367e1367cf22.zip
Fix a Debian bug.
svn path=/trunk/; revision=2827
-rw-r--r--NEWS2
-rw-r--r--fetchmail.c29
-rw-r--r--fetchmail.h1
-rw-r--r--uid.c15
4 files changed, 36 insertions, 11 deletions
diff --git a/NEWS b/NEWS
index e7a0bcd1..f796b73e 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@
(The `lines' figures total .c, .h, .l, and .y files under version control.)
* Added FAQ item on performance under load.
+* Fix Debian bug #60202 (segfaults when given command line arguments).
+ This only applied to `antispam', as it turned out.
fetchmail-5.3.3 (Mon Mar 13 16:34:29 EST 2000), 18763 lines:
diff --git a/fetchmail.c b/fetchmail.c
index 8d9dc8cc..3cd8c0d6 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -756,23 +756,30 @@ int main(int argc, char **argv)
exit(successes ? PS_SUCCESS : querystatus);
}
-static void optmerge(struct query *h2, struct query *h1, int force)
-/* merge two options records */
+static void list_merge(struct idlist **dstl, struct idlist **srcl, int force)
{
/*
* If force is off, modify h2 fields only when they're empty (treat h1
* as defaults). If force is on, modify each h2 field whenever h1
* is nonempty (treat h1 as an override).
*/
-#define LIST_MERGE(dstl, srcl) if (force ? !!srcl : !dstl) \
- free_str_list(&dstl), \
- append_str_list(&dstl, &srcl)
- LIST_MERGE(h2->server.localdomains, h1->server.localdomains);
- LIST_MERGE(h2->localnames, h1->localnames);
- LIST_MERGE(h2->mailboxes, h1->mailboxes);
- LIST_MERGE(h2->smtphunt, h1->smtphunt);
- LIST_MERGE(h2->antispam, h1->antispam);
-#undef LIST_MERGE
+ if (force ? !!srcl : !dstl)
+ {
+ struct idlist *cpl = copy_str_list(*srcl);
+
+ free_str_list(dstl);
+ append_str_list(dstl, &cpl);
+ }
+}
+
+static void optmerge(struct query *h2, struct query *h1, int force)
+/* merge two options records */
+{
+ list_merge(&h2->server.localdomains, &h1->server.localdomains, force);
+ list_merge(&h2->localnames, &h1->localnames, force);
+ list_merge(&h2->mailboxes, &h1->mailboxes, force);
+ list_merge(&h2->smtphunt, &h1->smtphunt, force);
+ list_merge(&h2->antispam, &h1->antispam, force);
#define FLAG_MERGE(fld) if (force ? !!h1->fld : !h2->fld) h2->fld = h1->fld
FLAG_MERGE(server.via);
diff --git a/fetchmail.h b/fetchmail.h
index fa38c73e..d469d3c2 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -433,6 +433,7 @@ char *nxtaddr(const char *);
void initialize_saved_lists(struct query *, const char *);
struct idlist *save_str(struct idlist **, const char *, flag);
void free_str_list(struct idlist **);
+struct idlist *copy_str_list(struct idlist *idl);
void save_str_pair(struct idlist **, const char *, const char *);
void free_str_pair_list(struct idlist **);
int delete_str(struct idlist **, int);
diff --git a/uid.c b/uid.c
index ce875956..453274b7 100644
--- a/uid.c
+++ b/uid.c
@@ -384,6 +384,21 @@ int delete_str(struct idlist **idl, int num)
return(0);
}
+struct idlist *copy_str_list(struct idlist *idl)
+/* copy the given UID list */
+{
+ struct idlist *newnode ;
+
+ if (idl == (struct idlist *)NULL)
+ return(NULL);
+ else
+ {
+ newnode = (struct idlist *)xmalloc(sizeof(struct idlist));
+ newnode->next = copy_str_list(idl->next);
+ return(newnode);
+ }
+}
+
void append_str_list(struct idlist **idl, struct idlist **nidl)
/* append nidl to idl (does not copy *) */
{