]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/auth.c
Restore original EUID rather than 0 during option processing.
[ppp.git] / pppd / auth.c
index 8180927c6dd56afa773cb56b6bebe7efd460c89f..cd0477780cf2111c604eaebd102fa9b0b81fa78a 100644 (file)
@@ -68,7 +68,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: auth.c,v 1.111 2006/06/04 21:56:31 paulus Exp $"
+#define RCSID  "$Id: auth.c,v 1.112 2006/06/18 11:26:00 paulus Exp $"
 
 #include <stdio.h>
 #include <stddef.h>
@@ -409,6 +409,7 @@ setupapfile(argv)
 {
     FILE *ufile;
     int l;
+    uid_t euid;
     char u[MAXNAMELEN], p[MAXSECRETLEN];
     char *fname;
 
@@ -418,12 +419,13 @@ setupapfile(argv)
     fname = strdup(*argv);
     if (fname == NULL)
        novm("+ua file name");
+    euid = geteuid();
     if (seteuid(getuid()) == -1) {
        option_error("unable to reset uid before opening %s: %m", fname);
        return 0;
     }
     ufile = fopen(fname, "r");
-    if (seteuid(0) == -1)
+    if (seteuid(euid) == -1)
        fatal("unable to regain privileges: %m");
     if (ufile == NULL) {
        option_error("unable to open user login data file %s", fname);