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 | 6565b8c9781f571735068aba5044a913b5fe31fe (patch) | |
tree | 15829e36ee62baa7dc5247e36ba5460fb9fc687e | |
parent | bf69d30b0741210dcdf61f493f6bf872a8931701 (diff) | |
download | samba-6565b8c9781f571735068aba5044a913b5fe31fe.tar.gz samba-6565b8c9781f571735068aba5044a913b5fe31fe.tar.xz samba-6565b8c9781f571735068aba5044a913b5fe31fe.zip |
tdb_traverse returns number of records, not zero, on success.
Now tested max connections and it works again. Hurrah !
Jeremy.
-rw-r--r-- | source/smbd/connection.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/smbd/connection.c b/source/smbd/connection.c index 6c401264d9c..4a9d202fef7 100644 --- a/source/smbd/connection.c +++ b/source/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 |