From f4afe8b0b1fb6eda4684e68071d9c751b5642f38 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 27 Oct 1996 04:23:23 +0000 Subject: Fix core dump bug in default-user logic. svn path=/trunk/; revision=397 --- driver.c | 12 ++++++------ fetchmail.c | 10 ++-------- fetchmail.h | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/driver.c b/driver.c index 15d2da9a..32f8c6fc 100644 --- a/driver.c +++ b/driver.c @@ -546,20 +546,20 @@ struct query *ctl; /* query control record */ find_server_names(tohdr, ctl, &xmit_names); find_server_names(cchdr, ctl, &xmit_names); find_server_names(bcchdr, ctl, &xmit_names); - - /* if nothing supplied localnames, default appropriately */ - if (!xmit_names) - save_uid(&xmit_names, -1, dfltuser); } else /* it's a single-drop box, use first localname */ #endif /* HAVE_GETHOSTBYNAME */ { if (ctl->localnames) save_uid(&xmit_names, -1, ctl->localnames->id); - else - save_uid(&xmit_names, -1, dfltuser); } + /* if nothing supplied localnames, default appropriately */ + if (getuid() == 0) + save_uid(&xmit_names, -1, ctl->remotename); + else + save_uid(&xmit_names, -1, user); + /* time to address the message */ if (ctl->mda[0]) /* we have a declared MDA */ { diff --git a/fetchmail.c b/fetchmail.c index f912cad9..aa8dff4e 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -58,7 +58,7 @@ int check_only; /* if --probe was set */ char *rcfile; /* path name of rc file */ char *idfile; /* UID list file */ int versioninfo; /* emit only version info */ -char *dfltuser; /* invoking user */ +char *user; /* the name of the invoking user */ static void termhook(); static char *lockfile; @@ -74,7 +74,7 @@ char **argv; int st, bkgd, lossage; struct query def_opts; int parsestatus, implicitmode; - char *user, *home, *tmpdir, tmpbuf[BUFSIZ]; + char *home, *tmpdir, tmpbuf[BUFSIZ]; struct passwd *pw; FILE *lockfp; pid_t pid; @@ -173,12 +173,6 @@ char **argv; if (strcmp(ctl->servername, "defaults") == 0) exit(PS_SYNTAX); - /* figure out who the default recipient should be */ - if (getuid() == 0) - dfltuser = ctl->remotename; - else - dfltuser = user; - /* merge in wired defaults, do sanity checks and prepare internal fields */ for (ctl = querylist; ctl; ctl = ctl->next) if (ctl->active && !(implicitmode && ctl->skip)) diff --git a/fetchmail.h b/fetchmail.h index 2ceec1d8..352676fd 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -139,7 +139,7 @@ extern char *rcfile; /* path name of rc file */ extern char *idfile; /* path name of UID file */ extern int linelimit; /* limit # lines retrieved per site */ extern int versioninfo; /* emit only version info */ -extern char *dfltuser; /* invoking user */ +extern char *user; /* name of invoking user */ #ifdef HAVE_PROTOTYPES -- cgit v1.2.3