Line data Source code
1 : /*
2 : Unix SMB/CIFS implementation.
3 : test suite for ntlmssp ndr operations
4 :
5 : Copyright (C) Guenther Deschner 2010,2015
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_ntlmssp.h"
24 : #include "torture/ndr/proto.h"
25 :
26 : static const uint8_t ntlmssp_NEGOTIATE_MESSAGE_data[] = {
27 : 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00,
28 : 0x97, 0x82, 0x08, 0xe2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
29 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x01, 0xb0, 0x1d,
30 : 0x00, 0x00, 0x00, 0x0f
31 : };
32 :
33 4 : static bool ntlmssp_NEGOTIATE_MESSAGE_check(struct torture_context *tctx,
34 : struct NEGOTIATE_MESSAGE *r)
35 : {
36 4 : torture_assert_str_equal(tctx, r->Signature, "NTLMSSP", "Signature");
37 4 : torture_assert_int_equal(tctx, r->MessageType, NtLmNegotiate, "MessageType");
38 4 : torture_assert_int_equal(tctx, r->NegotiateFlags, 0xe2088297, "NegotiateFlags");
39 4 : torture_assert_int_equal(tctx, r->DomainNameLen, 0, "DomainNameLen");
40 4 : torture_assert_int_equal(tctx, r->DomainNameMaxLen, 0, "DomainNameMaxLen");
41 4 : torture_assert(tctx, r->DomainName == NULL, "DomainName");
42 4 : torture_assert_int_equal(tctx, r->WorkstationLen, 0, "WorkstationLen");
43 4 : torture_assert_int_equal(tctx, r->WorkstationMaxLen, 0, "WorkstationMaxLen");
44 4 : torture_assert(tctx, r->Workstation == NULL, "Workstation");
45 4 : torture_assert_int_equal(tctx, r->Version.version.ProductMajorVersion, NTLMSSP_WINDOWS_MAJOR_VERSION_6, "ProductMajorVersion");
46 4 : torture_assert_int_equal(tctx, r->Version.version.ProductMinorVersion, NTLMSSP_WINDOWS_MINOR_VERSION_1, "ProductMinorVersion");
47 4 : torture_assert_int_equal(tctx, r->Version.version.ProductBuild, 0x1db0, "ProductBuild");
48 4 : torture_assert_int_equal(tctx, r->Version.version.Reserved[0], 0x00, "Reserved");
49 4 : torture_assert_int_equal(tctx, r->Version.version.Reserved[1], 0x00, "Reserved");
50 4 : torture_assert_int_equal(tctx, r->Version.version.Reserved[2], 0x00, "Reserved");
51 4 : torture_assert_int_equal(tctx, r->Version.version.NTLMRevisionCurrent, NTLMSSP_REVISION_W2K3, "NTLMRevisionCurrent");
52 :
53 0 : return true;
54 : }
55 :
56 : static const uint8_t ntlmssp_CHALLENGE_MESSAGE_data[] = {
57 : 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x02, 0x00, 0x00, 0x00,
58 : 0x0a, 0x00, 0x0a, 0x00, 0x38, 0x00, 0x00, 0x00, 0x95, 0x82, 0x89, 0xe2,
59 : 0xed, 0xc8, 0x2b, 0x7d, 0x2e, 0xd7, 0xd0, 0xd9, 0x00, 0x00, 0x00, 0x00,
60 : 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x78, 0x00, 0x42, 0x00, 0x00, 0x00,
61 : 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x53, 0x00, 0x41, 0x00,
62 : 0x4d, 0x00, 0x42, 0x00, 0x41, 0x00, 0x02, 0x00, 0x0a, 0x00, 0x53, 0x00,
63 : 0x41, 0x00, 0x4d, 0x00, 0x42, 0x00, 0x41, 0x00, 0x01, 0x00, 0x10, 0x00,
64 : 0x4d, 0x00, 0x54, 0x00, 0x48, 0x00, 0x45, 0x00, 0x4c, 0x00, 0x45, 0x00,
65 : 0x4e, 0x00, 0x41, 0x00, 0x04, 0x00, 0x1c, 0x00, 0x62, 0x00, 0x65, 0x00,
66 : 0x72, 0x00, 0x2e, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x68, 0x00,
67 : 0x61, 0x00, 0x74, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00,
68 : 0x03, 0x00, 0x2e, 0x00, 0x6d, 0x00, 0x74, 0x00, 0x68, 0x00, 0x65, 0x00,
69 : 0x6c, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x2e, 0x00, 0x62, 0x00,
70 : 0x65, 0x00, 0x72, 0x00, 0x2e, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00,
71 : 0x68, 0x00, 0x61, 0x00, 0x74, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00,
72 : 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00
73 : };
74 :
75 4 : static bool ntlmssp_CHALLENGE_MESSAGE_check(struct torture_context *tctx,
76 : struct CHALLENGE_MESSAGE *r)
77 : {
78 4 : uint8_t chal[8] = { 0xed, 0xc8, 0x2b, 0x7d, 0x2e, 0xd7, 0xd0, 0xd9 };
79 4 : uint8_t data[8] = { 0 };
80 :
81 4 : torture_assert_str_equal(tctx, r->Signature, "NTLMSSP", "Signature");
82 4 : torture_assert_int_equal(tctx, r->MessageType, NtLmChallenge, "MessageType");
83 4 : torture_assert_int_equal(tctx, r->TargetNameLen, 10, "TargetNameLen");
84 4 : torture_assert_int_equal(tctx, r->TargetNameMaxLen, 10, "TargetNameMaxLen");
85 4 : torture_assert_str_equal(tctx, r->TargetName, "SAMBA", "TargetName");
86 4 : torture_assert_int_equal(tctx, r->NegotiateFlags, 0xe2898295, "NegotiateFlags");
87 4 : torture_assert_mem_equal(tctx, r->ServerChallenge, chal, 8, "ServerChallenge");
88 4 : torture_assert_mem_equal(tctx, r->Reserved, data, 8, "Reserved");
89 4 : torture_assert_int_equal(tctx, r->TargetInfoLen, 120, "TargetInfoLen");
90 4 : torture_assert_int_equal(tctx, r->TargetInfoMaxLen, 120, "TargetInfoMaxLen");
91 4 : torture_assert_int_equal(tctx, r->TargetInfo->count, 5, "TargetInfo->count");
92 :
93 4 : torture_assert_int_equal(tctx, r->TargetInfo->pair[0].AvId, MsvAvNbDomainName, "AvId");
94 4 : torture_assert_int_equal(tctx, r->TargetInfo->pair[0].AvLen, 10, "AvLen");
95 4 : torture_assert_str_equal(tctx, r->TargetInfo->pair[0].Value.AvNbDomainName, "SAMBA", "AvNbDomainName");
96 :
97 4 : torture_assert_int_equal(tctx, r->TargetInfo->pair[1].AvId, MsvAvNbComputerName, "AvId");
98 4 : torture_assert_int_equal(tctx, r->TargetInfo->pair[1].AvLen, 16, "AvLen");
99 4 : torture_assert_str_equal(tctx, r->TargetInfo->pair[1].Value.AvNbComputerName, "MTHELENA", "AvNbComputerName");
100 :
101 4 : torture_assert_int_equal(tctx, r->TargetInfo->pair[2].AvId, MsvAvDnsDomainName, "AvId");
102 4 : torture_assert_int_equal(tctx, r->TargetInfo->pair[2].AvLen, 28, "AvLen");
103 4 : torture_assert_str_equal(tctx, r->TargetInfo->pair[2].Value.AvDnsDomainName, "ber.redhat.com", "AvDnsDomainName");
104 :
105 4 : torture_assert_int_equal(tctx, r->TargetInfo->pair[3].AvId, MsvAvDnsComputerName, "AvId");
106 4 : torture_assert_int_equal(tctx, r->TargetInfo->pair[3].AvLen, 46, "AvLen");
107 4 : torture_assert_str_equal(tctx, r->TargetInfo->pair[3].Value.AvDnsComputerName, "mthelena.ber.redhat.com", "AvDnsComputerName");
108 :
109 4 : torture_assert_int_equal(tctx, r->TargetInfo->pair[4].AvId, MsvAvEOL, "AvId");
110 4 : torture_assert_int_equal(tctx, r->TargetInfo->pair[4].AvLen, 0, "AvLen");
111 :
112 4 : torture_assert_int_equal(tctx, r->Version.version.ProductMajorVersion, NTLMSSP_WINDOWS_MAJOR_VERSION_6, "ProductMajorVersion");
113 4 : torture_assert_int_equal(tctx, r->Version.version.ProductMinorVersion, NTLMSSP_WINDOWS_MINOR_VERSION_1, "ProductMinorVersion");
114 4 : torture_assert_int_equal(tctx, r->Version.version.ProductBuild, 0, "ProductBuild");
115 4 : torture_assert_int_equal(tctx, r->Version.version.Reserved[0], 0x00, "Reserved");
116 4 : torture_assert_int_equal(tctx, r->Version.version.Reserved[1], 0x00, "Reserved");
117 4 : torture_assert_int_equal(tctx, r->Version.version.Reserved[2], 0x00, "Reserved");
118 4 : torture_assert_int_equal(tctx, r->Version.version.NTLMRevisionCurrent, NTLMSSP_REVISION_W2K3, "NTLMRevisionCurrent");
119 :
120 0 : return true;
121 : }
122 :
123 : static const uint8_t ntlmssp_AUTHENTICATE_MESSAGE_data[] = {
124 : 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x03, 0x00, 0x00, 0x00,
125 : 0x18, 0x00, 0x18, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x0e, 0x01,
126 : 0xa4, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x58, 0x00, 0x00, 0x00,
127 : 0x1a, 0x00, 0x1a, 0x00, 0x66, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00,
128 : 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0xb2, 0x01, 0x00, 0x00,
129 : 0x15, 0x82, 0x88, 0xe2, 0x06, 0x01, 0xb0, 0x1d, 0x00, 0x00, 0x00, 0x0f,
130 : 0x50, 0xe2, 0xb2, 0xa7, 0xf5, 0x83, 0x3e, 0xda, 0x71, 0xa7, 0xe8, 0x6e,
131 : 0x95, 0x1e, 0x3a, 0x57, 0x57, 0x00, 0x32, 0x00, 0x4b, 0x00, 0x38, 0x00,
132 : 0x44, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x41, 0x00, 0x64, 0x00, 0x6d, 0x00,
133 : 0x69, 0x00, 0x6e, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00,
134 : 0x61, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x57, 0x00, 0x32, 0x00,
135 : 0x4b, 0x00, 0x38, 0x00, 0x52, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00,
136 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
137 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0xcf, 0xfb, 0x39,
138 : 0x5a, 0xb3, 0x4c, 0x58, 0x86, 0x35, 0xa3, 0xe7, 0x1e, 0x00, 0x98, 0x43,
139 : 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x79, 0x02, 0x77,
140 : 0x1e, 0x54, 0xcb, 0x01, 0x3c, 0x21, 0x0a, 0xe9, 0xde, 0x61, 0xc0, 0x7e,
141 : 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00, 0x53, 0x00, 0x41, 0x00,
142 : 0x4d, 0x00, 0x42, 0x00, 0x41, 0x00, 0x01, 0x00, 0x10, 0x00, 0x4d, 0x00,
143 : 0x54, 0x00, 0x48, 0x00, 0x45, 0x00, 0x4c, 0x00, 0x45, 0x00, 0x4e, 0x00,
144 : 0x41, 0x00, 0x04, 0x00, 0x1c, 0x00, 0x62, 0x00, 0x65, 0x00, 0x72, 0x00,
145 : 0x2e, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x68, 0x00, 0x61, 0x00,
146 : 0x74, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x03, 0x00,
147 : 0x2e, 0x00, 0x6d, 0x00, 0x74, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6c, 0x00,
148 : 0x65, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x2e, 0x00, 0x62, 0x00, 0x65, 0x00,
149 : 0x72, 0x00, 0x2e, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x68, 0x00,
150 : 0x61, 0x00, 0x74, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00,
151 : 0x08, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
152 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x0a, 0xfd, 0x3b, 0x2c,
153 : 0xad, 0x43, 0x46, 0x8b, 0x49, 0x01, 0x6c, 0xa5, 0xf3, 0xbc, 0xd2, 0x13,
154 : 0xbb, 0x70, 0xe2, 0x65, 0x96, 0xba, 0x0d, 0x8d, 0x5d, 0x31, 0xe6, 0x47,
155 : 0x94, 0x61, 0xed, 0x28, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
156 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
157 : 0x09, 0x00, 0x1a, 0x00, 0x63, 0x00, 0x69, 0x00, 0x66, 0x00, 0x73, 0x00,
158 : 0x2f, 0x00, 0x6d, 0x00, 0x74, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6c, 0x00,
159 : 0x65, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
160 : 0x00, 0x00, 0xa4, 0x23, 0xd4, 0x5c, 0x16, 0x52, 0x8d, 0x56, 0x34, 0x2d,
161 : 0x1c, 0xff, 0x86, 0x17, 0xc9, 0x4f
162 : };
163 :
164 2 : static bool ntlmssp_AUTHENTICATE_MESSAGE_check(struct torture_context *tctx,
165 : struct AUTHENTICATE_MESSAGE *r)
166 : {
167 2 : uint8_t lm_challenge_response[24] = { 0 };
168 2 : struct NTLMv2_RESPONSE v2;
169 2 : struct AV_PAIR_LIST AvPairs;
170 2 : uint8_t Response[16] = {
171 : 0x38, 0xcf, 0xfb, 0x39, 0x5a, 0xb3, 0x4c, 0x58,
172 : 0x86, 0x35, 0xa3, 0xe7, 0x1e, 0x00, 0x98, 0x43
173 : };
174 2 : uint8_t ChallengeFromClient[8] = {
175 : 0x3c, 0x21, 0x0a, 0xe9, 0xde, 0x61, 0xc0, 0x7e
176 : };
177 2 : uint8_t MachineId[32] = {
178 : 0x0a, 0xfd, 0x3b, 0x2c, 0xad, 0x43, 0x46, 0x8b,
179 : 0x49, 0x01, 0x6c, 0xa5, 0xf3, 0xbc, 0xd2, 0x13,
180 : 0xbb, 0x70, 0xe2, 0x65, 0x96, 0xba, 0x0d, 0x8d,
181 : 0x5d, 0x31, 0xe6, 0x47, 0x94, 0x61, 0xed, 0x28
182 : };
183 2 : uint8_t EncryptedRandomSessionKey[16] = {
184 : 0xA4, 0x23, 0xD4, 0x5C, 0x16, 0x52, 0x8D, 0x56,
185 : 0x34, 0x2D, 0x1C, 0xFF, 0x86, 0x17, 0xC9, 0x4F
186 : };
187 :
188 2 : torture_assert_str_equal(tctx, r->Signature, "NTLMSSP", "Signature");
189 2 : torture_assert_int_equal(tctx, r->MessageType, NtLmAuthenticate, "MessageType");
190 2 : torture_assert_int_equal(tctx, r->LmChallengeResponseLen, 24, "LmChallengeResponseLen");
191 2 : torture_assert_int_equal(tctx, r->LmChallengeResponseMaxLen, 24, "LmChallengeResponseMaxLen");
192 2 : torture_assert_mem_equal(tctx, r->LmChallengeResponse->v1.Response, lm_challenge_response, 24, "LmChallengeResponse");
193 :
194 2 : torture_assert_int_equal(tctx, r->NtChallengeResponseLen, 270, "NtChallengeResponseLen");
195 2 : torture_assert_int_equal(tctx, r->NtChallengeResponseMaxLen, 270, "NtChallengeResponseMaxLen");
196 :
197 2 : v2 = r->NtChallengeResponse->v2;
198 :
199 2 : torture_assert_mem_equal(tctx, v2.Response, Response, 16, "v2.Response");
200 2 : torture_assert_int_equal(tctx, v2.Challenge.RespType, 1, "RespType");
201 2 : torture_assert_int_equal(tctx, v2.Challenge.HiRespType, 1, "HiRespType");
202 2 : torture_assert_int_equal(tctx, v2.Challenge.Reserved1, 0, "Reserved1");
203 2 : torture_assert_int_equal(tctx, v2.Challenge.Reserved2, 0, "Reserved2");
204 : /* TimeStamp : Tue Sep 14 17:06:53 2010 CEST */
205 2 : torture_assert_mem_equal(tctx, v2.Challenge.ChallengeFromClient, ChallengeFromClient, 8, "v2.Challenge.ChallengeFromClient");
206 2 : torture_assert_int_equal(tctx, v2.Challenge.Reserved3, 0, "Reserved3");
207 :
208 2 : AvPairs = v2.Challenge.AvPairs;
209 :
210 2 : torture_assert_int_equal(tctx, AvPairs.count, 8, "AvPairs.count");
211 :
212 2 : torture_assert_int_equal(tctx, AvPairs.pair[0].AvId, MsvAvNbDomainName, "AvId");
213 2 : torture_assert_int_equal(tctx, AvPairs.pair[0].AvLen, 10, "AvLen");
214 2 : torture_assert_str_equal(tctx, AvPairs.pair[0].Value.AvNbDomainName, "SAMBA", "Value.AvNbDomainName");
215 :
216 2 : torture_assert_int_equal(tctx, AvPairs.pair[1].AvId, MsvAvNbComputerName, "AvId");
217 2 : torture_assert_int_equal(tctx, AvPairs.pair[1].AvLen, 16, "AvLen");
218 2 : torture_assert_str_equal(tctx, AvPairs.pair[1].Value.AvNbComputerName, "MTHELENA", "Value.AvNbComputerName");
219 :
220 2 : torture_assert_int_equal(tctx, AvPairs.pair[2].AvId, MsvAvDnsDomainName, "AvId");
221 2 : torture_assert_int_equal(tctx, AvPairs.pair[2].AvLen, 28, "AvLen");
222 2 : torture_assert_str_equal(tctx, AvPairs.pair[2].Value.AvDnsDomainName, "ber.redhat.com", "Value.AvDnsDomainName");
223 :
224 2 : torture_assert_int_equal(tctx, AvPairs.pair[3].AvId, MsvAvDnsComputerName, "AvId");
225 2 : torture_assert_int_equal(tctx, AvPairs.pair[3].AvLen, 46, "AvLen");
226 2 : torture_assert_str_equal(tctx, AvPairs.pair[3].Value.AvDnsComputerName, "mthelena.ber.redhat.com", "Value.AvDnsComputerName");
227 :
228 2 : torture_assert_int_equal(tctx, AvPairs.pair[4].AvId, MsvAvSingleHost, "AvId");
229 2 : torture_assert_int_equal(tctx, AvPairs.pair[4].AvLen, 48, "AvLen");
230 2 : torture_assert_int_equal(tctx, AvPairs.pair[4].Value.AvSingleHost.Size, 48, "Value.AvSingleHost.Size");
231 2 : torture_assert_int_equal(tctx, AvPairs.pair[4].Value.AvSingleHost.Z4, 0, "Value.AvSingleHost.Z4");
232 2 : torture_assert_int_equal(tctx, AvPairs.pair[4].Value.AvSingleHost.token_info.Flags, 0, "Value.AvSingleHost.token_info.Flags");
233 2 : torture_assert_int_equal(tctx, AvPairs.pair[4].Value.AvSingleHost.token_info.TokenIL, 0x00003000, "Value.AvSingleHost.token_info.TokenIL");
234 2 : torture_assert_mem_equal(tctx, AvPairs.pair[4].Value.AvSingleHost.token_info.MachineId, MachineId, 32, "Value.AvSingleHost.token_info.MachineId");
235 2 : torture_assert_int_equal(tctx, AvPairs.pair[4].Value.AvSingleHost.remaining.length, 0, "Value.AvSingleHost.remaining.length");
236 :
237 2 : torture_assert_int_equal(tctx, AvPairs.pair[5].AvId, MsvChannelBindings, "AvId");
238 2 : torture_assert_int_equal(tctx, AvPairs.pair[5].AvLen, 16, "AvLen");
239 2 : torture_assert_mem_equal(tctx, AvPairs.pair[5].Value.ChannelBindings, lm_challenge_response, 16, "Value.ChannelBindings");
240 :
241 2 : torture_assert_int_equal(tctx, AvPairs.pair[6].AvId, MsvAvTargetName, "AvId");
242 2 : torture_assert_int_equal(tctx, AvPairs.pair[6].AvLen, 26, "AvLen");
243 2 : torture_assert_str_equal(tctx, AvPairs.pair[6].Value.AvTargetName, "cifs/mthelena", "Value.AvTargetName");
244 :
245 2 : torture_assert_int_equal(tctx, AvPairs.pair[7].AvId, MsvAvEOL, "AvId");
246 2 : torture_assert_int_equal(tctx, AvPairs.pair[7].AvLen, 0, "AvLen");
247 :
248 2 : torture_assert_int_equal(tctx, r->DomainNameLen, 14, "DomainNameLen");
249 2 : torture_assert_int_equal(tctx, r->DomainNameMaxLen, 14, "DomainNameMaxLen");
250 2 : torture_assert_str_equal(tctx, r->DomainName, "W2K8DOM", "DomainName");
251 :
252 2 : torture_assert_int_equal(tctx, r->UserNameLen, 26, "UserNameLen");
253 2 : torture_assert_int_equal(tctx, r->UserNameMaxLen, 26, "UserNameMaxLen");
254 2 : torture_assert_str_equal(tctx, r->UserName, "Administrator", "UserName");
255 :
256 2 : torture_assert_int_equal(tctx, r->WorkstationLen, 12, "WorkstationLen");
257 2 : torture_assert_int_equal(tctx, r->WorkstationMaxLen, 12, "WorkstationMaxLen");
258 2 : torture_assert_str_equal(tctx, r->Workstation, "W2K8R2", "Workstation");
259 :
260 2 : torture_assert_int_equal(tctx, r->EncryptedRandomSessionKeyLen, 16, "EncryptedRandomSessionKeyLen");
261 2 : torture_assert_int_equal(tctx, r->EncryptedRandomSessionKeyMaxLen, 16, "EncryptedRandomSessionKeyMaxLen");
262 2 : torture_assert_mem_equal(tctx, r->EncryptedRandomSessionKey->data, EncryptedRandomSessionKey, 16, "EncryptedRandomSessionKeyMaxLen");
263 :
264 2 : torture_assert_int_equal(tctx, r->NegotiateFlags, 0xe2888215, "NegotiateFlags");
265 :
266 2 : torture_assert_int_equal(tctx, r->Version.version.ProductMajorVersion, NTLMSSP_WINDOWS_MAJOR_VERSION_6, "ProductMajorVersion");
267 2 : torture_assert_int_equal(tctx, r->Version.version.ProductMinorVersion, NTLMSSP_WINDOWS_MINOR_VERSION_1, "ProductMinorVersion");
268 2 : torture_assert_int_equal(tctx, r->Version.version.ProductBuild, 0x1db0, "ProductBuild");
269 2 : torture_assert_int_equal(tctx, r->Version.version.Reserved[0], 0x00, "Reserved");
270 2 : torture_assert_int_equal(tctx, r->Version.version.Reserved[1], 0x00, "Reserved");
271 2 : torture_assert_int_equal(tctx, r->Version.version.Reserved[2], 0x00, "Reserved");
272 2 : torture_assert_int_equal(tctx, r->Version.version.NTLMRevisionCurrent, NTLMSSP_REVISION_W2K3, "NTLMRevisionCurrent");
273 :
274 0 : return true;
275 : }
276 :
277 2354 : struct torture_suite *ndr_ntlmssp_suite(TALLOC_CTX *ctx)
278 : {
279 2354 : struct torture_suite *suite = torture_suite_create(ctx, "ntlmssp");
280 :
281 2354 : torture_suite_add_ndr_pull_test(suite, NEGOTIATE_MESSAGE, ntlmssp_NEGOTIATE_MESSAGE_data, ntlmssp_NEGOTIATE_MESSAGE_check);
282 2354 : torture_suite_add_ndr_pull_test(suite, CHALLENGE_MESSAGE, ntlmssp_CHALLENGE_MESSAGE_data, ntlmssp_CHALLENGE_MESSAGE_check);
283 2354 : torture_suite_add_ndr_pull_test(suite, AUTHENTICATE_MESSAGE, ntlmssp_AUTHENTICATE_MESSAGE_data, ntlmssp_AUTHENTICATE_MESSAGE_check);
284 :
285 2354 : torture_suite_add_ndr_pull_validate_test(suite,
286 : NEGOTIATE_MESSAGE,
287 : ntlmssp_NEGOTIATE_MESSAGE_data,
288 : ntlmssp_NEGOTIATE_MESSAGE_check);
289 :
290 2354 : torture_suite_add_ndr_pull_validate_test(suite,
291 : CHALLENGE_MESSAGE,
292 : ntlmssp_CHALLENGE_MESSAGE_data,
293 : ntlmssp_CHALLENGE_MESSAGE_check);
294 :
295 2354 : return suite;
296 : }
|