1fc65968213b78ce6441bb0f9a94a03107c907fe
[samba.git] / source / include / rpc_netlogon.h
1 /* 
2    Unix SMB/Netbios implementation.
3    Version 1.9.
4    SMB parameters and setup
5    Copyright (C) Andrew Tridgell 1992-1997
6    Copyright (C) Luke Kenneth Casson Leighton 1996-1997
7    Copyright (C) Paul Ashton 1997
8    
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24 #ifndef _RPC_NETLOGON_H /* _RPC_NETLOGON_H */
25 #define _RPC_NETLOGON_H 
26
27
28 /* NETLOGON pipe */
29 #define NET_REQCHAL            0x04
30 #define NET_SRVPWSET           0x06
31 #define NET_SAMLOGON           0x02
32 #define NET_SAMLOGOFF          0x03
33 #define NET_AUTH2              0x0f
34 #define NET_LOGON_CTRL2        0x0e
35 #define NET_TRUST_DOM_LIST     0x13
36
37 /* Secure Channel types.  used in NetrServerAuthenticate negotiation */
38 #define SEC_CHAN_WKSTA   2
39 #define SEC_CHAN_DOMAIN  4
40
41         
42 /* NET_USER_INFO_3 */
43 typedef struct net_user_info_3
44 {
45         uint32 ptr_user_info;
46
47         NTTIME logon_time;            /* logon time */
48         NTTIME logoff_time;           /* logoff time */
49         NTTIME kickoff_time;          /* kickoff time */
50         NTTIME pass_last_set_time;    /* password last set time */
51         NTTIME pass_can_change_time;  /* password can change time */
52         NTTIME pass_must_change_time; /* password must change time */
53
54         UNIHDR hdr_user_name;    /* username unicode string header */
55         UNIHDR hdr_full_name;    /* user's full name unicode string header */
56         UNIHDR hdr_logon_script; /* logon script unicode string header */
57         UNIHDR hdr_profile_path; /* profile path unicode string header */
58         UNIHDR hdr_home_dir;     /* home directory unicode string header */
59         UNIHDR hdr_dir_drive;    /* home directory drive unicode string header */
60
61         uint16 logon_count;  /* logon count */
62         uint16 bad_pw_count; /* bad password count */
63
64         uint32 user_id;       /* User ID */
65         uint32 group_id;      /* Group ID */
66         uint32 num_groups;    /* num groups */
67         uint32 buffer_groups; /* undocumented buffer pointer to groups. */
68         uint32 user_flgs;     /* user flags */
69
70         uint8 user_sess_key[16]; /* unused user session key */
71
72         UNIHDR hdr_logon_srv; /* logon server unicode string header */
73         UNIHDR hdr_logon_dom; /* logon domain unicode string header */
74
75         uint32 buffer_dom_id; /* undocumented logon domain id pointer */
76         uint8 padding[40];    /* unused padding bytes.  expansion room */
77
78         uint32 num_other_sids; /* 0 - num_sids */
79         uint32 buffer_other_sids; /* NULL - undocumented pointer to SIDs. */
80         
81         UNISTR2 uni_user_name;    /* username unicode string */
82         UNISTR2 uni_full_name;    /* user's full name unicode string */
83         UNISTR2 uni_logon_script; /* logon script unicode string */
84         UNISTR2 uni_profile_path; /* profile path unicode string */
85         UNISTR2 uni_home_dir;     /* home directory unicode string */
86         UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
87
88         uint32 num_groups2;        /* num groups */
89         DOM_GID gids[LSA_MAX_GROUPS]; /* group info */
90
91         UNISTR2 uni_logon_srv; /* logon server unicode string */
92         UNISTR2 uni_logon_dom; /* logon domain unicode string */
93
94         DOM_SID2 dom_sid;           /* domain SID */
95         DOM_SID2 other_sids[LSA_MAX_SIDS]; /* undocumented - domain SIDs */
96
97 } NET_USER_INFO_3;
98
99
100 /********************************************************
101  Logon Control Query
102
103  query_level 0x1 - pdc status
104  query_level 0x3 - number of logon attempts.
105
106  ********************************************************/
107 /* NET_Q_LOGON_CTRL2 - LSA Netr Logon Control 2*/
108 typedef struct net_q_logon_ctrl2_info
109 {
110         uint32       ptr;             /* undocumented buffer pointer */
111         UNISTR2      uni_server_name; /* server name, starting with two '\'s */
112         
113         uint32       function_code; /* 0x1 */
114         uint32       query_level;   /* 0x1, 0x3 */
115         uint32       switch_value;  /* 0x1 */
116
117 } NET_Q_LOGON_CTRL2;
118
119 /* NETLOGON_INFO_1 - pdc status info, i presume */
120 typedef struct netlogon_1_info
121 {
122         uint32 flags;            /* 0x0 - undocumented */
123         uint32 pdc_status;       /* 0x0 - undocumented */
124
125 } NETLOGON_INFO_1;
126
127 /* NETLOGON_INFO_2 - pdc status info, plus trusted domain info */
128 typedef struct netlogon_2_info
129 {
130         uint32  flags;            /* 0x0 - undocumented */
131         uint32  pdc_status;       /* 0x0 - undocumented */
132         uint32  ptr_trusted_dc_name; /* pointer to trusted domain controller name */
133         uint32  tc_status;           /* 0x051f - ERROR_NO_LOGON_SERVERS */
134         UNISTR2 uni_trusted_dc_name; /* unicode string - trusted dc name */
135
136 } NETLOGON_INFO_2;
137
138 /* NETLOGON_INFO_3 - logon status info, i presume */
139 typedef struct netlogon_3_info
140 {
141         uint32 flags;            /* 0x0 - undocumented */
142         uint32 logon_attempts;   /* number of logon attempts */
143         uint32 reserved_1;       /* 0x0 - undocumented */
144         uint32 reserved_2;       /* 0x0 - undocumented */
145         uint32 reserved_3;       /* 0x0 - undocumented */
146         uint32 reserved_4;       /* 0x0 - undocumented */
147         uint32 reserved_5;       /* 0x0 - undocumented */
148
149 } NETLOGON_INFO_3;
150
151 /*******************************************************
152  Logon Control Response
153
154  switch_value is same as query_level in request 
155  *******************************************************/
156
157 /* NET_R_LOGON_CTRL2 - response to LSA Logon Control2 */
158 typedef struct net_r_logon_ctrl2_info
159 {
160         uint32       switch_value;  /* 0x1, 0x3 */
161         uint32       ptr;
162
163         union
164         {
165                 NETLOGON_INFO_1 info1;
166                 NETLOGON_INFO_2 info2;
167                 NETLOGON_INFO_3 info3;
168
169         } logon;
170
171         uint32 status; /* return code */
172
173 } NET_R_LOGON_CTRL2;
174
175 /* NET_Q_TRUST_DOM_LIST - LSA Query Trusted Domains */
176 typedef struct net_q_trust_dom_info
177 {
178         uint32       ptr;             /* undocumented buffer pointer */
179         UNISTR2      uni_server_name; /* server name, starting with two '\'s */
180         
181         uint32       function_code; /* 0x31 */
182
183 } NET_Q_TRUST_DOM_LIST;
184
185 #define MAX_TRUST_DOMS 1
186
187 /* NET_R_TRUST_DOM_LIST - response to LSA Trusted Domains */
188 typedef struct net_r_trust_dom_info
189 {
190         UNISTR2 uni_trust_dom_name[MAX_TRUST_DOMS];
191
192         uint32 status; /* return code */
193
194 } NET_R_TRUST_DOM_LIST;
195
196
197 /* NEG_FLAGS */
198 typedef struct neg_flags_info
199 {
200     uint32 neg_flags; /* negotiated flags */
201
202 } NEG_FLAGS;
203
204
205 /* NET_Q_REQ_CHAL */
206 typedef struct net_q_req_chal_info
207 {
208     uint32  undoc_buffer; /* undocumented buffer pointer */
209     UNISTR2 uni_logon_srv; /* logon server unicode string */
210     UNISTR2 uni_logon_clnt; /* logon client unicode string */
211     DOM_CHAL clnt_chal; /* client challenge */
212
213 } NET_Q_REQ_CHAL;
214
215
216 /* NET_R_REQ_CHAL */
217 typedef struct net_r_req_chal_info
218 {
219     DOM_CHAL srv_chal; /* server challenge */
220
221   uint32 status; /* return code */
222
223 } NET_R_REQ_CHAL;
224
225
226
227 /* NET_Q_AUTH_2 */
228 typedef struct net_q_auth2_info
229 {
230     DOM_LOG_INFO clnt_id; /* client identification info */
231     DOM_CHAL clnt_chal;     /* client-calculated credentials */
232
233     NEG_FLAGS clnt_flgs; /* usually 0x0000 01ff */
234
235 } NET_Q_AUTH_2;
236
237
238 /* NET_R_AUTH_2 */
239 typedef struct net_r_auth2_info
240 {
241     DOM_CHAL srv_chal;     /* server-calculated credentials */
242     NEG_FLAGS srv_flgs; /* usually 0x0000 01ff */
243
244   uint32 status; /* return code */
245
246 } NET_R_AUTH_2;
247
248
249 /* NET_Q_SRV_PWSET */
250 typedef struct net_q_srv_pwset_info
251 {
252     DOM_CLNT_INFO clnt_id; /* client identification/authentication info */
253     uint8 pwd[16]; /* new password - undocumented. */
254
255 } NET_Q_SRV_PWSET;
256     
257 /* NET_R_SRV_PWSET */
258 typedef struct net_r_srv_pwset_info
259 {
260     DOM_CRED srv_cred;     /* server-calculated credentials */
261
262   uint32 status; /* return code */
263
264 } NET_R_SRV_PWSET;
265
266 /* NET_ID_INFO_2 */
267 typedef struct net_network_info_2
268 {
269         uint32            ptr_id_info2;        /* pointer to id_info_2 */
270         UNIHDR            hdr_domain_name;     /* domain name unicode header */
271         uint32            param_ctrl;          /* param control (0x2) */
272         DOM_LOGON_ID      logon_id;            /* logon ID */
273         UNIHDR            hdr_user_name;       /* user name unicode header */
274         UNIHDR            hdr_wksta_name;      /* workstation name unicode header */
275         uint8             lm_chal[8];          /* lan manager 8 byte challenge */
276         STRHDR            hdr_nt_chal_resp;    /* nt challenge response */
277         STRHDR            hdr_lm_chal_resp;    /* lm challenge response */
278
279         UNISTR2           uni_domain_name;     /* domain name unicode string */
280         UNISTR2           uni_user_name;       /* user name unicode string */
281         UNISTR2           uni_wksta_name;      /* workgroup name unicode string */
282         STRING2           nt_chal_resp;        /* nt challenge response */
283         STRING2           lm_chal_resp;        /* lm challenge response */
284
285 } NET_ID_INFO_2;
286
287 /* NET_ID_INFO_1 */
288 typedef struct id_info_1
289 {
290         uint32            ptr_id_info1;        /* pointer to id_info_1 */
291         UNIHDR            hdr_domain_name;     /* domain name unicode header */
292         uint32            param_ctrl;          /* param control */
293         DOM_LOGON_ID      logon_id;            /* logon ID */
294         UNIHDR            hdr_user_name;       /* user name unicode header */
295         UNIHDR            hdr_wksta_name;      /* workstation name unicode header */
296         OWF_INFO          lm_owf;              /* LM OWF Password */
297         OWF_INFO          nt_owf;              /* NT OWF Password */
298         UNISTR2           uni_domain_name;     /* domain name unicode string */
299         UNISTR2           uni_user_name;       /* user name unicode string */
300         UNISTR2           uni_wksta_name;      /* workgroup name unicode string */
301
302 } NET_ID_INFO_1;
303
304 /* NET_ID_INFO_CTR */
305 typedef struct net_id_info_ctr_info
306 {
307   uint16         switch_value;
308   
309   union
310   {
311     NET_ID_INFO_1 id1; /* auth-level 1 - interactive user login */
312     NET_ID_INFO_2 id2; /* auth-level 2 - workstation referred login */
313
314   } auth;
315   
316 } NET_ID_INFO_CTR;
317
318 /* SAM_INFO - sam logon/off id structure */
319 typedef struct sam_info
320 {
321   DOM_CLNT_INFO2  client;
322   uint32          ptr_rtn_cred; /* pointer to return credentials */
323   DOM_CRED        rtn_cred; /* return credentials */
324   uint16          logon_level;
325   NET_ID_INFO_CTR *ctr;
326   uint16          validation_level;
327
328 } DOM_SAM_INFO;
329
330 /* NET_Q_SAM_LOGON */
331 typedef struct net_q_sam_logon_info
332 {
333     DOM_SAM_INFO sam_id;
334
335 } NET_Q_SAM_LOGON;
336
337 /* NET_R_SAM_LOGON */
338 typedef struct net_r_sam_logon_info
339 {
340     uint32 buffer_creds; /* undocumented buffer pointer */
341     DOM_CRED srv_creds; /* server credentials.  server time stamp appears to be ignored. */
342     
343         uint16 switch_value; /* 3 - indicates type of USER INFO */
344     NET_USER_INFO_3 *user;
345
346     uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */
347
348   uint32 status; /* return code */
349
350 } NET_R_SAM_LOGON;
351
352
353 /* NET_Q_SAM_LOGOFF */
354 typedef struct net_q_sam_logoff_info
355 {
356     DOM_SAM_INFO sam_id;
357
358 } NET_Q_SAM_LOGOFF;
359
360 /* NET_R_SAM_LOGOFF */
361 typedef struct net_r_sam_logoff_info
362 {
363     uint32 buffer_creds; /* undocumented buffer pointer */
364     DOM_CRED srv_creds; /* server credentials.  server time stamp appears to be ignored. */
365     
366   uint32 status; /* return code */
367
368 } NET_R_SAM_LOGOFF;
369
370
371 #endif /* _RPC_NETLOGON_H */
372