096e7cd66cab28bef1fd2986aea35d6472f19874
[kai/samba.git] / source3 / include / ntdomain.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 _NT_DOMAIN_H /* _NT_DOMAIN_H */
25 #define _NT_DOMAIN_H 
26
27
28 /* dce/rpc support */
29 #include "rpc_dce.h"
30
31 /* miscellaneous structures / defines */
32 #include "rpc_misc.h"
33
34 /* security descriptor structures */
35 #include "rpc_secdes.h" 
36
37 /* different dce/rpc pipes */
38 #include "rpc_lsa.h"
39 #include "rpc_netlogon.h"
40 #include "rpc_reg.h"
41 #include "rpc_samr.h"
42 #include "rpc_srvsvc.h"
43 #include "rpc_svcctl.h"
44 #include "rpc_wkssvc.h"
45 #include "rpc_brs.h"
46 #include "rpc_atsvc.h"
47 #include "rpc_spoolss.h"
48 #include "rpc_eventlog.h"
49
50 /* 
51  * A bunch of stuff that was put into smb.h
52  * in the NTDOM branch - it didn't belong there.
53  */
54  
55 typedef struct
56 {
57         struct mem_buf *data; /* memory buffer */
58         uint32 offset; /* offset currently being accessed in memory buffer */
59         uint8 align; /* data alignment */
60         BOOL io; /* parsing in or out of data stream */
61         BOOL error; /* error occurred */
62
63 } prs_struct;
64
65 typedef struct rpcsrv_struct
66 {
67         prs_struct rhdr; /* output header */
68         prs_struct rfault; /* fault */
69         prs_struct rdata; /* output data */
70         prs_struct rdata_i; /* output data (intermediate, for fragments) */
71         prs_struct rauth; /* output authentication verifier */
72         prs_struct rverf; /* output verifier */
73         prs_struct rntlm; /* output ntlmssp */
74
75         RPC_HDR       hdr;
76         RPC_HDR_BA    hdr_ba;
77         RPC_HDR_RB    hdr_rb;
78         RPC_HDR_REQ   hdr_req;
79         RPC_HDR_RESP  hdr_resp;
80         RPC_HDR_FAULT hdr_fault;
81         RPC_HDR_AUTH  auth_info;
82         RPC_HDR_AUTHA autha_info;
83
84         RPC_AUTH_NTLMSSP_VERIFIER auth_verifier;
85         RPC_AUTH_NTLMSSP_NEG      ntlmssp_neg;
86         RPC_AUTH_NTLMSSP_CHAL     ntlmssp_chal;
87         RPC_AUTH_NTLMSSP_RESP     ntlmssp_resp;
88         RPC_AUTH_NTLMSSP_CHK      ntlmssp_chk;
89
90         BOOL ntlmssp_auth;
91         BOOL ntlmssp_validated;
92         unsigned char ntlmssp_hash[258];
93         uint32 ntlmssp_seq_num;
94         fstring user_name;
95         fstring domain;
96         fstring wks;
97
98         uchar user_sess_key[16];
99
100         /* per-user authentication info.  hmm, this not appropriate, but
101            it will do for now.  dcinfo contains NETLOGON-specific info,
102            so have to think of a better method.
103          */
104         struct dcinfo dc;
105
106 } rpcsrv_struct;
107
108 typedef struct pipes_struct
109 {
110         struct pipes_struct *next, *prev;
111         int pnum;
112         connection_struct *conn;
113         uint16 vuid;
114         BOOL open; /* open connection */
115         uint16 device_state;
116         uint16 priority;
117         fstring name;
118         fstring pipe_srv_name;
119
120         /* remote, server-side rpc redirection */
121         struct msrpc_state *m;
122
123         /* local, server-side rpc state processing */
124         rpcsrv_struct *l;
125
126         /* to store pdus being constructed / communicated from smb to msrpc */
127         prs_struct smb_pdu;
128         prs_struct rsmb_pdu;
129
130         /* state-based info used in processing smbs to/from msrpc pdus */ 
131         uint32 file_offset;
132         uint32 prev_pdu_file_offset;
133         uint32 hdr_offsets;
134
135 } pipes_struct;
136
137 struct api_struct
138 {  
139   char *name;
140   uint8 opnum;
141   void (*fn) (rpcsrv_struct*, prs_struct*, prs_struct*);
142 };
143
144 struct mem_desc
145 {  
146         /* array memory offsets */
147         uint32 start; 
148         uint32 end;
149 };
150    
151 struct mem_buf
152 {  
153         BOOL dynamic; /* True iff data has been dynamically allocated
154                                          (and therefore can be freed) */
155         char *data;
156         uint32 data_size;
157         uint32 data_used;
158
159         uint32 margin; /* safety margin when reallocing. */
160                                    /* this can be abused quite nicely */
161         uint8 align;   /* alignment of data structures (smb, dce/rpc, udp etc) */
162
163         struct mem_desc offset;
164
165         struct mem_buf *next;
166 };
167
168 struct acct_info
169 {
170     fstring acct_name; /* account name */
171     fstring acct_desc; /* account description */
172     uint32  rid; /* domain-relative RID */
173 };
174
175 /*
176  * higher order functions for use with msrpc client code
177  */
178
179 #define ALIAS_FN(fn)\
180         void (*fn)(const char*, const DOM_SID*, uint32, const char*)
181 #define ALIAS_INFO_FN(fn)\
182         void (*fn)(const char*, const DOM_SID*, uint32, ALIAS_INFO_CTR *const)
183 #define ALIAS_MEM_FN(fn)\
184         void(*fn)(const char*, const DOM_SID*, uint32, const char*,\
185                   uint32, DOM_SID *const *const, char *const *const,\
186                   uint8*const)
187
188 #define GROUP_FN(fn)\
189         void (*fn)(const char*, const DOM_SID*, uint32, const char*)
190 #define GROUP_INFO_FN(fn)\
191         void (*fn)(const char*, const DOM_SID*, uint32, GROUP_INFO_CTR *const)
192 #define GROUP_MEM_FN(fn)\
193         void(*fn)(const char*, const DOM_SID*, uint32, const char*,\
194                   uint32, const uint32*, char *const *const,\
195                   uint32*const)
196
197 #define DOMAIN_FN(fn)\
198         void (*fn)(const char*)
199 #define DOMAIN_INFO_FN(fn)\
200         void (*fn)(const char*, const DOM_SID *, uint32, SAM_UNK_CTR *)
201
202 #define USER_FN(fn)\
203         void (*fn)(const char*, const DOM_SID*, uint32, const char*)
204 #define USER_INFO_FN(fn)\
205         void (*fn)(const char*, const DOM_SID*, uint32,\
206                    SAM_USER_INFO_21 *const)
207 #define USER_MEM_FN(fn)\
208         void (*fn)(const char*, const DOM_SID*, uint32, const char*,\
209                    uint32, const uint32*, char *const *const, uint32* const)
210
211 #define DISP_FN(fn)\
212         void (*fn)(const char*, const DOM_SID*, uint16, uint32, \
213                    SAM_DISPINFO_CTR *)
214
215 #define REG_FN(fn)\
216         void (*fn)(int, const char *, int)
217 #define REG_KEY_FN(fn)\
218         void (*fn)(const char*, const char*, time_t)
219 #define REG_VAL_FN(fn)\
220         void (*fn)(const char *, const char*, uint32, const BUFFER2 *)
221
222 #define SVC_QUERY_FN(fn)\
223         void (*fn)(const QUERY_SERVICE_CONFIG *)
224 #define SVC_INFO_FN(fn)\
225         void (*fn)(const ENUM_SRVC_STATUS *)
226
227 #define TPRT_INFO_FN(fn)\
228         void (*fn)(const SRV_TPRT_INFO_CTR *)
229
230 #define PRINT_INFO_FN(fn)\
231         void (*fn)(const char*, uint32, uint32, void  *const *const)
232 #define JOB_INFO_FN(fn)\
233         void (*fn)(const char*, const char*, uint32, uint32, void *const *const)
234
235 #endif /* _NT_DOMAIN_H */
236