From de6b5d8fb2ad8791c1bccbe86d08ef393a4e5f54 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 14 May 2001 18:43:49 +0000 Subject: 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) --- source3/smbd/connection.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'source3') 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 -- cgit