diff options
Diffstat (limited to 'auth.c')
-rw-r--r-- | auth.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -5,7 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include "includes.h" | 7 | #include "includes.h" |
8 | RCSID("$OpenBSD: auth.c,v 1.6 2000/04/26 21:28:31 markus Exp $"); | 8 | RCSID("$OpenBSD: auth.c,v 1.7 2000/05/17 21:37:24 deraadt Exp $"); |
9 | 9 | ||
10 | #include "xmalloc.h" | 10 | #include "xmalloc.h" |
11 | #include "rsa.h" | 11 | #include "rsa.h" |
@@ -48,6 +48,7 @@ allowed_user(struct passwd * pw) | |||
48 | { | 48 | { |
49 | struct stat st; | 49 | struct stat st; |
50 | struct group *grp; | 50 | struct group *grp; |
51 | char *shell; | ||
51 | int i; | 52 | int i; |
52 | #ifdef WITH_AIXAUTHENTICATE | 53 | #ifdef WITH_AIXAUTHENTICATE |
53 | char *loginmsg; | 54 | char *loginmsg; |
@@ -58,7 +59,14 @@ allowed_user(struct passwd * pw) | |||
58 | return 0; | 59 | return 0; |
59 | 60 | ||
60 | /* deny if shell does not exists or is not executable */ | 61 | /* deny if shell does not exists or is not executable */ |
61 | if (stat(pw->pw_shell, &st) != 0) | 62 | /* |
63 | * Get the shell from the password data. An empty shell field is | ||
64 | * legal, and means /bin/sh. | ||
65 | */ | ||
66 | shell = (pw->pw_shell[0] == '\0') ? _PATH_BSHELL : pw->pw_shell; | ||
67 | |||
68 | /* deny if shell does not exists or is not executable */ | ||
69 | if (stat(shell, &st) != 0) | ||
62 | return 0; | 70 | return 0; |
63 | if (!((st.st_mode & S_IFREG) && (st.st_mode & (S_IXOTH|S_IXUSR|S_IXGRP)))) | 71 | if (!((st.st_mode & S_IFREG) && (st.st_mode & (S_IXOTH|S_IXUSR|S_IXGRP)))) |
64 | return 0; | 72 | return 0; |