Added
Link Here
|
1 |
From 6947e4141016bb140dfae62cd71be9d9ba5d7060 Mon Sep 17 00:00:00 2001 |
2 |
From: Ralph Boehme <slow@samba.org> |
3 |
Date: Sat, 4 May 2019 12:12:04 +0200 |
4 |
Subject: [PATCH 1/2] s3:dbwrap: initialize messaging before getting the ctdb |
5 |
connection |
6 |
|
7 |
This is a better fix for bug #13465. |
8 |
|
9 |
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13925 |
10 |
|
11 |
Signed-off-by: Ralph Boehme <slow@samba.org> |
12 |
Reviewed-by: Jeremy Allison <jra@samba.org> |
13 |
(cherry picked from commit ca95d7f41b683b4d7ac59ed6ee709d44abfe2019) |
14 |
--- |
15 |
source3/lib/dbwrap/dbwrap_open.c | 8 +++++++- |
16 |
1 file changed, 7 insertions(+), 1 deletion(-) |
17 |
|
18 |
diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c |
19 |
index c8dfd9103a8..20084bca471 100644 |
20 |
--- a/source3/lib/dbwrap/dbwrap_open.c |
21 |
+++ b/source3/lib/dbwrap/dbwrap_open.c |
22 |
@@ -141,13 +141,19 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx, |
23 |
struct messaging_context *msg_ctx; |
24 |
struct ctdbd_connection *conn; |
25 |
|
26 |
+ /* |
27 |
+ * Initialize messaging before getting the ctdb |
28 |
+ * connection, as the ctdb connection requires messaging |
29 |
+ * to be initialized. |
30 |
+ */ |
31 |
+ msg_ctx = global_messaging_context(); |
32 |
+ |
33 |
conn = messaging_ctdb_connection(); |
34 |
if (conn == NULL) { |
35 |
DBG_WARNING("No ctdb connection\n"); |
36 |
errno = EIO; |
37 |
return NULL; |
38 |
} |
39 |
- msg_ctx = global_messaging_context(); |
40 |
|
41 |
result = db_open_ctdb(mem_ctx, msg_ctx, base, |
42 |
hash_size, |
43 |
-- |
44 |
2.21.0 |
45 |
|
46 |
|
47 |
From ca5652c7ee22955fb1690534fe33759ccb008ee5 Mon Sep 17 00:00:00 2001 |
48 |
From: Ralph Boehme <slow@samba.org> |
49 |
Date: Sat, 4 May 2019 12:12:48 +0200 |
50 |
Subject: [PATCH 2/2] s3: remove now unneeded call to |
51 |
cmdline_messaging_context() |
52 |
|
53 |
This was only needed as dbwrap_open() had a bug where it asked for the ctdb |
54 |
connection before initializing messaging. The previous commit fixed that so we |
55 |
can now safely remove the calls to cmdline_messaging_context() from all tools |
56 |
that don't use messaging. |
57 |
|
58 |
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13925 |
59 |
|
60 |
Signed-off-by: Ralph Boehme <slow@samba.org> |
61 |
Reviewed-by: Jeremy Allison <jra@samba.org> |
62 |
|
63 |
Autobuild-User(master): Jeremy Allison <jra@samba.org> |
64 |
Autobuild-Date(master): Thu Oct 24 09:33:47 UTC 2019 on sn-devel-184 |
65 |
|
66 |
(cherry picked from commit 9471508391fd3bcf199b1e94f8d9ee2b956e8f8e) |
67 |
--- |
68 |
source3/lib/popt_common_cmdline.c | 7 ------- |
69 |
source3/utils/dbwrap_tool.c | 2 -- |
70 |
source3/utils/eventlogadm.c | 3 --- |
71 |
source3/utils/ntlm_auth.c | 2 -- |
72 |
source3/utils/pdbedit.c | 2 -- |
73 |
source3/utils/sharesec.c | 1 - |
74 |
source3/utils/smbget.c | 2 -- |
75 |
source3/utils/smbpasswd.c | 2 -- |
76 |
source3/utils/testparm.c | 2 -- |
77 |
9 files changed, 23 deletions(-) |
78 |
|
79 |
diff --git a/source3/lib/popt_common_cmdline.c b/source3/lib/popt_common_cmdline.c |
80 |
index 79e34847f48..39a787510a3 100644 |
81 |
--- a/source3/lib/popt_common_cmdline.c |
82 |
+++ b/source3/lib/popt_common_cmdline.c |
83 |
@@ -102,15 +102,8 @@ static void popt_common_credentials_callback(poptContext con, |
84 |
} |
85 |
|
86 |
if (reason == POPT_CALLBACK_REASON_POST) { |
87 |
- struct messaging_context *msg_ctx = NULL; |
88 |
bool ok; |
89 |
|
90 |
- msg_ctx = cmdline_messaging_context(get_dyn_CONFIGFILE()); |
91 |
- if (msg_ctx == NULL) { |
92 |
- fprintf(stderr, "Unable to initialize " |
93 |
- "messaging context\n"); |
94 |
- } |
95 |
- |
96 |
ok = lp_load_client(get_dyn_CONFIGFILE()); |
97 |
if (!ok) { |
98 |
const char *pname = poptGetInvocationName(con); |
99 |
diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c |
100 |
index 2808a5d68bf..153a4459ee0 100644 |
101 |
--- a/source3/utils/dbwrap_tool.c |
102 |
+++ b/source3/utils/dbwrap_tool.c |
103 |
@@ -422,8 +422,6 @@ int main(int argc, const char **argv) |
104 |
while (extra_argv[extra_argc]) extra_argc++; |
105 |
} |
106 |
|
107 |
- cmdline_messaging_context(get_dyn_CONFIGFILE()); |
108 |
- |
109 |
lp_load_global(get_dyn_CONFIGFILE()); |
110 |
|
111 |
if ((extra_argc < 2) || (extra_argc > 5)) { |
112 |
diff --git a/source3/utils/eventlogadm.c b/source3/utils/eventlogadm.c |
113 |
index db874dfae8a..2770fffa48c 100644 |
114 |
--- a/source3/utils/eventlogadm.c |
115 |
+++ b/source3/utils/eventlogadm.c |
116 |
@@ -473,9 +473,6 @@ int main( int argc, char *argv[] ) |
117 |
exit( 1 ); |
118 |
} |
119 |
|
120 |
- cmdline_messaging_context(configfile == NULL ? |
121 |
- get_dyn_CONFIGFILE() : configfile); |
122 |
- |
123 |
if ( configfile == NULL ) { |
124 |
lp_load_global(get_dyn_CONFIGFILE()); |
125 |
} else if (!lp_load_global(configfile)) { |
126 |
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c |
127 |
index 2be641c891c..87f6554ae4f 100644 |
128 |
--- a/source3/utils/ntlm_auth.c |
129 |
+++ b/source3/utils/ntlm_auth.c |
130 |
@@ -2504,8 +2504,6 @@ enum { |
131 |
|
132 |
poptFreeContext(pc); |
133 |
|
134 |
- cmdline_messaging_context(get_dyn_CONFIGFILE()); |
135 |
- |
136 |
if (!lp_load_global(get_dyn_CONFIGFILE())) { |
137 |
d_fprintf(stderr, "ntlm_auth: error opening config file %s. Error was %s\n", |
138 |
get_dyn_CONFIGFILE(), strerror(errno)); |
139 |
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c |
140 |
index 74f8c3b0b2f..14edbaeceea 100644 |
141 |
--- a/source3/utils/pdbedit.c |
142 |
+++ b/source3/utils/pdbedit.c |
143 |
@@ -1128,8 +1128,6 @@ int main(int argc, const char **argv) |
144 |
if (user_name == NULL) |
145 |
user_name = poptGetArg(pc); |
146 |
|
147 |
- cmdline_messaging_context(get_dyn_CONFIGFILE()); |
148 |
- |
149 |
if (!lp_load_global(get_dyn_CONFIGFILE())) { |
150 |
fprintf(stderr, "Can't load %s - run testparm to debug it\n", get_dyn_CONFIGFILE()); |
151 |
exit(1); |
152 |
diff --git a/source3/utils/sharesec.c b/source3/utils/sharesec.c |
153 |
index 2ea81b9adfa..10c347eaac3 100644 |
154 |
--- a/source3/utils/sharesec.c |
155 |
+++ b/source3/utils/sharesec.c |
156 |
@@ -501,7 +501,6 @@ int main(int argc, const char *argv[]) |
157 |
|
158 |
setlinebuf(stdout); |
159 |
|
160 |
- cmdline_messaging_context(get_dyn_CONFIGFILE()); |
161 |
lp_load_with_registry_shares(get_dyn_CONFIGFILE()); |
162 |
|
163 |
/* check for initializing secrets.tdb first */ |
164 |
diff --git a/source3/utils/smbget.c b/source3/utils/smbget.c |
165 |
index 58690be56e3..a948a336445 100644 |
166 |
--- a/source3/utils/smbget.c |
167 |
+++ b/source3/utils/smbget.c |
168 |
@@ -1003,8 +1003,6 @@ int main(int argc, char **argv) |
169 |
|
170 |
popt_burn_cmdline_password(argc, argv); |
171 |
|
172 |
- cmdline_messaging_context(get_dyn_CONFIGFILE()); |
173 |
- |
174 |
if (smbc_init(get_auth_data, opt.debuglevel) < 0) { |
175 |
fprintf(stderr, "Unable to initialize libsmbclient\n"); |
176 |
return 1; |
177 |
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c |
178 |
index 8e2b9d7f80f..a6509abe5cb 100644 |
179 |
--- a/source3/utils/smbpasswd.c |
180 |
+++ b/source3/utils/smbpasswd.c |
181 |
@@ -197,8 +197,6 @@ static int process_options(int argc, char **argv, int local_flags) |
182 |
usage(); |
183 |
} |
184 |
|
185 |
- cmdline_messaging_context(configfile); |
186 |
- |
187 |
if (!lp_load_global(configfile)) { |
188 |
fprintf(stderr, "Can't load %s - run testparm to debug it\n", |
189 |
configfile); |
190 |
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c |
191 |
index efa58a6a417..9ba625da4bf 100644 |
192 |
--- a/source3/utils/testparm.c |
193 |
+++ b/source3/utils/testparm.c |
194 |
@@ -742,8 +742,6 @@ static void do_per_share_checks(int s) |
195 |
goto done; |
196 |
} |
197 |
|
198 |
- cmdline_messaging_context(config_file); |
199 |
- |
200 |
fprintf(stderr,"Load smb config files from %s\n",config_file); |
201 |
|
202 |
if (!lp_load_with_registry_shares(config_file)) { |
203 |
-- |
204 |
2.21.0 |
205 |
|