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_unixinfo.h"
7 : #include "bin/default/librpc/gen_ndr/ndr_unixinfo_c.h"
8 :
9 : /* unixinfo - client functions generated by pidl */
10 :
11 : struct dcerpc_unixinfo_SidToUid_r_state {
12 : TALLOC_CTX *out_mem_ctx;
13 : };
14 :
15 : static void dcerpc_unixinfo_SidToUid_r_done(struct tevent_req *subreq);
16 :
17 0 : struct tevent_req *dcerpc_unixinfo_SidToUid_r_send(TALLOC_CTX *mem_ctx,
18 : struct tevent_context *ev,
19 : struct dcerpc_binding_handle *h,
20 : struct unixinfo_SidToUid *r)
21 : {
22 0 : struct tevent_req *req;
23 0 : struct dcerpc_unixinfo_SidToUid_r_state *state;
24 0 : struct tevent_req *subreq;
25 :
26 0 : req = tevent_req_create(mem_ctx, &state,
27 : struct dcerpc_unixinfo_SidToUid_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_unixinfo,
39 0 : NDR_UNIXINFO_SIDTOUID, 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_unixinfo_SidToUid_r_done, req);
44 :
45 0 : return req;
46 : }
47 :
48 0 : static void dcerpc_unixinfo_SidToUid_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 0 : 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_unixinfo_SidToUid_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
65 : {
66 0 : struct dcerpc_unixinfo_SidToUid_r_state *state =
67 0 : tevent_req_data(req,
68 : struct dcerpc_unixinfo_SidToUid_r_state);
69 0 : 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 3 : NTSTATUS dcerpc_unixinfo_SidToUid_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct unixinfo_SidToUid *r)
83 : {
84 0 : NTSTATUS status;
85 :
86 3 : status = dcerpc_binding_handle_call(h,
87 : NULL, &ndr_table_unixinfo,
88 : NDR_UNIXINFO_SIDTOUID, mem_ctx, r);
89 :
90 3 : return status;
91 : }
92 :
93 : struct dcerpc_unixinfo_SidToUid_state {
94 : struct unixinfo_SidToUid orig;
95 : struct unixinfo_SidToUid tmp;
96 : TALLOC_CTX *out_mem_ctx;
97 : };
98 :
99 : static void dcerpc_unixinfo_SidToUid_done(struct tevent_req *subreq);
100 :
101 0 : struct tevent_req *dcerpc_unixinfo_SidToUid_send(TALLOC_CTX *mem_ctx,
102 : struct tevent_context *ev,
103 : struct dcerpc_binding_handle *h,
104 : struct dom_sid _sid /* [in] */,
105 : uint64_t *_uid /* [out] [ref] */)
106 : {
107 0 : struct tevent_req *req;
108 0 : struct dcerpc_unixinfo_SidToUid_state *state;
109 0 : struct tevent_req *subreq;
110 :
111 0 : req = tevent_req_create(mem_ctx, &state,
112 : struct dcerpc_unixinfo_SidToUid_state);
113 0 : if (req == NULL) {
114 0 : return NULL;
115 : }
116 0 : state->out_mem_ctx = NULL;
117 :
118 : /* In parameters */
119 0 : state->orig.in.sid = _sid;
120 :
121 : /* Out parameters */
122 0 : state->orig.out.uid = _uid;
123 :
124 : /* Result */
125 0 : NDR_ZERO_STRUCT(state->orig.out.result);
126 :
127 0 : state->out_mem_ctx = talloc_named_const(state, 0,
128 : "dcerpc_unixinfo_SidToUid_out_memory");
129 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
130 0 : return tevent_req_post(req, ev);
131 : }
132 :
133 : /* make a temporary copy, that we pass to the dispatch function */
134 0 : state->tmp = state->orig;
135 :
136 0 : subreq = dcerpc_unixinfo_SidToUid_r_send(state, ev, h, &state->tmp);
137 0 : if (tevent_req_nomem(subreq, req)) {
138 0 : return tevent_req_post(req, ev);
139 : }
140 0 : tevent_req_set_callback(subreq, dcerpc_unixinfo_SidToUid_done, req);
141 0 : return req;
142 : }
143 :
144 0 : static void dcerpc_unixinfo_SidToUid_done(struct tevent_req *subreq)
145 : {
146 0 : struct tevent_req *req = tevent_req_callback_data(
147 : subreq, struct tevent_req);
148 0 : struct dcerpc_unixinfo_SidToUid_state *state = tevent_req_data(
149 : req, struct dcerpc_unixinfo_SidToUid_state);
150 0 : NTSTATUS status;
151 0 : TALLOC_CTX *mem_ctx;
152 :
153 0 : if (state->out_mem_ctx) {
154 0 : mem_ctx = state->out_mem_ctx;
155 : } else {
156 0 : mem_ctx = state;
157 : }
158 :
159 0 : status = dcerpc_unixinfo_SidToUid_r_recv(subreq, mem_ctx);
160 0 : TALLOC_FREE(subreq);
161 0 : if (tevent_req_nterror(req, status)) {
162 0 : return;
163 : }
164 :
165 : /* Copy out parameters */
166 0 : *state->orig.out.uid = *state->tmp.out.uid;
167 :
168 : /* Copy result */
169 0 : state->orig.out.result = state->tmp.out.result;
170 :
171 : /* Reset temporary structure */
172 0 : NDR_ZERO_STRUCT(state->tmp);
173 :
174 0 : tevent_req_done(req);
175 : }
176 :
177 0 : NTSTATUS dcerpc_unixinfo_SidToUid_recv(struct tevent_req *req,
178 : TALLOC_CTX *mem_ctx,
179 : NTSTATUS *result)
180 : {
181 0 : struct dcerpc_unixinfo_SidToUid_state *state = tevent_req_data(
182 : req, struct dcerpc_unixinfo_SidToUid_state);
183 0 : NTSTATUS status;
184 :
185 0 : if (tevent_req_is_nterror(req, &status)) {
186 0 : tevent_req_received(req);
187 0 : return status;
188 : }
189 :
190 : /* Steal possible out parameters to the callers context */
191 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
192 :
193 : /* Return result */
194 0 : *result = state->orig.out.result;
195 :
196 0 : tevent_req_received(req);
197 0 : return NT_STATUS_OK;
198 : }
199 :
200 0 : NTSTATUS dcerpc_unixinfo_SidToUid(struct dcerpc_binding_handle *h,
201 : TALLOC_CTX *mem_ctx,
202 : struct dom_sid _sid /* [in] */,
203 : uint64_t *_uid /* [out] [ref] */,
204 : NTSTATUS *result)
205 : {
206 0 : struct unixinfo_SidToUid r;
207 0 : NTSTATUS status;
208 :
209 : /* In parameters */
210 0 : r.in.sid = _sid;
211 :
212 : /* Out parameters */
213 0 : r.out.uid = _uid;
214 :
215 : /* Result */
216 0 : NDR_ZERO_STRUCT(r.out.result);
217 :
218 0 : status = dcerpc_unixinfo_SidToUid_r(h, mem_ctx, &r);
219 0 : if (!NT_STATUS_IS_OK(status)) {
220 0 : return status;
221 : }
222 :
223 : /* Return variables */
224 0 : *_uid = *r.out.uid;
225 :
226 : /* Return result */
227 0 : *result = r.out.result;
228 :
229 0 : return NT_STATUS_OK;
230 : }
231 :
232 : struct dcerpc_unixinfo_UidToSid_r_state {
233 : TALLOC_CTX *out_mem_ctx;
234 : };
235 :
236 : static void dcerpc_unixinfo_UidToSid_r_done(struct tevent_req *subreq);
237 :
238 0 : struct tevent_req *dcerpc_unixinfo_UidToSid_r_send(TALLOC_CTX *mem_ctx,
239 : struct tevent_context *ev,
240 : struct dcerpc_binding_handle *h,
241 : struct unixinfo_UidToSid *r)
242 : {
243 0 : struct tevent_req *req;
244 0 : struct dcerpc_unixinfo_UidToSid_r_state *state;
245 0 : struct tevent_req *subreq;
246 :
247 0 : req = tevent_req_create(mem_ctx, &state,
248 : struct dcerpc_unixinfo_UidToSid_r_state);
249 0 : if (req == NULL) {
250 0 : return NULL;
251 : }
252 :
253 0 : state->out_mem_ctx = talloc_new(state);
254 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
255 0 : return tevent_req_post(req, ev);
256 : }
257 :
258 0 : subreq = dcerpc_binding_handle_call_send(state, ev, h,
259 : NULL, &ndr_table_unixinfo,
260 0 : NDR_UNIXINFO_UIDTOSID, state->out_mem_ctx, r);
261 0 : if (tevent_req_nomem(subreq, req)) {
262 0 : return tevent_req_post(req, ev);
263 : }
264 0 : tevent_req_set_callback(subreq, dcerpc_unixinfo_UidToSid_r_done, req);
265 :
266 0 : return req;
267 : }
268 :
269 0 : static void dcerpc_unixinfo_UidToSid_r_done(struct tevent_req *subreq)
270 : {
271 0 : struct tevent_req *req =
272 0 : tevent_req_callback_data(subreq,
273 : struct tevent_req);
274 0 : NTSTATUS status;
275 :
276 0 : status = dcerpc_binding_handle_call_recv(subreq);
277 0 : TALLOC_FREE(subreq);
278 0 : if (tevent_req_nterror(req, status)) {
279 0 : return;
280 : }
281 :
282 0 : tevent_req_done(req);
283 : }
284 :
285 0 : NTSTATUS dcerpc_unixinfo_UidToSid_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
286 : {
287 0 : struct dcerpc_unixinfo_UidToSid_r_state *state =
288 0 : tevent_req_data(req,
289 : struct dcerpc_unixinfo_UidToSid_r_state);
290 0 : NTSTATUS status;
291 :
292 0 : if (tevent_req_is_nterror(req, &status)) {
293 0 : tevent_req_received(req);
294 0 : return status;
295 : }
296 :
297 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
298 :
299 0 : tevent_req_received(req);
300 0 : return NT_STATUS_OK;
301 : }
302 :
303 3 : NTSTATUS dcerpc_unixinfo_UidToSid_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct unixinfo_UidToSid *r)
304 : {
305 0 : NTSTATUS status;
306 :
307 3 : status = dcerpc_binding_handle_call(h,
308 : NULL, &ndr_table_unixinfo,
309 : NDR_UNIXINFO_UIDTOSID, mem_ctx, r);
310 :
311 3 : return status;
312 : }
313 :
314 : struct dcerpc_unixinfo_UidToSid_state {
315 : struct unixinfo_UidToSid orig;
316 : struct unixinfo_UidToSid tmp;
317 : TALLOC_CTX *out_mem_ctx;
318 : };
319 :
320 : static void dcerpc_unixinfo_UidToSid_done(struct tevent_req *subreq);
321 :
322 0 : struct tevent_req *dcerpc_unixinfo_UidToSid_send(TALLOC_CTX *mem_ctx,
323 : struct tevent_context *ev,
324 : struct dcerpc_binding_handle *h,
325 : uint64_t _uid /* [in] */,
326 : struct dom_sid *_sid /* [out] [ref] */)
327 : {
328 0 : struct tevent_req *req;
329 0 : struct dcerpc_unixinfo_UidToSid_state *state;
330 0 : struct tevent_req *subreq;
331 :
332 0 : req = tevent_req_create(mem_ctx, &state,
333 : struct dcerpc_unixinfo_UidToSid_state);
334 0 : if (req == NULL) {
335 0 : return NULL;
336 : }
337 0 : state->out_mem_ctx = NULL;
338 :
339 : /* In parameters */
340 0 : state->orig.in.uid = _uid;
341 :
342 : /* Out parameters */
343 0 : state->orig.out.sid = _sid;
344 :
345 : /* Result */
346 0 : NDR_ZERO_STRUCT(state->orig.out.result);
347 :
348 0 : state->out_mem_ctx = talloc_named_const(state, 0,
349 : "dcerpc_unixinfo_UidToSid_out_memory");
350 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
351 0 : return tevent_req_post(req, ev);
352 : }
353 :
354 : /* make a temporary copy, that we pass to the dispatch function */
355 0 : state->tmp = state->orig;
356 :
357 0 : subreq = dcerpc_unixinfo_UidToSid_r_send(state, ev, h, &state->tmp);
358 0 : if (tevent_req_nomem(subreq, req)) {
359 0 : return tevent_req_post(req, ev);
360 : }
361 0 : tevent_req_set_callback(subreq, dcerpc_unixinfo_UidToSid_done, req);
362 0 : return req;
363 : }
364 :
365 0 : static void dcerpc_unixinfo_UidToSid_done(struct tevent_req *subreq)
366 : {
367 0 : struct tevent_req *req = tevent_req_callback_data(
368 : subreq, struct tevent_req);
369 0 : struct dcerpc_unixinfo_UidToSid_state *state = tevent_req_data(
370 : req, struct dcerpc_unixinfo_UidToSid_state);
371 0 : NTSTATUS status;
372 0 : TALLOC_CTX *mem_ctx;
373 :
374 0 : if (state->out_mem_ctx) {
375 0 : mem_ctx = state->out_mem_ctx;
376 : } else {
377 0 : mem_ctx = state;
378 : }
379 :
380 0 : status = dcerpc_unixinfo_UidToSid_r_recv(subreq, mem_ctx);
381 0 : TALLOC_FREE(subreq);
382 0 : if (tevent_req_nterror(req, status)) {
383 0 : return;
384 : }
385 :
386 : /* Copy out parameters */
387 0 : *state->orig.out.sid = *state->tmp.out.sid;
388 :
389 : /* Copy result */
390 0 : state->orig.out.result = state->tmp.out.result;
391 :
392 : /* Reset temporary structure */
393 0 : NDR_ZERO_STRUCT(state->tmp);
394 :
395 0 : tevent_req_done(req);
396 : }
397 :
398 0 : NTSTATUS dcerpc_unixinfo_UidToSid_recv(struct tevent_req *req,
399 : TALLOC_CTX *mem_ctx,
400 : NTSTATUS *result)
401 : {
402 0 : struct dcerpc_unixinfo_UidToSid_state *state = tevent_req_data(
403 : req, struct dcerpc_unixinfo_UidToSid_state);
404 0 : NTSTATUS status;
405 :
406 0 : if (tevent_req_is_nterror(req, &status)) {
407 0 : tevent_req_received(req);
408 0 : return status;
409 : }
410 :
411 : /* Steal possible out parameters to the callers context */
412 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
413 :
414 : /* Return result */
415 0 : *result = state->orig.out.result;
416 :
417 0 : tevent_req_received(req);
418 0 : return NT_STATUS_OK;
419 : }
420 :
421 0 : NTSTATUS dcerpc_unixinfo_UidToSid(struct dcerpc_binding_handle *h,
422 : TALLOC_CTX *mem_ctx,
423 : uint64_t _uid /* [in] */,
424 : struct dom_sid *_sid /* [out] [ref] */,
425 : NTSTATUS *result)
426 : {
427 0 : struct unixinfo_UidToSid r;
428 0 : NTSTATUS status;
429 :
430 : /* In parameters */
431 0 : r.in.uid = _uid;
432 :
433 : /* Out parameters */
434 0 : r.out.sid = _sid;
435 :
436 : /* Result */
437 0 : NDR_ZERO_STRUCT(r.out.result);
438 :
439 0 : status = dcerpc_unixinfo_UidToSid_r(h, mem_ctx, &r);
440 0 : if (!NT_STATUS_IS_OK(status)) {
441 0 : return status;
442 : }
443 :
444 : /* Return variables */
445 0 : *_sid = *r.out.sid;
446 :
447 : /* Return result */
448 0 : *result = r.out.result;
449 :
450 0 : return NT_STATUS_OK;
451 : }
452 :
453 : struct dcerpc_unixinfo_SidToGid_r_state {
454 : TALLOC_CTX *out_mem_ctx;
455 : };
456 :
457 : static void dcerpc_unixinfo_SidToGid_r_done(struct tevent_req *subreq);
458 :
459 0 : struct tevent_req *dcerpc_unixinfo_SidToGid_r_send(TALLOC_CTX *mem_ctx,
460 : struct tevent_context *ev,
461 : struct dcerpc_binding_handle *h,
462 : struct unixinfo_SidToGid *r)
463 : {
464 0 : struct tevent_req *req;
465 0 : struct dcerpc_unixinfo_SidToGid_r_state *state;
466 0 : struct tevent_req *subreq;
467 :
468 0 : req = tevent_req_create(mem_ctx, &state,
469 : struct dcerpc_unixinfo_SidToGid_r_state);
470 0 : if (req == NULL) {
471 0 : return NULL;
472 : }
473 :
474 0 : state->out_mem_ctx = talloc_new(state);
475 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
476 0 : return tevent_req_post(req, ev);
477 : }
478 :
479 0 : subreq = dcerpc_binding_handle_call_send(state, ev, h,
480 : NULL, &ndr_table_unixinfo,
481 0 : NDR_UNIXINFO_SIDTOGID, state->out_mem_ctx, r);
482 0 : if (tevent_req_nomem(subreq, req)) {
483 0 : return tevent_req_post(req, ev);
484 : }
485 0 : tevent_req_set_callback(subreq, dcerpc_unixinfo_SidToGid_r_done, req);
486 :
487 0 : return req;
488 : }
489 :
490 0 : static void dcerpc_unixinfo_SidToGid_r_done(struct tevent_req *subreq)
491 : {
492 0 : struct tevent_req *req =
493 0 : tevent_req_callback_data(subreq,
494 : struct tevent_req);
495 0 : NTSTATUS status;
496 :
497 0 : status = dcerpc_binding_handle_call_recv(subreq);
498 0 : TALLOC_FREE(subreq);
499 0 : if (tevent_req_nterror(req, status)) {
500 0 : return;
501 : }
502 :
503 0 : tevent_req_done(req);
504 : }
505 :
506 0 : NTSTATUS dcerpc_unixinfo_SidToGid_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
507 : {
508 0 : struct dcerpc_unixinfo_SidToGid_r_state *state =
509 0 : tevent_req_data(req,
510 : struct dcerpc_unixinfo_SidToGid_r_state);
511 0 : NTSTATUS status;
512 :
513 0 : if (tevent_req_is_nterror(req, &status)) {
514 0 : tevent_req_received(req);
515 0 : return status;
516 : }
517 :
518 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
519 :
520 0 : tevent_req_received(req);
521 0 : return NT_STATUS_OK;
522 : }
523 :
524 3 : NTSTATUS dcerpc_unixinfo_SidToGid_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct unixinfo_SidToGid *r)
525 : {
526 0 : NTSTATUS status;
527 :
528 3 : status = dcerpc_binding_handle_call(h,
529 : NULL, &ndr_table_unixinfo,
530 : NDR_UNIXINFO_SIDTOGID, mem_ctx, r);
531 :
532 3 : return status;
533 : }
534 :
535 : struct dcerpc_unixinfo_SidToGid_state {
536 : struct unixinfo_SidToGid orig;
537 : struct unixinfo_SidToGid tmp;
538 : TALLOC_CTX *out_mem_ctx;
539 : };
540 :
541 : static void dcerpc_unixinfo_SidToGid_done(struct tevent_req *subreq);
542 :
543 0 : struct tevent_req *dcerpc_unixinfo_SidToGid_send(TALLOC_CTX *mem_ctx,
544 : struct tevent_context *ev,
545 : struct dcerpc_binding_handle *h,
546 : struct dom_sid _sid /* [in] */,
547 : uint64_t *_gid /* [out] [ref] */)
548 : {
549 0 : struct tevent_req *req;
550 0 : struct dcerpc_unixinfo_SidToGid_state *state;
551 0 : struct tevent_req *subreq;
552 :
553 0 : req = tevent_req_create(mem_ctx, &state,
554 : struct dcerpc_unixinfo_SidToGid_state);
555 0 : if (req == NULL) {
556 0 : return NULL;
557 : }
558 0 : state->out_mem_ctx = NULL;
559 :
560 : /* In parameters */
561 0 : state->orig.in.sid = _sid;
562 :
563 : /* Out parameters */
564 0 : state->orig.out.gid = _gid;
565 :
566 : /* Result */
567 0 : NDR_ZERO_STRUCT(state->orig.out.result);
568 :
569 0 : state->out_mem_ctx = talloc_named_const(state, 0,
570 : "dcerpc_unixinfo_SidToGid_out_memory");
571 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
572 0 : return tevent_req_post(req, ev);
573 : }
574 :
575 : /* make a temporary copy, that we pass to the dispatch function */
576 0 : state->tmp = state->orig;
577 :
578 0 : subreq = dcerpc_unixinfo_SidToGid_r_send(state, ev, h, &state->tmp);
579 0 : if (tevent_req_nomem(subreq, req)) {
580 0 : return tevent_req_post(req, ev);
581 : }
582 0 : tevent_req_set_callback(subreq, dcerpc_unixinfo_SidToGid_done, req);
583 0 : return req;
584 : }
585 :
586 0 : static void dcerpc_unixinfo_SidToGid_done(struct tevent_req *subreq)
587 : {
588 0 : struct tevent_req *req = tevent_req_callback_data(
589 : subreq, struct tevent_req);
590 0 : struct dcerpc_unixinfo_SidToGid_state *state = tevent_req_data(
591 : req, struct dcerpc_unixinfo_SidToGid_state);
592 0 : NTSTATUS status;
593 0 : TALLOC_CTX *mem_ctx;
594 :
595 0 : if (state->out_mem_ctx) {
596 0 : mem_ctx = state->out_mem_ctx;
597 : } else {
598 0 : mem_ctx = state;
599 : }
600 :
601 0 : status = dcerpc_unixinfo_SidToGid_r_recv(subreq, mem_ctx);
602 0 : TALLOC_FREE(subreq);
603 0 : if (tevent_req_nterror(req, status)) {
604 0 : return;
605 : }
606 :
607 : /* Copy out parameters */
608 0 : *state->orig.out.gid = *state->tmp.out.gid;
609 :
610 : /* Copy result */
611 0 : state->orig.out.result = state->tmp.out.result;
612 :
613 : /* Reset temporary structure */
614 0 : NDR_ZERO_STRUCT(state->tmp);
615 :
616 0 : tevent_req_done(req);
617 : }
618 :
619 0 : NTSTATUS dcerpc_unixinfo_SidToGid_recv(struct tevent_req *req,
620 : TALLOC_CTX *mem_ctx,
621 : NTSTATUS *result)
622 : {
623 0 : struct dcerpc_unixinfo_SidToGid_state *state = tevent_req_data(
624 : req, struct dcerpc_unixinfo_SidToGid_state);
625 0 : NTSTATUS status;
626 :
627 0 : if (tevent_req_is_nterror(req, &status)) {
628 0 : tevent_req_received(req);
629 0 : return status;
630 : }
631 :
632 : /* Steal possible out parameters to the callers context */
633 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
634 :
635 : /* Return result */
636 0 : *result = state->orig.out.result;
637 :
638 0 : tevent_req_received(req);
639 0 : return NT_STATUS_OK;
640 : }
641 :
642 0 : NTSTATUS dcerpc_unixinfo_SidToGid(struct dcerpc_binding_handle *h,
643 : TALLOC_CTX *mem_ctx,
644 : struct dom_sid _sid /* [in] */,
645 : uint64_t *_gid /* [out] [ref] */,
646 : NTSTATUS *result)
647 : {
648 0 : struct unixinfo_SidToGid r;
649 0 : NTSTATUS status;
650 :
651 : /* In parameters */
652 0 : r.in.sid = _sid;
653 :
654 : /* Out parameters */
655 0 : r.out.gid = _gid;
656 :
657 : /* Result */
658 0 : NDR_ZERO_STRUCT(r.out.result);
659 :
660 0 : status = dcerpc_unixinfo_SidToGid_r(h, mem_ctx, &r);
661 0 : if (!NT_STATUS_IS_OK(status)) {
662 0 : return status;
663 : }
664 :
665 : /* Return variables */
666 0 : *_gid = *r.out.gid;
667 :
668 : /* Return result */
669 0 : *result = r.out.result;
670 :
671 0 : return NT_STATUS_OK;
672 : }
673 :
674 : struct dcerpc_unixinfo_GidToSid_r_state {
675 : TALLOC_CTX *out_mem_ctx;
676 : };
677 :
678 : static void dcerpc_unixinfo_GidToSid_r_done(struct tevent_req *subreq);
679 :
680 0 : struct tevent_req *dcerpc_unixinfo_GidToSid_r_send(TALLOC_CTX *mem_ctx,
681 : struct tevent_context *ev,
682 : struct dcerpc_binding_handle *h,
683 : struct unixinfo_GidToSid *r)
684 : {
685 0 : struct tevent_req *req;
686 0 : struct dcerpc_unixinfo_GidToSid_r_state *state;
687 0 : struct tevent_req *subreq;
688 :
689 0 : req = tevent_req_create(mem_ctx, &state,
690 : struct dcerpc_unixinfo_GidToSid_r_state);
691 0 : if (req == NULL) {
692 0 : return NULL;
693 : }
694 :
695 0 : state->out_mem_ctx = talloc_new(state);
696 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
697 0 : return tevent_req_post(req, ev);
698 : }
699 :
700 0 : subreq = dcerpc_binding_handle_call_send(state, ev, h,
701 : NULL, &ndr_table_unixinfo,
702 0 : NDR_UNIXINFO_GIDTOSID, state->out_mem_ctx, r);
703 0 : if (tevent_req_nomem(subreq, req)) {
704 0 : return tevent_req_post(req, ev);
705 : }
706 0 : tevent_req_set_callback(subreq, dcerpc_unixinfo_GidToSid_r_done, req);
707 :
708 0 : return req;
709 : }
710 :
711 0 : static void dcerpc_unixinfo_GidToSid_r_done(struct tevent_req *subreq)
712 : {
713 0 : struct tevent_req *req =
714 0 : tevent_req_callback_data(subreq,
715 : struct tevent_req);
716 0 : NTSTATUS status;
717 :
718 0 : status = dcerpc_binding_handle_call_recv(subreq);
719 0 : TALLOC_FREE(subreq);
720 0 : if (tevent_req_nterror(req, status)) {
721 0 : return;
722 : }
723 :
724 0 : tevent_req_done(req);
725 : }
726 :
727 0 : NTSTATUS dcerpc_unixinfo_GidToSid_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
728 : {
729 0 : struct dcerpc_unixinfo_GidToSid_r_state *state =
730 0 : tevent_req_data(req,
731 : struct dcerpc_unixinfo_GidToSid_r_state);
732 0 : NTSTATUS status;
733 :
734 0 : if (tevent_req_is_nterror(req, &status)) {
735 0 : tevent_req_received(req);
736 0 : return status;
737 : }
738 :
739 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
740 :
741 0 : tevent_req_received(req);
742 0 : return NT_STATUS_OK;
743 : }
744 :
745 3 : NTSTATUS dcerpc_unixinfo_GidToSid_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct unixinfo_GidToSid *r)
746 : {
747 0 : NTSTATUS status;
748 :
749 3 : status = dcerpc_binding_handle_call(h,
750 : NULL, &ndr_table_unixinfo,
751 : NDR_UNIXINFO_GIDTOSID, mem_ctx, r);
752 :
753 3 : return status;
754 : }
755 :
756 : struct dcerpc_unixinfo_GidToSid_state {
757 : struct unixinfo_GidToSid orig;
758 : struct unixinfo_GidToSid tmp;
759 : TALLOC_CTX *out_mem_ctx;
760 : };
761 :
762 : static void dcerpc_unixinfo_GidToSid_done(struct tevent_req *subreq);
763 :
764 0 : struct tevent_req *dcerpc_unixinfo_GidToSid_send(TALLOC_CTX *mem_ctx,
765 : struct tevent_context *ev,
766 : struct dcerpc_binding_handle *h,
767 : uint64_t _gid /* [in] */,
768 : struct dom_sid *_sid /* [out] [ref] */)
769 : {
770 0 : struct tevent_req *req;
771 0 : struct dcerpc_unixinfo_GidToSid_state *state;
772 0 : struct tevent_req *subreq;
773 :
774 0 : req = tevent_req_create(mem_ctx, &state,
775 : struct dcerpc_unixinfo_GidToSid_state);
776 0 : if (req == NULL) {
777 0 : return NULL;
778 : }
779 0 : state->out_mem_ctx = NULL;
780 :
781 : /* In parameters */
782 0 : state->orig.in.gid = _gid;
783 :
784 : /* Out parameters */
785 0 : state->orig.out.sid = _sid;
786 :
787 : /* Result */
788 0 : NDR_ZERO_STRUCT(state->orig.out.result);
789 :
790 0 : state->out_mem_ctx = talloc_named_const(state, 0,
791 : "dcerpc_unixinfo_GidToSid_out_memory");
792 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
793 0 : return tevent_req_post(req, ev);
794 : }
795 :
796 : /* make a temporary copy, that we pass to the dispatch function */
797 0 : state->tmp = state->orig;
798 :
799 0 : subreq = dcerpc_unixinfo_GidToSid_r_send(state, ev, h, &state->tmp);
800 0 : if (tevent_req_nomem(subreq, req)) {
801 0 : return tevent_req_post(req, ev);
802 : }
803 0 : tevent_req_set_callback(subreq, dcerpc_unixinfo_GidToSid_done, req);
804 0 : return req;
805 : }
806 :
807 0 : static void dcerpc_unixinfo_GidToSid_done(struct tevent_req *subreq)
808 : {
809 0 : struct tevent_req *req = tevent_req_callback_data(
810 : subreq, struct tevent_req);
811 0 : struct dcerpc_unixinfo_GidToSid_state *state = tevent_req_data(
812 : req, struct dcerpc_unixinfo_GidToSid_state);
813 0 : NTSTATUS status;
814 0 : TALLOC_CTX *mem_ctx;
815 :
816 0 : if (state->out_mem_ctx) {
817 0 : mem_ctx = state->out_mem_ctx;
818 : } else {
819 0 : mem_ctx = state;
820 : }
821 :
822 0 : status = dcerpc_unixinfo_GidToSid_r_recv(subreq, mem_ctx);
823 0 : TALLOC_FREE(subreq);
824 0 : if (tevent_req_nterror(req, status)) {
825 0 : return;
826 : }
827 :
828 : /* Copy out parameters */
829 0 : *state->orig.out.sid = *state->tmp.out.sid;
830 :
831 : /* Copy result */
832 0 : state->orig.out.result = state->tmp.out.result;
833 :
834 : /* Reset temporary structure */
835 0 : NDR_ZERO_STRUCT(state->tmp);
836 :
837 0 : tevent_req_done(req);
838 : }
839 :
840 0 : NTSTATUS dcerpc_unixinfo_GidToSid_recv(struct tevent_req *req,
841 : TALLOC_CTX *mem_ctx,
842 : NTSTATUS *result)
843 : {
844 0 : struct dcerpc_unixinfo_GidToSid_state *state = tevent_req_data(
845 : req, struct dcerpc_unixinfo_GidToSid_state);
846 0 : NTSTATUS status;
847 :
848 0 : if (tevent_req_is_nterror(req, &status)) {
849 0 : tevent_req_received(req);
850 0 : return status;
851 : }
852 :
853 : /* Steal possible out parameters to the callers context */
854 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
855 :
856 : /* Return result */
857 0 : *result = state->orig.out.result;
858 :
859 0 : tevent_req_received(req);
860 0 : return NT_STATUS_OK;
861 : }
862 :
863 0 : NTSTATUS dcerpc_unixinfo_GidToSid(struct dcerpc_binding_handle *h,
864 : TALLOC_CTX *mem_ctx,
865 : uint64_t _gid /* [in] */,
866 : struct dom_sid *_sid /* [out] [ref] */,
867 : NTSTATUS *result)
868 : {
869 0 : struct unixinfo_GidToSid r;
870 0 : NTSTATUS status;
871 :
872 : /* In parameters */
873 0 : r.in.gid = _gid;
874 :
875 : /* Out parameters */
876 0 : r.out.sid = _sid;
877 :
878 : /* Result */
879 0 : NDR_ZERO_STRUCT(r.out.result);
880 :
881 0 : status = dcerpc_unixinfo_GidToSid_r(h, mem_ctx, &r);
882 0 : if (!NT_STATUS_IS_OK(status)) {
883 0 : return status;
884 : }
885 :
886 : /* Return variables */
887 0 : *_sid = *r.out.sid;
888 :
889 : /* Return result */
890 0 : *result = r.out.result;
891 :
892 0 : return NT_STATUS_OK;
893 : }
894 :
895 : struct dcerpc_unixinfo_GetPWUid_r_state {
896 : TALLOC_CTX *out_mem_ctx;
897 : };
898 :
899 : static void dcerpc_unixinfo_GetPWUid_r_done(struct tevent_req *subreq);
900 :
901 0 : struct tevent_req *dcerpc_unixinfo_GetPWUid_r_send(TALLOC_CTX *mem_ctx,
902 : struct tevent_context *ev,
903 : struct dcerpc_binding_handle *h,
904 : struct unixinfo_GetPWUid *r)
905 : {
906 0 : struct tevent_req *req;
907 0 : struct dcerpc_unixinfo_GetPWUid_r_state *state;
908 0 : struct tevent_req *subreq;
909 :
910 0 : req = tevent_req_create(mem_ctx, &state,
911 : struct dcerpc_unixinfo_GetPWUid_r_state);
912 0 : if (req == NULL) {
913 0 : return NULL;
914 : }
915 :
916 0 : state->out_mem_ctx = talloc_new(state);
917 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
918 0 : return tevent_req_post(req, ev);
919 : }
920 :
921 0 : subreq = dcerpc_binding_handle_call_send(state, ev, h,
922 : NULL, &ndr_table_unixinfo,
923 0 : NDR_UNIXINFO_GETPWUID, state->out_mem_ctx, r);
924 0 : if (tevent_req_nomem(subreq, req)) {
925 0 : return tevent_req_post(req, ev);
926 : }
927 0 : tevent_req_set_callback(subreq, dcerpc_unixinfo_GetPWUid_r_done, req);
928 :
929 0 : return req;
930 : }
931 :
932 0 : static void dcerpc_unixinfo_GetPWUid_r_done(struct tevent_req *subreq)
933 : {
934 0 : struct tevent_req *req =
935 0 : tevent_req_callback_data(subreq,
936 : struct tevent_req);
937 0 : NTSTATUS status;
938 :
939 0 : status = dcerpc_binding_handle_call_recv(subreq);
940 0 : TALLOC_FREE(subreq);
941 0 : if (tevent_req_nterror(req, status)) {
942 0 : return;
943 : }
944 :
945 0 : tevent_req_done(req);
946 : }
947 :
948 0 : NTSTATUS dcerpc_unixinfo_GetPWUid_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
949 : {
950 0 : struct dcerpc_unixinfo_GetPWUid_r_state *state =
951 0 : tevent_req_data(req,
952 : struct dcerpc_unixinfo_GetPWUid_r_state);
953 0 : NTSTATUS status;
954 :
955 0 : if (tevent_req_is_nterror(req, &status)) {
956 0 : tevent_req_received(req);
957 0 : return status;
958 : }
959 :
960 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
961 :
962 0 : tevent_req_received(req);
963 0 : return NT_STATUS_OK;
964 : }
965 :
966 3 : NTSTATUS dcerpc_unixinfo_GetPWUid_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct unixinfo_GetPWUid *r)
967 : {
968 0 : NTSTATUS status;
969 :
970 3 : status = dcerpc_binding_handle_call(h,
971 : NULL, &ndr_table_unixinfo,
972 : NDR_UNIXINFO_GETPWUID, mem_ctx, r);
973 :
974 3 : return status;
975 : }
976 :
977 : struct dcerpc_unixinfo_GetPWUid_state {
978 : struct unixinfo_GetPWUid orig;
979 : struct unixinfo_GetPWUid tmp;
980 : TALLOC_CTX *out_mem_ctx;
981 : };
982 :
983 : static void dcerpc_unixinfo_GetPWUid_done(struct tevent_req *subreq);
984 :
985 0 : struct tevent_req *dcerpc_unixinfo_GetPWUid_send(TALLOC_CTX *mem_ctx,
986 : struct tevent_context *ev,
987 : struct dcerpc_binding_handle *h,
988 : uint32_t *_count /* [in,out] [range(0,1023),ref] */,
989 : uint64_t *_uids /* [in] [size_is(*count)] */,
990 : struct unixinfo_GetPWUidInfo *_infos /* [out] [size_is(*count)] */)
991 : {
992 0 : struct tevent_req *req;
993 0 : struct dcerpc_unixinfo_GetPWUid_state *state;
994 0 : struct tevent_req *subreq;
995 :
996 0 : req = tevent_req_create(mem_ctx, &state,
997 : struct dcerpc_unixinfo_GetPWUid_state);
998 0 : if (req == NULL) {
999 0 : return NULL;
1000 : }
1001 0 : state->out_mem_ctx = NULL;
1002 :
1003 : /* In parameters */
1004 0 : state->orig.in.count = _count;
1005 0 : state->orig.in.uids = _uids;
1006 :
1007 : /* Out parameters */
1008 0 : state->orig.out.count = _count;
1009 0 : state->orig.out.infos = _infos;
1010 :
1011 : /* Result */
1012 0 : NDR_ZERO_STRUCT(state->orig.out.result);
1013 :
1014 0 : state->out_mem_ctx = talloc_named_const(state, 0,
1015 : "dcerpc_unixinfo_GetPWUid_out_memory");
1016 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
1017 0 : return tevent_req_post(req, ev);
1018 : }
1019 :
1020 : /* make a temporary copy, that we pass to the dispatch function */
1021 0 : state->tmp = state->orig;
1022 :
1023 0 : subreq = dcerpc_unixinfo_GetPWUid_r_send(state, ev, h, &state->tmp);
1024 0 : if (tevent_req_nomem(subreq, req)) {
1025 0 : return tevent_req_post(req, ev);
1026 : }
1027 0 : tevent_req_set_callback(subreq, dcerpc_unixinfo_GetPWUid_done, req);
1028 0 : return req;
1029 : }
1030 :
1031 0 : static void dcerpc_unixinfo_GetPWUid_done(struct tevent_req *subreq)
1032 : {
1033 0 : struct tevent_req *req = tevent_req_callback_data(
1034 : subreq, struct tevent_req);
1035 0 : struct dcerpc_unixinfo_GetPWUid_state *state = tevent_req_data(
1036 : req, struct dcerpc_unixinfo_GetPWUid_state);
1037 0 : NTSTATUS status;
1038 0 : TALLOC_CTX *mem_ctx;
1039 :
1040 0 : if (state->out_mem_ctx) {
1041 0 : mem_ctx = state->out_mem_ctx;
1042 : } else {
1043 0 : mem_ctx = state;
1044 : }
1045 :
1046 0 : status = dcerpc_unixinfo_GetPWUid_r_recv(subreq, mem_ctx);
1047 0 : TALLOC_FREE(subreq);
1048 0 : if (tevent_req_nterror(req, status)) {
1049 0 : return;
1050 : }
1051 :
1052 : /* Copy out parameters */
1053 0 : *state->orig.out.count = *state->tmp.out.count;
1054 : {
1055 0 : size_t _copy_len_infos;
1056 0 : if ((*state->tmp.out.count) > (*state->tmp.in.count)) {
1057 0 : tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
1058 0 : return;
1059 : }
1060 0 : _copy_len_infos = *state->tmp.out.count;
1061 0 : if (state->orig.out.infos != state->tmp.out.infos) {
1062 0 : memcpy(state->orig.out.infos, state->tmp.out.infos, _copy_len_infos * sizeof(*state->orig.out.infos));
1063 : }
1064 : }
1065 :
1066 : /* Copy result */
1067 0 : state->orig.out.result = state->tmp.out.result;
1068 :
1069 : /* Reset temporary structure */
1070 0 : NDR_ZERO_STRUCT(state->tmp);
1071 :
1072 0 : tevent_req_done(req);
1073 : }
1074 :
1075 0 : NTSTATUS dcerpc_unixinfo_GetPWUid_recv(struct tevent_req *req,
1076 : TALLOC_CTX *mem_ctx,
1077 : NTSTATUS *result)
1078 : {
1079 0 : struct dcerpc_unixinfo_GetPWUid_state *state = tevent_req_data(
1080 : req, struct dcerpc_unixinfo_GetPWUid_state);
1081 0 : NTSTATUS status;
1082 :
1083 0 : if (tevent_req_is_nterror(req, &status)) {
1084 0 : tevent_req_received(req);
1085 0 : return status;
1086 : }
1087 :
1088 : /* Steal possible out parameters to the callers context */
1089 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
1090 :
1091 : /* Return result */
1092 0 : *result = state->orig.out.result;
1093 :
1094 0 : tevent_req_received(req);
1095 0 : return NT_STATUS_OK;
1096 : }
1097 :
1098 0 : NTSTATUS dcerpc_unixinfo_GetPWUid(struct dcerpc_binding_handle *h,
1099 : TALLOC_CTX *mem_ctx,
1100 : uint32_t *_count /* [in,out] [range(0,1023),ref] */,
1101 : uint64_t *_uids /* [in] [size_is(*count)] */,
1102 : struct unixinfo_GetPWUidInfo *_infos /* [out] [size_is(*count)] */,
1103 : NTSTATUS *result)
1104 : {
1105 0 : struct unixinfo_GetPWUid r;
1106 0 : NTSTATUS status;
1107 :
1108 : /* In parameters */
1109 0 : r.in.count = _count;
1110 0 : r.in.uids = _uids;
1111 :
1112 : /* Out parameters */
1113 0 : r.out.count = _count;
1114 0 : r.out.infos = _infos;
1115 :
1116 : /* Result */
1117 0 : NDR_ZERO_STRUCT(r.out.result);
1118 :
1119 0 : status = dcerpc_unixinfo_GetPWUid_r(h, mem_ctx, &r);
1120 0 : if (!NT_STATUS_IS_OK(status)) {
1121 0 : return status;
1122 : }
1123 :
1124 : /* Return variables */
1125 0 : *_count = *r.out.count;
1126 : {
1127 0 : size_t _copy_len_infos;
1128 0 : if ((*r.out.count) > (*r.in.count)) {
1129 0 : return NT_STATUS_INVALID_NETWORK_RESPONSE;
1130 : }
1131 0 : _copy_len_infos = *r.out.count;
1132 0 : if (_infos != r.out.infos) {
1133 0 : memcpy(_infos, r.out.infos, _copy_len_infos * sizeof(*_infos));
1134 : }
1135 : }
1136 :
1137 : /* Return result */
1138 0 : *result = r.out.result;
1139 :
1140 0 : return NT_STATUS_OK;
1141 : }
1142 :
|