summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-04-08 05:34:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:28 -0500
commitf83e6ded9d31f819dba5e59e15c703d292716206 (patch)
tree37f141211a39f9aa5fe260068ba6ce6936caedde /source4/torture
parente3775ee8501e2f15ee172970085c2c12e50da1cf (diff)
downloadsamba-f83e6ded9d31f819dba5e59e15c703d292716206.tar.gz
samba-f83e6ded9d31f819dba5e59e15c703d292716206.tar.bz2
samba-f83e6ded9d31f819dba5e59e15c703d292716206.zip
r6245: receive and parse the GETDC response in the NBT-DGRAM test. The test
now tries to bind to port 138 if possible, so if you run it as root and smbd/nmbd is not running then it works against windows servers (This used to be commit 52ccdb79bc922be52c24dd393323dbbee83a2aea)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/nbt/dgram.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c
index c87940a94d..b87e7e0b0f 100644
--- a/source4/torture/nbt/dgram.c
+++ b/source4/torture/nbt/dgram.c
@@ -36,9 +36,22 @@ static void netlogon_handler(struct dgram_mailslot_handler *dgmslot,
struct nbt_dgram_packet *packet,
const char *src_address, int src_port)
{
+ NTSTATUS status;
+ struct nbt_netlogon_packet netlogon;
+
printf("netlogon reply from %s:%d\n", src_address, src_port);
+
+ status = dgram_mailslot_netlogon_parse(dgmslot, dgmslot, packet, &netlogon);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Failed to parse netlogon packet from %s:%d\n",
+ src_address, src_port);
+ return;
+ }
+
+ NDR_PRINT_DEBUG(nbt_netlogon_packet, &netlogon);
}
+
/* test UDP/138 netlogon requests */
static BOOL nbt_test_netlogon(TALLOC_CTX *mem_ctx,
struct nbt_name name, const char *address)
@@ -52,7 +65,14 @@ static BOOL nbt_test_netlogon(TALLOC_CTX *mem_ctx,
int timelimit = lp_parm_int(-1, "torture", "timelimit", 10);
struct timeval tv = timeval_current();
- socket_listen(dgmsock->sock, myaddress, 0, 0, 0);
+ /* try receiving replies on port 138 first, which will only
+ work if we are root and smbd/nmbd are not running - fall
+ back to listening on any port, which means replies from
+ some windows versions won't be seen */
+ status = socket_listen(dgmsock->sock, myaddress, lp_dgram_port(), 0, 0);
+ if (!NT_STATUS_IS_OK(status)) {
+ socket_listen(dgmsock->sock, myaddress, 0, 0, 0);
+ }
/* setup a temporary mailslot listener for replies */
dgmslot = dgram_mailslot_temp(dgmsock, "\\MAILSLOT\\NET\\GETDC",