]> git.ozlabs.org Git - ppp.git/commitdiff
check we're running as root
authorPaul Mackerras <paulus@samba.org>
Tue, 8 Oct 1996 06:43:49 +0000 (06:43 +0000)
committerPaul Mackerras <paulus@samba.org>
Tue, 8 Oct 1996 06:43:49 +0000 (06:43 +0000)
pppd/main.c

index 273e90a822a350390f2e3a4db6110283e3dcc2e8..e4624209e5155ef57083639270428be0d32c96e3 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: main.c,v 1.38 1996/10/08 04:35:03 paulus Exp $";
+static char rcsid[] = "$Id: main.c,v 1.39 1996/10/08 06:43:49 paulus Exp $";
 #endif
 
 #include <stdio.h>
@@ -178,7 +178,7 @@ main(argc, argv)
 #endif
 
     if (gethostname(hostname, MAXNAMELEN) < 0 ) {
-       syslog(LOG_ERR, "couldn't get hostname: %m");
+       option_error("Couldn't get hostname: %m");
        die(1);
     }
     hostname[MAXNAMELEN-1] = 0;
@@ -209,6 +209,15 @@ main(argc, argv)
        exit(1);
     }
 
+    /*
+     * Check that we are running as root.
+     */
+    if (geteuid() != 0) {
+       option_error("must be root to run %s, since it is not setuid-root",
+                    argv[0]);
+       die(1);
+    }
+
     /*
      * Check that the options given are valid and consistent.
      */