aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS7
-rw-r--r--env.c31
-rw-r--r--fetchmail.man8
-rw-r--r--netrc.c6
4 files changed, 27 insertions, 25 deletions
diff --git a/NEWS b/NEWS
index b6a2cef6..65275856 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,13 @@
Release Notes:
+fetchmail-5.0.1 ():
+* Try to discover user/home via getpwuid(getuid()) before using LOGNAME/HOME.
+* Mike Pearce's fix for buggy DEFAULT handling in .netrc.
+
+There are 255 people on fetchmail-friends and 369 on fetchmail-announce.
+
+------------------------------------------------------------------------------
fetchmail-5.0.0 (Mon Apr 5 11:00:24 EDT 1999):
* Update for fetchsetup from Kent Robotti.
* Eliminate a realloc error in fetchmail -v -v progress message generation.
diff --git a/env.c b/env.c
index ad915263..dd6755d4 100644
--- a/env.c
+++ b/env.c
@@ -40,23 +40,22 @@ void envquery(int argc, char **argv)
else
program_name = argv[0];
- if ((user = getenv("USER")) == (char *)NULL)
- user = getenv("LOGNAME");
-
- if ((user == (char *)NULL) || (home = getenv("HOME")) == (char *)NULL)
+ if ((pw = getpwuid(getuid())) != NULL)
{
- if ((pw = getpwuid(getuid())) != NULL)
- {
- user = pw->pw_name;
- home = pw->pw_dir;
- }
- else
- {
- fprintf(stderr,
- _("%s: can't find your name and home directory!\n"),
- program_name);
- exit(PS_UNDEFINED);
- }
+ user = pw->pw_name;
+ home = pw->pw_dir;
+ }
+ else if ((home = getenv("HOME")))
+ {
+ if ((user = getenv("LOGNAME")) == (char *)NULL || user[0] == '\0')
+ user = getenv("USER");
+ }
+ else
+ {
+ fprintf(stderr,
+ _("%s: can't find your name and home directory!\n"),
+ program_name);
+ exit(PS_UNDEFINED);
}
#define RCFILE_NAME ".fetchmailrc"
diff --git a/fetchmail.man b/fetchmail.man
index 6cd6475a..e04a7959 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -1755,11 +1755,11 @@ lock file to help prevent concurrent runs (root mode, Linux systems).
lock file to help prevent concurrent runs (root mode, systems without /var/run).
.SH ENVIRONMENT
-For correct initialization,
+For correct initialization,
.I fetchmail
-requires either that both the USER and HOME environment variables are
-correctly set, or that \fBgetpwuid\fR(3) be able to retrieve a password
-entry from your user ID.
+requires either that \fBgetpwuid\fR(3) be able to retrieve a password
+entry from your user ID, or that either the LOGNAME or USER and the
+HOME environment variables are correctly set.
.SH SIGNALS
If a
diff --git a/netrc.c b/netrc.c
index 7c500702..e275c9d3 100644
--- a/netrc.c
+++ b/netrc.c
@@ -298,11 +298,7 @@ search_netrc (list, host, account)
/* Look for the HOST in LIST. */
while (list)
{
- if (!list->host)
- /* We hit the default entry. */
- break;
-
- else if (!strcmp(list->host, host))
+ if (list->host && !strcmp(list->host, host))
if (!list->account || !strcmp(list->account, account))
/* We found a matching entry. */
break;