X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fauth.c;h=cd0477780cf2111c604eaebd102fa9b0b81fa78a;hb=4f7e19816b21500f2e499df26551fbdd158c76a0;hp=8180927c6dd56afa773cb56b6bebe7efd460c89f;hpb=dedb8ad67549c26ee30264c8eaa1eae449b3d9f7;p=ppp.git diff --git a/pppd/auth.c b/pppd/auth.c index 8180927..cd04777 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -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 #include @@ -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);