if (def_askpass && !user_askpass)
user_askpass = def_askpass;
- /* If no tty is present but DISPLAY is set, use askpass if we have it. */
- if (user_askpass && !ISSET(tgetpass_flags, TGP_STDIN) &&
- user_ttypath == NULL && user_display != NULL && *user_display != '\0')
- SET(tgetpass_flags, TGP_ASKPASS);
+ /* If user specified -A, make sure there is an askpass helper defined. */
+ if (ISSET(tgetpass_flags, TGP_ASKPASS)) {
+ if (user_askpass == NULL)
+ log_error(NO_MAIL,
+ "no askpass program specified, try setting SUDO_ASKPASS");
+ } else {
+ /* If no tty but DISPLAY is set, use askpass if we have it. */
+ if (user_askpass && !ISSET(tgetpass_flags, TGP_STDIN) &&
+ !user_ttypath && user_display && *user_display != '\0')
+ SET(tgetpass_flags, TGP_ASKPASS);
+ }
/* User may have overriden environment resetting via the -E flag. */
if (ISSET(sudo_mode, MODE_PRESERVE_ENV) && def_setenv)
excl);
usage(1);
}
+ if (ISSET(tgetpass_flags, TGP_STDIN) && ISSET(tgetpass_flags, TGP_ASKPASS)) {
+ warningx("the `-A' and `-S' options may not be used together");
+ usage(1);
+ }
if ((NewArgc == 0 && (rval & MODE_EDIT)) ||
(NewArgc > 0 && !(rval & (MODE_RUN | MODE_EDIT | MODE_CHECK))))
usage(1);