--- sh-utils-2.0/src/su.c.nostdin Sat Aug 28 14:35:51 1999 +++ sh-utils-2.0/src/su.c Sat Aug 28 14:38:43 1999 @@ -316,7 +316,6 @@ correct_password (const struct passwd *pw) { #ifdef USE_PAM - /* root always succeeds; this isn't an authentication question (no * extra privs are being granted) so it shouldn't authenticate with PAM. * However, we want to create the pam_handle so that proper credentials @@ -325,6 +324,12 @@ PAM_BAIL_P; if (getuid () == 0) return 1; + + if (!isatty(0)) { + fprintf(stderr, "standard in must be a tty\n"); + exit(1); + } + retval = pam_authenticate(pamh, 0); PAM_BAIL_P; retval = pam_acct_mgmt(pamh, 0);