Line data Source code
1 : /* client functions auto-generated by pidl */
2 :
3 : #include "includes.h"
4 : #include <tevent.h>
5 : #include "lib/util/tevent_ntstatus.h"
6 : #include "bin/default/librpc/gen_ndr/ndr_mdssvc.h"
7 : #include "bin/default/librpc/gen_ndr/ndr_mdssvc_c.h"
8 :
9 : /* mdssvc - client functions generated by pidl */
10 :
11 : struct dcerpc_mdssvc_open_r_state {
12 : TALLOC_CTX *out_mem_ctx;
13 : };
14 :
15 : static void dcerpc_mdssvc_open_r_done(struct tevent_req *subreq);
16 :
17 0 : struct tevent_req *dcerpc_mdssvc_open_r_send(TALLOC_CTX *mem_ctx,
18 : struct tevent_context *ev,
19 : struct dcerpc_binding_handle *h,
20 : struct mdssvc_open *r)
21 : {
22 : struct tevent_req *req;
23 : struct dcerpc_mdssvc_open_r_state *state;
24 : struct tevent_req *subreq;
25 :
26 0 : req = tevent_req_create(mem_ctx, &state,
27 : struct dcerpc_mdssvc_open_r_state);
28 0 : if (req == NULL) {
29 0 : return NULL;
30 : }
31 :
32 0 : state->out_mem_ctx = talloc_new(state);
33 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
34 0 : return tevent_req_post(req, ev);
35 : }
36 :
37 0 : subreq = dcerpc_binding_handle_call_send(state, ev, h,
38 : NULL, &ndr_table_mdssvc,
39 0 : NDR_MDSSVC_OPEN, state->out_mem_ctx, r);
40 0 : if (tevent_req_nomem(subreq, req)) {
41 0 : return tevent_req_post(req, ev);
42 : }
43 0 : tevent_req_set_callback(subreq, dcerpc_mdssvc_open_r_done, req);
44 :
45 0 : return req;
46 : }
47 :
48 0 : static void dcerpc_mdssvc_open_r_done(struct tevent_req *subreq)
49 : {
50 0 : struct tevent_req *req =
51 0 : tevent_req_callback_data(subreq,
52 : struct tevent_req);
53 : NTSTATUS status;
54 :
55 0 : status = dcerpc_binding_handle_call_recv(subreq);
56 0 : TALLOC_FREE(subreq);
57 0 : if (tevent_req_nterror(req, status)) {
58 0 : return;
59 : }
60 :
61 0 : tevent_req_done(req);
62 : }
63 :
64 0 : NTSTATUS dcerpc_mdssvc_open_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
65 : {
66 0 : struct dcerpc_mdssvc_open_r_state *state =
67 0 : tevent_req_data(req,
68 : struct dcerpc_mdssvc_open_r_state);
69 : NTSTATUS status;
70 :
71 0 : if (tevent_req_is_nterror(req, &status)) {
72 0 : tevent_req_received(req);
73 0 : return status;
74 : }
75 :
76 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
77 :
78 0 : tevent_req_received(req);
79 0 : return NT_STATUS_OK;
80 : }
81 :
82 0 : NTSTATUS dcerpc_mdssvc_open_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct mdssvc_open *r)
83 : {
84 : NTSTATUS status;
85 :
86 0 : status = dcerpc_binding_handle_call(h,
87 : NULL, &ndr_table_mdssvc,
88 : NDR_MDSSVC_OPEN, mem_ctx, r);
89 :
90 0 : return status;
91 : }
92 :
93 : struct dcerpc_mdssvc_open_state {
94 : struct mdssvc_open orig;
95 : struct mdssvc_open tmp;
96 : TALLOC_CTX *out_mem_ctx;
97 : };
98 :
99 : static void dcerpc_mdssvc_open_done(struct tevent_req *subreq);
100 :
101 0 : struct tevent_req *dcerpc_mdssvc_open_send(TALLOC_CTX *mem_ctx,
102 : struct tevent_context *ev,
103 : struct dcerpc_binding_handle *h,
104 : uint32_t *_device_id /* [in,out] [ref] */,
105 : uint32_t *_unkn2 /* [in,out] [ref] */,
106 : uint32_t *_unkn3 /* [in,out] [ref] */,
107 : const char *_share_mount_path /* [in] [charset(UTF8),size_is(1025)] */,
108 : const char *_share_name /* [in] [charset(UTF8),size_is(1025)] */,
109 : const char *_share_path /* [out] [charset(UTF8),size_is(1025)] */,
110 : struct policy_handle *_handle /* [out] [ref] */)
111 : {
112 : struct tevent_req *req;
113 : struct dcerpc_mdssvc_open_state *state;
114 : struct tevent_req *subreq;
115 :
116 0 : req = tevent_req_create(mem_ctx, &state,
117 : struct dcerpc_mdssvc_open_state);
118 0 : if (req == NULL) {
119 0 : return NULL;
120 : }
121 0 : state->out_mem_ctx = NULL;
122 :
123 : /* In parameters */
124 0 : state->orig.in.device_id = _device_id;
125 0 : state->orig.in.unkn2 = _unkn2;
126 0 : state->orig.in.unkn3 = _unkn3;
127 0 : state->orig.in.share_mount_path = _share_mount_path;
128 0 : state->orig.in.share_name = _share_name;
129 :
130 : /* Out parameters */
131 0 : state->orig.out.device_id = _device_id;
132 0 : state->orig.out.unkn2 = _unkn2;
133 0 : state->orig.out.unkn3 = _unkn3;
134 0 : state->orig.out.share_path = _share_path;
135 0 : state->orig.out.handle = _handle;
136 :
137 0 : state->out_mem_ctx = talloc_named_const(state, 0,
138 : "dcerpc_mdssvc_open_out_memory");
139 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
140 0 : return tevent_req_post(req, ev);
141 : }
142 :
143 : /* make a temporary copy, that we pass to the dispatch function */
144 0 : state->tmp = state->orig;
145 :
146 0 : subreq = dcerpc_mdssvc_open_r_send(state, ev, h, &state->tmp);
147 0 : if (tevent_req_nomem(subreq, req)) {
148 0 : return tevent_req_post(req, ev);
149 : }
150 0 : tevent_req_set_callback(subreq, dcerpc_mdssvc_open_done, req);
151 0 : return req;
152 : }
153 :
154 0 : static void dcerpc_mdssvc_open_done(struct tevent_req *subreq)
155 : {
156 0 : struct tevent_req *req = tevent_req_callback_data(
157 : subreq, struct tevent_req);
158 0 : struct dcerpc_mdssvc_open_state *state = tevent_req_data(
159 : req, struct dcerpc_mdssvc_open_state);
160 : NTSTATUS status;
161 : TALLOC_CTX *mem_ctx;
162 :
163 0 : if (state->out_mem_ctx) {
164 0 : mem_ctx = state->out_mem_ctx;
165 : } else {
166 0 : mem_ctx = state;
167 : }
168 :
169 0 : status = dcerpc_mdssvc_open_r_recv(subreq, mem_ctx);
170 0 : TALLOC_FREE(subreq);
171 0 : if (tevent_req_nterror(req, status)) {
172 0 : return;
173 : }
174 :
175 : /* Copy out parameters */
176 0 : *state->orig.out.device_id = *state->tmp.out.device_id;
177 0 : *state->orig.out.unkn2 = *state->tmp.out.unkn2;
178 0 : *state->orig.out.unkn3 = *state->tmp.out.unkn3;
179 : {
180 : size_t _copy_len_share_path;
181 0 : _copy_len_share_path = ndr_charset_length(state->tmp.out.share_path, CH_UNIX);
182 0 : if (_copy_len_share_path > 1025) {
183 0 : tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
184 0 : return;
185 : }
186 0 : if (state->orig.out.share_path != state->tmp.out.share_path) {
187 0 : memcpy(discard_const_p(uint8_t *, state->orig.out.share_path), state->tmp.out.share_path, _copy_len_share_path * sizeof(*state->orig.out.share_path));
188 : }
189 : }
190 0 : *state->orig.out.handle = *state->tmp.out.handle;
191 :
192 : /* Reset temporary structure */
193 0 : NDR_ZERO_STRUCT(state->tmp);
194 :
195 0 : tevent_req_done(req);
196 : }
197 :
198 0 : NTSTATUS dcerpc_mdssvc_open_recv(struct tevent_req *req,
199 : TALLOC_CTX *mem_ctx)
200 : {
201 0 : struct dcerpc_mdssvc_open_state *state = tevent_req_data(
202 : req, struct dcerpc_mdssvc_open_state);
203 : NTSTATUS status;
204 :
205 0 : if (tevent_req_is_nterror(req, &status)) {
206 0 : tevent_req_received(req);
207 0 : return status;
208 : }
209 :
210 : /* Steal possible out parameters to the callers context */
211 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
212 :
213 0 : tevent_req_received(req);
214 0 : return NT_STATUS_OK;
215 : }
216 :
217 0 : NTSTATUS dcerpc_mdssvc_open(struct dcerpc_binding_handle *h,
218 : TALLOC_CTX *mem_ctx,
219 : uint32_t *_device_id /* [in,out] [ref] */,
220 : uint32_t *_unkn2 /* [in,out] [ref] */,
221 : uint32_t *_unkn3 /* [in,out] [ref] */,
222 : const char *_share_mount_path /* [in] [charset(UTF8),size_is(1025)] */,
223 : const char *_share_name /* [in] [charset(UTF8),size_is(1025)] */,
224 : const char *_share_path /* [out] [charset(UTF8),size_is(1025)] */,
225 : struct policy_handle *_handle /* [out] [ref] */)
226 : {
227 : struct mdssvc_open r;
228 : NTSTATUS status;
229 :
230 : /* In parameters */
231 0 : r.in.device_id = _device_id;
232 0 : r.in.unkn2 = _unkn2;
233 0 : r.in.unkn3 = _unkn3;
234 0 : r.in.share_mount_path = _share_mount_path;
235 0 : r.in.share_name = _share_name;
236 :
237 : /* Out parameters */
238 0 : r.out.device_id = _device_id;
239 0 : r.out.unkn2 = _unkn2;
240 0 : r.out.unkn3 = _unkn3;
241 0 : r.out.share_path = _share_path;
242 0 : r.out.handle = _handle;
243 :
244 0 : status = dcerpc_mdssvc_open_r(h, mem_ctx, &r);
245 0 : if (!NT_STATUS_IS_OK(status)) {
246 0 : return status;
247 : }
248 :
249 : /* Return variables */
250 0 : *_device_id = *r.out.device_id;
251 0 : *_unkn2 = *r.out.unkn2;
252 0 : *_unkn3 = *r.out.unkn3;
253 : {
254 : size_t _copy_len_share_path;
255 0 : _copy_len_share_path = ndr_charset_length(r.out.share_path, CH_UNIX);
256 0 : if (_copy_len_share_path > 1025) {
257 0 : return NT_STATUS_INVALID_NETWORK_RESPONSE;
258 : }
259 0 : if (_share_path != r.out.share_path) {
260 0 : memcpy(discard_const_p(uint8_t *, _share_path), r.out.share_path, _copy_len_share_path * sizeof(*_share_path));
261 : }
262 : }
263 0 : *_handle = *r.out.handle;
264 :
265 : /* Return result */
266 :
267 0 : return NT_STATUS_OK;
268 : }
269 :
270 : struct dcerpc_mdssvc_unknown1_r_state {
271 : TALLOC_CTX *out_mem_ctx;
272 : };
273 :
274 : static void dcerpc_mdssvc_unknown1_r_done(struct tevent_req *subreq);
275 :
276 0 : struct tevent_req *dcerpc_mdssvc_unknown1_r_send(TALLOC_CTX *mem_ctx,
277 : struct tevent_context *ev,
278 : struct dcerpc_binding_handle *h,
279 : struct mdssvc_unknown1 *r)
280 : {
281 : struct tevent_req *req;
282 : struct dcerpc_mdssvc_unknown1_r_state *state;
283 : struct tevent_req *subreq;
284 :
285 0 : req = tevent_req_create(mem_ctx, &state,
286 : struct dcerpc_mdssvc_unknown1_r_state);
287 0 : if (req == NULL) {
288 0 : return NULL;
289 : }
290 :
291 0 : state->out_mem_ctx = talloc_new(state);
292 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
293 0 : return tevent_req_post(req, ev);
294 : }
295 :
296 0 : subreq = dcerpc_binding_handle_call_send(state, ev, h,
297 : NULL, &ndr_table_mdssvc,
298 0 : NDR_MDSSVC_UNKNOWN1, state->out_mem_ctx, r);
299 0 : if (tevent_req_nomem(subreq, req)) {
300 0 : return tevent_req_post(req, ev);
301 : }
302 0 : tevent_req_set_callback(subreq, dcerpc_mdssvc_unknown1_r_done, req);
303 :
304 0 : return req;
305 : }
306 :
307 0 : static void dcerpc_mdssvc_unknown1_r_done(struct tevent_req *subreq)
308 : {
309 0 : struct tevent_req *req =
310 0 : tevent_req_callback_data(subreq,
311 : struct tevent_req);
312 : NTSTATUS status;
313 :
314 0 : status = dcerpc_binding_handle_call_recv(subreq);
315 0 : TALLOC_FREE(subreq);
316 0 : if (tevent_req_nterror(req, status)) {
317 0 : return;
318 : }
319 :
320 0 : tevent_req_done(req);
321 : }
322 :
323 0 : NTSTATUS dcerpc_mdssvc_unknown1_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
324 : {
325 0 : struct dcerpc_mdssvc_unknown1_r_state *state =
326 0 : tevent_req_data(req,
327 : struct dcerpc_mdssvc_unknown1_r_state);
328 : NTSTATUS status;
329 :
330 0 : if (tevent_req_is_nterror(req, &status)) {
331 0 : tevent_req_received(req);
332 0 : return status;
333 : }
334 :
335 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
336 :
337 0 : tevent_req_received(req);
338 0 : return NT_STATUS_OK;
339 : }
340 :
341 0 : NTSTATUS dcerpc_mdssvc_unknown1_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct mdssvc_unknown1 *r)
342 : {
343 : NTSTATUS status;
344 :
345 0 : status = dcerpc_binding_handle_call(h,
346 : NULL, &ndr_table_mdssvc,
347 : NDR_MDSSVC_UNKNOWN1, mem_ctx, r);
348 :
349 0 : return status;
350 : }
351 :
352 : struct dcerpc_mdssvc_unknown1_state {
353 : struct mdssvc_unknown1 orig;
354 : struct mdssvc_unknown1 tmp;
355 : TALLOC_CTX *out_mem_ctx;
356 : };
357 :
358 : static void dcerpc_mdssvc_unknown1_done(struct tevent_req *subreq);
359 :
360 0 : struct tevent_req *dcerpc_mdssvc_unknown1_send(TALLOC_CTX *mem_ctx,
361 : struct tevent_context *ev,
362 : struct dcerpc_binding_handle *h,
363 : struct policy_handle *_handle /* [in] [ref] */,
364 : uint32_t _unkn1 /* [in] */,
365 : uint32_t _device_id /* [in] */,
366 : uint32_t _unkn3 /* [in] */,
367 : uint32_t _unkn4 /* [in] */,
368 : uint32_t _uid /* [in] */,
369 : uint32_t _gid /* [in] */,
370 : uint32_t *_status /* [out] [ref] */,
371 : uint32_t *_flags /* [out] [ref] */,
372 : uint32_t *_unkn7 /* [out] [ref] */)
373 : {
374 : struct tevent_req *req;
375 : struct dcerpc_mdssvc_unknown1_state *state;
376 : struct tevent_req *subreq;
377 :
378 0 : req = tevent_req_create(mem_ctx, &state,
379 : struct dcerpc_mdssvc_unknown1_state);
380 0 : if (req == NULL) {
381 0 : return NULL;
382 : }
383 0 : state->out_mem_ctx = NULL;
384 :
385 : /* In parameters */
386 0 : state->orig.in.handle = _handle;
387 0 : state->orig.in.unkn1 = _unkn1;
388 0 : state->orig.in.device_id = _device_id;
389 0 : state->orig.in.unkn3 = _unkn3;
390 0 : state->orig.in.unkn4 = _unkn4;
391 0 : state->orig.in.uid = _uid;
392 0 : state->orig.in.gid = _gid;
393 :
394 : /* Out parameters */
395 0 : state->orig.out.status = _status;
396 0 : state->orig.out.flags = _flags;
397 0 : state->orig.out.unkn7 = _unkn7;
398 :
399 0 : state->out_mem_ctx = talloc_named_const(state, 0,
400 : "dcerpc_mdssvc_unknown1_out_memory");
401 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
402 0 : return tevent_req_post(req, ev);
403 : }
404 :
405 : /* make a temporary copy, that we pass to the dispatch function */
406 0 : state->tmp = state->orig;
407 :
408 0 : subreq = dcerpc_mdssvc_unknown1_r_send(state, ev, h, &state->tmp);
409 0 : if (tevent_req_nomem(subreq, req)) {
410 0 : return tevent_req_post(req, ev);
411 : }
412 0 : tevent_req_set_callback(subreq, dcerpc_mdssvc_unknown1_done, req);
413 0 : return req;
414 : }
415 :
416 0 : static void dcerpc_mdssvc_unknown1_done(struct tevent_req *subreq)
417 : {
418 0 : struct tevent_req *req = tevent_req_callback_data(
419 : subreq, struct tevent_req);
420 0 : struct dcerpc_mdssvc_unknown1_state *state = tevent_req_data(
421 : req, struct dcerpc_mdssvc_unknown1_state);
422 : NTSTATUS status;
423 : TALLOC_CTX *mem_ctx;
424 :
425 0 : if (state->out_mem_ctx) {
426 0 : mem_ctx = state->out_mem_ctx;
427 : } else {
428 0 : mem_ctx = state;
429 : }
430 :
431 0 : status = dcerpc_mdssvc_unknown1_r_recv(subreq, mem_ctx);
432 0 : TALLOC_FREE(subreq);
433 0 : if (tevent_req_nterror(req, status)) {
434 0 : return;
435 : }
436 :
437 : /* Copy out parameters */
438 0 : *state->orig.out.status = *state->tmp.out.status;
439 0 : *state->orig.out.flags = *state->tmp.out.flags;
440 0 : *state->orig.out.unkn7 = *state->tmp.out.unkn7;
441 :
442 : /* Reset temporary structure */
443 0 : NDR_ZERO_STRUCT(state->tmp);
444 :
445 0 : tevent_req_done(req);
446 : }
447 :
448 0 : NTSTATUS dcerpc_mdssvc_unknown1_recv(struct tevent_req *req,
449 : TALLOC_CTX *mem_ctx)
450 : {
451 0 : struct dcerpc_mdssvc_unknown1_state *state = tevent_req_data(
452 : req, struct dcerpc_mdssvc_unknown1_state);
453 : NTSTATUS status;
454 :
455 0 : if (tevent_req_is_nterror(req, &status)) {
456 0 : tevent_req_received(req);
457 0 : return status;
458 : }
459 :
460 : /* Steal possible out parameters to the callers context */
461 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
462 :
463 0 : tevent_req_received(req);
464 0 : return NT_STATUS_OK;
465 : }
466 :
467 0 : NTSTATUS dcerpc_mdssvc_unknown1(struct dcerpc_binding_handle *h,
468 : TALLOC_CTX *mem_ctx,
469 : struct policy_handle *_handle /* [in] [ref] */,
470 : uint32_t _unkn1 /* [in] */,
471 : uint32_t _device_id /* [in] */,
472 : uint32_t _unkn3 /* [in] */,
473 : uint32_t _unkn4 /* [in] */,
474 : uint32_t _uid /* [in] */,
475 : uint32_t _gid /* [in] */,
476 : uint32_t *_status /* [out] [ref] */,
477 : uint32_t *_flags /* [out] [ref] */,
478 : uint32_t *_unkn7 /* [out] [ref] */)
479 : {
480 : struct mdssvc_unknown1 r;
481 : NTSTATUS status;
482 :
483 : /* In parameters */
484 0 : r.in.handle = _handle;
485 0 : r.in.unkn1 = _unkn1;
486 0 : r.in.device_id = _device_id;
487 0 : r.in.unkn3 = _unkn3;
488 0 : r.in.unkn4 = _unkn4;
489 0 : r.in.uid = _uid;
490 0 : r.in.gid = _gid;
491 :
492 : /* Out parameters */
493 0 : r.out.status = _status;
494 0 : r.out.flags = _flags;
495 0 : r.out.unkn7 = _unkn7;
496 :
497 0 : status = dcerpc_mdssvc_unknown1_r(h, mem_ctx, &r);
498 0 : if (!NT_STATUS_IS_OK(status)) {
499 0 : return status;
500 : }
501 :
502 : /* Return variables */
503 0 : *_status = *r.out.status;
504 0 : *_flags = *r.out.flags;
505 0 : *_unkn7 = *r.out.unkn7;
506 :
507 : /* Return result */
508 :
509 0 : return NT_STATUS_OK;
510 : }
511 :
512 : struct dcerpc_mdssvc_cmd_r_state {
513 : TALLOC_CTX *out_mem_ctx;
514 : };
515 :
516 : static void dcerpc_mdssvc_cmd_r_done(struct tevent_req *subreq);
517 :
518 0 : struct tevent_req *dcerpc_mdssvc_cmd_r_send(TALLOC_CTX *mem_ctx,
519 : struct tevent_context *ev,
520 : struct dcerpc_binding_handle *h,
521 : struct mdssvc_cmd *r)
522 : {
523 : struct tevent_req *req;
524 : struct dcerpc_mdssvc_cmd_r_state *state;
525 : struct tevent_req *subreq;
526 :
527 0 : req = tevent_req_create(mem_ctx, &state,
528 : struct dcerpc_mdssvc_cmd_r_state);
529 0 : if (req == NULL) {
530 0 : return NULL;
531 : }
532 :
533 0 : state->out_mem_ctx = talloc_new(state);
534 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
535 0 : return tevent_req_post(req, ev);
536 : }
537 :
538 0 : subreq = dcerpc_binding_handle_call_send(state, ev, h,
539 : NULL, &ndr_table_mdssvc,
540 0 : NDR_MDSSVC_CMD, state->out_mem_ctx, r);
541 0 : if (tevent_req_nomem(subreq, req)) {
542 0 : return tevent_req_post(req, ev);
543 : }
544 0 : tevent_req_set_callback(subreq, dcerpc_mdssvc_cmd_r_done, req);
545 :
546 0 : return req;
547 : }
548 :
549 0 : static void dcerpc_mdssvc_cmd_r_done(struct tevent_req *subreq)
550 : {
551 0 : struct tevent_req *req =
552 0 : tevent_req_callback_data(subreq,
553 : struct tevent_req);
554 : NTSTATUS status;
555 :
556 0 : status = dcerpc_binding_handle_call_recv(subreq);
557 0 : TALLOC_FREE(subreq);
558 0 : if (tevent_req_nterror(req, status)) {
559 0 : return;
560 : }
561 :
562 0 : tevent_req_done(req);
563 : }
564 :
565 0 : NTSTATUS dcerpc_mdssvc_cmd_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
566 : {
567 0 : struct dcerpc_mdssvc_cmd_r_state *state =
568 0 : tevent_req_data(req,
569 : struct dcerpc_mdssvc_cmd_r_state);
570 : NTSTATUS status;
571 :
572 0 : if (tevent_req_is_nterror(req, &status)) {
573 0 : tevent_req_received(req);
574 0 : return status;
575 : }
576 :
577 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
578 :
579 0 : tevent_req_received(req);
580 0 : return NT_STATUS_OK;
581 : }
582 :
583 0 : NTSTATUS dcerpc_mdssvc_cmd_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct mdssvc_cmd *r)
584 : {
585 : NTSTATUS status;
586 :
587 0 : status = dcerpc_binding_handle_call(h,
588 : NULL, &ndr_table_mdssvc,
589 : NDR_MDSSVC_CMD, mem_ctx, r);
590 :
591 0 : return status;
592 : }
593 :
594 : struct dcerpc_mdssvc_cmd_state {
595 : struct mdssvc_cmd orig;
596 : struct mdssvc_cmd tmp;
597 : TALLOC_CTX *out_mem_ctx;
598 : };
599 :
600 : static void dcerpc_mdssvc_cmd_done(struct tevent_req *subreq);
601 :
602 0 : struct tevent_req *dcerpc_mdssvc_cmd_send(TALLOC_CTX *mem_ctx,
603 : struct tevent_context *ev,
604 : struct dcerpc_binding_handle *h,
605 : struct policy_handle *_handle /* [in] [ref] */,
606 : uint32_t _unkn1 /* [in] */,
607 : uint32_t _device_id /* [in] */,
608 : uint32_t _unkn3 /* [in] */,
609 : uint32_t _unkn4 /* [in] */,
610 : uint32_t _flags /* [in] */,
611 : struct mdssvc_blob _request_blob /* [in] */,
612 : uint32_t _unkn5 /* [in] */,
613 : uint32_t _max_fragment_size1 /* [in] */,
614 : uint32_t _unkn6 /* [in] */,
615 : uint32_t _max_fragment_size2 /* [in] */,
616 : uint32_t _unkn7 /* [in] */,
617 : uint32_t _unkn8 /* [in] */,
618 : uint32_t *_fragment /* [out] [ref] */,
619 : struct mdssvc_blob *_response_blob /* [out] [ref] */,
620 : uint32_t *_unkn9 /* [out] [ref] */)
621 : {
622 : struct tevent_req *req;
623 : struct dcerpc_mdssvc_cmd_state *state;
624 : struct tevent_req *subreq;
625 :
626 0 : req = tevent_req_create(mem_ctx, &state,
627 : struct dcerpc_mdssvc_cmd_state);
628 0 : if (req == NULL) {
629 0 : return NULL;
630 : }
631 0 : state->out_mem_ctx = NULL;
632 :
633 : /* In parameters */
634 0 : state->orig.in.handle = _handle;
635 0 : state->orig.in.unkn1 = _unkn1;
636 0 : state->orig.in.device_id = _device_id;
637 0 : state->orig.in.unkn3 = _unkn3;
638 0 : state->orig.in.unkn4 = _unkn4;
639 0 : state->orig.in.flags = _flags;
640 0 : state->orig.in.request_blob = _request_blob;
641 0 : state->orig.in.unkn5 = _unkn5;
642 0 : state->orig.in.max_fragment_size1 = _max_fragment_size1;
643 0 : state->orig.in.unkn6 = _unkn6;
644 0 : state->orig.in.max_fragment_size2 = _max_fragment_size2;
645 0 : state->orig.in.unkn7 = _unkn7;
646 0 : state->orig.in.unkn8 = _unkn8;
647 :
648 : /* Out parameters */
649 0 : state->orig.out.fragment = _fragment;
650 0 : state->orig.out.response_blob = _response_blob;
651 0 : state->orig.out.unkn9 = _unkn9;
652 :
653 0 : state->out_mem_ctx = talloc_named_const(state, 0,
654 : "dcerpc_mdssvc_cmd_out_memory");
655 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
656 0 : return tevent_req_post(req, ev);
657 : }
658 :
659 : /* make a temporary copy, that we pass to the dispatch function */
660 0 : state->tmp = state->orig;
661 :
662 0 : subreq = dcerpc_mdssvc_cmd_r_send(state, ev, h, &state->tmp);
663 0 : if (tevent_req_nomem(subreq, req)) {
664 0 : return tevent_req_post(req, ev);
665 : }
666 0 : tevent_req_set_callback(subreq, dcerpc_mdssvc_cmd_done, req);
667 0 : return req;
668 : }
669 :
670 0 : static void dcerpc_mdssvc_cmd_done(struct tevent_req *subreq)
671 : {
672 0 : struct tevent_req *req = tevent_req_callback_data(
673 : subreq, struct tevent_req);
674 0 : struct dcerpc_mdssvc_cmd_state *state = tevent_req_data(
675 : req, struct dcerpc_mdssvc_cmd_state);
676 : NTSTATUS status;
677 : TALLOC_CTX *mem_ctx;
678 :
679 0 : if (state->out_mem_ctx) {
680 0 : mem_ctx = state->out_mem_ctx;
681 : } else {
682 0 : mem_ctx = state;
683 : }
684 :
685 0 : status = dcerpc_mdssvc_cmd_r_recv(subreq, mem_ctx);
686 0 : TALLOC_FREE(subreq);
687 0 : if (tevent_req_nterror(req, status)) {
688 0 : return;
689 : }
690 :
691 : /* Copy out parameters */
692 0 : *state->orig.out.fragment = *state->tmp.out.fragment;
693 0 : *state->orig.out.response_blob = *state->tmp.out.response_blob;
694 0 : *state->orig.out.unkn9 = *state->tmp.out.unkn9;
695 :
696 : /* Reset temporary structure */
697 0 : NDR_ZERO_STRUCT(state->tmp);
698 :
699 0 : tevent_req_done(req);
700 : }
701 :
702 0 : NTSTATUS dcerpc_mdssvc_cmd_recv(struct tevent_req *req,
703 : TALLOC_CTX *mem_ctx)
704 : {
705 0 : struct dcerpc_mdssvc_cmd_state *state = tevent_req_data(
706 : req, struct dcerpc_mdssvc_cmd_state);
707 : NTSTATUS status;
708 :
709 0 : if (tevent_req_is_nterror(req, &status)) {
710 0 : tevent_req_received(req);
711 0 : return status;
712 : }
713 :
714 : /* Steal possible out parameters to the callers context */
715 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
716 :
717 0 : tevent_req_received(req);
718 0 : return NT_STATUS_OK;
719 : }
720 :
721 0 : NTSTATUS dcerpc_mdssvc_cmd(struct dcerpc_binding_handle *h,
722 : TALLOC_CTX *mem_ctx,
723 : struct policy_handle *_handle /* [in] [ref] */,
724 : uint32_t _unkn1 /* [in] */,
725 : uint32_t _device_id /* [in] */,
726 : uint32_t _unkn3 /* [in] */,
727 : uint32_t _unkn4 /* [in] */,
728 : uint32_t _flags /* [in] */,
729 : struct mdssvc_blob _request_blob /* [in] */,
730 : uint32_t _unkn5 /* [in] */,
731 : uint32_t _max_fragment_size1 /* [in] */,
732 : uint32_t _unkn6 /* [in] */,
733 : uint32_t _max_fragment_size2 /* [in] */,
734 : uint32_t _unkn7 /* [in] */,
735 : uint32_t _unkn8 /* [in] */,
736 : uint32_t *_fragment /* [out] [ref] */,
737 : struct mdssvc_blob *_response_blob /* [out] [ref] */,
738 : uint32_t *_unkn9 /* [out] [ref] */)
739 : {
740 : struct mdssvc_cmd r;
741 : NTSTATUS status;
742 :
743 : /* In parameters */
744 0 : r.in.handle = _handle;
745 0 : r.in.unkn1 = _unkn1;
746 0 : r.in.device_id = _device_id;
747 0 : r.in.unkn3 = _unkn3;
748 0 : r.in.unkn4 = _unkn4;
749 0 : r.in.flags = _flags;
750 0 : r.in.request_blob = _request_blob;
751 0 : r.in.unkn5 = _unkn5;
752 0 : r.in.max_fragment_size1 = _max_fragment_size1;
753 0 : r.in.unkn6 = _unkn6;
754 0 : r.in.max_fragment_size2 = _max_fragment_size2;
755 0 : r.in.unkn7 = _unkn7;
756 0 : r.in.unkn8 = _unkn8;
757 :
758 : /* Out parameters */
759 0 : r.out.fragment = _fragment;
760 0 : r.out.response_blob = _response_blob;
761 0 : r.out.unkn9 = _unkn9;
762 :
763 0 : status = dcerpc_mdssvc_cmd_r(h, mem_ctx, &r);
764 0 : if (!NT_STATUS_IS_OK(status)) {
765 0 : return status;
766 : }
767 :
768 : /* Return variables */
769 0 : *_fragment = *r.out.fragment;
770 0 : *_response_blob = *r.out.response_blob;
771 0 : *_unkn9 = *r.out.unkn9;
772 :
773 : /* Return result */
774 :
775 0 : return NT_STATUS_OK;
776 : }
777 :
778 : struct dcerpc_mdssvc_close_r_state {
779 : TALLOC_CTX *out_mem_ctx;
780 : };
781 :
782 : static void dcerpc_mdssvc_close_r_done(struct tevent_req *subreq);
783 :
784 0 : struct tevent_req *dcerpc_mdssvc_close_r_send(TALLOC_CTX *mem_ctx,
785 : struct tevent_context *ev,
786 : struct dcerpc_binding_handle *h,
787 : struct mdssvc_close *r)
788 : {
789 : struct tevent_req *req;
790 : struct dcerpc_mdssvc_close_r_state *state;
791 : struct tevent_req *subreq;
792 :
793 0 : req = tevent_req_create(mem_ctx, &state,
794 : struct dcerpc_mdssvc_close_r_state);
795 0 : if (req == NULL) {
796 0 : return NULL;
797 : }
798 :
799 0 : state->out_mem_ctx = talloc_new(state);
800 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
801 0 : return tevent_req_post(req, ev);
802 : }
803 :
804 0 : subreq = dcerpc_binding_handle_call_send(state, ev, h,
805 : NULL, &ndr_table_mdssvc,
806 0 : NDR_MDSSVC_CLOSE, state->out_mem_ctx, r);
807 0 : if (tevent_req_nomem(subreq, req)) {
808 0 : return tevent_req_post(req, ev);
809 : }
810 0 : tevent_req_set_callback(subreq, dcerpc_mdssvc_close_r_done, req);
811 :
812 0 : return req;
813 : }
814 :
815 0 : static void dcerpc_mdssvc_close_r_done(struct tevent_req *subreq)
816 : {
817 0 : struct tevent_req *req =
818 0 : tevent_req_callback_data(subreq,
819 : struct tevent_req);
820 : NTSTATUS status;
821 :
822 0 : status = dcerpc_binding_handle_call_recv(subreq);
823 0 : TALLOC_FREE(subreq);
824 0 : if (tevent_req_nterror(req, status)) {
825 0 : return;
826 : }
827 :
828 0 : tevent_req_done(req);
829 : }
830 :
831 0 : NTSTATUS dcerpc_mdssvc_close_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
832 : {
833 0 : struct dcerpc_mdssvc_close_r_state *state =
834 0 : tevent_req_data(req,
835 : struct dcerpc_mdssvc_close_r_state);
836 : NTSTATUS status;
837 :
838 0 : if (tevent_req_is_nterror(req, &status)) {
839 0 : tevent_req_received(req);
840 0 : return status;
841 : }
842 :
843 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
844 :
845 0 : tevent_req_received(req);
846 0 : return NT_STATUS_OK;
847 : }
848 :
849 0 : NTSTATUS dcerpc_mdssvc_close_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct mdssvc_close *r)
850 : {
851 : NTSTATUS status;
852 :
853 0 : status = dcerpc_binding_handle_call(h,
854 : NULL, &ndr_table_mdssvc,
855 : NDR_MDSSVC_CLOSE, mem_ctx, r);
856 :
857 0 : return status;
858 : }
859 :
860 : struct dcerpc_mdssvc_close_state {
861 : struct mdssvc_close orig;
862 : struct mdssvc_close tmp;
863 : TALLOC_CTX *out_mem_ctx;
864 : };
865 :
866 : static void dcerpc_mdssvc_close_done(struct tevent_req *subreq);
867 :
868 0 : struct tevent_req *dcerpc_mdssvc_close_send(TALLOC_CTX *mem_ctx,
869 : struct tevent_context *ev,
870 : struct dcerpc_binding_handle *h,
871 : struct policy_handle *_in_handle /* [in] [ref] */,
872 : uint32_t _unkn1 /* [in] */,
873 : uint32_t _device_id /* [in] */,
874 : uint32_t _unkn2 /* [in] */,
875 : uint32_t _unkn3 /* [in] */,
876 : struct policy_handle *_out_handle /* [out] [ref] */,
877 : uint32_t *_status /* [out] [ref] */)
878 : {
879 : struct tevent_req *req;
880 : struct dcerpc_mdssvc_close_state *state;
881 : struct tevent_req *subreq;
882 :
883 0 : req = tevent_req_create(mem_ctx, &state,
884 : struct dcerpc_mdssvc_close_state);
885 0 : if (req == NULL) {
886 0 : return NULL;
887 : }
888 0 : state->out_mem_ctx = NULL;
889 :
890 : /* In parameters */
891 0 : state->orig.in.in_handle = _in_handle;
892 0 : state->orig.in.unkn1 = _unkn1;
893 0 : state->orig.in.device_id = _device_id;
894 0 : state->orig.in.unkn2 = _unkn2;
895 0 : state->orig.in.unkn3 = _unkn3;
896 :
897 : /* Out parameters */
898 0 : state->orig.out.out_handle = _out_handle;
899 0 : state->orig.out.status = _status;
900 :
901 0 : state->out_mem_ctx = talloc_named_const(state, 0,
902 : "dcerpc_mdssvc_close_out_memory");
903 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
904 0 : return tevent_req_post(req, ev);
905 : }
906 :
907 : /* make a temporary copy, that we pass to the dispatch function */
908 0 : state->tmp = state->orig;
909 :
910 0 : subreq = dcerpc_mdssvc_close_r_send(state, ev, h, &state->tmp);
911 0 : if (tevent_req_nomem(subreq, req)) {
912 0 : return tevent_req_post(req, ev);
913 : }
914 0 : tevent_req_set_callback(subreq, dcerpc_mdssvc_close_done, req);
915 0 : return req;
916 : }
917 :
918 0 : static void dcerpc_mdssvc_close_done(struct tevent_req *subreq)
919 : {
920 0 : struct tevent_req *req = tevent_req_callback_data(
921 : subreq, struct tevent_req);
922 0 : struct dcerpc_mdssvc_close_state *state = tevent_req_data(
923 : req, struct dcerpc_mdssvc_close_state);
924 : NTSTATUS status;
925 : TALLOC_CTX *mem_ctx;
926 :
927 0 : if (state->out_mem_ctx) {
928 0 : mem_ctx = state->out_mem_ctx;
929 : } else {
930 0 : mem_ctx = state;
931 : }
932 :
933 0 : status = dcerpc_mdssvc_close_r_recv(subreq, mem_ctx);
934 0 : TALLOC_FREE(subreq);
935 0 : if (tevent_req_nterror(req, status)) {
936 0 : return;
937 : }
938 :
939 : /* Copy out parameters */
940 0 : *state->orig.out.out_handle = *state->tmp.out.out_handle;
941 0 : *state->orig.out.status = *state->tmp.out.status;
942 :
943 : /* Reset temporary structure */
944 0 : NDR_ZERO_STRUCT(state->tmp);
945 :
946 0 : tevent_req_done(req);
947 : }
948 :
949 0 : NTSTATUS dcerpc_mdssvc_close_recv(struct tevent_req *req,
950 : TALLOC_CTX *mem_ctx)
951 : {
952 0 : struct dcerpc_mdssvc_close_state *state = tevent_req_data(
953 : req, struct dcerpc_mdssvc_close_state);
954 : NTSTATUS status;
955 :
956 0 : if (tevent_req_is_nterror(req, &status)) {
957 0 : tevent_req_received(req);
958 0 : return status;
959 : }
960 :
961 : /* Steal possible out parameters to the callers context */
962 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
963 :
964 0 : tevent_req_received(req);
965 0 : return NT_STATUS_OK;
966 : }
967 :
968 0 : NTSTATUS dcerpc_mdssvc_close(struct dcerpc_binding_handle *h,
969 : TALLOC_CTX *mem_ctx,
970 : struct policy_handle *_in_handle /* [in] [ref] */,
971 : uint32_t _unkn1 /* [in] */,
972 : uint32_t _device_id /* [in] */,
973 : uint32_t _unkn2 /* [in] */,
974 : uint32_t _unkn3 /* [in] */,
975 : struct policy_handle *_out_handle /* [out] [ref] */,
976 : uint32_t *_status /* [out] [ref] */)
977 : {
978 : struct mdssvc_close r;
979 : NTSTATUS status;
980 :
981 : /* In parameters */
982 0 : r.in.in_handle = _in_handle;
983 0 : r.in.unkn1 = _unkn1;
984 0 : r.in.device_id = _device_id;
985 0 : r.in.unkn2 = _unkn2;
986 0 : r.in.unkn3 = _unkn3;
987 :
988 : /* Out parameters */
989 0 : r.out.out_handle = _out_handle;
990 0 : r.out.status = _status;
991 :
992 0 : status = dcerpc_mdssvc_close_r(h, mem_ctx, &r);
993 0 : if (!NT_STATUS_IS_OK(status)) {
994 0 : return status;
995 : }
996 :
997 : /* Return variables */
998 0 : *_out_handle = *r.out.out_handle;
999 0 : *_status = *r.out.status;
1000 :
1001 : /* Return result */
1002 :
1003 0 : return NT_STATUS_OK;
1004 : }
1005 :
|