s3: Fix connecting to ctdb as non-root
authorVolker Lendecke <vl@samba.org>
Tue, 14 Jun 2011 15:52:42 +0000 (17:52 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 9 Aug 2011 14:57:51 +0000 (16:57 +0200)
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

source3/smbd/connection.c

index 08afd92f6e71204b64d73298eeaa88f7c1682ae5..f1ec301ee2833d010069d0b8288b1aeffe961993 100644 (file)
@@ -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"));