version 1.6, 2000/04/26 21:28:31 |
version 1.6.2.2, 2000/09/01 18:23:17 |
|
|
#include "ssh2.h" |
#include "ssh2.h" |
#include "auth.h" |
#include "auth.h" |
#include "session.h" |
#include "session.h" |
#include "dispatch.h" |
|
|
|
|
|
/* import */ |
/* import */ |
extern ServerOptions options; |
extern ServerOptions options; |
extern char *forced_command; |
extern char *forced_command; |
|
|
{ |
{ |
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; |