X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fplugins%2Fpassprompt.c;h=ab9f390c2d1c968c8054b60e1e5da7cc81eb5e00;hb=HEAD;hp=06d9ff2197c9f89a080f4186d2c57c792b67b916;hpb=b2c21894e165d7a0b4f1600fd8a8fd1b21305752;p=ppp.git diff --git a/pppd/plugins/passprompt.c b/pppd/plugins/passprompt.c index 06d9ff2..7779d51 100644 --- a/pppd/plugins/passprompt.c +++ b/pppd/plugins/passprompt.c @@ -9,22 +9,29 @@ * 2 of the License, or (at your option) any later version. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include +#include +#include +#include #include -#include "pppd.h" +#include +#include +#include +#include + +#include +#include +#include +#include -char pppd_version[] = VERSION; +char pppd_version[] = PPPD_VERSION; static char promptprog[PATH_MAX+1]; static int promptprog_refused = 0; -static option_t options[] = { +static struct option options[] = { { "promptprog", o_string, promptprog, "External PAP password prompting program", OPT_STATIC, NULL, PATH_MAX }, @@ -57,7 +64,7 @@ static int promptpass(char *user, char *passwd) if (!kid) { /* we are the child, exec the program */ char *argv[5], fdstr[32]; - sys_close(); + ppp_sys_close(); closelog(); close(p[0]); ret = seteuid(getuid()); @@ -68,10 +75,10 @@ static int promptpass(char *user, char *passwd) if (ret != 0) { warn("Couldn't set effective user id"); } - argv[0] = promptprog; - argv[1] = user; - argv[2] = remote_name; sprintf(fdstr, "%d", p[1]); + argv[0] = promptprog; + argv[1] = strdup(user); + argv[2] = strdup(ppp_remote_name()); argv[3] = fdstr; argv[4] = 0; execv(*argv, argv); @@ -86,7 +93,7 @@ static int promptpass(char *user, char *passwd) if (red == 0) break; if (red < 0) { - if (errno == EINTR && !got_sigterm) + if (errno == EINTR && !ppp_signaled(SIGTERM)) continue; error("Can't read secret from %s: %m", promptprog); readgood = -1; @@ -98,7 +105,7 @@ static int promptpass(char *user, char *passwd) /* now wait for child to exit */ while (waitpid(kid, &wstat, 0) < 0) { - if (errno != EINTR || got_sigterm) { + if (errno != EINTR || ppp_signaled(SIGTERM)) { warn("error waiting for %s: %m", promptprog); break; } @@ -122,7 +129,7 @@ static int promptpass(char *user, char *passwd) void plugin_init(void) { - add_options(options); + ppp_add_options(options); pap_passwd_hook = promptpass; #ifdef PPP_WITH_EAPTLS eaptls_passwd_hook = promptpass;