From c17f9817453a37e94e77a541d6ba675d1d29431e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 25 May 2012 14:50:11 +0200 Subject: s4-torture: verify #8373 and add ndr nbt tests for LOGON_PRIMARY_QUERY nbt_netlogon_requests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guenther Autobuild-User: Günther Deschner Autobuild-Date: Tue May 29 15:49:10 CEST 2012 on sn-devel-104 --- source4/torture/ndr/nbt.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'source4/torture/ndr') diff --git a/source4/torture/ndr/nbt.c b/source4/torture/ndr/nbt.c index 21cd571114..a753c2fe6f 100644 --- a/source4/torture/ndr/nbt.c +++ b/source4/torture/ndr/nbt.c @@ -2,7 +2,7 @@ Unix SMB/CIFS implementation. test suite for nbt ndr operations - Copyright (C) Guenther Deschner 2010,2011 + Copyright (C) Guenther Deschner 2010-2012 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -136,12 +136,42 @@ static bool nbt_netlogon_packet_check(struct torture_context *tctx, return true; } +static const uint8_t nbt_netlogon_packet_logon_primary_query_data[] = { + 0x07, 0x00, 0x58, 0x50, 0x44, 0x41, 0x54, 0x45, 0x56, 0x2d, 0x50, 0x52, + 0x4f, 0x00, 0x5c, 0x4d, 0x41, 0x49, 0x4c, 0x53, 0x4c, 0x4f, 0x54, 0x5c, + 0x4e, 0x45, 0x54, 0x5c, 0x47, 0x45, 0x54, 0x44, 0x43, 0x38, 0x31, 0x37, + 0x00, 0x00, 0x58, 0x00, 0x50, 0x00, 0x44, 0x00, 0x41, 0x00, 0x54, 0x00, + 0x45, 0x00, 0x56, 0x00, 0x2d, 0x00, 0x50, 0x00, 0x52, 0x00, 0x4f, 0x00, + 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff +}; + +static bool nbt_netlogon_packet_logon_primary_query_check(struct torture_context *tctx, + struct nbt_netlogon_packet *r) +{ + torture_assert_int_equal(tctx, r->command, LOGON_PRIMARY_QUERY, "command"); + torture_assert_str_equal(tctx, r->req.pdc.computer_name, "XPDATEV-PRO", "computer_name"); + torture_assert_str_equal(tctx, r->req.pdc.mailslot_name, "\\MAILSLOT\\NET\\GETDC817", "mailslot_name"); + torture_assert_int_equal(tctx, r->req.pdc._pad.length, 1, "_pad.length"); + torture_assert_int_equal(tctx, r->req.pdc._pad.data[0], 0, "_pad.data"); + torture_assert_str_equal(tctx, r->req.pdc.unicode_name, "XPDATEV-PRO", "unicode_name"); + torture_assert_int_equal(tctx, r->req.pdc.nt_version, 0x0000000b, "nt_version"); + torture_assert_int_equal(tctx, r->req.pdc.lmnt_token, 0xffff, "lmnt_token"); + torture_assert_int_equal(tctx, r->req.pdc.lm20_token, 0xffff, "lm20_token"); + + return true; +} + struct torture_suite *ndr_nbt_suite(TALLOC_CTX *ctx) { struct torture_suite *suite = torture_suite_create(ctx, "nbt"); torture_suite_add_ndr_pull_test(suite, nbt_netlogon_packet, netlogon_logon_request_req_data, netlogon_logon_request_req_check); + torture_suite_add_ndr_pull_test(suite, + nbt_netlogon_packet, + nbt_netlogon_packet_logon_primary_query_data, + nbt_netlogon_packet_logon_primary_query_check); + torture_suite_add_ndr_pull_test(suite, nbt_netlogon_response2, netlogon_logon_request_resp_data, netlogon_logon_request_resp_check); torture_suite_add_ndr_pull_test(suite, @@ -159,5 +189,10 @@ struct torture_suite *ndr_nbt_suite(TALLOC_CTX *ctx) data_blob_const(nbt_netlogon_packet_data, sizeof(nbt_netlogon_packet_data)), nbt_netlogon_packet_check); + torture_suite_add_ndr_pullpush_test(suite, + nbt_netlogon_packet, + data_blob_const(nbt_netlogon_packet_logon_primary_query_data, sizeof(nbt_netlogon_packet_logon_primary_query_data)), + nbt_netlogon_packet_logon_primary_query_check); + return suite; } -- cgit