move msg.sock from /var/lib/samba to /run/samba
authorMichael Tokarev <mjt@tls.msk.ru>
Tue, 26 Apr 2022 13:11:48 +0000 (16:11 +0300)
committerMichael Tokarev <mjt@tls.msk.ru>
Wed, 2 Apr 2025 11:34:31 +0000 (14:34 +0300)
Move socket directory from /var/lib/samba to /run/samba,
exactly like msg.lock.  This directory is only used by various
samba components to communicate with each other (smbcontrol),
there's no place for it in /var/lib.

Also remove msg.sock subdir in various tests.

It'd be nice to also move ntp socket and similar somewhere to
/run/samba too, but this is a bit more difficult since it is
used in other software.

https://lists.samba.org/archive/samba-technical/2022-April/137322.html

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Gbp-Pq: Name move-msg.sock-from-var-lib-samba-to-run-samba.patch

python/samba/tests/blackbox/downgradedatabase.py
python/samba/tests/join.py
python/samba/tests/samdb.py
source3/lib/messages.c
source4/lib/messaging/messaging.c
source4/torture/drs/python/samba_tool_drs.py
source4/torture/drs/python/samba_tool_drs_critical.py
source4/torture/drs/python/samba_tool_drs_no_dns.py

index d850d1b5527eb035d4b8492225f603c41647f41a..a8f5d98c6136785115aea367a5ee2fee42869b53 100644 (file)
@@ -60,6 +60,7 @@ class DowngradeTestBase(BlackboxTestCase):
                      "etc",
                      "state",
                      "bind-dns",
+                     "msg.sock",
                      "msg.lock")
         self.rm_files("names.tdb", "gencache.tdb")
         super().tearDown()
index b04cb4a506c68f18113127aea53f0eeaae196f19..e052b4d1e313d4c7411166551c4b9d4ada0f4c79 100644 (file)
@@ -74,7 +74,7 @@ class JoinTestCase(DNSTKeyTest):
         if paths is not None:
             shutil.rmtree(paths.private_dir)
             shutil.rmtree(paths.state_dir)
-            self.rm_dirs("etc", "msg.lock", "bind-dns")
+            self.rm_dirs("etc", "msg.lock", "msg.sock", "bind-dns")
             self.rm_files("names.tdb")
 
         self.join_ctx.cleanup_old_join(force=True)
index e8b632bc9e261bc4fb3e34b0088e2c2b510d0374..3d3b21b6b6311a34b42247446d85e3921b62b0ab 100644 (file)
@@ -54,7 +54,7 @@ class SamDBTestCase(TestCaseInTempDir):
 
     def tearDown(self):
         self.rm_files('names.tdb')
-        self.rm_dirs('etc', 'msg.lock', 'private', 'state', 'bind-dns')
+        self.rm_dirs('etc', 'msg.lock', 'msg.sock', 'private', 'state', 'bind-dns')
 
         super().tearDown()
 
index b856a2889b1f5bb750e71dd0c3c0493b01ff3b60..46b99cb1c19611a40d2813d75e28f1266e12e853 100644 (file)
@@ -462,11 +462,6 @@ static int messaging_context_destructor(struct messaging_context *ctx)
        return 0;
 }
 
-static const char *private_path(const char *name)
-{
-       return talloc_asprintf(talloc_tos(), "%s/%s", lp_private_dir(), name);
-}
-
 static NTSTATUS messaging_init_internal(TALLOC_CTX *mem_ctx,
                                        struct tevent_context *ev,
                                        struct messaging_context **pmsg_ctx)
@@ -501,7 +496,7 @@ static NTSTATUS messaging_init_internal(TALLOC_CTX *mem_ctx,
                return NT_STATUS_ACCESS_DENIED;
        }
 
-       priv_path = private_path("msg.sock");
+       priv_path = lock_path(talloc_tos(), "msg.sock");
        if (priv_path == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -664,7 +659,7 @@ NTSTATUS messaging_reinit(struct messaging_context *msg_ctx)
                msg_ctx->per_process_talloc_ctx,
                msg_ctx->event_ctx,
                &msg_ctx->id.unique_id,
-               private_path("msg.sock"),
+               lock_path(talloc_tos(), "msg.sock"),
                lck_path,
                messaging_recv_cb,
                msg_ctx,
index 06adc19c89940feb562c41d4ad84bff9210e1548..e3242fdccc554d936a69b1f9ba2365d0a3af9338 100644 (file)
@@ -537,7 +537,7 @@ static struct imessaging_context *imessaging_init_internal(
                goto fail;
        }
 
-       msg->sock_dir = lpcfg_private_path(msg, lp_ctx, "msg.sock");
+       msg->sock_dir = lpcfg_lock_path(msg, lp_ctx, "msg.sock");
        if (msg->sock_dir == NULL) {
                goto fail;
        }
index e622fe4f5987a1ea4ce226534e252a007aa04ecd..5a6f5ac85946ae40f9d863137ebef769c7107092 100644 (file)
@@ -42,7 +42,7 @@ class SambaToolDrsTests(drs_base.DrsBaseTestCase):
         self._enable_inbound_repl(self.dnsname_dc2)
 
         self.rm_files('names.tdb', allow_missing=True)
-        self.rm_dirs('etc', 'msg.lock', 'private', 'state', 'bind-dns',
+        self.rm_dirs('etc', 'msg.lock', 'msg.sock', 'private', 'state', 'bind-dns',
                      allow_missing=True)
 
         super(SambaToolDrsTests, self).tearDown()
index 5260e1588b258b70544fb436ac7bfd0e1ecbe22c..34925c0ae41598a53ee5482d24b72af93ec39f6d 100644 (file)
@@ -42,7 +42,7 @@ class SambaToolDrsTests(drs_base.DrsBaseTestCase):
         self._enable_inbound_repl(self.dnsname_dc2)
 
         self.rm_files('names.tdb', allow_missing=True)
-        self.rm_dirs('etc', 'msg.lock', 'private', 'state', 'bind-dns',
+        self.rm_dirs('etc', 'msg.lock', 'msg.sock', 'private', 'state', 'bind-dns',
                      allow_missing=True)
 
         super(SambaToolDrsTests, self).tearDown()
index aad59661757c87e508a2dcd4630b98af8ff8cc81..ebc176abf62f2ca9ac02cdb4296eac38fff41e0e 100644 (file)
@@ -47,7 +47,7 @@ class SambaToolDrsNoDnsTests(drs_base.DrsBaseTestCase):
     def tearDown(self):
         self._enable_inbound_repl(self.dnsname_dc1)
         self.rm_files('names.tdb', allow_missing=True)
-        self.rm_dirs('etc', 'msg.lock', 'private', 'state', 'bind-dns',
+        self.rm_dirs('etc', 'msg.lock', 'msg.sock', 'private', 'state', 'bind-dns',
                      allow_missing=True)
 
         super(SambaToolDrsNoDnsTests, self).tearDown()