diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2019-09-28 11:23:50 +0200 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2019-09-28 11:25:40 +0200 |
commit | b27a75cd05b681bbdd95396b2874303d6fed4ae0 (patch) | |
tree | 26928d947a780e2ecbc8a3525dfeafdd8d8eb6a8 | |
parent | 90f5c8459868840a591cb93fa88867705c0e7b24 (diff) | |
download | fetchmail-b27a75cd05b681bbdd95396b2874303d6fed4ae0.tar.gz fetchmail-b27a75cd05b681bbdd95396b2874303d6fed4ae0.tar.bz2 fetchmail-b27a75cd05b681bbdd95396b2874303d6fed4ae0.zip |
6.4.1, regression fix for default file locations.
The fix between 6.4.0-rc4 and 6.4.0 for Debian Bug#941129 caused
a regression in the default file locations, some files were looked
for without dot (.fetchmail.pid, .fetchmailrc).
Reported by Cy Schubert.
-rw-r--r-- | NEWS | 10 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | env.c | 34 | ||||
-rw-r--r-- | fetchmail.c | 1 | ||||
-rw-r--r-- | fetchmail.h | 1 | ||||
-rw-r--r-- | fetchmail.man | 44 | ||||
-rw-r--r-- | lock.c | 2 |
7 files changed, 74 insertions, 20 deletions
@@ -63,6 +63,16 @@ removed from a 6.5.0 or newer release.) -------------------------------------------------------------------------------- +fetchmail-6.4.1 (released 2019-09-28, 27459 LoC): + +## REGRESSION FIX: +* The bug fix Debian Bug#941129 was incomplete and caused a regression + in the default file locations, so that fetchmail was no longer able to + find it configuration files in some situations. + Reported by Cy Schubert. + +-------------------------------------------------------------------------------- + fetchmail-6.4.0 (released 2019-09-27, 27429 LoC): # NOTE THAT FETCHMAIL IS NO LONGER PUBLISHED THROUGH IBIBLIO. diff --git a/configure.ac b/configure.ac index c7233105..f00ba500 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl Process this file with autoconf to produce a configure script. dnl dnl XXX - if bumping version here, check fetchmail.man, too! -AC_INIT([fetchmail],[6.4.0],[fetchmail-users@lists.sourceforge.net]) +AC_INIT([fetchmail],[6.4.1],[fetchmail-users@lists.sourceforge.net]) AC_CONFIG_SRCDIR([fetchmail.h]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_LIBOBJ_DIR([.]) @@ -110,15 +110,43 @@ void envquery(int argc, char **argv) endpwent(); + /* This documentation added to 6.4.1, + * and manual page corrected. + * + * here's the home directory logic: + * 1. we derive home. it is taken from: + * a. HOME_ETC + * b. HOME + * c. the user's passwd entry + * 2. we derive fmhome. It is normally + * a. home. + * b. It can be overridden from FETCHMAILHOME. + * If and only if fmhome != home, then the + * default configuration files will be expected + * without leading dots. + */ + /* compute user's home directory */ home = getenv("HOME_ETC"); - if (!home && !(home = getenv("HOME"))) + if (!home) + home = getenv("HOME"); + if (!home) home = xstrdup(pwp->pw_dir); + /* and make it an absolute path, so we + * can optionally chdir("/") later in daemonize() + * without changing behaviour. + */ + { + static char _home_abs[_POSIX_PATH_MAX]; + char *tmp = realpath(home, _home_abs); + if (tmp) home = _home_abs; + } /* compute fetchmail's home directory */ fmhome = getenv("FETCHMAILHOME"); if (NULL == fmhome) { fmhome = home; + at_home = 1; } /* and make it an absolute path, so we * can optionally chdir("/") later in daemonize() @@ -138,7 +166,7 @@ void envquery(int argc, char **argv) * for its files. We don't want to do that if fetchmail has its * own home ($FETCHMAILHOME), however. */ - rcfile = (char *)xmalloc(strlen(fmhome)+sizeof(RCFILE_NAME)+(fmhome==home)+2); + rcfile = (char *)xmalloc(strlen(fmhome) + sizeof(RCFILE_NAME) + 3); /* avoid //.fetchmailrc */ if (strcmp(fmhome, "/") != 0) strcpy(rcfile, fmhome); @@ -147,7 +175,7 @@ void envquery(int argc, char **argv) if (rcfile[strlen(rcfile) - 1] != '/') strcat(rcfile, "/"); - if (fmhome==home) + if (at_home) strcat(rcfile, "."); strcat(rcfile, RCFILE_NAME); } diff --git a/fetchmail.c b/fetchmail.c index 5e570154..82c0c14b 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -76,6 +76,7 @@ flag versioninfo; /* emit only version info */ char *user; /* the name of the invoking user */ char *home; /* invoking user's home directory */ char *fmhome; /* fetchmail's home directory */ +int at_home; /* fetchmail is running inside the user's home directory */ const char *program_name; /* the name to prefix error messages with */ flag configdump; /* dump control blocks for configurator */ const char *fetchmailhost; /* either `localhost' or the host's FQDN */ diff --git a/fetchmail.h b/fetchmail.h index dae4f8a1..70187309 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -458,6 +458,7 @@ extern flag versioninfo; /* emit only version info */ extern char *user; /* name of invoking user */ extern char *home; /* home directory of invoking user */ extern char *fmhome; /* fetchmail home directory */ +extern int at_home; /* normally 1, but 0 if FETCHMAILHOME overrides it */ extern int pass; /* number of re-polling pass */ extern flag configdump; /* dump control blocks as Python dictionary */ extern const char *fetchmailhost; /* either "localhost" or an FQDN */ diff --git a/fetchmail.man b/fetchmail.man index cf6249ef..1face9b4 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -10,7 +10,7 @@ .\" Load www macros to process .URL requests, this requires groff: .mso www.tmac .\" -.TH fetchmail 1 "fetchmail 6.4.0" "fetchmail" "fetchmail reference manual" +.TH fetchmail 1 "fetchmail 6.4.1" "fetchmail" "fetchmail reference manual" .SH NAME fetchmail \- fetch mail from a POP, IMAP, ETRN, or ODMR-capable server @@ -2828,18 +2828,21 @@ that of the last host queried. .SH FILES .TP 5 -~/.fetchmailrc -default run control file +~/.fetchmailrc, $HOME/.fetchmailrc, $HOME_ETC/.fetchmailrc, $FETCHMAILHOME/fetchmailrc +default run control file (location can be overridden with environment variables) .TP 5 -~/.fetchids +~/.fetchids, $HOME/.fetchids, $HOME_ETC/.fetchids, $FETCHMAILHOME/.fetchids default location of file recording last message UIDs seen per host. +(location can be overridden with environment variables) .TP 5 -~/.fetchmail.pid -lock file to help prevent concurrent runs (non-root mode). +~/.fetchmail.pid, $HOME/.fetchmail.pid, $HOME_ETC/.fetchmail.pid, $FETCHMAILHOME/fetchmail.pid +default location of lock file to help prevent concurrent runs (non-root mode). +(location can be overridden with environment variables) .TP 5 -~/.netrc +~/.netrc, $HOME/.netrc, $HOME_ETC/.netrc your FTP run control file, which (if present) will be searched for passwords as a last resort before prompting for one interactively. +(location can be overridden with environment variables) .TP 5 /var/run/fetchmail.pid lock file to help prevent concurrent runs (root mode, Linux systems). @@ -2851,10 +2854,10 @@ lock file to help prevent concurrent runs (root mode, systems without /var/run). .IP \fBFETCHMAILHOME\fP If this environment variable is set to a valid and existing directory name, fetchmail will read $FETCHMAILHOME/fetchmailrc -(the dot is missing in this case), $FETCHMAILHOME/.fetchids and -$FETCHMAILHOME/.fetchmail.pid rather than from the user's home +(the dot is missing in this case), $FETCHMAILHOME/.fetchids (keeping its dot) and +$FETCHMAILHOME/fetchmail.pid (without dot) rather than from the user's home directory. The .netrc file is always looked for in the the invoking -user's home directory regardless of FETCHMAILHOME's setting. +user's home directory (or $HOME_ETC) regardless of FETCHMAILHOME's setting. .IP \fBFETCHMAILUSER\fP If this environment variable is set, it is used as the name of the @@ -2886,15 +2889,26 @@ used as a workaround when TOP does not work properly. (since v6.3.17): If this environment variable is set and not empty, fetchmail will always load the default X.509 trusted certificate locations for SSL/TLS CA certificates, -even if \fB\-\-sslcertfile\fP and \fB\-\-sslcertpath\fP are given. The latter locations take precedence over the system default locations. +even if \fB\-\-sslcertfile\fP and \fB\-\-sslcertpath\fP are given. +The latter locations take precedence over the system default locations. This is useful in case there are broken certificates in the system directories and the user has no administrator privileges to remedy the problem. -.IP \fBHOME_ETC\fP -If the HOME_ETC variable is set, fetchmail will read -$HOME_ETC/.fetchmailrc instead of ~/.fetchmailrc. +.IP \fBHOME\fP +(documented since 6.4.1): +This variable is nomally set to the user's home directory. If it is set +to a different directory than what is the password database, HOME takes +prececence. -If HOME_ETC and FETCHMAILHOME are both set, HOME_ETC will be ignored. +.IP \fBHOME_ETC\fP +(documented corrected to match behaviour code since 6.4.1): +If the HOME_ETC variable is set, it will override fetchmail's idea of $HOME, +i. e. fetchmail will read .fetchmailrc, .fetchids, .fetchmail.pid and .netrc +from $HOME_ETC instead of $HOME (or if HOME is also unset, +from the passwd file's home directory location). + +If HOME_ETC and FETCHMAILHOME are both set, FETCHMAILHOME takes prececence +and HOME_ETC will be ignored. .IP \fBSOCKS_CONF\fP (only if SOCKS support is compiled in) this variable is used by the @@ -50,7 +50,7 @@ void fm_lock_setup(struct runctl *ctl) + strlen(FETCHMAIL_PIDFILE) + 3); /* 3: "/", "." and NUL */ strcpy(lockfile, fmhome); strcat(lockfile, "/"); - if (fmhome == home) + if (at_home) strcat(lockfile, "."); strcat(lockfile, FETCHMAIL_PIDFILE); } |