1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

prevent segv by not calling tdb_traverse and tdb_close if tdb_open_log

returns NULL.
(This used to be commit afdf93836b)
This commit is contained in:
Herb Lewis 2001-09-10 22:31:59 +00:00
parent cae476a1a2
commit c5dd2c8271

View File

@ -621,8 +621,7 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
tdb = tdb_open_log(lock_path("sessionid.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); tdb = tdb_open_log(lock_path("sessionid.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0);
if (!tdb) { if (!tdb) {
d_printf("sessionid.tdb not initialised\n"); d_printf("sessionid.tdb not initialised\n");
} } else {
if (locks_only) goto locks; if (locks_only) goto locks;
d_printf("\nSamba version %s\n",VERSION); d_printf("\nSamba version %s\n",VERSION);
@ -631,11 +630,13 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
tdb_traverse(tdb, traverse_sessionid, NULL); tdb_traverse(tdb, traverse_sessionid, NULL);
tdb_close(tdb); tdb_close(tdb);
}
tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0);
if (!tdb) { if (!tdb) {
d_printf("connections.tdb not initialised\n"); d_printf("connections.tdb not initialised\n");
} else if (verbose) { } else
if (verbose) {
d_printf("Opened status file %s\n", fname); d_printf("Opened status file %s\n", fname);
} }
@ -647,6 +648,7 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
tdb_traverse(tdb, traverse_fn1, NULL); tdb_traverse(tdb, traverse_fn1, NULL);
tdb_close(tdb); tdb_close(tdb);
}
locks: locks:
if (processes_only) exit(0); if (processes_only) exit(0);