From 4083b8ac6ca9c107e50503f41b66077fb65eb2d9 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 16 Sep 2010 15:47:42 +1000 Subject: s4-torture assert that we get a temp datagram socket. 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 --- source4/torture/nbt/dgram.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source4/torture/nbt') diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c index 4c0fe4bd77..8a701ac499 100644 --- a/source4/torture/nbt/dgram.c +++ b/source4/torture/nbt/dgram.c @@ -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; -- cgit