From: Paul Mackerras Date: Wed, 20 Jan 1999 00:00:35 +0000 (+0000) Subject: If device name given, complain if not privileged X-Git-Tag: RELEASE_2_3_6~40 X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=122606b29e977c437d32c407e640357b43e03e6e If device name given, complain if not privileged --- diff --git a/pppd/options.c b/pppd/options.c index 4407cef..346430d 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.45 1999/01/20 00:00:35 paulus Exp $"; #endif #include @@ -304,6 +304,7 @@ scan_args(argc, argv) char *arg; option_t *opt; + privileged_option = privileged; while (argc > 0) { arg = *argv++; --argc; @@ -1183,11 +1184,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; }