]> Pileus Git - ~andy/fetchmail/commitdiff
Added `to' keyword, changed local-user default.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 14 Oct 1996 16:28:52 +0000 (16:28 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 14 Oct 1996 16:28:52 +0000 (16:28 -0000)
svn path=/trunk/; revision=331

NEWS
fetchmail.c
fetchmail.man
rcfile_l.l
rcfile_y.y

diff --git a/NEWS b/NEWS
index a2bb102c9292c19ab570924553f15378ab5a92d8..b9b60bc69a5d30d5ed51acc1508bc6c14080063a 100644 (file)
--- 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):
 
index b3a8046ae407d04b2b3e06ec896ab15d799a850a..4257562c5ee2b906e36fc48cc250a887b078daa6 100644 (file)
@@ -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)
index b68251178fbea8791240022728f1c1e142433d23..1fd25bf93d57526baf98e79722ca63f78c693b4e 100644 (file)
@@ -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.
index 9ae0fcfae5923f0a961e6e9daea40f571b428bd8..000b10d96a9fd134644a7858935f995a47af283c 100644 (file)
@@ -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; }
index b0c5df1305b761cdcb2a186073f2d666b380d1b6..f6df31fffea85058896642888173566601e18266 100644 (file)
@@ -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);}