diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-05-26 05:12:31 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-05-26 05:12:31 +0200 |
commit | 575f1243856f52f87ccb09f1235f1263b7c54b9b (patch) | |
tree | f0470a71393c3a3416de934f3e3daa6fd48a94f6 /source4/scripting/bin/smbstatus | |
parent | 4b3641695ba42d0348e8eceadb02430342c1513c (diff) | |
download | samba-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/smbstatus')
-rwxr-xr-x | source4/scripting/bin/smbstatus | 12 |
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) |