]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Add a safeguard for misconfigured directory permissions gitlab/master
authorVolker Lendecke <vl@samba.org>
Fri, 26 Sep 2025 11:56:37 +0000 (13:56 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 29 Sep 2025 08:14:22 +0000 (08:14 +0000)
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 <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Sep 29 08:14:22 UTC 2025 on atb-devel-224

source3/lib/serverid.c

index 45b1fc97382cecdcbcfce8c342696e82e5af1a52..84eb719c3ecb4640961d4aa38257840c93c65d17 100644 (file)
@@ -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;
        }