s4-torture assert that we get a temp datagram socket.
authorAndrew Bartlett <abartlet@samba.org>
Thu, 16 Sep 2010 05:47:42 +0000 (15:47 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 16 Sep 2010 11:09:17 +0000 (21:09 +1000)
I've seen a segfault because we failed to check this isn't NULL
before we use it.  This will still of course fail, but not so
spectacularly.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
source4/torture/nbt/dgram.c

index 4c0fe4bd776e223577d6e0345d4b782ff5bc23e3..8a701ac49993bd3b7210c643144ac65e753b5d88 100644 (file)
@@ -114,6 +114,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
        /* setup a temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
 
        ZERO_STRUCT(logon);
        logon.command = LOGON_PRIMARY_QUERY;
@@ -206,7 +207,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
        /* setup a temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
-       
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
 
        ZERO_STRUCT(logon);
        logon.command = LOGON_SAM_LOGON_REQUEST;
@@ -246,6 +247,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
        /* setup (another) temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
        
        ZERO_STRUCT(logon);
        logon.command = LOGON_SAM_LOGON_REQUEST;
@@ -295,6 +297,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
        /* setup (another) temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
        
        ZERO_STRUCT(logon);
        logon.command = LOGON_SAM_LOGON_REQUEST;
@@ -335,7 +338,6 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
        /* setup (another) temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
-       
        torture_assert(tctx, dgmslot != NULL, "Error getting a Mailslot for GetDC reply");
 
        ZERO_STRUCT(logon);
@@ -483,7 +485,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
        /* setup a temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
-       
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
 
        ZERO_STRUCT(logon);
        logon.command = LOGON_SAM_LOGON_REQUEST;
@@ -528,7 +530,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
        /* setup a temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
-       
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
 
        ZERO_STRUCT(logon);
        logon.command = LOGON_SAM_LOGON_REQUEST;
@@ -572,6 +574,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
        /* setup (another) temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
        
        ZERO_STRUCT(logon);
        logon.command = LOGON_PRIMARY_QUERY;
@@ -609,6 +612,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
        /* setup (another) temporary mailslot listener for replies */
        dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
                                      netlogon_handler, NULL);
+       torture_assert(tctx, dgmslot != NULL, "Error temporary mailslot for GetDC");
        
        ZERO_STRUCT(logon);
        logon.command = LOGON_PRIMARY_QUERY;