This commit was manufactured by cvs2svn to create branch 'SAMBA_TNG'.
[Samba.git] / source / include / ntdomain.h
blob32c0f2558fb2bb7b0efa888c46852532376e72ff
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
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.
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.
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.
24 #ifndef _NT_DOMAIN_H /* _NT_DOMAIN_H */
25 #define _NT_DOMAIN_H
28 /* dce/rpc support */
29 #include "rpc_dce.h"
31 /* dce/rpc authentication support */
32 #include "rpc_ntlmssp.h"
33 #include "rpc_netsec.h"
35 /* miscellaneous structures / defines */
36 #include "rpc_misc.h"
38 /* security descriptor structures */
39 #include "rpc_secdes.h"
41 /* different dce/rpc pipes */
42 #include "rpc_lsa.h"
43 #include "rpc_netlogon.h"
44 #include "rpc_samr.h"
45 #include "rpc_srvsvc.h"
46 #include "rpc_svcctl.h"
47 #include "rpc_wkssvc.h"
48 #include "rpc_atsvc.h"
49 #include "rpc_eventlog.h"
50 #include "rpc_dfs.h"
52 /* MS AD prototypes */
53 #include "sam.h"
55 /*
56 * A bunch of stuff that was put into smb.h
57 * in the NTDOM branch - it didn't belong there.
60 #define CHECK_STRUCT(data) \
61 { \
62 if ((data)->struct_start != 0xfefefefe || \
63 (data)->struct_end != 0xdcdcdcdc) \
64 { \
65 DEBUG(0,("uninitialised structure (%s, %d)\n", \
66 FUNCTION_MACRO, __LINE__)); \
67 sleep(30); \
68 } \
71 typedef struct parse_struct
73 uint32 struct_start;
75 char *data; /* memory buffer */
76 size_t data_size; /* current memory buffer size */
77 /* array memory offsets */
78 uint32 start;
79 uint32 end;
81 uint32 offset; /* offset currently being accessed in memory buffer */
82 uint8 align; /* data alignment */
83 BOOL io; /* parsing in or out of data stream */
84 BOOL error; /* error occurred while parsing (out of memory bounds) */
85 BOOL bigendian; /* big-endian data */
87 struct parse_struct *next;
89 uint32 struct_end;
92 prs_struct;
95 * Defines for io member of prs_struct.
98 #define MARSHALL 0
99 #define UNMARSHALL 1
101 #define MARSHALLING(ps) (!(ps)->io)
102 #define UNMARSHALLING(ps) ((ps)->io)
104 #include "rpc_spoolss.h"
106 typedef struct netsec_auth_struct
108 RPC_AUTH_NETSEC_NEG netsec_neg;
109 uchar sess_key[16];
111 uint32 seq_num;
114 netsec_auth_struct;
116 typedef struct ntlmssp_auth_struct
118 RPC_AUTH_NTLMSSP_CHAL ntlmssp_chal;
120 unsigned char ntlmssp_hash[258];
121 uint32 ntlmssp_seq_num;
124 ntlmssp_auth_struct;
126 struct srv_auth_fns;
128 typedef struct rpcsrv_struct
130 prs_struct data_i; /* input data (intermediate, for fragments) */
131 prs_struct rdata; /* output data (to create fragments from */
133 /* indicates how far in rdata we have got, creating fragments */
134 uint32 rdata_offset;
136 prs_struct smb_pdu;
137 prs_struct rsmb_pdu;
139 void *auth_info;
140 struct srv_auth_fns *auth;
142 /* set of authentication modules. does not include noauth */
143 uint32 num_auths;
144 struct srv_auth_fns **auth_fns;
146 BOOL auth_validated;
147 BOOL faulted_once_before;
149 RPC_HDR hdr;
150 RPC_HDR_BA hdr_ba;
151 RPC_HDR_RB hdr_rb;
152 RPC_HDR_REQ hdr_req;
154 vuser_key key;
155 vuser_key initial_pipe_key;
157 int c; /* socket */
160 rpcsrv_struct;
162 struct cli_connection;
164 typedef struct cli_auth_fns
166 /* these three will do for now. they *should* match with server-side */
167 BOOL (*create_bind_req) (struct cli_connection *, prs_struct *,
168 uint32, RPC_IFACE *, RPC_IFACE *);
169 BOOL (*decode_bind_resp) (struct cli_connection *, prs_struct *);
170 BOOL (*create_bind_cont) (struct cli_connection *, prs_struct *,
171 uint32);
172 /* creates an authenticated PDU */
173 BOOL (*cli_create_pdu) (struct cli_connection *, uint8,
174 prs_struct *, int, int *,
175 prs_struct *, uint8 *);
176 /* decodes an authenticated PDU */
177 BOOL (*cli_decode_pdu) (struct cli_connection *, prs_struct *,
178 int, int);
181 cli_auth_fns;
183 typedef struct srv_auth_fns
185 BOOL (*api_is_auth) (RPC_HDR_AUTH *, void **auth_info);
187 /* state-based authentication: one to decode, one to generate */
188 BOOL (*api_auth_chk) (rpcsrv_struct *, enum RPC_PKT_TYPE);
189 BOOL (*api_auth_gen) (rpcsrv_struct *, prs_struct *,
190 enum RPC_PKT_TYPE);
192 /* decodes an authenticated PDU */
193 BOOL (*api_decode_pdu) (rpcsrv_struct *);
194 /* creates an authenticated PDU */
195 BOOL (*api_create_pdu) (rpcsrv_struct *, uint32, prs_struct *);
198 srv_auth_fns;
200 typedef struct pipes_struct
202 struct pipes_struct *next, *prev;
203 int pnum;
204 vuser_key key;
205 uint16 device_state;
206 uint16 priority;
207 fstring name;
208 fstring pipe_srv_name;
210 /* remote, server-side rpc redirection */
211 struct msrpc_local *m;
213 /* local, server-side rpc state processing */
214 rpcsrv_struct *l;
217 pipes_struct;
219 typedef struct msrpc_service_fns
221 void (*auth_init) (rpcsrv_struct *);
222 void (*service_init) (char *);
223 BOOL (*reload_services) (BOOL);
224 int (*main_init) (int, char *[]);
225 void (*idle) (void);
228 msrpc_service_fns;
230 struct api_struct
232 char *name;
233 uint8 opnum;
234 BOOL (*fn) (prs_struct *, prs_struct *);
237 struct acct_info
239 fstring acct_name; /* account name */
240 fstring acct_desc; /* account description */
241 uint32 rid; /* domain-relative RID */
245 * higher order functions for use with msrpc client code
248 #define ALIAS_FN(fn)\
249 void (*fn)(const char*, const DOM_SID*, uint32, const char*)
250 #define ALIAS_INFO_FN(fn)\
251 void (*fn)(const char*, const DOM_SID*, uint32, ALIAS_INFO_CTR *const)
252 #define ALIAS_MEM_FN(fn)\
253 void(*fn)(const char*, const DOM_SID*, uint32, const char*,\
254 uint32, DOM_SID *const *const, char *const *const,\
255 uint32*const)
257 #define GROUP_FN(fn)\
258 void (*fn)(const char*, const DOM_SID*, uint32, const char*)
259 #define GROUP_INFO_FN(fn)\
260 void (*fn)(const char*, const DOM_SID*, uint32, GROUP_INFO_CTR *const)
261 #define GROUP_MEM_FN(fn)\
262 void(*fn)(const char*, const DOM_SID*, uint32, const char*,\
263 uint32, const uint32*, char *const *const,\
264 uint32*const)
266 #define DOMAIN_FN(fn)\
267 void (*fn)(const char*)
268 #define DOMAIN_INFO_FN(fn)\
269 void (*fn)(const char*, const DOM_SID *, uint32, SAM_UNK_CTR *)
271 #define USER_FN(fn)\
272 void (*fn)(const char*, const DOM_SID*, uint32, const char*)
273 #define USER_INFO_FN(fn)\
274 void (*fn)(const char*, const DOM_SID*, uint32, \
275 SAM_USERINFO_CTR *const)
276 #define USER_MEM_FN(fn)\
277 void (*fn)(const char*, const DOM_SID*, uint32, const char*,\
278 uint32, const uint32*, char *const *const, uint32* const)
280 #define DISP_FN(fn)\
281 void (*fn)(const char*, const DOM_SID*, uint16, uint32, \
282 SAM_DISPINFO_CTR *)
284 #define REG_FN(fn)\
285 void (*fn)(int, const char *, int)
286 #define REG_KEY_FN(fn)\
287 void (*fn)(const char*, const char*, time_t)
288 #define REG_VAL_FN(fn)\
289 void (*fn)(const char *, const char*, uint32, const BUFFER2 *)
291 #define SVC_QUERY_FN(fn)\
292 void (*fn)(const QUERY_SERVICE_CONFIG *)
293 #define SVC_INFO_FN(fn)\
294 void (*fn)(const ENUM_SRVC_STATUS *)
296 #define TPRT_INFO_FN(fn)\
297 void (*fn)(const SRV_TPRT_INFO_CTR *)
299 #define PRINT_INFO_FN(fn)\
300 void (*fn)(const char*, uint32, uint32, void *const *const)
301 #define JOB_INFO_FN(fn)\
302 void (*fn)(const char*, const char*, uint32, uint32, void *const *const)
304 #endif /* _NT_DOMAIN_H */