From e72ec8a0b777fdcc929919e28f1b0893a85271b5 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 14 Oct 1996 16:28:52 +0000 Subject: Added `to' keyword, changed local-user default. svn path=/trunk/; revision=331 --- NEWS | 7 +++++-- fetchmail.c | 5 ++++- fetchmail.man | 18 ++++++++++-------- rcfile_l.l | 1 + rcfile_y.y | 6 ++++-- 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 %token STRING %token 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);} -- cgit v1.2.3