#include "sudo_plugin.h"
#include "sudo_plugin_int.h"
+/* tgetpass.c */
+extern const char *askpass_path;
+
/*
* Read in /etc/sudo.conf
* Returns a list of plugins.
}
if (strcasecmp(name, "askpass") != 0)
continue;
- /* XXX - Just set in environment for now */
- setenv("SUDO_ASKPASS", path, 0);
+ askpass_path = estrdup(path);
continue;
}
extern struct user_details user_details; /* XXX */
+#ifdef _PATH_SUDO_ASKPASS
+const char *askpass_path = _PATH_SUDO_ASKPASS;
+#else
+const char *askpass_path;
+#endif
+
/*
* Like getpass(3) but with timeout and echo flags.
*/
sigaction_t sa, savealrm, saveint, savehup, savequit, saveterm;
sigaction_t savetstp, savettin, savettou, savepipe;
char *pass;
- static char *askpass;
+ static const char *askpass;
static char buf[SUDO_PASS_MAX + 1];
int i, input, output, save_errno, neednl = 0, need_restart;
if (askpass == NULL) {
askpass = getenv("SUDO_ASKPASS");
-#ifdef _PATH_SUDO_ASKPASS
- if (askpass == NULL)
- askpass = _PATH_SUDO_ASKPASS;
-#endif
+ if (askpass == NULL || *askpass == '\0')
+ askpass = askpass_path;
}
/* If no tty present and we need to disable echo, try askpass. */