From 01fbe3eeb23ecaf8b117c8744ddb6d3f1c14da85 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 26 Sep 2025 13:56:37 +0200 Subject: [PATCH] lib: Add a safeguard for misconfigured directory permissions An installation I've seen had the path to the msg.lock directory set up such that only root could access it. We're calling serverid_exists() as non-root, so this is a pretty bad error. Log this as an error in syslog by default and assume this PID still exists. Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Mon Sep 29 08:14:22 UTC 2025 on atb-devel-224 --- source3/lib/serverid.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c index 45b1fc97382..84eb719c3ec 100644 --- a/source3/lib/serverid.c +++ b/source3/lib/serverid.c @@ -20,6 +20,7 @@ #include "replace.h" #include "lib/util/samba_util.h" #include "lib/util/server_id.h" +#include "lib/util/debug.h" #include "source3/lib/util_procid.h" #include "source3/param/param_proto.h" #include "serverid.h" @@ -43,6 +44,12 @@ static bool serverid_exists_local(const struct server_id *id) ret = messaging_dgm_get_unique(id->pid, &unique); if (ret != 0) { + if (ret == EACCES) { + DBG_ERR("Access denied on msg.lock file for PID %jd, " + "assuming process still exists\n", + (intmax_t)id->pid); + return true; + } return false; } -- 2.47.3