1 /* client functions auto-generated by pidl */
5 #include "lib/util/tevent_ntstatus.h"
6 #include "librpc/gen_ndr/ndr_unixinfo.h"
7 #include "librpc/gen_ndr/ndr_unixinfo_c.h"
9 /* unixinfo - client functions generated by pidl */
11 struct dcerpc_unixinfo_SidToUid_r_state {
12 TALLOC_CTX *out_mem_ctx;
15 static void dcerpc_unixinfo_SidToUid_r_done(struct tevent_req *subreq);
17 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)
22 struct tevent_req *req;
23 struct dcerpc_unixinfo_SidToUid_r_state *state;
24 struct tevent_req *subreq;
26 req = tevent_req_create(mem_ctx, &state,
27 struct dcerpc_unixinfo_SidToUid_r_state);
32 state->out_mem_ctx = talloc_new(state);
33 if (tevent_req_nomem(state->out_mem_ctx, req)) {
34 return tevent_req_post(req, ev);
37 subreq = dcerpc_binding_handle_call_send(state, ev, h,
38 NULL, &ndr_table_unixinfo,
39 NDR_UNIXINFO_SIDTOUID, state->out_mem_ctx, r);
40 if (tevent_req_nomem(subreq, req)) {
41 return tevent_req_post(req, ev);
43 tevent_req_set_callback(subreq, dcerpc_unixinfo_SidToUid_r_done, req);
48 static void dcerpc_unixinfo_SidToUid_r_done(struct tevent_req *subreq)
50 struct tevent_req *req =
51 tevent_req_callback_data(subreq,
55 status = dcerpc_binding_handle_call_recv(subreq);
56 if (!NT_STATUS_IS_OK(status)) {
57 tevent_req_nterror(req, status);
64 NTSTATUS dcerpc_unixinfo_SidToUid_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
66 struct dcerpc_unixinfo_SidToUid_r_state *state =
68 struct dcerpc_unixinfo_SidToUid_r_state);
71 if (tevent_req_is_nterror(req, &status)) {
72 tevent_req_received(req);
76 talloc_steal(mem_ctx, state->out_mem_ctx);
78 tevent_req_received(req);
82 NTSTATUS dcerpc_unixinfo_SidToUid_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct unixinfo_SidToUid *r)
86 status = dcerpc_binding_handle_call(h,
87 NULL, &ndr_table_unixinfo,
88 NDR_UNIXINFO_SIDTOUID, mem_ctx, r);
93 NTSTATUS dcerpc_unixinfo_SidToUid_compat(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct unixinfo_SidToUid *r)
97 status = dcerpc_unixinfo_SidToUid_r(p->binding_handle, mem_ctx, r);
99 if (NT_STATUS_IS_RPC(status)) {
100 status = NT_STATUS_NET_WRITE_FAULT;
103 if (NT_STATUS_IS_OK(status)) {
104 status = r->out.result;
110 struct dcerpc_unixinfo_SidToUid_state {
111 struct unixinfo_SidToUid orig;
112 struct unixinfo_SidToUid tmp;
113 TALLOC_CTX *out_mem_ctx;
116 static void dcerpc_unixinfo_SidToUid_done(struct tevent_req *subreq);
118 struct tevent_req *dcerpc_unixinfo_SidToUid_send(TALLOC_CTX *mem_ctx,
119 struct tevent_context *ev,
120 struct dcerpc_binding_handle *h,
121 struct dom_sid _sid /* [in] */,
122 uint64_t *_uid /* [out] [ref] */)
124 struct tevent_req *req;
125 struct dcerpc_unixinfo_SidToUid_state *state;
126 struct tevent_req *subreq;
128 req = tevent_req_create(mem_ctx, &state,
129 struct dcerpc_unixinfo_SidToUid_state);
133 state->out_mem_ctx = NULL;
136 state->orig.in.sid = _sid;
139 state->orig.out.uid = _uid;
142 ZERO_STRUCT(state->orig.out.result);
144 state->out_mem_ctx = talloc_named_const(state, 0,
145 "dcerpc_unixinfo_SidToUid_out_memory");
146 if (tevent_req_nomem(state->out_mem_ctx, req)) {
147 return tevent_req_post(req, ev);
150 /* make a temporary copy, that we pass to the dispatch function */
151 state->tmp = state->orig;
153 subreq = dcerpc_unixinfo_SidToUid_r_send(state, ev, h, &state->tmp);
154 if (tevent_req_nomem(subreq, req)) {
155 return tevent_req_post(req, ev);
157 tevent_req_set_callback(subreq, dcerpc_unixinfo_SidToUid_done, req);
161 static void dcerpc_unixinfo_SidToUid_done(struct tevent_req *subreq)
163 struct tevent_req *req = tevent_req_callback_data(
164 subreq, struct tevent_req);
165 struct dcerpc_unixinfo_SidToUid_state *state = tevent_req_data(
166 req, struct dcerpc_unixinfo_SidToUid_state);
170 if (state->out_mem_ctx) {
171 mem_ctx = state->out_mem_ctx;
176 status = dcerpc_unixinfo_SidToUid_r_recv(subreq, mem_ctx);
178 if (!NT_STATUS_IS_OK(status)) {
179 tevent_req_nterror(req, status);
183 /* Copy out parameters */
184 *state->orig.out.uid = *state->tmp.out.uid;
187 state->orig.out.result = state->tmp.out.result;
189 /* Reset temporary structure */
190 ZERO_STRUCT(state->tmp);
192 tevent_req_done(req);
195 NTSTATUS dcerpc_unixinfo_SidToUid_recv(struct tevent_req *req,
199 struct dcerpc_unixinfo_SidToUid_state *state = tevent_req_data(
200 req, struct dcerpc_unixinfo_SidToUid_state);
203 if (tevent_req_is_nterror(req, &status)) {
204 tevent_req_received(req);
208 /* Steal possible out parameters to the callers context */
209 talloc_steal(mem_ctx, state->out_mem_ctx);
212 *result = state->orig.out.result;
214 tevent_req_received(req);
218 NTSTATUS dcerpc_unixinfo_SidToUid(struct dcerpc_binding_handle *h,
220 struct dom_sid _sid /* [in] */,
221 uint64_t *_uid /* [out] [ref] */,
224 struct unixinfo_SidToUid r;
230 status = dcerpc_unixinfo_SidToUid_r(h, mem_ctx, &r);
231 if (!NT_STATUS_IS_OK(status)) {
235 /* Return variables */
239 *result = r.out.result;
244 struct dcerpc_unixinfo_UidToSid_r_state {
245 TALLOC_CTX *out_mem_ctx;
248 static void dcerpc_unixinfo_UidToSid_r_done(struct tevent_req *subreq);
250 struct tevent_req *dcerpc_unixinfo_UidToSid_r_send(TALLOC_CTX *mem_ctx,
251 struct tevent_context *ev,
252 struct dcerpc_binding_handle *h,
253 struct unixinfo_UidToSid *r)
255 struct tevent_req *req;
256 struct dcerpc_unixinfo_UidToSid_r_state *state;
257 struct tevent_req *subreq;
259 req = tevent_req_create(mem_ctx, &state,
260 struct dcerpc_unixinfo_UidToSid_r_state);
265 state->out_mem_ctx = talloc_new(state);
266 if (tevent_req_nomem(state->out_mem_ctx, req)) {
267 return tevent_req_post(req, ev);
270 subreq = dcerpc_binding_handle_call_send(state, ev, h,
271 NULL, &ndr_table_unixinfo,
272 NDR_UNIXINFO_UIDTOSID, state->out_mem_ctx, r);
273 if (tevent_req_nomem(subreq, req)) {
274 return tevent_req_post(req, ev);
276 tevent_req_set_callback(subreq, dcerpc_unixinfo_UidToSid_r_done, req);
281 static void dcerpc_unixinfo_UidToSid_r_done(struct tevent_req *subreq)
283 struct tevent_req *req =
284 tevent_req_callback_data(subreq,
288 status = dcerpc_binding_handle_call_recv(subreq);
289 if (!NT_STATUS_IS_OK(status)) {
290 tevent_req_nterror(req, status);
294 tevent_req_done(req);
297 NTSTATUS dcerpc_unixinfo_UidToSid_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
299 struct dcerpc_unixinfo_UidToSid_r_state *state =
301 struct dcerpc_unixinfo_UidToSid_r_state);
304 if (tevent_req_is_nterror(req, &status)) {
305 tevent_req_received(req);
309 talloc_steal(mem_ctx, state->out_mem_ctx);
311 tevent_req_received(req);
315 NTSTATUS dcerpc_unixinfo_UidToSid_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct unixinfo_UidToSid *r)
319 status = dcerpc_binding_handle_call(h,
320 NULL, &ndr_table_unixinfo,
321 NDR_UNIXINFO_UIDTOSID, mem_ctx, r);
326 NTSTATUS dcerpc_unixinfo_UidToSid_compat(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct unixinfo_UidToSid *r)
330 status = dcerpc_unixinfo_UidToSid_r(p->binding_handle, mem_ctx, r);
332 if (NT_STATUS_IS_RPC(status)) {
333 status = NT_STATUS_NET_WRITE_FAULT;
336 if (NT_STATUS_IS_OK(status)) {
337 status = r->out.result;
343 struct dcerpc_unixinfo_UidToSid_state {
344 struct unixinfo_UidToSid orig;
345 struct unixinfo_UidToSid tmp;
346 TALLOC_CTX *out_mem_ctx;
349 static void dcerpc_unixinfo_UidToSid_done(struct tevent_req *subreq);
351 struct tevent_req *dcerpc_unixinfo_UidToSid_send(TALLOC_CTX *mem_ctx,
352 struct tevent_context *ev,
353 struct dcerpc_binding_handle *h,
354 uint64_t _uid /* [in] */,
355 struct dom_sid *_sid /* [out] [ref] */)
357 struct tevent_req *req;
358 struct dcerpc_unixinfo_UidToSid_state *state;
359 struct tevent_req *subreq;
361 req = tevent_req_create(mem_ctx, &state,
362 struct dcerpc_unixinfo_UidToSid_state);
366 state->out_mem_ctx = NULL;
369 state->orig.in.uid = _uid;
372 state->orig.out.sid = _sid;
375 ZERO_STRUCT(state->orig.out.result);
377 state->out_mem_ctx = talloc_named_const(state, 0,
378 "dcerpc_unixinfo_UidToSid_out_memory");
379 if (tevent_req_nomem(state->out_mem_ctx, req)) {
380 return tevent_req_post(req, ev);
383 /* make a temporary copy, that we pass to the dispatch function */
384 state->tmp = state->orig;
386 subreq = dcerpc_unixinfo_UidToSid_r_send(state, ev, h, &state->tmp);
387 if (tevent_req_nomem(subreq, req)) {
388 return tevent_req_post(req, ev);
390 tevent_req_set_callback(subreq, dcerpc_unixinfo_UidToSid_done, req);
394 static void dcerpc_unixinfo_UidToSid_done(struct tevent_req *subreq)
396 struct tevent_req *req = tevent_req_callback_data(
397 subreq, struct tevent_req);
398 struct dcerpc_unixinfo_UidToSid_state *state = tevent_req_data(
399 req, struct dcerpc_unixinfo_UidToSid_state);
403 if (state->out_mem_ctx) {
404 mem_ctx = state->out_mem_ctx;
409 status = dcerpc_unixinfo_UidToSid_r_recv(subreq, mem_ctx);
411 if (!NT_STATUS_IS_OK(status)) {
412 tevent_req_nterror(req, status);
416 /* Copy out parameters */
417 *state->orig.out.sid = *state->tmp.out.sid;
420 state->orig.out.result = state->tmp.out.result;
422 /* Reset temporary structure */
423 ZERO_STRUCT(state->tmp);
425 tevent_req_done(req);
428 NTSTATUS dcerpc_unixinfo_UidToSid_recv(struct tevent_req *req,
432 struct dcerpc_unixinfo_UidToSid_state *state = tevent_req_data(
433 req, struct dcerpc_unixinfo_UidToSid_state);
436 if (tevent_req_is_nterror(req, &status)) {
437 tevent_req_received(req);
441 /* Steal possible out parameters to the callers context */
442 talloc_steal(mem_ctx, state->out_mem_ctx);
445 *result = state->orig.out.result;
447 tevent_req_received(req);
451 NTSTATUS dcerpc_unixinfo_UidToSid(struct dcerpc_binding_handle *h,
453 uint64_t _uid /* [in] */,
454 struct dom_sid *_sid /* [out] [ref] */,
457 struct unixinfo_UidToSid r;
463 status = dcerpc_unixinfo_UidToSid_r(h, mem_ctx, &r);
464 if (!NT_STATUS_IS_OK(status)) {
468 /* Return variables */
472 *result = r.out.result;
477 struct dcerpc_unixinfo_SidToGid_r_state {
478 TALLOC_CTX *out_mem_ctx;
481 static void dcerpc_unixinfo_SidToGid_r_done(struct tevent_req *subreq);
483 struct tevent_req *dcerpc_unixinfo_SidToGid_r_send(TALLOC_CTX *mem_ctx,
484 struct tevent_context *ev,
485 struct dcerpc_binding_handle *h,
486 struct unixinfo_SidToGid *r)
488 struct tevent_req *req;
489 struct dcerpc_unixinfo_SidToGid_r_state *state;
490 struct tevent_req *subreq;
492 req = tevent_req_create(mem_ctx, &state,
493 struct dcerpc_unixinfo_SidToGid_r_state);
498 state->out_mem_ctx = talloc_new(state);
499 if (tevent_req_nomem(state->out_mem_ctx, req)) {
500 return tevent_req_post(req, ev);
503 subreq = dcerpc_binding_handle_call_send(state, ev, h,
504 NULL, &ndr_table_unixinfo,
505 NDR_UNIXINFO_SIDTOGID, state->out_mem_ctx, r);
506 if (tevent_req_nomem(subreq, req)) {
507 return tevent_req_post(req, ev);
509 tevent_req_set_callback(subreq, dcerpc_unixinfo_SidToGid_r_done, req);
514 static void dcerpc_unixinfo_SidToGid_r_done(struct tevent_req *subreq)
516 struct tevent_req *req =
517 tevent_req_callback_data(subreq,
521 status = dcerpc_binding_handle_call_recv(subreq);
522 if (!NT_STATUS_IS_OK(status)) {
523 tevent_req_nterror(req, status);
527 tevent_req_done(req);
530 NTSTATUS dcerpc_unixinfo_SidToGid_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
532 struct dcerpc_unixinfo_SidToGid_r_state *state =
534 struct dcerpc_unixinfo_SidToGid_r_state);
537 if (tevent_req_is_nterror(req, &status)) {
538 tevent_req_received(req);
542 talloc_steal(mem_ctx, state->out_mem_ctx);
544 tevent_req_received(req);
548 NTSTATUS dcerpc_unixinfo_SidToGid_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct unixinfo_SidToGid *r)
552 status = dcerpc_binding_handle_call(h,
553 NULL, &ndr_table_unixinfo,
554 NDR_UNIXINFO_SIDTOGID, mem_ctx, r);
559 NTSTATUS dcerpc_unixinfo_SidToGid_compat(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct unixinfo_SidToGid *r)
563 status = dcerpc_unixinfo_SidToGid_r(p->binding_handle, mem_ctx, r);
565 if (NT_STATUS_IS_RPC(status)) {
566 status = NT_STATUS_NET_WRITE_FAULT;
569 if (NT_STATUS_IS_OK(status)) {
570 status = r->out.result;
576 struct dcerpc_unixinfo_SidToGid_state {
577 struct unixinfo_SidToGid orig;
578 struct unixinfo_SidToGid tmp;
579 TALLOC_CTX *out_mem_ctx;
582 static void dcerpc_unixinfo_SidToGid_done(struct tevent_req *subreq);
584 struct tevent_req *dcerpc_unixinfo_SidToGid_send(TALLOC_CTX *mem_ctx,
585 struct tevent_context *ev,
586 struct dcerpc_binding_handle *h,
587 struct dom_sid _sid /* [in] */,
588 uint64_t *_gid /* [out] [ref] */)
590 struct tevent_req *req;
591 struct dcerpc_unixinfo_SidToGid_state *state;
592 struct tevent_req *subreq;
594 req = tevent_req_create(mem_ctx, &state,
595 struct dcerpc_unixinfo_SidToGid_state);
599 state->out_mem_ctx = NULL;
602 state->orig.in.sid = _sid;
605 state->orig.out.gid = _gid;
608 ZERO_STRUCT(state->orig.out.result);
610 state->out_mem_ctx = talloc_named_const(state, 0,
611 "dcerpc_unixinfo_SidToGid_out_memory");
612 if (tevent_req_nomem(state->out_mem_ctx, req)) {
613 return tevent_req_post(req, ev);
616 /* make a temporary copy, that we pass to the dispatch function */
617 state->tmp = state->orig;
619 subreq = dcerpc_unixinfo_SidToGid_r_send(state, ev, h, &state->tmp);
620 if (tevent_req_nomem(subreq, req)) {
621 return tevent_req_post(req, ev);
623 tevent_req_set_callback(subreq, dcerpc_unixinfo_SidToGid_done, req);
627 static void dcerpc_unixinfo_SidToGid_done(struct tevent_req *subreq)
629 struct tevent_req *req = tevent_req_callback_data(
630 subreq, struct tevent_req);
631 struct dcerpc_unixinfo_SidToGid_state *state = tevent_req_data(
632 req, struct dcerpc_unixinfo_SidToGid_state);
636 if (state->out_mem_ctx) {
637 mem_ctx = state->out_mem_ctx;
642 status = dcerpc_unixinfo_SidToGid_r_recv(subreq, mem_ctx);
644 if (!NT_STATUS_IS_OK(status)) {
645 tevent_req_nterror(req, status);
649 /* Copy out parameters */
650 *state->orig.out.gid = *state->tmp.out.gid;
653 state->orig.out.result = state->tmp.out.result;
655 /* Reset temporary structure */
656 ZERO_STRUCT(state->tmp);
658 tevent_req_done(req);
661 NTSTATUS dcerpc_unixinfo_SidToGid_recv(struct tevent_req *req,
665 struct dcerpc_unixinfo_SidToGid_state *state = tevent_req_data(
666 req, struct dcerpc_unixinfo_SidToGid_state);
669 if (tevent_req_is_nterror(req, &status)) {
670 tevent_req_received(req);
674 /* Steal possible out parameters to the callers context */
675 talloc_steal(mem_ctx, state->out_mem_ctx);
678 *result = state->orig.out.result;
680 tevent_req_received(req);
684 NTSTATUS dcerpc_unixinfo_SidToGid(struct dcerpc_binding_handle *h,
686 struct dom_sid _sid /* [in] */,
687 uint64_t *_gid /* [out] [ref] */,
690 struct unixinfo_SidToGid r;
696 status = dcerpc_unixinfo_SidToGid_r(h, mem_ctx, &r);
697 if (!NT_STATUS_IS_OK(status)) {
701 /* Return variables */
705 *result = r.out.result;
710 struct dcerpc_unixinfo_GidToSid_r_state {
711 TALLOC_CTX *out_mem_ctx;
714 static void dcerpc_unixinfo_GidToSid_r_done(struct tevent_req *subreq);
716 struct tevent_req *dcerpc_unixinfo_GidToSid_r_send(TALLOC_CTX *mem_ctx,
717 struct tevent_context *ev,
718 struct dcerpc_binding_handle *h,
719 struct unixinfo_GidToSid *r)
721 struct tevent_req *req;
722 struct dcerpc_unixinfo_GidToSid_r_state *state;
723 struct tevent_req *subreq;
725 req = tevent_req_create(mem_ctx, &state,
726 struct dcerpc_unixinfo_GidToSid_r_state);
731 state->out_mem_ctx = talloc_new(state);
732 if (tevent_req_nomem(state->out_mem_ctx, req)) {
733 return tevent_req_post(req, ev);
736 subreq = dcerpc_binding_handle_call_send(state, ev, h,
737 NULL, &ndr_table_unixinfo,
738 NDR_UNIXINFO_GIDTOSID, state->out_mem_ctx, r);
739 if (tevent_req_nomem(subreq, req)) {
740 return tevent_req_post(req, ev);
742 tevent_req_set_callback(subreq, dcerpc_unixinfo_GidToSid_r_done, req);
747 static void dcerpc_unixinfo_GidToSid_r_done(struct tevent_req *subreq)
749 struct tevent_req *req =
750 tevent_req_callback_data(subreq,
754 status = dcerpc_binding_handle_call_recv(subreq);
755 if (!NT_STATUS_IS_OK(status)) {
756 tevent_req_nterror(req, status);
760 tevent_req_done(req);
763 NTSTATUS dcerpc_unixinfo_GidToSid_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
765 struct dcerpc_unixinfo_GidToSid_r_state *state =
767 struct dcerpc_unixinfo_GidToSid_r_state);
770 if (tevent_req_is_nterror(req, &status)) {
771 tevent_req_received(req);
775 talloc_steal(mem_ctx, state->out_mem_ctx);
777 tevent_req_received(req);
781 NTSTATUS dcerpc_unixinfo_GidToSid_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct unixinfo_GidToSid *r)
785 status = dcerpc_binding_handle_call(h,
786 NULL, &ndr_table_unixinfo,
787 NDR_UNIXINFO_GIDTOSID, mem_ctx, r);
792 NTSTATUS dcerpc_unixinfo_GidToSid_compat(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct unixinfo_GidToSid *r)
796 status = dcerpc_unixinfo_GidToSid_r(p->binding_handle, mem_ctx, r);
798 if (NT_STATUS_IS_RPC(status)) {
799 status = NT_STATUS_NET_WRITE_FAULT;
802 if (NT_STATUS_IS_OK(status)) {
803 status = r->out.result;
809 struct dcerpc_unixinfo_GidToSid_state {
810 struct unixinfo_GidToSid orig;
811 struct unixinfo_GidToSid tmp;
812 TALLOC_CTX *out_mem_ctx;
815 static void dcerpc_unixinfo_GidToSid_done(struct tevent_req *subreq);
817 struct tevent_req *dcerpc_unixinfo_GidToSid_send(TALLOC_CTX *mem_ctx,
818 struct tevent_context *ev,
819 struct dcerpc_binding_handle *h,
820 uint64_t _gid /* [in] */,
821 struct dom_sid *_sid /* [out] [ref] */)
823 struct tevent_req *req;
824 struct dcerpc_unixinfo_GidToSid_state *state;
825 struct tevent_req *subreq;
827 req = tevent_req_create(mem_ctx, &state,
828 struct dcerpc_unixinfo_GidToSid_state);
832 state->out_mem_ctx = NULL;
835 state->orig.in.gid = _gid;
838 state->orig.out.sid = _sid;
841 ZERO_STRUCT(state->orig.out.result);
843 state->out_mem_ctx = talloc_named_const(state, 0,
844 "dcerpc_unixinfo_GidToSid_out_memory");
845 if (tevent_req_nomem(state->out_mem_ctx, req)) {
846 return tevent_req_post(req, ev);
849 /* make a temporary copy, that we pass to the dispatch function */
850 state->tmp = state->orig;
852 subreq = dcerpc_unixinfo_GidToSid_r_send(state, ev, h, &state->tmp);
853 if (tevent_req_nomem(subreq, req)) {
854 return tevent_req_post(req, ev);
856 tevent_req_set_callback(subreq, dcerpc_unixinfo_GidToSid_done, req);
860 static void dcerpc_unixinfo_GidToSid_done(struct tevent_req *subreq)
862 struct tevent_req *req = tevent_req_callback_data(
863 subreq, struct tevent_req);
864 struct dcerpc_unixinfo_GidToSid_state *state = tevent_req_data(
865 req, struct dcerpc_unixinfo_GidToSid_state);
869 if (state->out_mem_ctx) {
870 mem_ctx = state->out_mem_ctx;
875 status = dcerpc_unixinfo_GidToSid_r_recv(subreq, mem_ctx);
877 if (!NT_STATUS_IS_OK(status)) {
878 tevent_req_nterror(req, status);
882 /* Copy out parameters */
883 *state->orig.out.sid = *state->tmp.out.sid;
886 state->orig.out.result = state->tmp.out.result;
888 /* Reset temporary structure */
889 ZERO_STRUCT(state->tmp);
891 tevent_req_done(req);
894 NTSTATUS dcerpc_unixinfo_GidToSid_recv(struct tevent_req *req,
898 struct dcerpc_unixinfo_GidToSid_state *state = tevent_req_data(
899 req, struct dcerpc_unixinfo_GidToSid_state);
902 if (tevent_req_is_nterror(req, &status)) {
903 tevent_req_received(req);
907 /* Steal possible out parameters to the callers context */
908 talloc_steal(mem_ctx, state->out_mem_ctx);
911 *result = state->orig.out.result;
913 tevent_req_received(req);
917 NTSTATUS dcerpc_unixinfo_GidToSid(struct dcerpc_binding_handle *h,
919 uint64_t _gid /* [in] */,
920 struct dom_sid *_sid /* [out] [ref] */,
923 struct unixinfo_GidToSid r;
929 status = dcerpc_unixinfo_GidToSid_r(h, mem_ctx, &r);
930 if (!NT_STATUS_IS_OK(status)) {
934 /* Return variables */
938 *result = r.out.result;
943 struct dcerpc_unixinfo_GetPWUid_r_state {
944 TALLOC_CTX *out_mem_ctx;
947 static void dcerpc_unixinfo_GetPWUid_r_done(struct tevent_req *subreq);
949 struct tevent_req *dcerpc_unixinfo_GetPWUid_r_send(TALLOC_CTX *mem_ctx,
950 struct tevent_context *ev,
951 struct dcerpc_binding_handle *h,
952 struct unixinfo_GetPWUid *r)
954 struct tevent_req *req;
955 struct dcerpc_unixinfo_GetPWUid_r_state *state;
956 struct tevent_req *subreq;
958 req = tevent_req_create(mem_ctx, &state,
959 struct dcerpc_unixinfo_GetPWUid_r_state);
964 state->out_mem_ctx = talloc_new(state);
965 if (tevent_req_nomem(state->out_mem_ctx, req)) {
966 return tevent_req_post(req, ev);
969 subreq = dcerpc_binding_handle_call_send(state, ev, h,
970 NULL, &ndr_table_unixinfo,
971 NDR_UNIXINFO_GETPWUID, state->out_mem_ctx, r);
972 if (tevent_req_nomem(subreq, req)) {
973 return tevent_req_post(req, ev);
975 tevent_req_set_callback(subreq, dcerpc_unixinfo_GetPWUid_r_done, req);
980 static void dcerpc_unixinfo_GetPWUid_r_done(struct tevent_req *subreq)
982 struct tevent_req *req =
983 tevent_req_callback_data(subreq,
987 status = dcerpc_binding_handle_call_recv(subreq);
988 if (!NT_STATUS_IS_OK(status)) {
989 tevent_req_nterror(req, status);
993 tevent_req_done(req);
996 NTSTATUS dcerpc_unixinfo_GetPWUid_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
998 struct dcerpc_unixinfo_GetPWUid_r_state *state =
1000 struct dcerpc_unixinfo_GetPWUid_r_state);
1003 if (tevent_req_is_nterror(req, &status)) {
1004 tevent_req_received(req);
1008 talloc_steal(mem_ctx, state->out_mem_ctx);
1010 tevent_req_received(req);
1011 return NT_STATUS_OK;
1014 NTSTATUS dcerpc_unixinfo_GetPWUid_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct unixinfo_GetPWUid *r)
1018 status = dcerpc_binding_handle_call(h,
1019 NULL, &ndr_table_unixinfo,
1020 NDR_UNIXINFO_GETPWUID, mem_ctx, r);
1025 NTSTATUS dcerpc_unixinfo_GetPWUid_compat(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct unixinfo_GetPWUid *r)
1029 status = dcerpc_unixinfo_GetPWUid_r(p->binding_handle, mem_ctx, r);
1031 if (NT_STATUS_IS_RPC(status)) {
1032 status = NT_STATUS_NET_WRITE_FAULT;
1035 if (NT_STATUS_IS_OK(status)) {
1036 status = r->out.result;
1042 struct dcerpc_unixinfo_GetPWUid_state {
1043 struct unixinfo_GetPWUid orig;
1044 struct unixinfo_GetPWUid tmp;
1045 TALLOC_CTX *out_mem_ctx;
1048 static void dcerpc_unixinfo_GetPWUid_done(struct tevent_req *subreq);
1050 struct tevent_req *dcerpc_unixinfo_GetPWUid_send(TALLOC_CTX *mem_ctx,
1051 struct tevent_context *ev,
1052 struct dcerpc_binding_handle *h,
1053 uint32_t *_count /* [in,out] [ref,range(0,1023)] */,
1054 uint64_t *_uids /* [in] [size_is(*count)] */,
1055 struct unixinfo_GetPWUidInfo *_infos /* [out] [size_is(*count)] */)
1057 struct tevent_req *req;
1058 struct dcerpc_unixinfo_GetPWUid_state *state;
1059 struct tevent_req *subreq;
1061 req = tevent_req_create(mem_ctx, &state,
1062 struct dcerpc_unixinfo_GetPWUid_state);
1066 state->out_mem_ctx = NULL;
1069 state->orig.in.count = _count;
1070 state->orig.in.uids = _uids;
1072 /* Out parameters */
1073 state->orig.out.count = _count;
1074 state->orig.out.infos = _infos;
1077 ZERO_STRUCT(state->orig.out.result);
1079 state->out_mem_ctx = talloc_named_const(state, 0,
1080 "dcerpc_unixinfo_GetPWUid_out_memory");
1081 if (tevent_req_nomem(state->out_mem_ctx, req)) {
1082 return tevent_req_post(req, ev);
1085 /* make a temporary copy, that we pass to the dispatch function */
1086 state->tmp = state->orig;
1088 subreq = dcerpc_unixinfo_GetPWUid_r_send(state, ev, h, &state->tmp);
1089 if (tevent_req_nomem(subreq, req)) {
1090 return tevent_req_post(req, ev);
1092 tevent_req_set_callback(subreq, dcerpc_unixinfo_GetPWUid_done, req);
1096 static void dcerpc_unixinfo_GetPWUid_done(struct tevent_req *subreq)
1098 struct tevent_req *req = tevent_req_callback_data(
1099 subreq, struct tevent_req);
1100 struct dcerpc_unixinfo_GetPWUid_state *state = tevent_req_data(
1101 req, struct dcerpc_unixinfo_GetPWUid_state);
1103 TALLOC_CTX *mem_ctx;
1105 if (state->out_mem_ctx) {
1106 mem_ctx = state->out_mem_ctx;
1111 status = dcerpc_unixinfo_GetPWUid_r_recv(subreq, mem_ctx);
1112 TALLOC_FREE(subreq);
1113 if (!NT_STATUS_IS_OK(status)) {
1114 tevent_req_nterror(req, status);
1118 /* Copy out parameters */
1119 *state->orig.out.count = *state->tmp.out.count;
1120 if ((*state->tmp.out.count) > (*state->tmp.in.count)) {
1121 tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
1124 memcpy(state->orig.out.infos, state->tmp.out.infos, (*state->tmp.out.count) * sizeof(*state->orig.out.infos));
1127 state->orig.out.result = state->tmp.out.result;
1129 /* Reset temporary structure */
1130 ZERO_STRUCT(state->tmp);
1132 tevent_req_done(req);
1135 NTSTATUS dcerpc_unixinfo_GetPWUid_recv(struct tevent_req *req,
1136 TALLOC_CTX *mem_ctx,
1139 struct dcerpc_unixinfo_GetPWUid_state *state = tevent_req_data(
1140 req, struct dcerpc_unixinfo_GetPWUid_state);
1143 if (tevent_req_is_nterror(req, &status)) {
1144 tevent_req_received(req);
1148 /* Steal possible out parameters to the callers context */
1149 talloc_steal(mem_ctx, state->out_mem_ctx);
1152 *result = state->orig.out.result;
1154 tevent_req_received(req);
1155 return NT_STATUS_OK;
1158 NTSTATUS dcerpc_unixinfo_GetPWUid(struct dcerpc_binding_handle *h,
1159 TALLOC_CTX *mem_ctx,
1160 uint32_t *_count /* [in,out] [ref,range(0,1023)] */,
1161 uint64_t *_uids /* [in] [size_is(*count)] */,
1162 struct unixinfo_GetPWUidInfo *_infos /* [out] [size_is(*count)] */,
1165 struct unixinfo_GetPWUid r;
1169 r.in.count = _count;
1172 status = dcerpc_unixinfo_GetPWUid_r(h, mem_ctx, &r);
1173 if (!NT_STATUS_IS_OK(status)) {
1177 /* Return variables */
1178 *_count = *r.out.count;
1179 if ((*r.out.count) > (*r.in.count)) {
1180 return NT_STATUS_INVALID_NETWORK_RESPONSE;
1182 memcpy(_infos, r.out.infos, (*r.out.count) * sizeof(*_infos));
1185 *result = r.out.result;
1187 return NT_STATUS_OK;