]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/passprompt.c
Fix include paths for plugins to use the public API of pppd
[ppp.git] / pppd / plugins / passprompt.c
index dae326867fcdea9b2f6190d6e01fd24fff056352..7cd0a2bfe1cbac8a0f29a23b0c2319c1c0080497 100644 (file)
@@ -9,17 +9,13 @@
  *  2 of the License, or (at your option) any later version.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <errno.h>
 #include <unistd.h>
 #include <sys/wait.h>
 #include <syslog.h>
-#include "pppd.h"
+#include <pppd/pppd.h>
 
-char pppd_version[] = VERSION;
+char pppd_version[] = PPPD_VERSION;
 
 static char promptprog[PATH_MAX+1];
 static int promptprog_refused = 0;
@@ -35,7 +31,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)
@@ -60,8 +56,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;
@@ -118,7 +120,7 @@ void plugin_init(void)
 {
     add_options(options);
     pap_passwd_hook = promptpass;
-#ifdef USE_EAPTLS
+#ifdef PPP_WITH_EAPTLS
     eaptls_passwd_hook = promptpass;
 #endif
 }