s3:smb2 fix smbd crash on premature end of smb2 conn (Bug 8286)
authorChristian Ambach <ambi@samba.org>
Mon, 4 Jul 2011 15:55:54 +0000 (17:55 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 5 Jul 2011 17:39:18 +0000 (19:39 +0200)
when smbd tries to clean up locks after a premature end of a smb2
connection, lock_db has already been freed and so it crashes

this patch changes the order in which items are freed so that
lock_db is still around when it is needed

source3/smbd/server_exit.c

index a853c77a2067628d3bd749655be8a15f89a12b71..4c71d8fa92a5c80484c8540a88583c021223864f 100644 (file)
@@ -152,9 +152,6 @@ static void exit_server_common(enum server_exit_reason how,
                rpc_lsarpc_shutdown();
        }
 
-       locking_end();
-       printing_end();
-
        /*
         * we need to force the order of freeing the following,
         * because smbd_msg_ctx is not a talloc child of smbd_server_conn.
@@ -165,6 +162,9 @@ static void exit_server_common(enum server_exit_reason how,
        server_event_context_free();
        TALLOC_FREE(smbd_memcache_ctx);
 
+       locking_end();
+       printing_end();
+
        if (how != SERVER_EXIT_NORMAL) {
                DEBUGSEP(0);
                DEBUG(0,("Abnormal server exit: %s\n",