]> git.ozlabs.org Git - ppp.git/commitdiff
If device name given, complain if not privileged
authorPaul Mackerras <paulus@samba.org>
Wed, 20 Jan 1999 00:00:35 +0000 (00:00 +0000)
committerPaul Mackerras <paulus@samba.org>
Wed, 20 Jan 1999 00:00:35 +0000 (00:00 +0000)
pppd/options.c

index 4407cefa16adbdc272b09206ce490c6bbbf5663d..346430d454f0037d2450e444ba7865ad03c77147 100644 (file)
@@ -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 <ctype.h>
@@ -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;
 }