From 3db209c9567c728c13b5d901e81f151ed1d2b0f7 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 19 Jan 2024 11:32:26 +0100
Subject: [PATCH] user-util: validate the right field

(cherry picked from commit 829854afa5e38db30be207fc8f8f80705e623795)
(cherry picked from commit 624984ff423a98f1fd66e64ddfe3a8972d2f911f)
(cherry picked from commit 641b8d700694984e40199008b059a65184dc946b)

Conflict:NA
Reference:https://github.com/systemd/systemd-stable/commit/3db209c9567c728c13b5d901e81f151ed1d2b0f7

---
 src/basic/user-util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/basic/user-util.c b/src/basic/user-util.c
index 519ab70118..c81d19409d 100644
--- a/src/basic/user-util.c
+++ b/src/basic/user-util.c
@@ -314,7 +314,7 @@ int get_user_creds(
         if (shell) {
                 if (FLAGS_SET(flags, USER_CREDS_CLEAN) &&
                     (isempty(p->pw_shell) ||
-                     !path_is_valid(p->pw_dir) ||
+                     !path_is_valid(p->pw_shell) ||
                      !path_is_absolute(p->pw_shell) ||
                      is_nologin_shell(p->pw_shell)))
                         *shell = NULL;
-- 
2.33.0

