smbd: don't client->connections without checking client != NULL first in exit_server_...
authorRalph Boehme <slow@samba.org>
Wed, 25 Jul 2018 18:02:23 +0000 (20:02 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 25 Jul 2018 23:29:38 +0000 (01:29 +0200)
exit_server_common() can be called also in smbd processes without a
smbXsrv_client structure, e.g. the parent or some background tasks.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jul 26 01:29:38 CEST 2018 on sn-devel-144

source3/smbd/server_exit.c

index 149cd863505cff2c0f3c46767652351402a1f586..cc8ea18aedafb45f459d59989f5960d69e46de4c 100644 (file)
@@ -96,6 +96,7 @@ static void exit_server_common(enum server_exit_reason how,
 
        if (client != NULL) {
                sconn = client->sconn;
+               xconn = client->connections;
        }
 
        if (!exit_firsttime)
@@ -108,7 +109,7 @@ static void exit_server_common(enum server_exit_reason how,
        /*
         * Here we typically have just one connection
         */
-       for (xconn = client->connections; xconn != NULL; xconn = xconn_next) {
+       for (; xconn != NULL; xconn = xconn_next) {
                xconn_next = xconn->next;
                DLIST_REMOVE(client->connections, xconn);