From: Volker Theile Date: Tue, 26 Nov 2024 08:26:14 +0000 (+0100) Subject: Allow setting an empty homedir X-Git-Tag: 4.17.0-rc1~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a65fccf199667bf1568ca362e24bdcd07d3a8154;p=thirdparty%2Fshadow.git Allow setting an empty homedir With the PR 352 it is not possible anymore to run `usermod --home "" `. This PR will fix that regression. Related to: https://github.com/shadow-maint/shadow/pull/352 Signed-off-by: Volker Theile --- diff --git a/src/usermod.c b/src/usermod.c index e994132c8..ddcd64010 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -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);