summaryrefslogtreecommitdiffstats
path: root/auth.c
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 /auth.c
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
Diffstat (limited to 'auth.c')
-rw-r--r--auth.c10
1 files changed, 8 insertions, 2 deletions
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 */