summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-11-18 15:38:02 +0100
committerGünther Deschner <gd@samba.org>2011-11-20 23:10:39 +0100
commit1781415196dbd0d91884b7fcef7b2f12bce90164 (patch)
tree3410f0649b24585cd8874ae4d100fa083cac09fd /source4
parent005798fa0ba118ba668e378063f778fa0438ab4e (diff)
downloadsamba-1781415196dbd0d91884b7fcef7b2f12bce90164.tar.gz
samba-1781415196dbd0d91884b7fcef7b2f12bce90164.tar.bz2
samba-1781415196dbd0d91884b7fcef7b2f12bce90164.zip
s4-smbtorture: add ndr test for nbt_netlogon_packet to avoid future regressions.
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 <gd@samba.org> Autobuild-Date: Sun Nov 20 23:10:39 CET 2011 on sn-devel-104
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/ndr/nbt.c36
1 files changed, 36 insertions, 0 deletions
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;
}