X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fauth.c;h=cd0477780cf2111c604eaebd102fa9b0b81fa78a;hb=e3426561f8042f6f231de8103b21f200d2042ef3;hp=8e1180ddaa49c7894051e95c08a9fe048890cecf;hpb=9596fe66415eb97e70cbbafc08c2af387aea062b;p=ppp.git diff --git a/pppd/auth.c b/pppd/auth.c index 8e1180d..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.109 2006/05/22 00:04:07 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,9 +419,14 @@ setupapfile(argv) fname = strdup(*argv); if (fname == NULL) novm("+ua file name"); - seteuid(getuid()); + euid = geteuid(); + if (seteuid(getuid()) == -1) { + option_error("unable to reset uid before opening %s: %m", fname); + return 0; + } ufile = fopen(fname, "r"); - seteuid(0); + if (seteuid(euid) == -1) + fatal("unable to regain privileges: %m"); if (ufile == NULL) { option_error("unable to open user login data file %s", fname); return 0;