source: trunk/server/source4/torture/ndr/nbt.c

Last change on this file was 920, checked in by Silvan Scherrer, 9 years ago

Samba Server: apply latest security patches to trunk

File size: 2.7 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3 test suite for nbt ndr operations
4
5 Copyright (C) Guenther Deschner 2010
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#include "includes.h"
22#include "torture/ndr/ndr.h"
23#include "librpc/gen_ndr/ndr_nbt.h"
24
25static const uint8_t netlogon_logon_request_req_data[] = {
26 0x00, 0x00, 0x57, 0x49, 0x4e, 0x39, 0x38, 0x00, 0x47, 0x44, 0x00, 0x5c,
27 0x4d, 0x41, 0x49, 0x4c, 0x53, 0x4c, 0x4f, 0x54, 0x5c, 0x54, 0x45, 0x4d,
28 0x50, 0x5c, 0x4e, 0x45, 0x54, 0x4c, 0x4f, 0x47, 0x4f, 0x4e, 0x00, 0x01,
29 0x01, 0x00, 0xff, 0xff
30};
31
32static bool netlogon_logon_request_req_check(struct torture_context *tctx,
33 struct nbt_netlogon_packet *r)
34{
35 torture_assert_int_equal(tctx, r->command, LOGON_REQUEST, "command");
36 torture_assert_str_equal(tctx, r->req.logon0.computer_name, "WIN98", "computer name");
37 torture_assert_str_equal(tctx, r->req.logon0.user_name, "GD", "user_name");
38 torture_assert_str_equal(tctx, r->req.logon0.mailslot_name, "\\MAILSLOT\\TEMP\\NETLOGON", "mailslot_name");
39 torture_assert_int_equal(tctx, r->req.logon0.request_count, 1, "request_count");
40 torture_assert_int_equal(tctx, r->req.logon0.lmnt_token, 1, "lmnt_token");
41 torture_assert_int_equal(tctx, r->req.logon0.lm20_token, 0xffff, "lm20_token");
42
43 return true;
44}
45
46static const uint8_t netlogon_logon_request_resp_data[] = {
47 0x06, 0x00, 0x5c, 0x5c, 0x4d, 0x54, 0x48, 0x45, 0x4c, 0x45, 0x4e, 0x41,
48 0x00, 0xff, 0xff
49};
50
51static bool netlogon_logon_request_resp_check(struct torture_context *tctx,
52 struct nbt_netlogon_response2 *r)
53{
54 torture_assert_int_equal(tctx, r->command, LOGON_RESPONSE2, "command");
55 torture_assert_str_equal(tctx, r->pdc_name, "\\\\MTHELENA", "pdc_name");
56 torture_assert_int_equal(tctx, r->lm20_token, 0xffff, "lm20_token");
57
58 return true;
59}
60
61struct torture_suite *ndr_nbt_suite(TALLOC_CTX *ctx)
62{
63 struct torture_suite *suite = torture_suite_create(ctx, "nbt");
64
65 torture_suite_add_ndr_pull_test(suite, nbt_netlogon_packet, netlogon_logon_request_req_data, netlogon_logon_request_req_check);
66
67 torture_suite_add_ndr_pull_test(suite, nbt_netlogon_response2, netlogon_logon_request_resp_data, netlogon_logon_request_resp_check);
68
69 return suite;
70}
Note: See TracBrowser for help on using the repository browser.