- (djm) Bug #178: On AIX /etc/nologin wasnt't shown to users. Fix from

Ralf.Wenk@fh-karlsruhe.de and dtucker@zip.com.au
This commit is contained in:
Damien Miller 2003-01-07 17:38:58 +11:00
parent b93addb6d6
commit f25c18d7e8
3 changed files with 12 additions and 3 deletions

View File

@ -10,6 +10,8 @@
on one by peak@argo.troja.mff.cuni.cz
- (djm) Bug #111: Run syslog and stderr logging through strnvis to eliminate
nasties. Report from peak@argo.troja.mff.cuni.cz
- (djm) Bug #178: On AIX /etc/nologin wasnt't shown to users. Fix from
Ralf.Wenk@fh-karlsruhe.de and dtucker@zip.com.au
20030103
- (djm) Bug #461: ssh-copy-id fails with no arguments. Patch from
@ -938,4 +940,4 @@
save auth method before monitor_reset_key_state(); bugzilla bug #284;
ok provos@
$Id: ChangeLog,v 1.2546 2003/01/07 06:04:18 djm Exp $
$Id: ChangeLog,v 1.2547 2003/01/07 06:38:58 djm Exp $

10
auth.c
View File

@ -218,6 +218,8 @@ allowed_user(struct passwd * pw)
*/
if ( (pw->pw_uid != 0) && (geteuid() == 0) &&
loginrestrictions(pw->pw_name, S_RLOGIN, NULL, &loginmsg) != 0) {
int loginrestrict_errno = errno;
if (loginmsg && *loginmsg) {
/* Remove embedded newlines (if any) */
char *p;
@ -227,9 +229,13 @@ allowed_user(struct passwd * pw)
}
/* Remove trailing newline */
*--p = '\0';
log("Login restricted for %s: %.100s", pw->pw_name, loginmsg);
log("Login restricted for %s: %.100s", pw->pw_name,
loginmsg);
}
return 0;
/* Don't fail if /etc/nologin set */
if (!(loginrestrict_errno == EPERM &&
stat(_PATH_NOLOGIN, &st) == 0))
return 0;
}
#endif /* WITH_AIXAUTHENTICATE */

View File

@ -1194,6 +1194,7 @@ do_nologin(struct passwd *pw)
while (fgets(buf, sizeof(buf), f))
fputs(buf, stderr);
fclose(f);
fflush(NULL);
exit(254);
}
}