[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Tue Jun 14 11:07:01 MDT 2011


The branch, master has been updated
       via  df6b877 s3: Fix connecting to ctdb as non-root
       via  2817eed s3: Fix count_current_connections
      from  1514900 s3-docs: Fix a typo found by Samba-JP oota <ribbon at samba.gr.jp>

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit df6b877cc2a868f0a05192f1c524831c177fa1cb
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jun 14 17:52:42 2011 +0200

    s3: Fix connecting to ctdb as non-root
    
    This is at least one instance which I could identify
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Tue Jun 14 19:06:39 CEST 2011 on sn-devel-104

commit 2817eed7412380116766a75718c90e635f6c93f4
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jun 14 17:50:41 2011 +0200

    s3: Fix count_current_connections
    
    "False" is not really a valid return value for "int"..

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/connection.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c
index 8560a5d..f1ec301 100644
--- a/source3/smbd/connection.c
+++ b/source3/smbd/connection.c
@@ -101,6 +101,7 @@ static int count_fn(struct db_record *rec,
 int count_current_connections( const char *sharename, bool clear  )
 {
 	struct count_stat cs;
+	int ret;
 
 	cs.curr_connections = 0;
 	cs.name = sharename;
@@ -111,10 +112,18 @@ int count_current_connections( const char *sharename, bool clear  )
 	 * as it leads to deadlock.
 	 */
 
-	if (connections_forall(count_fn, &cs) == -1) {
+	/*
+	 * 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"));
-		return False;
+		return 0;
 	}
 
 	return cs.curr_connections;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list