r2889: add DRSUAPI server
[ira/wip.git] / source4 / rpc_server / drsuapi / dcesrv_drsuapi.c
1 /* 
2    Unix SMB/CIFS implementation.
3
4    endpoint server for the drsuapi pipe
5
6    Copyright (C) Stefan Metzmacher 2004
7    
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #include "includes.h"
24 #include "rpc_server/common/common.h"
25 #include "rpc_server/drsuapi/dcesrv_drsuapi.h"
26
27 /*
28   destroy a general handle. 
29 */
30 static void drsuapi_handle_destroy(struct dcesrv_connection *conn, struct dcesrv_handle *h)
31 {
32         talloc_free(h->data);
33 }
34
35 /* 
36   drsuapi_DsBind 
37 */
38 static NTSTATUS drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
39                        struct drsuapi_DsBind *r)
40 {
41         struct drsuapi_bind_state *b_state;
42         struct dcesrv_handle *handle;
43
44         r->out.info = NULL;
45         ZERO_STRUCTP(r->out.bind_handle);
46
47         b_state = talloc_p(dce_call->conn, struct drsuapi_bind_state);
48         if (!b_state) {
49                 return NT_STATUS_NO_MEMORY;
50         }
51
52         /* TODO: fill b_state here */
53
54         handle = dcesrv_handle_new(dce_call->conn, DRSUAPI_BIND_HANDLE);
55         if (!handle) {
56                 talloc_free(b_state);
57                 return NT_STATUS_NO_MEMORY;
58         }
59
60         handle->data = b_state;
61         handle->destroy = drsuapi_handle_destroy;
62
63         *r->out.bind_handle = handle->wire_handle;
64
65         return NT_STATUS_OK;
66 }
67
68
69 /* 
70   drsuapi_DsUnbind 
71 */
72 static NTSTATUS drsuapi_DsUnbind(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
73                        struct drsuapi_DsUnbind *r)
74 {
75         struct dcesrv_handle *h;
76
77         *r->out.bind_handle = *r->in.bind_handle;
78
79         DCESRV_PULL_HANDLE(h, r->in.bind_handle, DRSUAPI_BIND_HANDLE);
80
81         /* this causes the callback drsuapi_handle_destroy() to be called by
82            the handle destroy code which destroys the state associated
83            with the handle */
84         dcesrv_handle_destroy(dce_call->conn, h);
85
86         ZERO_STRUCTP(r->out.bind_handle);
87
88         return NT_STATUS_OK;
89 }
90
91
92 /* 
93   DRSUAPI_REPLICA_SYNC 
94 */
95 static NTSTATUS DRSUAPI_REPLICA_SYNC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
96                        struct DRSUAPI_REPLICA_SYNC *r)
97 {
98         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
99 }
100
101
102 /* 
103   DRSUAPI_GET_NC_CHANGES 
104 */
105 static NTSTATUS DRSUAPI_GET_NC_CHANGES(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
106                        struct DRSUAPI_GET_NC_CHANGES *r)
107 {
108         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
109 }
110
111
112 /* 
113   DRSUAPI_UPDATE_REFS 
114 */
115 static NTSTATUS DRSUAPI_UPDATE_REFS(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
116                        struct DRSUAPI_UPDATE_REFS *r)
117 {
118         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
119 }
120
121
122 /* 
123   DRSUAPI_REPLICA_ADD 
124 */
125 static NTSTATUS DRSUAPI_REPLICA_ADD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
126                        struct DRSUAPI_REPLICA_ADD *r)
127 {
128         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
129 }
130
131
132 /* 
133   DRSUAPI_REPLICA_DEL 
134 */
135 static NTSTATUS DRSUAPI_REPLICA_DEL(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
136                        struct DRSUAPI_REPLICA_DEL *r)
137 {
138         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
139 }
140
141
142 /* 
143   DRSUAPI_REPLICA_MODIFY 
144 */
145 static NTSTATUS DRSUAPI_REPLICA_MODIFY(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
146                        struct DRSUAPI_REPLICA_MODIFY *r)
147 {
148         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
149 }
150
151
152 /* 
153   DRSUAPI_VERIFY_NAMES 
154 */
155 static NTSTATUS DRSUAPI_VERIFY_NAMES(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
156                        struct DRSUAPI_VERIFY_NAMES *r)
157 {
158         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
159 }
160
161
162 /* 
163   DRSUAPI_GET_MEMBERSHIPS 
164 */
165 static NTSTATUS DRSUAPI_GET_MEMBERSHIPS(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
166                        struct DRSUAPI_GET_MEMBERSHIPS *r)
167 {
168         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
169 }
170
171
172 /* 
173   DRSUAPI_INTER_DOMAIN_MOVE 
174 */
175 static NTSTATUS DRSUAPI_INTER_DOMAIN_MOVE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
176                        struct DRSUAPI_INTER_DOMAIN_MOVE *r)
177 {
178         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
179 }
180
181
182 /* 
183   DRSUAPI_GET_NT4_CHANGELOG 
184 */
185 static NTSTATUS DRSUAPI_GET_NT4_CHANGELOG(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
186                        struct DRSUAPI_GET_NT4_CHANGELOG *r)
187 {
188         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
189 }
190
191
192 /* 
193   DRSUAPI_CRACKNAMES 
194 */
195 static NTSTATUS DRSUAPI_CRACKNAMES(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
196                        struct DRSUAPI_CRACKNAMES *r)
197 {
198         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
199 }
200
201
202 /* 
203   DRSUAPI_WRITE_SPN 
204 */
205 static NTSTATUS DRSUAPI_WRITE_SPN(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
206                        struct DRSUAPI_WRITE_SPN *r)
207 {
208         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
209 }
210
211
212 /* 
213   DRSUAPI_REMOVE_DS_SERVER 
214 */
215 static NTSTATUS DRSUAPI_REMOVE_DS_SERVER(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
216                        struct DRSUAPI_REMOVE_DS_SERVER *r)
217 {
218         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
219 }
220
221
222 /* 
223   DRSUAPI_REMOVE_DS_DOMAIN 
224 */
225 static NTSTATUS DRSUAPI_REMOVE_DS_DOMAIN(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
226                        struct DRSUAPI_REMOVE_DS_DOMAIN *r)
227 {
228         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
229 }
230
231
232 /* 
233   DRSUAPI_DOMAIN_CONTROLLER_INFO 
234 */
235 static NTSTATUS DRSUAPI_DOMAIN_CONTROLLER_INFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
236                        struct DRSUAPI_DOMAIN_CONTROLLER_INFO *r)
237 {
238         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
239 }
240
241
242 /* 
243   DRSUAPI_ADD_ENTRY 
244 */
245 static NTSTATUS DRSUAPI_ADD_ENTRY(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
246                        struct DRSUAPI_ADD_ENTRY *r)
247 {
248         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
249 }
250
251
252 /* 
253   DRSUAPI_EXECUTE_KCC 
254 */
255 static NTSTATUS DRSUAPI_EXECUTE_KCC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
256                        struct DRSUAPI_EXECUTE_KCC *r)
257 {
258         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
259 }
260
261
262 /* 
263   DRSUAPI_GET_REPL_INFO 
264 */
265 static NTSTATUS DRSUAPI_GET_REPL_INFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
266                        struct DRSUAPI_GET_REPL_INFO *r)
267 {
268         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
269 }
270
271
272 /* 
273   DRSUAPI_ADD_SID_HISTORY 
274 */
275 static NTSTATUS DRSUAPI_ADD_SID_HISTORY(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
276                        struct DRSUAPI_ADD_SID_HISTORY *r)
277 {
278         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
279 }
280
281
282 /* 
283   DRSUAPI_GET_MEMBERSHIPS2 
284 */
285 static NTSTATUS DRSUAPI_GET_MEMBERSHIPS2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
286                        struct DRSUAPI_GET_MEMBERSHIPS2 *r)
287 {
288         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
289 }
290
291
292 /* 
293   DRSUAPI_REPLICA_VERIFY_OBJECTS 
294 */
295 static NTSTATUS DRSUAPI_REPLICA_VERIFY_OBJECTS(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
296                        struct DRSUAPI_REPLICA_VERIFY_OBJECTS *r)
297 {
298         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
299 }
300
301
302 /* 
303   DRSUAPI_GET_OBJECT_EXISTENCE 
304 */
305 static NTSTATUS DRSUAPI_GET_OBJECT_EXISTENCE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
306                        struct DRSUAPI_GET_OBJECT_EXISTENCE *r)
307 {
308         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
309 }
310
311
312 /* 
313   DRSUAPI_QUERY_SITES_BY_COST 
314 */
315 static NTSTATUS DRSUAPI_QUERY_SITES_BY_COST(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
316                        struct DRSUAPI_QUERY_SITES_BY_COST *r)
317 {
318         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
319 }
320
321
322 /* include the generated boilerplate */
323 #include "librpc/gen_ndr/ndr_drsuapi_s.c"