Ref: http://bugs.debian.org/161489

If you run smbstatus on a server that has never had a client connect to
it, an error is returned:

# smbstatus 
sessionid.tdb not initialised

Service      pid     machine       Connected at
-------------------------------------------------------
Failed to open byte range locking database
ERROR: Failed to initialise locking database
Can't initialise locking module - exiting
# echo $?
1
#

This seems unreasonable, given that this is a valid state for the server
to be in.  The attached patch causes smbstatus to deal with a failure of
tdb_open() with an explanation and an exit(0).

Cheers,
Steve Langasek
postmodern programmer
diff -uNr samba-2.999+3.0.alpha20.orig/source/utils/status.c 
samba-2.999+3.0.alpha20/source/utils/status.c
--- samba-2.999+3.0.alpha20.orig/source/utils/status.c  2002-09-26 14:38:36.000000000 
-0500
+++ samba-2.999+3.0.alpha20/source/utils/status.c       2002-10-04 10:48:46.000000000 
+-0500
@@ -646,6 +646,12 @@
        if (!shares_only) {
                int ret;
 
+               tdb = tdb_open_log(lock_path("locking.tdb"), 0, TDB_DEFAULT, O_RDONLY, 
+0);
+               if (!tdb) {
+                       d_printf("%s not initialised\n", lock_path("locking.tdb"));
+                       d_printf("This is normal if an SMB client has never connected 
+to your server.\n");
+                       exit(0);
+               }
                if (!locking_init(1)) {
                        d_printf("Can't initialise locking module - exiting\n");
                        exit(1);

Attachment: msg03520/pgp00000.pgp
Description: PGP signature

Reply via email to