2 Unix SMB/CIFS implementation.
4 endpoint server for the drsuapi pipe
6 Copyright (C) Stefan Metzmacher 2004
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.
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.
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.
24 #include "rpc_server/common/common.h"
25 #include "rpc_server/drsuapi/dcesrv_drsuapi.h"
28 destroy a general handle.
30 static void drsuapi_handle_destroy(struct dcesrv_connection
*conn
, struct dcesrv_handle
*h
)
38 static NTSTATUS
drsuapi_DsBind(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
39 struct drsuapi_DsBind
*r
)
41 struct drsuapi_bind_state
*b_state
;
42 struct dcesrv_handle
*handle
;
45 ZERO_STRUCTP(r
->out
.bind_handle
);
47 b_state
= talloc_p(dce_call
->conn
, struct drsuapi_bind_state
);
49 return NT_STATUS_NO_MEMORY
;
52 /* TODO: fill b_state here */
54 handle
= dcesrv_handle_new(dce_call
->conn
, DRSUAPI_BIND_HANDLE
);
57 return NT_STATUS_NO_MEMORY
;
60 handle
->data
= b_state
;
61 handle
->destroy
= drsuapi_handle_destroy
;
63 *r
->out
.bind_handle
= handle
->wire_handle
;
72 static NTSTATUS
drsuapi_DsUnbind(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
73 struct drsuapi_DsUnbind
*r
)
75 struct dcesrv_handle
*h
;
77 *r
->out
.bind_handle
= *r
->in
.bind_handle
;
79 DCESRV_PULL_HANDLE(h
, r
->in
.bind_handle
, DRSUAPI_BIND_HANDLE
);
81 /* this causes the callback drsuapi_handle_destroy() to be called by
82 the handle destroy code which destroys the state associated
84 dcesrv_handle_destroy(dce_call
->conn
, h
);
86 ZERO_STRUCTP(r
->out
.bind_handle
);
95 static NTSTATUS
DRSUAPI_REPLICA_SYNC(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
96 struct DRSUAPI_REPLICA_SYNC
*r
)
98 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
103 DRSUAPI_GET_NC_CHANGES
105 static NTSTATUS
DRSUAPI_GET_NC_CHANGES(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
106 struct DRSUAPI_GET_NC_CHANGES
*r
)
108 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
115 static NTSTATUS
DRSUAPI_UPDATE_REFS(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
116 struct DRSUAPI_UPDATE_REFS
*r
)
118 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
125 static NTSTATUS
DRSUAPI_REPLICA_ADD(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
126 struct DRSUAPI_REPLICA_ADD
*r
)
128 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
135 static NTSTATUS
DRSUAPI_REPLICA_DEL(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
136 struct DRSUAPI_REPLICA_DEL
*r
)
138 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
143 DRSUAPI_REPLICA_MODIFY
145 static NTSTATUS
DRSUAPI_REPLICA_MODIFY(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
146 struct DRSUAPI_REPLICA_MODIFY
*r
)
148 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
155 static NTSTATUS
DRSUAPI_VERIFY_NAMES(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
156 struct DRSUAPI_VERIFY_NAMES
*r
)
158 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
163 DRSUAPI_GET_MEMBERSHIPS
165 static NTSTATUS
DRSUAPI_GET_MEMBERSHIPS(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
166 struct DRSUAPI_GET_MEMBERSHIPS
*r
)
168 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
173 DRSUAPI_INTER_DOMAIN_MOVE
175 static NTSTATUS
DRSUAPI_INTER_DOMAIN_MOVE(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
176 struct DRSUAPI_INTER_DOMAIN_MOVE
*r
)
178 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
183 DRSUAPI_GET_NT4_CHANGELOG
185 static NTSTATUS
DRSUAPI_GET_NT4_CHANGELOG(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
186 struct DRSUAPI_GET_NT4_CHANGELOG
*r
)
188 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
195 static NTSTATUS
drsuapi_DsCrackNames(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
196 struct drsuapi_DsCrackNames
*r
)
198 struct dcesrv_handle
*h
;
200 r
->out
.level
= r
->in
.level
;
201 ZERO_STRUCT(r
->out
.out
);
203 DCESRV_PULL_HANDLE(h
, r
->in
.bind_handle
, DRSUAPI_BIND_HANDLE
);
205 switch (r
->in
.level
) {
209 r
->out
.out
.info1
= talloc_p(mem_ctx
, struct drsuapi_DsCrackNamesOutInfo1
);
210 NTSTATUS_TALLOC_CHECK(r
->out
.out
.info1
);
212 r
->out
.out
.info1
->names
= talloc_array_p(mem_ctx
,
213 struct drsuapi_DsCrackNamesOutInfo1Names
,
214 r
->in
.in
.info1
.count
);
215 NTSTATUS_TALLOC_CHECK(r
->out
.out
.info1
->names
);
217 r
->out
.out
.info1
->count
= r
->in
.in
.info1
.count
;
219 for (i
=0; i
< r
->out
.out
.info1
->count
; i
++) {
221 r
->out
.out
.info1
->names
[i
].unknown1
= 2;
222 r
->out
.out
.info1
->names
[i
].name1
= NULL
;
223 r
->out
.out
.info1
->names
[i
].name2
= NULL
;
225 /* TODO: fill crack the right names! */
226 name
= talloc_asprintf(mem_ctx
, "%s/", lp_realm());
227 if (strcmp(name
, r
->in
.in
.info1
.names
[i
].str
) != 0) {
230 r
->out
.out
.info1
->names
[i
].unknown1
= 0;
231 r
->out
.out
.info1
->names
[i
].name1
= talloc_asprintf(mem_ctx
, "%s", lp_realm());
232 r
->out
.out
.info1
->names
[i
].name2
= talloc_asprintf(mem_ctx
, "%s\\", lp_workgroup());
238 return NT_STATUS_INVALID_LEVEL
;
245 static NTSTATUS
DRSUAPI_WRITE_SPN(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
246 struct DRSUAPI_WRITE_SPN
*r
)
248 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
253 DRSUAPI_REMOVE_DS_SERVER
255 static NTSTATUS
DRSUAPI_REMOVE_DS_SERVER(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
256 struct DRSUAPI_REMOVE_DS_SERVER
*r
)
258 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
263 DRSUAPI_REMOVE_DS_DOMAIN
265 static NTSTATUS
DRSUAPI_REMOVE_DS_DOMAIN(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
266 struct DRSUAPI_REMOVE_DS_DOMAIN
*r
)
268 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
273 DRSUAPI_DOMAIN_CONTROLLER_INFO
275 static NTSTATUS
DRSUAPI_DOMAIN_CONTROLLER_INFO(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
276 struct DRSUAPI_DOMAIN_CONTROLLER_INFO
*r
)
278 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
285 static NTSTATUS
DRSUAPI_ADD_ENTRY(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
286 struct DRSUAPI_ADD_ENTRY
*r
)
288 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
295 static NTSTATUS
DRSUAPI_EXECUTE_KCC(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
296 struct DRSUAPI_EXECUTE_KCC
*r
)
298 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
303 DRSUAPI_GET_REPL_INFO
305 static NTSTATUS
DRSUAPI_GET_REPL_INFO(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
306 struct DRSUAPI_GET_REPL_INFO
*r
)
308 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
313 DRSUAPI_ADD_SID_HISTORY
315 static NTSTATUS
DRSUAPI_ADD_SID_HISTORY(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
316 struct DRSUAPI_ADD_SID_HISTORY
*r
)
318 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
323 DRSUAPI_GET_MEMBERSHIPS2
325 static NTSTATUS
DRSUAPI_GET_MEMBERSHIPS2(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
326 struct DRSUAPI_GET_MEMBERSHIPS2
*r
)
328 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
333 DRSUAPI_REPLICA_VERIFY_OBJECTS
335 static NTSTATUS
DRSUAPI_REPLICA_VERIFY_OBJECTS(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
336 struct DRSUAPI_REPLICA_VERIFY_OBJECTS
*r
)
338 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
343 DRSUAPI_GET_OBJECT_EXISTENCE
345 static NTSTATUS
DRSUAPI_GET_OBJECT_EXISTENCE(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
346 struct DRSUAPI_GET_OBJECT_EXISTENCE
*r
)
348 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
353 DRSUAPI_QUERY_SITES_BY_COST
355 static NTSTATUS
DRSUAPI_QUERY_SITES_BY_COST(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
356 struct DRSUAPI_QUERY_SITES_BY_COST
*r
)
358 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
362 /* include the generated boilerplate */
363 #include "librpc/gen_ndr/ndr_drsuapi_s.c"