summaryrefslogtreecommitdiff
path: root/source4/scripting/bin
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-05-26 05:12:31 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-05-26 05:12:31 +0200
commit575f1243856f52f87ccb09f1235f1263b7c54b9b (patch)
treef0470a71393c3a3416de934f3e3daa6fd48a94f6 /source4/scripting/bin
parent4b3641695ba42d0348e8eceadb02430342c1513c (diff)
downloadsamba-575f1243856f52f87ccb09f1235f1263b7c54b9b.tar.gz
samba-575f1243856f52f87ccb09f1235f1263b7c54b9b.tar.bz2
samba-575f1243856f52f87ccb09f1235f1263b7c54b9b.zip
Cope with no server being active.
(This used to be commit 893119bb4c9c297966d43d37fe73faa747b7c86e)
Diffstat (limited to 'source4/scripting/bin')
-rwxr-xr-xsource4/scripting/bin/smbstatus12
1 files changed, 9 insertions, 3 deletions
diff --git a/source4/scripting/bin/smbstatus b/source4/scripting/bin/smbstatus
index 7e58ee1269..bbd0e84826 100755
--- a/source4/scripting/bin/smbstatus
+++ b/source4/scripting/bin/smbstatus
@@ -19,7 +19,7 @@ from samba import irpc, messaging
def show_sessions(conn):
"""show open sessions"""
- conn = open_connection("smb_server")
+
sessions = conn.smbsrv_information(irpc.SMBSRV_INFO_SESSIONS).next()
print "User Client Connected at"
print "-------------------------------------------------------------------------------"
@@ -73,5 +73,11 @@ def open_connection(name):
if opts.nbt:
show_nbt(open_connection)
else:
- show_sessions(open_connection)
- show_tcons(open_connection)
+ try:
+ conn = open_connection("smb_server")
+ except RuntimeError, (num, msg):
+ if msg == 'NT_STATUS_OBJECT_NAME_NOT_FOUND':
+ print "No active connections"
+ else:
+ show_sessions(conn)
+ show_tcons(conn)