]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Allow setting an empty homedir
authorVolker Theile <votdev@gmx.de>
Tue, 26 Nov 2024 08:26:14 +0000 (09:26 +0100)
committerSerge Hallyn <serge@hallyn.com>
Wed, 27 Nov 2024 15:51:06 +0000 (09:51 -0600)
With the PR 352 it is not possible anymore to run `usermod --home "" <USERNAME>`. This PR will fix that regression.

Related to: https://github.com/shadow-maint/shadow/pull/352

Signed-off-by: Volker Theile <votdev@gmx.de>
src/usermod.c

index e994132c8c760c2b9402b25025fcb7b21efb6dfe..ddcd64010155a86a8e2a3d74262e562fcb306ac7 100644 (file)
@@ -64,6 +64,7 @@
 #include "shadowlog.h"
 #include "string/memset/memzero.h"
 #include "string/sprintf/xasprintf.h"
+#include "string/strcmp/streq.h"
 #include "string/strdup/xstrdup.h"
 #include "time/day_to_str.h"
 
@@ -1062,7 +1063,7 @@ process_flags(int argc, char **argv)
                                }
                                dflg = true;
                                user_newhome = optarg;
-                               if (user_newhome[0] != '/') {
+                               if ((user_newhome[0] != '/') && !streq(user_newhome, "")) {
                                        fprintf (stderr,
                                                 _("%s: homedir must be an absolute path\n"),
                                                 Prog);