summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-01-07 17:38:58 +1100
committerDamien Miller <djm@mindrot.org>2003-01-07 17:38:58 +1100
commitf25c18d7e8810ad94c7d2030cb0427e22745531e (patch)
tree11ab9ede077fac71dfb936356a0f793135200c17
parentb93addb6d667b36bdbb298b8b3c581c1738c0c9f (diff)
- (djm) Bug #178: On AIX /etc/nologin wasnt't shown to users. Fix from
Ralf.Wenk@fh-karlsruhe.de and dtucker@zip.com.au
-rw-r--r--ChangeLog4
-rw-r--r--auth.c10
-rw-r--r--session.c1
3 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 0c7bfaca..890b1621 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 $
diff --git a/auth.c b/auth.c
index ee21149d..7deded20 100644
--- a/auth.c
+++ b/auth.c
@@ -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 */
diff --git a/session.c b/session.c
index 9832d7a8..c16cdcc1 100644
--- a/session.c
+++ b/session.c
@@ -1194,6 +1194,7 @@ do_nologin(struct passwd *pw)
while (fgets(buf, sizeof(buf), f))
fputs(buf, stderr);
fclose(f);
+ fflush(NULL);
exit(254);
}
}