X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Foptions.c;h=6078dcc041c55dcf6ea72887235fa3826b90b14b;hb=8a68ed35b0312fe46436a3490097a4fdc5af1c95;hp=346430d454f0037d2450e444ba7865ad03c77147;hpb=122606b29e977c437d32c407e640357b43e03e6e;p=ppp.git diff --git a/pppd/options.c b/pppd/options.c index 346430d..6078dcc 100644 --- a/pppd/options.c +++ b/pppd/options.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: options.c,v 1.45 1999/01/20 00:00:35 paulus Exp $"; +static char rcsid[] = "$Id: options.c,v 1.47 1999/03/02 05:59:21 paulus Exp $"; #endif #include @@ -133,7 +133,6 @@ static int setactivefilter __P((char **)); static option_t *find_option __P((char *name)); static int process_option __P((option_t *, char **)); static int n_arguments __P((option_t *)); -static int readable __P((int fd)); /* * Valid arguments. @@ -417,7 +416,7 @@ options_from_user() int ret; struct passwd *pw; - pw = getpwuid(getuid()); + pw = getpwuid(uid); if (pw == NULL || (user = pw->pw_dir) == NULL || user[0] == 0) return 1; file = _PATH_USEROPT; @@ -685,16 +684,14 @@ option_error __V((char *fmt, ...)) /* * readable - check if a file is readable by the real user. */ -static int +int readable(fd) int fd; { - uid_t uid; int ngroups, i; struct stat sbuf; GIDSET_TYPE groups[NGROUPS_MAX]; - uid = getuid(); if (uid == 0) return 1; if (fstat(fd, &sbuf) != 0) @@ -1184,15 +1181,11 @@ setdevname(cp, quiet) return -1; } - if (!privileged_option) { - if (!quiet) - option_error("setting the device name requires root privilege"); - return -1; - } - (void) strncpy(devnam, cp, MAXPATHLEN); devnam[MAXPATHLEN-1] = 0; default_device = FALSE; + devnam_info.priv = privileged_option; + devnam_info.source = option_source; return 1; }