s4-torture: verify #8373 and add ndr nbt tests for LOGON_PRIMARY_QUERY nbt_netlogon_r...
authorGünther Deschner <gd@samba.org>
Fri, 25 May 2012 12:50:11 +0000 (14:50 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 29 May 2012 13:49:10 +0000 (15:49 +0200)
Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Tue May 29 15:49:10 CEST 2012 on sn-devel-104

selftest/skip
source4/torture/ndr/nbt.c

index f2f6b695e86e09d47b6fe463d22e59000c7629e0..bd113125d0be94ace0cd96aafbf0ae9426f81cd7 100644 (file)
@@ -102,3 +102,4 @@ bench # don't run benchmarks in our selftest
 ^samba4.drs.delete_object.python # flakey test
 ^samba4.rpc.unixinfo # This contains a server-side getpwuid call which hangs the server when nss_winbindd is in use
 ^samba.tests.dcerpc.unix  # This contains a server-side getpwuid call which hangs the server when nss_winbindd is in use
+^samba.*.local.ndr.nbt_netlogon_packet # until bug #8373 is fixed
index 21cd57111496ab3f3cd6e8ddf5b5f004013596c0..a753c2fe6fb4a351dd5326874e588fa9497a52b9 100644 (file)
@@ -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;
 }