summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerb Lewis <herb@samba.org>2001-09-10 22:31:59 +0000
committerHerb Lewis <herb@samba.org>2001-09-10 22:31:59 +0000
commitc5dd2c827154bab6977ba9d768d81c0fae18badd (patch)
tree91d149b2f212d58925e30903eabed77ae6aa35d9
parentcae476a1a2080b2267b7d2efe81b2e80b45a0031 (diff)
downloadsamba-c5dd2c827154bab6977ba9d768d81c0fae18badd.tar.gz
samba-c5dd2c827154bab6977ba9d768d81c0fae18badd.tar.bz2
samba-c5dd2c827154bab6977ba9d768d81c0fae18badd.zip
prevent segv by not calling tdb_traverse and tdb_close if tdb_open_log
returns NULL. (This used to be commit afdf93836b59d5d9ede2ac0f3298d99471872829)
-rw-r--r--source3/utils/status.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 47379fd57c..23e2f4a63c 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -621,32 +621,34 @@ 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);
if (!tdb) {
d_printf("sessionid.tdb not initialised\n");
- }
-
- if (locks_only) goto locks;
+ } else {
+ if (locks_only) goto locks;
- d_printf("\nSamba version %s\n",VERSION);
- d_printf("PID Username Group Machine \n");
- d_printf("-------------------------------------------------------------------\n");
+ d_printf("\nSamba version %s\n",VERSION);
+ d_printf("PID Username Group Machine \n");
+ d_printf("-------------------------------------------------------------------\n");
- tdb_traverse(tdb, traverse_sessionid, NULL);
- tdb_close(tdb);
+ tdb_traverse(tdb, traverse_sessionid, NULL);
+ tdb_close(tdb);
+ }
tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0);
if (!tdb) {
d_printf("connections.tdb not initialised\n");
- } else if (verbose) {
- d_printf("Opened status file %s\n", fname);
- }
+ } else
+ if (verbose) {
+ d_printf("Opened status file %s\n", fname);
+ }
- if (brief)
- exit(0);
-
- d_printf("\nService pid machine Connected at\n");
- d_printf("-------------------------------------------------------\n");
+ if (brief)
+ exit(0);
+
+ d_printf("\nService pid machine Connected at\n");
+ d_printf("-------------------------------------------------------\n");
- tdb_traverse(tdb, traverse_fn1, NULL);
- tdb_close(tdb);
+ tdb_traverse(tdb, traverse_fn1, NULL);
+ tdb_close(tdb);
+ }
locks:
if (processes_only) exit(0);