version 1.1.1.5, 2013/10/14 07:56:35
|
version 1.1.1.6, 2014/06/15 16:12:55
|
Line 87 tgetpass(const char *prompt, int timeout, int flags)
|
Line 87 tgetpass(const char *prompt, int timeout, int flags)
|
if (!ISSET(flags, TGP_STDIN|TGP_ECHO|TGP_ASKPASS|TGP_NOECHO_TRY) && |
if (!ISSET(flags, TGP_STDIN|TGP_ECHO|TGP_ASKPASS|TGP_NOECHO_TRY) && |
!tty_present()) { |
!tty_present()) { |
if (askpass == NULL || getenv_unhooked("DISPLAY") == NULL) { |
if (askpass == NULL || getenv_unhooked("DISPLAY") == NULL) { |
warningx(_("no tty present and no askpass program specified")); | warningx(U_("no tty present and no askpass program specified")); |
debug_return_str(NULL); |
debug_return_str(NULL); |
} |
} |
SET(flags, TGP_ASKPASS); |
SET(flags, TGP_ASKPASS); |
Line 96 tgetpass(const char *prompt, int timeout, int flags)
|
Line 96 tgetpass(const char *prompt, int timeout, int flags)
|
/* If using a helper program to get the password, run it instead. */ |
/* If using a helper program to get the password, run it instead. */ |
if (ISSET(flags, TGP_ASKPASS)) { |
if (ISSET(flags, TGP_ASKPASS)) { |
if (askpass == NULL || *askpass == '\0') |
if (askpass == NULL || *askpass == '\0') |
fatalx(_("no askpass program specified, try setting SUDO_ASKPASS")); | fatalx(U_("no askpass program specified, try setting SUDO_ASKPASS")); |
debug_return_str_masked(sudo_askpass(askpass, prompt)); |
debug_return_str_masked(sudo_askpass(askpass, prompt)); |
} |
} |
|
|
Line 215 sudo_askpass(const char *askpass, const char *prompt)
|
Line 215 sudo_askpass(const char *askpass, const char *prompt)
|
debug_decl(sudo_askpass, SUDO_DEBUG_CONV) |
debug_decl(sudo_askpass, SUDO_DEBUG_CONV) |
|
|
if (pipe(pfd) == -1) |
if (pipe(pfd) == -1) |
fatal(_("unable to create pipe")); | fatal(U_("unable to create pipe")); |
|
|
if ((pid = fork()) == -1) |
if ((pid = fork()) == -1) |
fatal(_("unable to fork")); | fatal(U_("unable to fork")); |
|
|
if (pid == 0) { |
if (pid == 0) { |
/* child, point stdout to output side of the pipe and exec askpass */ |
/* child, point stdout to output side of the pipe and exec askpass */ |
Line 229 sudo_askpass(const char *askpass, const char *prompt)
|
Line 229 sudo_askpass(const char *askpass, const char *prompt)
|
if (setuid(ROOT_UID) == -1) |
if (setuid(ROOT_UID) == -1) |
warning("setuid(%d)", ROOT_UID); |
warning("setuid(%d)", ROOT_UID); |
if (setgid(user_details.gid)) { |
if (setgid(user_details.gid)) { |
warning(_("unable to set gid to %u"), (unsigned int)user_details.gid); | warning(U_("unable to set gid to %u"), (unsigned int)user_details.gid); |
_exit(255); |
_exit(255); |
} |
} |
if (setuid(user_details.uid)) { |
if (setuid(user_details.uid)) { |
warning(_("unable to set uid to %u"), (unsigned int)user_details.uid); | warning(U_("unable to set uid to %u"), (unsigned int)user_details.uid); |
_exit(255); |
_exit(255); |
} |
} |
closefrom(STDERR_FILENO + 1); |
closefrom(STDERR_FILENO + 1); |
execl(askpass, askpass, prompt, (char *)NULL); |
execl(askpass, askpass, prompt, (char *)NULL); |
warning(_("unable to run %s"), askpass); | warning(U_("unable to run %s"), askpass); |
_exit(255); |
_exit(255); |
} |
} |
|
|