diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-09-16 15:47:42 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-09-16 21:09:17 +1000 |
commit | 4083b8ac6ca9c107e50503f41b66077fb65eb2d9 (patch) | |
tree | 00a9d03b1d9a6a679a4d3eeda9d326bb65abee29 | |
parent | 6832d5e9334f93d2b41fa50580379a2381311748 (diff) | |
download | samba-4083b8ac6ca9c107e50503f41b66077fb65eb2d9.tar.gz samba-4083b8ac6ca9c107e50503f41b66077fb65eb2d9.tar.bz2 samba-4083b8ac6ca9c107e50503f41b66077fb65eb2d9.zip |
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 <tridge@samba.org>
-rw-r--r-- | source4/torture/nbt/dgram.c | 12 |
1 files changed, 8 insertions, 4 deletions
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; |