summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-06-14 17:52:42 +0200
committerVolker Lendecke <vlendec@samba.org>2011-06-14 19:06:39 +0200
commitdf6b877cc2a868f0a05192f1c524831c177fa1cb (patch)
tree66f280c11698fe964fbf8ca3de7650ae454f4356
parent2817eed7412380116766a75718c90e635f6c93f4 (diff)
downloadsamba-df6b877cc2a868f0a05192f1c524831c177fa1cb.tar.gz
s3: Fix connecting to ctdb as non-root
This is at least one instance which I could identify Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Tue Jun 14 19:06:39 CEST 2011 on sn-devel-104
-rw-r--r--source3/smbd/connection.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c
index 08afd92f6e7..f1ec301ee28 100644
--- a/source3/smbd/connection.c
+++ b/source3/smbd/connection.c
@@ -112,7 +112,14 @@ int count_current_connections( const char *sharename, bool clear )
* as it leads to deadlock.
*/
+ /*
+ * become_root() because we might have to open connections.tdb
+ * via ctdb, which is not possible without root.
+ */
+ become_root();
ret = connections_forall(count_fn, &cs);
+ unbecome_root();
+
if (ret == -1) {
DEBUG(0,("count_current_connections: traverse of "
"connections.tdb failed\n"));