Merge pull request #307 from glysbaysb/usermod-shell-path
usermod: check if shell is know
This commit is contained in:
commit
f28660f5dd
@ -1005,10 +1005,10 @@ msgstr ""
|
|||||||
|
|
||||||
#: usermod.8.xml:327(para) chsh.1.xml:123(para)
|
#: usermod.8.xml:327(para) chsh.1.xml:123(para)
|
||||||
msgid ""
|
msgid ""
|
||||||
"The name of the user's new login shell. Setting this field to blank causes "
|
"The path of the user's new login shell. Setting this field to blank causes "
|
||||||
"the system to select the default login shell."
|
"the system to select the default login shell."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Der Name der neuen Anmelde-Shell des Benutzers. Falls dieses Feld leer "
|
"Der Pfad der neuen Anmelde-Shell des Benutzers. Falls dieses Feld leer "
|
||||||
"gelassen wird, verwendet das System die Standard-Anmelde-Shell."
|
"gelassen wird, verwendet das System die Standard-Anmelde-Shell."
|
||||||
|
|
||||||
#: usermod.8.xml:334(term) useradd.8.xml:471(term)
|
#: usermod.8.xml:334(term) useradd.8.xml:471(term)
|
||||||
|
@ -353,7 +353,7 @@
|
|||||||
</term>
|
</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
The name of the user's new login shell. Setting this field to
|
The path of the user's new login shell. Setting this field to
|
||||||
blank causes the system to select the default login shell.
|
blank causes the system to select the default login shell.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
@ -1032,7 +1032,7 @@ static void grp_update (void)
|
|||||||
static void process_flags (int argc, char **argv)
|
static void process_flags (int argc, char **argv)
|
||||||
{
|
{
|
||||||
const struct group *grp;
|
const struct group *grp;
|
||||||
|
struct stat st;
|
||||||
bool anyflag = false;
|
bool anyflag = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -1180,12 +1180,25 @@ static void process_flags (int argc, char **argv)
|
|||||||
case 'P': /* no-op, handled in process_prefix_flag () */
|
case 'P': /* no-op, handled in process_prefix_flag () */
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
if (!VALID (optarg)) {
|
if ( ( !VALID (optarg) )
|
||||||
|
|| ( ('\0' != optarg[0])
|
||||||
|
&& ('/' != optarg[0])
|
||||||
|
&& ('*' != optarg[0]) )) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: invalid field '%s'\n"),
|
_("%s: invalid shell '%s'\n"),
|
||||||
Prog, optarg);
|
Prog, optarg);
|
||||||
exit (E_BAD_ARG);
|
exit (E_BAD_ARG);
|
||||||
}
|
}
|
||||||
|
if ( '\0' != optarg[0]
|
||||||
|
&& '*' != optarg[0]
|
||||||
|
&& strcmp(optarg, "/sbin/nologin") != 0
|
||||||
|
&& ( stat(optarg, &st) != 0
|
||||||
|
|| S_ISDIR(st.st_mode)
|
||||||
|
|| access(optarg, X_OK) != 0)) {
|
||||||
|
fprintf (stderr,
|
||||||
|
_("%s: Warning: missing or non-executable shell '%s'\n"),
|
||||||
|
Prog, optarg);
|
||||||
|
}
|
||||||
user_newshell = optarg;
|
user_newshell = optarg;
|
||||||
sflg = true;
|
sflg = true;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user