aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-10-14 16:28:52 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-10-14 16:28:52 +0000
commite72ec8a0b777fdcc929919e28f1b0893a85271b5 (patch)
tree7be47972f93d45dffa6f8084d99563be69d2b89a
parent32b10e9e33c10dd3223fde2541bbfea0852c2af5 (diff)
downloadfetchmail-e72ec8a0b777fdcc929919e28f1b0893a85271b5.tar.gz
fetchmail-e72ec8a0b777fdcc929919e28f1b0893a85271b5.tar.bz2
fetchmail-e72ec8a0b777fdcc929919e28f1b0893a85271b5.zip
Added `to' keyword, changed local-user default.
svn path=/trunk/; revision=331
-rw-r--r--NEWS7
-rw-r--r--fetchmail.c5
-rw-r--r--fetchmail.man18
-rw-r--r--rcfile_l.l1
-rw-r--r--rcfile_y.y6
5 files changed, 24 insertions, 13 deletions
diff --git a/NEWS b/NEWS
index a2bb102c..b9b60bc6 100644
--- a/NEWS
+++ b/NEWS
@@ -24,8 +24,11 @@ features --
bugs --
-* Default user name to deliver to is now the calling user (was the remote
- user ID).
+* Default user name to deliver to is now the calling user, unless
+ program is running as root in which case it is the remote user name
+ (default can be overridden with an `is' or `to' declaration).
+ In versions up to 1.7 it was the calling user; in 1.8 the remote
+ user ID. This created some confusion.
fetchmail-1.8 (Fri Oct 11 15:08:10 EDT 1996):
diff --git a/fetchmail.c b/fetchmail.c
index b3a8046a..4257562c 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -193,7 +193,10 @@ char **argv;
/* if rc file didn't supply a localname, default appropriately */
if (!hostp->localname[0])
- strcpy(hostp->localname, user);
+ if (getuid() == 0)
+ strcpy(hostp->localname, hostp->remotename);
+ else
+ strcpy(hostp->localname, user);
/* check that delivery is going to a real local user */
if ((pw = getpwnam(user)) == (struct passwd *)NULL)
diff --git a/fetchmail.man b/fetchmail.man
index b6825117..1fd25bf9 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -385,6 +385,7 @@ Legal user options are
username (or user)
is
+ to
password (or pass)
remotefolder (or remote)
smtphost (or smtp)
@@ -399,14 +400,15 @@ Legal user options are
norewrite
.PP
All options correspond to the obvious command-line arguments except
-three: \fBis\fR, \fBpassword\fR and \fBskip\fR.
-.PP
-The \fBis\fR keyword associates a following local username with the
-mailserver user name in the entry. It is intended to be used in
-configurations where \fIfetchmail\fR runs as root and retrieves
-mail for multiple local users. If no \fBis\fR clause is present,
-the default local username is the same as the argument of the
-\fBuser\fR keyword.
+four: \fBis\fR, \fBto\fR, \fBpassword\fR and \fBskip\fR.
+.PP
+The \fBis\fR or \fIto\fR keywords associate a following local
+username with the mailserver user name in the entry. They are intended
+to be used in configurations where \fIfetchmail\fR runs as root and
+retrieves mail for multiple local users. If no \fBis\fR or \fIto\fR
+clause is present, the default local username is the calling user,
+unless the calling user is root in which case it is the remote user
+name of the current entry.
.PP
The \fBpassword\fR option requires a string argument, which is the password
to be used with the entry's server.
diff --git a/rcfile_l.l b/rcfile_l.l
index 9ae0fcfa..000b10d9 100644
--- a/rcfile_l.l
+++ b/rcfile_l.l
@@ -38,6 +38,7 @@ mda { return MDA; }
is { return IS; }
here { return HERE; }
there { return THERE; }
+to { return TO; }
keep { yylval.flag = FLAG_TRUE; return KEEP; }
flush { yylval.flag = FLAG_TRUE; return FLUSH; }
diff --git a/rcfile_y.y b/rcfile_y.y
index b0c5df13..f6df31ff 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -37,7 +37,7 @@ static int prc_errflag;
}
%token DEFAULTS SERVER PROTOCOL AUTHENTICATE TIMEOUT KPOP KERBEROS
-%token USERNAME PASSWORD FOLDER SMTPHOST MDA IS HERE THERE
+%token USERNAME PASSWORD FOLDER SMTPHOST MDA IS HERE THERE TO
%token <proto> PROTO
%token <sval> STRING
%token <number> NUMBER
@@ -109,7 +109,9 @@ user1opts : user_option
| user1opts user_option
;
-user_option : IS STRING {strcpy(current.localname, $2);}
+user_option : TO STRING {strcpy(current.localname, $2);}
+ | TO STRING HERE {strcpy(current.localname, $2);}
+ | IS STRING {strcpy(current.localname, $2);}
| IS STRING HERE {strcpy(current.localname, $2);}
| IS STRING THERE {strcpy(current.remotename, $2);}
| PASSWORD STRING {strcpy(current.password, $2);}