summaryrefslogtreecommitdiffstats
path: root/debian/patches/move-msg.sock-from-var-lib-samba-to-run-samba.patch
blob: ceb2a4f2be979cb7b073a555adad8f89398ea14b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From: Michael Tokarev <mjt@tls.msk.ru>
Date: Tue, 26 Apr 2022 16:11:48 +0300
Subject: move msg.sock from /var/lib/samba to /run/samba

This moves a socket directory from /var/lib/samba to /run/samba.

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

diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 8641a9dad56..bf866e65e44 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -461,11 +461,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)
@@ -500,7 +495,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;
 	}
@@ -663,7 +658,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,
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index a00c35be0d5..da641bc06aa 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -500,7 +500,7 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
 		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;
 	}