summaryrefslogtreecommitdiffstats
path: root/debian/patches/testparm-do-not-fail-if-pid-dir-does-not-exist.patch
blob: cdf1dd29e6f338e5fb925041f9812b99d5b63f4d (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From 68fe6de9aeca04c252d1d89165802e0fa981d28c Mon Sep 17 00:00:00 2001
From: Michael Tokarev <mjt@tls.msk.ru>
Date: Tue, 26 Apr 2022 16:14:38 +0300
Subject: testparm: do not fail if /run/samba does not exist

testparm explicitly fails if $piddir or $lockdir does not exist.
However, the daemons which actually use these directories, will
create it on demand, there is no need to fail even simple testparm
operations if the dirs are not there.

This change lets to (pre)configure samba without bothering to
pre-create the directories which are overwise needed only to fulfil
testparm criteria.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 python/samba/netcmd/testparm.py | 6 ++----
 source3/utils/testparm.c        | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/python/samba/netcmd/testparm.py b/python/samba/netcmd/testparm.py
index b44dea1f141..6fecbb15303 100644
--- a/python/samba/netcmd/testparm.py
+++ b/python/samba/netcmd/testparm.py
@@ -142,14 +142,12 @@ class cmd_testparm(Command):
         lockdir = lp.get("lockdir")
 
         if not os.path.isdir(lockdir):
-            logger.error("lock directory %s does not exist", lockdir)
-            valid = False
+            logger.warning("lock directory %s does not exist", lockdir)
 
         piddir = lp.get("pid directory")
 
         if not os.path.isdir(piddir):
-            logger.error("pid directory %s does not exist", piddir)
-            valid = False
+            logger.warning("pid directory %s does not exist", piddir)
 
         winbind_separator = lp.get("winbind separator")
 
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index 71bc4c2694e..4916a665c02 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -326,9 +326,8 @@ static int do_global_checks(void)
 	}
 
 	if (!directory_exist_stat(lp_lock_directory(), &st)) {
-		fprintf(stderr, "ERROR: lock directory %s does not exist\n\n",
+		fprintf(stderr, "WARNING: lock directory %s does not exist\n\n",
 		       lp_lock_directory());
-		ret = 1;
 	} else if ((st.st_ex_mode & 0777) != 0755) {
 		fprintf(stderr, "WARNING: lock directory %s should have "
 				"permissions 0755 for browsing to work\n\n",
@@ -356,9 +355,8 @@ static int do_global_checks(void)
 	}
 
 	if (!directory_exist_stat(lp_pid_directory(), &st)) {
-		fprintf(stderr, "ERROR: pid directory %s does not exist\n\n",
+		fprintf(stderr, "WARNING: pid directory %s does not exist\n\n",
 		       lp_pid_directory());
-		ret = 1;
 	}
 
 	if (lp_passdb_expand_explicit()) {
-- 
2.30.2