X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fplugins%2Fpassprompt.c;h=14a199f8c743e574a71538d996998fd0361fcafe;hb=3ae4027842d48c3c92996ffb8443b9b320c1c775;hp=ab9f390c2d1c968c8054b60e1e5da7cc81eb5e00;hpb=e87fe1bbd37a1486c5223f110e9ce3ef75971f93;p=ppp.git diff --git a/pppd/plugins/passprompt.c b/pppd/plugins/passprompt.c index ab9f390..14a199f 100644 --- a/pppd/plugins/passprompt.c +++ b/pppd/plugins/passprompt.c @@ -8,13 +8,16 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ + #include #include #include +#include +#include #include -#include "pppd.h" +#include -char pppd_version[] = VERSION; +char pppd_version[] = PPPD_VERSION; static char promptprog[PATH_MAX+1]; static int promptprog_refused = 0; @@ -30,7 +33,7 @@ static int promptpass(char *user, char *passwd) { int p[2]; pid_t kid; - int readgood, wstat; + int readgood, wstat, ret; ssize_t red; if (promptprog_refused || promptprog[0] == 0 || access(promptprog, X_OK) < 0) @@ -55,8 +58,14 @@ static int promptpass(char *user, char *passwd) sys_close(); closelog(); close(p[0]); - seteuid(getuid()); - setegid(getgid()); + ret = seteuid(getuid()); + if (ret != 0) { + warn("Couldn't set effective user id"); + } + ret = setegid(getgid()); + if (ret != 0) { + warn("Couldn't set effective user id"); + } argv[0] = promptprog; argv[1] = user; argv[2] = remote_name; @@ -113,7 +122,7 @@ void plugin_init(void) { add_options(options); pap_passwd_hook = promptpass; -#ifdef USE_EAPTLS +#ifdef PPP_WITH_EAPTLS eaptls_passwd_hook = promptpass; #endif }