diff options
author | Jeremy Allison <jra@samba.org> | 2001-05-14 18:43:49 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-05-14 18:43:49 +0000 |
commit | de6b5d8fb2ad8791c1bccbe86d08ef393a4e5f54 (patch) | |
tree | 3da1240109fbbef76d00b63a92b92abfc8b401df | |
parent | 1b1aaa9dbe520a1c11fa78aa98d69833ee55c0af (diff) | |
download | samba-de6b5d8fb2ad8791c1bccbe86d08ef393a4e5f54.tar.gz samba-de6b5d8fb2ad8791c1bccbe86d08ef393a4e5f54.tar.bz2 samba-de6b5d8fb2ad8791c1bccbe86d08ef393a4e5f54.zip |
tdb_traverse returns number of records, not zero, on success.
Now tested max connections and it works again. Hurrah !
Jeremy.
(This used to be commit 6565b8c9781f571735068aba5044a913b5fe31fe)
-rw-r--r-- | source3/smbd/connection.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index 6c401264d9..4a9d202fef 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -91,7 +91,7 @@ static int count_fn( TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf, void *u return 0; } - if (strequal(crec.name, cs->name)) + if (cs && strequal(crec.name, cs->name)) cs->curr_connections++; return 0; @@ -137,7 +137,8 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO db_locked = True; - if (tdb_traverse(tdb, count_fn, &cs)) { + if (tdb_traverse(tdb, count_fn, &cs) == -1) { + DEBUG(0,("claim_connection: traverse of connections.tdb failed.\n")); ret = False; goto out; } @@ -191,3 +192,14 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO return ret; } +#if 0 +/**************************************************************************** + Use the count function to clean any dead records. Shouldn't be needed... +****************************************************************************/ + +void clean_connection_db(void) +{ + if (tdb_traverse(tdb, count_fn, NULL) == -1) + DEBUG(0,("clean_connection_db: traverse of connections.tdb failed.\n")); +} +#endif |