diff options
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; |