]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/options.c
export readable() from options.c so auth.c can use it
[ppp.git] / pppd / options.c
index 4407cefa16adbdc272b09206ce490c6bbbf5663d..b2c7b58574f0944cb090fd6e0123ee508d6476b0 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.46 1999/02/26 11:03:34 paulus Exp $";
 #endif
 
 #include <ctype.h>
@@ -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;
 }