From 52f3bf729a4f715d94366b01e7e8b4ae0aec9e06 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 8 Nov 2001 18:34:27 +0000 Subject: Avoid UIDL core dump. svn path=/trunk/; revision=3547 --- NEWS | 4 +++- fetchmail.c | 40 ++++++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/NEWS b/NEWS index 9de54f91..8f0541d7 100644 --- a/NEWS +++ b/NEWS @@ -3,7 +3,7 @@ (The `lines' figures total .c, .h, .l, and .y files under version control.) * Changed the logging logic along lines suggested by Jan Klaverstijn, -* fetchmauilconf looks first in the directory it's running from to find +* fetchmailconf looks first in the directory it's running from to find fetchmail. * Make sure we vet a success status correctly from open_smtp_sink() and open_bsmtp_sink(). @@ -18,6 +18,8 @@ * NextStep and OpenStep port patch from Eric Sunshine. * Block signals during SockConnect() so we don't get a socket descriptor leak if we're hit by an alarm signal during connect(2). +* Set queryname even when server is inactive; avoids a core-dump bug in + the fetchids code. fetchmail-5.9.4 (Wed Oct 3 07:47:45 EDT 2001), 21104 lines: diff --git a/fetchmail.c b/fetchmail.c index a1c6754d..c5b6f7cb 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -1003,14 +1003,30 @@ static int load_params(int argc, char **argv, int optind) { ctl->wedged = FALSE; - if (configdump || ctl->active ) - { - /* merge in defaults */ - optmerge(ctl, &def_opts, FALSE); + /* merge in defaults */ + optmerge(ctl, &def_opts, FALSE); + + /* force command-line options */ + optmerge(ctl, &cmd_opts, TRUE); + + /* + * queryname has to be set up for inactive servers too. + * Otherwise the UIDL code core-dumps on startup. + */ + if (ctl->server.via) + ctl->server.queryname = xstrdup(ctl->server.via); + else + ctl->server.queryname = xstrdup(ctl->server.pollname); - /* force command-line options */ - optmerge(ctl, &cmd_opts, TRUE); + /* + * We no longer do DNS lookups at startup. + * This is a kluge. It enables users to edit their + * configurations when DNS isn't available. + */ + ctl->server.truename = xstrdup(ctl->server.queryname); + if (configdump || ctl->active ) + { /* this code enables flags to be turned off */ #define DEFAULT(flag, dflt) if (flag == FLAG_TRUE)\ flag = TRUE;\ @@ -1074,18 +1090,6 @@ static int load_params(int argc, char **argv, int optind) } #endif /* !HAVE_GETHOSTBYNAME || !HAVE_RES_SEARCH */ - if (ctl->server.via) - ctl->server.queryname = xstrdup(ctl->server.via); - else - ctl->server.queryname = xstrdup(ctl->server.pollname); - - /* - * We no longer do DNS lookups at startup. - * This is a kluge. It enables users to edit their - * configurations when DNS isn't available. - */ - ctl->server.truename = xstrdup(ctl->server.queryname); - /* if no folders were specified, set up the null one as default */ if (!ctl->mailboxes) save_str(&ctl->mailboxes, (char *)NULL, 0); -- cgit v1.2.3