diff options
-rwxr-xr-x | source4/scripting/bin/smbstatus | 12 | ||||
-rw-r--r-- | source4/smb_server/smb_server.c | 4 |
2 files changed, 11 insertions, 5 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) diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c index 367557dbb7..6eccb836d6 100644 --- a/source4/smb_server/smb_server.c +++ b/source4/smb_server/smb_server.c @@ -150,12 +150,12 @@ static void smbsrv_accept(struct stream_connection *conn) smb_conn->connection = conn; conn->private = smb_conn; - irpc_add_name(conn->msg_ctx, "smb_server"); - smb_conn->statistics.connect_time = timeval_current(); smbsrv_management_init(smb_conn); + irpc_add_name(conn->msg_ctx, "smb_server"); + if (!NT_STATUS_IS_OK(share_get_context_by_name(smb_conn, lp_share_backend(smb_conn->lp_ctx), smb_conn->connection->event.ctx, smb_conn->lp_ctx, &(smb_conn->share_context)))) { |