diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
commit | 6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch) | |
tree | 850c71039563c16a5d563c47e7ba2ab645baf198 /source3/smbd/connection.c | |
parent | 6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff) | |
parent | 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff) | |
download | samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.gz samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.bz2 samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.zip |
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16
Diffstat (limited to 'source3/smbd/connection.c')
-rw-r--r-- | source3/smbd/connection.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index 8560a5d211..7ed9518756 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 < 0) { DEBUG(0,("count_current_connections: traverse of " "connections.tdb failed\n")); - return False; + return 0; } return cs.curr_connections; |