From 1781415196dbd0d91884b7fcef7b2f12bce90164 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 18 Nov 2011 15:38:02 +0100 Subject: s4-smbtorture: add ndr test for nbt_netlogon_packet to avoid future regressions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guys, we really should make sure to always add ndr tests like this whenever we change some sensitive libndr or handmarshalling bits. Guenther Autobuild-User: Günther Deschner Autobuild-Date: Sun Nov 20 23:10:39 CET 2011 on sn-devel-104 --- source4/torture/ndr/nbt.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/source4/torture/ndr/nbt.c b/source4/torture/ndr/nbt.c index cc25dd5ff5..21cd571114 100644 --- a/source4/torture/ndr/nbt.c +++ b/source4/torture/ndr/nbt.c @@ -105,6 +105,37 @@ static bool netlogon_samlogon_response_check(struct torture_context *tctx, return true; } +static const uint8_t nbt_netlogon_packet_data[] = { + 0x12, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x45, 0x00, 0x4e, 0x00, 0x4e, 0x00, + 0x59, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x45, 0x00, 0x4e, 0x00, 0x4e, 0x00, + 0x59, 0x00, 0x24, 0x00, 0x00, 0x00, 0x5c, 0x4d, 0x41, 0x49, 0x4c, 0x53, + 0x4c, 0x4f, 0x54, 0x5c, 0x4e, 0x45, 0x54, 0x5c, 0x47, 0x45, 0x54, 0x44, + 0x43, 0x35, 0x32, 0x45, 0x41, 0x41, 0x38, 0x43, 0x30, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x15, 0x00, 0x00, 0x00, 0x9c, 0x4e, 0x59, 0xff, + 0xe1, 0xa0, 0x39, 0xac, 0x29, 0xa6, 0xe2, 0xda, 0x01, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff +}; + +static bool nbt_netlogon_packet_check(struct torture_context *tctx, + struct nbt_netlogon_packet *r) +{ + torture_assert_int_equal(tctx, r->command, LOGON_SAM_LOGON_REQUEST, "command"); + torture_assert_int_equal(tctx, r->req.logon.request_count, 0, "request_count"); + torture_assert_str_equal(tctx, r->req.logon.computer_name, "LENNY", "computer_name"); + torture_assert_str_equal(tctx, r->req.logon.user_name, "LENNY$", "user_name"); + torture_assert_str_equal(tctx, r->req.logon.mailslot_name, "\\MAILSLOT\\NET\\GETDC52EAA8C0", "mailslot_name"); + torture_assert_int_equal(tctx, r->req.logon.acct_control, 0x00000080, "acct_control"); + torture_assert_int_equal(tctx, r->req.logon.sid_size, 24, "sid_size"); + torture_assert_int_equal(tctx, r->req.logon._pad.length, 2, "_pad.length"); + torture_assert_sid_equal(tctx, &r->req.logon.sid, dom_sid_parse_talloc(tctx, "S-1-5-21-4284042908-2889457889-3672286761"), "sid"); + torture_assert_int_equal(tctx, r->req.logon.nt_version, NETLOGON_NT_VERSION_1, "nt_version"); + torture_assert_int_equal(tctx, r->req.logon.lmnt_token, 0xffff, "lmnt_token"); + torture_assert_int_equal(tctx, r->req.logon.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"); @@ -123,5 +154,10 @@ struct torture_suite *ndr_nbt_suite(TALLOC_CTX *ctx) data_blob_const(netlogon_samlogon_response_data, sizeof(netlogon_samlogon_response_data)), netlogon_samlogon_response_check); + torture_suite_add_ndr_pullpush_test(suite, + nbt_netlogon_packet, + data_blob_const(nbt_netlogon_packet_data, sizeof(nbt_netlogon_packet_data)), + nbt_netlogon_packet_check); + return suite; } -- cgit