util_strlist: Add some more "const"s - small correction
[Samba/ekacnet.git] / librpc / idl / ntlmssp.idl
blob0bb30bb22e316211dd646e02dc22093d48703f5a
1 #include "idl_types.h"
3 /*
4 ntlmssp interface definition
5 */
8 pointer_default(unique),
9 helper("../librpc/ndr/ndr_ntlmssp.h"),
10 helpstring("NTLM messages"),
11 uuid("6e746c6d-7373-700a-0000-00000000")
13 interface ntlmssp
15 typedef [v1_enum] enum {
16 NtLmNegotiate = 0x00000001,
17 NtLmChallenge = 0x00000002,
18 NtLmAuthenticate = 0x00000003
19 } ntlmssp_MessageType;
21 typedef [bitmap32bit] bitmap {
22 NTLMSSP_NEGOTIATE_UNICODE = 0x00000001,
23 NTLMSSP_NEGOTIATE_OEM = 0x00000002, /* NTLM_NEGOTIATE_OEM in MS-NLMP */
24 NTLMSSP_REQUEST_TARGET = 0x00000004,
25 NTLMSSP_NEGOTIATE_SIGN = 0x00000010, /* Message integrity */
26 NTLMSSP_NEGOTIATE_SEAL = 0x00000020, /* Message confidentiality */
27 NTLMSSP_NEGOTIATE_DATAGRAM = 0x00000040,
28 NTLMSSP_NEGOTIATE_LM_KEY = 0x00000080,
29 NTLMSSP_NEGOTIATE_NETWARE = 0x00000100, /* not mentioned in MS-NLMP */
30 NTLMSSP_NEGOTIATE_NTLM = 0x00000200,
31 NTLMSSP_NEGOTIATE_NT_ONLY = 0x00000400,
32 NTLMSSP_ANONYMOUS = 0x00000800, /* no symbol name in MS-NLMP */
33 NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED = 0x00001000,
34 NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED = 0x00002000,
35 NTLMSSP_NEGOTIATE_THIS_IS_LOCAL_CALL = 0x00004000, /* not mentioned in MS-NLMP */
36 NTLMSSP_NEGOTIATE_ALWAYS_SIGN = 0x00008000,
37 NTLMSSP_TARGET_TYPE_DOMAIN = 0x00010000,
38 NTLMSSP_TARGET_TYPE_SERVER = 0x00020000,
39 NTLMSSP_TARGET_TYPE_SHARE = 0x00040000,
40 NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY = 0x00080000,
41 NTLMSSP_NEGOTIATE_IDENTIFY = 0x00100000,
42 NTLMSSP_REQUEST_NON_NT_SESSION_KEY = 0x00400000,
43 NTLMSSP_NEGOTIATE_TARGET_INFO = 0x00800000,
44 NTLMSSP_NEGOTIATE_VERSION = 0x02000000,
45 NTLMSSP_NEGOTIATE_128 = 0x20000000, /* 128-bit encryption */
46 NTLMSSP_NEGOTIATE_KEY_EXCH = 0x40000000,
47 NTLMSSP_NEGOTIATE_56 = 0x80000000
48 } NEGOTIATE;
50 /* convenience mapping */
51 const int NTLMSSP_NEGOTIATE_NTLM2 = NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY;
54 NTLMSSP_WINDOWS_MAJOR_VERSION_5: Windows XP SP2 and Server 2003
55 NTLMSSP_WINDOWS_MAJOR_VERSION_6: Windows Vista, Server 2008, 7 and Server 2008 R2
58 typedef [enum8bit] enum {
59 NTLMSSP_WINDOWS_MAJOR_VERSION_5 = 0x05,
60 NTLMSSP_WINDOWS_MAJOR_VERSION_6 = 0x06
61 } ntlmssp_WindowsMajorVersion;
64 NTLMSSP_WINDOWS_MINOR_VERSION_0: Windows Vista, Server 2008, 7, Server 2008 R2
65 NTLMSSP_WINDOWS_MINOR_VERSION_1: Windows XP SP2
66 NTLMSSP_WINDOWS_MINOR_VERSION_2: Windows Server 2003
69 typedef [enum8bit] enum {
70 NTLMSSP_WINDOWS_MINOR_VERSION_0 = 0x00,
71 NTLMSSP_WINDOWS_MINOR_VERSION_1 = 0x01,
72 NTLMSSP_WINDOWS_MINOR_VERSION_2 = 0x02
73 } ntlmssp_WindowsMinorVersion;
76 NTLMSSP_REVISION_W2K3_RC1:
77 NTLMSSP_REVISION_W2K3: Windows XP SP2, Server 2003, Vista, Server 2008, 7, Server 2008 R2
80 typedef [enum8bit] enum {
81 NTLMSSP_REVISION_W2K3_RC1 = 0x0A,
82 NTLMSSP_REVISION_W2K3 = 0x0F
83 } ntlmssp_NTLMRevisionCurrent;
85 typedef struct {
86 ntlmssp_WindowsMajorVersion ProductMajorVersion;
87 ntlmssp_WindowsMinorVersion ProductMinorVersion;
88 uint16 ProductBuild;
89 uint8 Reserved[3];
90 ntlmssp_NTLMRevisionCurrent NTLMRevisionCurrent;
91 } VERSION;
93 typedef [nodiscriminant] union {
94 [case(NTLMSSP_NEGOTIATE_VERSION)] VERSION version;
95 [default];
96 } ntlmssp_Version;
98 /* NTLMSSP negotiate message */
100 typedef [public] struct {
101 [charset(DOS),value("NTLMSSP")] uint8 Signature[8];
102 [value(NtLmNegotiate)] ntlmssp_MessageType MessageType;
103 NEGOTIATE NegotiateFlags;
104 [value(strlen(DomainName))] uint16 DomainNameLen;
105 [value(DomainNameLen)] uint16 DomainNameMaxLen;
106 [relative] [subcontext(0),subcontext_size(DomainNameLen)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM))] string *DomainName;
107 [value(strlen(Workstation))] uint16 WorkstationLen;
108 [value(WorkstationLen)] uint16 WorkstationMaxLen;
109 [relative] [subcontext(0),subcontext_size(WorkstationLen)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM))] string *Workstation;
110 [switch_is(NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)] ntlmssp_Version Version;
111 } NEGOTIATE_MESSAGE;
113 typedef enum {
114 MsvAvEOL = 0,
115 MsvAvNbComputerName = 1,
116 MsvAvNbDomainName = 2,
117 MsvAvDnsComputerName = 3,
118 MsvAvDnsDomainName = 4,
119 MsvAvDnsTreeName = 5,
120 MsvAvFlags = 6,
121 MsvAvTimestamp = 7,
122 MsAvRestrictions = 8,
123 MsvAvTargetName = 9,
124 MsvChannelBindings = 10
125 } ntlmssp_AvId;
127 typedef struct {
128 uint32 Size;
129 [value(0)] uint32 Z4;
130 boolean32 IntegrityLevel;
131 uint32 SubjectIntegrityLevel;
132 uint8 MachineId[32];
133 } Restriction_Encoding;
135 typedef [bitmap32bit] bitmap {
136 NTLMSSP_AVFLAG_CONSTRAINTED_ACCOUNT = 0x00000001,
137 NTLMSSP_AVFLAG_MIC_IN_AUTHENTICATE_MESSAGE = 0x00000002
138 } ntlmssp_AvFlags;
140 typedef [gensize,nodiscriminant,flag(NDR_NOALIGN)] union {
141 [case(MsvAvEOL)] ;
142 [case(MsvAvNbComputerName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvNbComputerName;
143 [case(MsvAvNbDomainName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvNbDomainName;
144 [case(MsvAvDnsComputerName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvDnsComputerName;
145 [case(MsvAvDnsDomainName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvDnsDomainName;
146 [case(MsvAvDnsTreeName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvDnsTreeName;
147 [case(MsvAvFlags)] ntlmssp_AvFlags AvFlags;
148 [case(MsvAvTimestamp)] NTTIME AvTimestamp;
149 [case(MsAvRestrictions)] Restriction_Encoding AvRestrictions;
150 [case(MsvAvTargetName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvTargetName;
151 [case(MsvChannelBindings)] uint8 ChannelBindings[16];
152 [default] [flag(NDR_REMAINING)] DATA_BLOB blob;
153 } ntlmssp_AvValue;
155 typedef [public,flag(NDR_NOALIGN)] struct {
156 ntlmssp_AvId AvId;
157 [value(ndr_size_ntlmssp_AvValue(&r->Value, r->AvId, ndr->iconv_convenience, 0))] uint16 AvLen;
158 [subcontext(0),subcontext_size(AvLen),switch_is(AvId)] ntlmssp_AvValue Value;
159 } AV_PAIR;
161 typedef [gensize,nopush,nopull,flag(NDR_NOALIGN)] struct {
162 uint32 count;
163 AV_PAIR pair[count];
164 } AV_PAIR_LIST;
166 /* NTLMSSP challenge message */
168 typedef [public,flag(NDR_PAHEX)] struct {
169 [charset(DOS),value("NTLMSSP")] uint8 Signature[8];
170 [value(NtLmChallenge)] ntlmssp_MessageType MessageType;
171 [value(ndr_ntlmssp_string_length(NegotiateFlags, TargetName))] uint16 TargetNameLen;
172 [value(TargetNameLen)] uint16 TargetNameMaxLen;
173 [relative] [subcontext(0),subcontext_size(TargetNameLen)] [flag(ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags))] string *TargetName;
174 NEGOTIATE NegotiateFlags;
175 uint8 ServerChallenge[8];
176 uint8 Reserved[8];
177 [value(ndr_size_AV_PAIR_LIST(TargetInfo, ndr->iconv_convenience, ndr->flags))] uint16 TargetInfoLen;
178 [value(TargetInfoLen)] uint16 TargetNameInfoMaxLen;
179 [relative] [subcontext(0),subcontext_size(TargetInfoLen)] AV_PAIR_LIST *TargetInfo;
180 [switch_is(NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)] ntlmssp_Version Version;
181 } CHALLENGE_MESSAGE;
183 typedef [public,flag(NDR_PAHEX)] struct {
184 uint8 Response[24];
185 } LM_RESPONSE;
187 typedef [public,flag(NDR_PAHEX)] struct {
188 uint8 Response[16];
189 uint8 ChallengeFromClient[8];
190 } LMv2_RESPONSE;
192 typedef [nodiscriminant] union {
193 [case(24)] LM_RESPONSE v1;
194 [default];
195 } ntlmssp_LM_RESPONSE;
197 typedef [public,flag(NDR_PAHEX)] struct {
198 uint8 Response[24];
199 } NTLM_RESPONSE;
201 typedef [flag(NDR_PAHEX)] struct {
202 [value(1)] uint8 RespType;
203 [value(1)] uint8 HiRespType;
204 uint16 Reserved1;
205 uint32 Reserved2;
206 NTTIME TimeStamp;
207 uint8 ChallengeFromClient[8];
208 uint32 Reserved3;
209 [subcontext(0)] [flag(NDR_REMAINING)] AV_PAIR_LIST AvPairs;
210 } NTLMv2_CLIENT_CHALLENGE;
212 typedef [public,flag(NDR_PAHEX)] struct {
213 uint8 Response[16];
214 NTLMv2_CLIENT_CHALLENGE Challenge;
215 } NTLMv2_RESPONSE;
217 typedef [public,nodiscriminant] union {
218 [case(0)] ;
219 [case(0x18)] NTLM_RESPONSE v1;
220 [default] NTLMv2_RESPONSE v2;
221 } ntlmssp_NTLM_RESPONSE;
223 typedef [flag(NDR_PAHEX)] struct {
224 uint8 MIC[16];
225 } MIC;
227 /* NTLMSSP authenticate message */
229 typedef [public,flag(NDR_REMAINING)] struct {
230 [charset(DOS),value("NTLMSSP")] uint8 Signature[8];
231 [value(NtLmAuthenticate)] ntlmssp_MessageType MessageType;
232 uint16 LmChallengeResponseLen;
233 [value(LmChallengeResponseLen)] uint16 LmChallengeResponseMaxLen;
234 [relative] [subcontext(0),subcontext_size(LmChallengeResponseLen),switch_is(LmChallengeResponseLen)] ntlmssp_LM_RESPONSE *LmChallengeResponse;
235 uint16 NtChallengeResponseLen;
236 [value(NtChallengeResponseLen)] uint16 NtChallengeResponseMaxLen;
237 [relative] [subcontext(0),subcontext_size(NtChallengeResponseMaxLen),switch_is(NtChallengeResponseLen)] ntlmssp_NTLM_RESPONSE *NtChallengeResponse;
238 [value(ndr_ntlmssp_string_length(NegotiateFlags, DomainName))] uint16 DomainNameLen;
239 [value(DomainNameLen)] uint16 DomainNameMaxLen;
240 [relative] [subcontext(0),subcontext_size(DomainNameLen)] [flag(ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags))] string *DomainName;
241 [value(ndr_ntlmssp_string_length(NegotiateFlags, UserName))] uint16 UserNameLen;
242 [value(UserNameLen)] uint16 UserNameMaxLen;
243 [relative] [subcontext(0),subcontext_size(UserNameLen)] [flag(ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags))] string *UserName;
244 [value(ndr_ntlmssp_string_length(NegotiateFlags, Workstation))] uint16 WorkstationLen;
245 [value(WorkstationLen)] uint16 WorkstationMaxLen;
246 [relative] [subcontext(0),subcontext_size(WorkstationLen)] [flag(ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags))] string *Workstation;
247 [value(EncryptedRandomSessionKey->length)] uint16 EncryptedRandomSessionKeyLen;
248 [value(EncryptedRandomSessionKeyLen)] uint16 EncryptedRandomSessionKeyMaxLen;
249 [relative] [subcontext(0),subcontext_size(EncryptedRandomSessionKeyLen)] DATA_BLOB *EncryptedRandomSessionKey;
250 NEGOTIATE NegotiateFlags;
251 [switch_is(NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)] ntlmssp_Version Version;
252 /* MIC (Message Integrity) is only included when the client has
253 * sent a timestap Av struct in the CHALLENGE_MESSAGE AvPair */
254 /* [flag(NDR_REMAINING)] MIC mic; */
255 } AUTHENTICATE_MESSAGE;
257 /* NTLMSSP signature version */
258 const int NTLMSSP_SIGN_VERSION = 0x01;
260 /* NTLMSSP signature size */
261 const int NTLMSSP_SIG_SIZE = 16;
263 typedef [public] struct {
264 [value(NTLMSSP_SIGN_VERSION)] uint32 Version;
265 uint32 RandomPad;
266 uint32 Checksum;
267 uint32 SeqNum;
268 } NTLMSSP_MESSAGE_SIGNATURE;
270 typedef [public,flag(NDR_PAHEX)] struct {
271 [value(NTLMSSP_SIGN_VERSION)] uint32 Version;
272 uint8 Checksum[8];
273 uint32 SeqNum;
274 } NTLMSSP_MESSAGE_SIGNATURE_NTLMv2;
276 /* some ndrdump helpers */
278 void decode_NEGOTIATE_MESSAGE(
279 [in] NEGOTIATE_MESSAGE negotiate
282 void decode_CHALLENGE_MESSAGE(
283 [in] CHALLENGE_MESSAGE challenge
286 void decode_AUTHENTICATE_MESSAGE(
287 [in] AUTHENTICATE_MESSAGE authenticate
290 void decode_NTLMv2_CLIENT_CHALLENGE(
291 [in] NTLMv2_CLIENT_CHALLENGE challenge