50741a7c13
* Add shadow-4.8-shell-check.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/shadow?expand=0&rev=83
44 lines
1.5 KiB
Diff
44 lines
1.5 KiB
Diff
From 4ed08824e511fa5247006c71490b0440e1c17319 Mon Sep 17 00:00:00 2001
|
|
From: Tomas Mraz <tmraz@fedoraproject.org>
|
|
Date: Thu, 16 Jan 2020 12:55:30 +0100
|
|
Subject: [PATCH] Make the check for non-executable shell only a warning.
|
|
|
|
Although it is a good idea to check for an inadvertent typo
|
|
in the shell name it is possible that the shell might not be present
|
|
on the system yet when the user is added.
|
|
---
|
|
src/useradd.c | 15 +++++++++++----
|
|
1 file changed, 11 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/useradd.c b/src/useradd.c
|
|
index c29ae949..a679392d 100644
|
|
--- a/src/useradd.c
|
|
+++ b/src/useradd.c
|
|
@@ -1328,15 +1328,22 @@ static void process_flags (int argc, char **argv)
|
|
if ( ( !VALID (optarg) )
|
|
|| ( ('\0' != optarg[0])
|
|
&& ('/' != optarg[0])
|
|
- && ('*' != optarg[0]) )
|
|
- || (stat(optarg, &st) != 0)
|
|
- || (S_ISDIR(st.st_mode))
|
|
- || (access(optarg, X_OK) != 0)) {
|
|
+ && ('*' != optarg[0]) )) {
|
|
fprintf (stderr,
|
|
_("%s: invalid shell '%s'\n"),
|
|
Prog, optarg);
|
|
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_shell = optarg;
|
|
def_shell = optarg;
|
|
sflg = true;
|