Merge pull request #187 from jubalh/useradd-s
useradd: check for valid shell argument
This commit is contained in:
commit
e97df9b1ec
@ -1101,6 +1101,7 @@ static void process_flags (int argc, char **argv)
|
|||||||
const struct group *grp;
|
const struct group *grp;
|
||||||
bool anyflag = false;
|
bool anyflag = false;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -1327,7 +1328,10 @@ static void process_flags (int argc, char **argv)
|
|||||||
if ( ( !VALID (optarg) )
|
if ( ( !VALID (optarg) )
|
||||||
|| ( ('\0' != optarg[0])
|
|| ( ('\0' != optarg[0])
|
||||||
&& ('/' != optarg[0])
|
&& ('/' != optarg[0])
|
||||||
&& ('*' != optarg[0]) )) {
|
&& ('*' != optarg[0]) )
|
||||||
|
|| (stat(optarg, &st) != 0)
|
||||||
|
|| (S_ISDIR(st.st_mode))
|
||||||
|
|| (access(optarg, X_OK != 0))) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: invalid shell '%s'\n"),
|
_("%s: invalid shell '%s'\n"),
|
||||||
Prog, optarg);
|
Prog, optarg);
|
||||||
|
Loading…
Reference in New Issue
Block a user