X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Foptions.c;h=b2c7b58574f0944cb090fd6e0123ee508d6476b0;hb=49464ac3690f1a89de335d99b64c7e846ca6fcd1;hp=4407cefa16adbdc272b09206ce490c6bbbf5663d;hpb=bfa20ccde2a70b1252dbb614132f1a4cbee815d4;p=ppp.git diff --git a/pppd/options.c b/pppd/options.c index 4407cef..b2c7b58 100644 --- a/pppd/options.c +++ b/pppd/options.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: options.c,v 1.44 1998/11/07 06:59:28 paulus Exp $"; +static char rcsid[] = "$Id: options.c,v 1.46 1999/02/26 11:03:34 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. @@ -304,6 +303,7 @@ scan_args(argc, argv) char *arg; option_t *opt; + privileged_option = privileged; while (argc > 0) { arg = *argv++; --argc; @@ -684,7 +684,7 @@ option_error __V((char *fmt, ...)) /* * readable - check if a file is readable by the real user. */ -static int +int readable(fd) int fd; { @@ -1183,11 +1183,15 @@ 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; }