diff options
author | brian <brian@FreeBSD.org> | 1997-11-13 15:35:06 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-11-13 15:35:06 +0000 |
commit | 4acd7a70dacf7255bb61397ed869bab1f07e5c5f (patch) | |
tree | 904d654002b29d769cd3d71e223e02fe226d0869 /usr.sbin/ppp | |
parent | 8c141b213152f6189ab6f681e110614789fb36e5 (diff) | |
download | FreeBSD-src-4acd7a70dacf7255bb61397ed869bab1f07e5c5f.zip FreeBSD-src-4acd7a70dacf7255bb61397ed869bab1f07e5c5f.tar.gz |
Don't run if ppp.conf is writable.
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/main.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index f4b08ce..1e6bec1 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: main.c,v 1.96 1997/11/13 14:43:18 brian Exp $ + * $Id: main.c,v 1.97 1997/11/13 14:44:06 brian Exp $ * * TODO: * o Add commands for traffic summary, version display, etc. @@ -69,6 +69,7 @@ #include "main.h" #include "vjcomp.h" #include "async.h" +#include "pathnames.h" #ifndef O_NONBLOCK #ifdef O_NDELAY @@ -356,6 +357,21 @@ main(int argc, char **argv) VarTerm = stdout; ID0init(); + if (ID0realuid() != 0) { + char conf[200], *ptr; + + snprintf(conf, sizeof conf, "%s/%s", _PATH_PPP, CONFFILE); + do { + if (!access(conf, W_OK)) { + LogPrintf(LogALERT, "ppp: Access violation: Please protect %s\n", conf); + return -1; + } + ptr = conf + strlen(conf)-2; + while (ptr > conf && *ptr != '/') + *ptr-- = '\0'; + } while (ptr >= conf); + } + if (!ValidSystem(GetLabel())) { fprintf(stderr, "You may not use ppp in this mode with this label\n"); if (mode & MODE_DIRECT) { |