X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Foptions.c;h=328b1428a0965350ba450b163a669e0e6f9ae92a;hb=e15bba841ee500abc715fccf876fed4dd2462b1b;hp=4407cefa16adbdc272b09206ce490c6bbbf5663d;hpb=bfa20ccde2a70b1252dbb614132f1a4cbee815d4;p=ppp.git diff --git a/pppd/options.c b/pppd/options.c index 4407cef..328b142 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.48 1999/03/06 11:28:10 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; @@ -342,17 +342,24 @@ options_from_file(filename, must_exist, check_prot, priv) char args[MAXARGS][MAXWORDLEN]; char cmd[MAXWORDLEN]; - if ((f = fopen(filename, "r")) == NULL) { + if (check_prot) + seteuid(getuid()); + f = fopen(filename, "r"); + if (check_prot) + seteuid(0); + if (f == NULL) { if (!must_exist && errno == ENOENT) return 1; option_error("Can't open options file %s: %m", filename); return 0; } +#if 0 /* check done by setting effective UID above */ if (check_prot && !readable(fileno(f))) { option_error("Can't open options file %s: access denied", filename); fclose(f); return 0; } +#endif oldpriv = privileged_option; privileged_option = priv; @@ -684,7 +691,7 @@ option_error __V((char *fmt, ...)) /* * readable - check if a file is readable by the real user. */ -static int +int readable(fd) int fd; {