summaryrefslogtreecommitdiffstats
path: root/auth.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-03-17 23:13:27 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-03-17 23:13:27 +0000
commitd69191bb4e93374f9818ab485d1a28fbfc0d1493 (patch)
tree1e623ada352baee7e3681ef476e8cab536de3c92 /auth.c
parentfea7278d901d7ee66b990f9c5d3ef7616c1a9c58 (diff)
- markus@cvs.openbsd.org 2001/03/17 17:27:59
[auth.c] check /etc/shells, too
Diffstat (limited to 'auth.c')
-rw-r--r--auth.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/auth.c b/auth.c
index 3e31a448..14e7f7e7 100644
--- a/auth.c
+++ b/auth.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: auth.c,v 1.19 2001/03/02 18:54:31 deraadt Exp $");
+RCSID("$OpenBSD: auth.c,v 1.20 2001/03/17 17:27:59 markus Exp $");
#ifdef HAVE_LOGIN_H
#include <login.h>
@@ -57,7 +57,7 @@ int
allowed_user(struct passwd * pw)
{
struct stat st;
- char *shell;
+ char *shell, *cp;
int i;
#ifdef WITH_AIXAUTHENTICATE
char *loginmsg;
@@ -95,6 +95,15 @@ allowed_user(struct passwd * pw)
*/
shell = (pw->pw_shell[0] == '\0') ? _PATH_BSHELL : pw->pw_shell;
+ /* disallow anyone who does not have a standard shell */
+ setusershell();
+ while ((cp = getusershell()) != NULL)
+ if (strcmp(cp, shell) == 0)
+ break;
+ endusershell();
+ if (cp == NULL)
+ return 0;
+
/* deny if shell does not exists or is not executable */
if (stat(shell, &st) != 0)
return 0;