1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-01 04:58:35 +03:00

s4-smbtorture: add some ndr validation tests for netlogon_samlogon_response structs.

Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Thu Nov  3 20:08:20 CET 2011 on sn-devel-104
This commit is contained in:
Günther Deschner 2011-11-03 09:34:04 +01:00
parent 663c2b4f16
commit 79ab7ac33b

View File

@ -2,7 +2,7 @@
Unix SMB/CIFS implementation.
test suite for nbt ndr operations
Copyright (C) Guenther Deschner 2010
Copyright (C) Guenther Deschner 2010,2011
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
@ -59,6 +59,52 @@ static bool netlogon_logon_request_resp_check(struct torture_context *tctx,
return true;
}
static const uint8_t netlogon_samlogon_response_data[] = {
/* 0x04, 0x74, 0x17, 0x00, 0x00, 0x00, 0xfd, 0x33, 0x00, 0x00, 0x03, 0x13, */
0x17, 0x00, 0x00, 0x00, 0xfd, 0x33, 0x00, 0x00, 0x03, 0x13,
0x44, 0xcd, 0x1c, 0x00, 0x4c, 0x46, 0xa6, 0x21, 0xe9, 0xd6, 0xb9, 0xb1,
0x2f, 0xe9, 0x07, 0x77, 0x32, 0x6b, 0x38, 0x64, 0x6f, 0x6d, 0x03, 0x62,
0x65, 0x72, 0x06, 0x72, 0x65, 0x64, 0x68, 0x61, 0x74, 0x03, 0x63, 0x6f,
0x6d, 0x00, 0xc0, 0x18, 0x08, 0x67, 0x64, 0x77, 0x32, 0x6b, 0x38, 0x72,
0x32, 0xc0, 0x18, 0x07, 0x57, 0x32, 0x4b, 0x38, 0x44, 0x4f, 0x4d, 0x00,
0x08, 0x47, 0x44, 0x57, 0x32, 0x4b, 0x38, 0x52, 0x32, 0x00, 0x00, 0x17,
0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x2d, 0x46, 0x69, 0x72, 0x73,
0x74, 0x2d, 0x53, 0x69, 0x74, 0x65, 0x2d, 0x4e, 0x61, 0x6d, 0x65, 0x00,
0xc0, 0x51, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
};
static bool netlogon_samlogon_response_check(struct torture_context *tctx,
struct netlogon_samlogon_response *r)
{
struct GUID guid;
torture_assert_ntstatus_ok(tctx, GUID_from_string("cd441303-001c-464c-a621-e9d6b9b12fe9", &guid), "");
torture_assert_int_equal(tctx, r->ntver, 5, "ntver");
torture_assert_int_equal(tctx, r->data.nt5_ex.command, LOGON_SAM_LOGON_RESPONSE_EX, "command");
torture_assert_int_equal(tctx, r->data.nt5_ex.sbz, 0, "sbz");
torture_assert_int_equal(tctx, r->data.nt5_ex.server_type, 0x000033fd, "server_type");
torture_assert_guid_equal(tctx, r->data.nt5_ex.domain_uuid, guid, "domain_uuid");
torture_assert_str_equal(tctx, r->data.nt5_ex.forest, "w2k8dom.ber.redhat.com", "forest");
torture_assert_str_equal(tctx, r->data.nt5_ex.dns_domain, "w2k8dom.ber.redhat.com", "dns_domain");
torture_assert_str_equal(tctx, r->data.nt5_ex.pdc_dns_name, "gdw2k8r2.w2k8dom.ber.redhat.com", "pdc_dns_name");
torture_assert_str_equal(tctx, r->data.nt5_ex.domain_name, "W2K8DOM", "domain_name");
torture_assert_str_equal(tctx, r->data.nt5_ex.pdc_name, "GDW2K8R2", "pdc_name");
torture_assert_str_equal(tctx, r->data.nt5_ex.user_name, "", "user_name");
torture_assert_str_equal(tctx, r->data.nt5_ex.server_site, "Default-First-Site-Name", "server_site");
torture_assert_str_equal(tctx, r->data.nt5_ex.client_site, "Default-First-Site-Name", "client_site");
torture_assert_int_equal(tctx, r->data.nt5_ex.sockaddr_size, 0, "sockaddr_size");
/* sockaddr: struct nbt_sockaddr
* sockaddr_family : 0x00000000 (0)
* pdc_ip : (null)
* remaining : DATA_BLOB length=0 */
torture_assert_int_equal(tctx, r->data.nt5_ex.nt_version, 5, "nt_version");
/* next_closest_site NULL */
torture_assert_int_equal(tctx, r->data.nt5_ex.lmnt_token, 0xffff, "lmnt_token");
torture_assert_int_equal(tctx, r->data.nt5_ex.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");
@ -67,5 +113,15 @@ struct torture_suite *ndr_nbt_suite(TALLOC_CTX *ctx)
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,
netlogon_samlogon_response,
netlogon_samlogon_response_data,
netlogon_samlogon_response_check);
torture_suite_add_ndr_pullpush_test(suite,
netlogon_samlogon_response,
data_blob_const(netlogon_samlogon_response_data, sizeof(netlogon_samlogon_response_data)),
netlogon_samlogon_response_check);
return suite;
}