version 1.6, 2000/04/26 21:28:31 |
version 1.7, 2000/05/17 21:37:24 |
|
|
{ |
{ |
struct stat st; |
struct stat st; |
struct group *grp; |
struct group *grp; |
|
char *shell; |
int i; |
int i; |
|
|
/* Shouldn't be called if pw is NULL, but better safe than sorry... */ |
/* Shouldn't be called if pw is NULL, but better safe than sorry... */ |
if (!pw) |
if (!pw) |
return 0; |
return 0; |
|
|
|
/* |
|
* Get the shell from the password data. An empty shell field is |
|
* legal, and means /bin/sh. |
|
*/ |
|
shell = (pw->pw_shell[0] == '\0') ? _PATH_BSHELL : pw->pw_shell; |
|
|
/* deny if shell does not exists or is not executable */ |
/* deny if shell does not exists or is not executable */ |
if (stat(pw->pw_shell, &st) != 0) |
if (stat(shell, &st) != 0) |
return 0; |
return 0; |
if (!((st.st_mode & S_IFREG) && (st.st_mode & (S_IXOTH|S_IXUSR|S_IXGRP)))) |
if (!((st.st_mode & S_IFREG) && (st.st_mode & (S_IXOTH|S_IXUSR|S_IXGRP)))) |
return 0; |
return 0; |