summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2010-01-12 19:45:26 +1100
committerDarren Tucker <dtucker@zip.com.au>2010-01-12 19:45:26 +1100
commit1b0c2455daf26b9eca30210f7628b7e4667501ad (patch)
treeff63ea5e8339474020c352515a2b095561431c06 /session.c
parentc6cc90b4653ad605072f11986cdbfc8a9d968185 (diff)
- dtucker@cvs.openbsd.org 2010/01/12 01:31:05
[session.c] Do not allow logins if /etc/nologin exists but is not readable by the user logging in. Noted by Jan.Pechanec at Sun, ok djm@ deraadt@
Diffstat (limited to 'session.c')
-rw-r--r--session.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/session.c b/session.c
index 733b5a909..6cd07d4fe 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: session.c,v 1.249 2009/11/20 00:15:41 dtucker Exp $ */ 1/* $OpenBSD: session.c,v 1.250 2010/01/12 01:31:05 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved 4 * All rights reserved
@@ -1387,10 +1387,12 @@ do_nologin(struct passwd *pw)
1387 if (pw->pw_uid) 1387 if (pw->pw_uid)
1388 f = fopen(_PATH_NOLOGIN, "r"); 1388 f = fopen(_PATH_NOLOGIN, "r");
1389#endif 1389#endif
1390 if (f) { 1390 if (f != NULL || errno == EPERM) {
1391 /* /etc/nologin exists. Print its contents and exit. */ 1391 /* /etc/nologin exists. Print its contents and exit. */
1392 logit("User %.100s not allowed because %s exists", 1392 logit("User %.100s not allowed because %s exists",
1393 pw->pw_name, _PATH_NOLOGIN); 1393 pw->pw_name, _PATH_NOLOGIN);
1394 if (f == NULL)
1395 exit(254);
1394 while (fgets(buf, sizeof(buf), f)) 1396 while (fgets(buf, sizeof(buf), f))
1395 fputs(buf, stderr); 1397 fputs(buf, stderr);
1396 fclose(f); 1398 fclose(f);