s3:winbind: Add async wb_sid2uid
[Samba/gebeck_regimport.git] / source3 / librpc / gen_ndr / srv_wbint.c
blob2fd6c17c281654eab782203ca8da463f47fc6a53
1 /*
2 * Unix SMB/CIFS implementation.
3 * server auto-generated by pidl. DO NOT MODIFY!
4 */
6 #include "includes.h"
7 #include "librpc/gen_ndr/srv_wbint.h"
9 static bool api_wbint_Ping(pipes_struct *p)
11 const struct ndr_interface_call *call;
12 struct ndr_pull *pull;
13 struct ndr_push *push;
14 enum ndr_err_code ndr_err;
15 DATA_BLOB blob;
16 struct wbint_Ping *r;
18 call = &ndr_table_wbint.calls[NDR_WBINT_PING];
20 r = talloc(talloc_tos(), struct wbint_Ping);
21 if (r == NULL) {
22 return false;
25 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
26 talloc_free(r);
27 return false;
30 pull = ndr_pull_init_blob(&blob, r, NULL);
31 if (pull == NULL) {
32 talloc_free(r);
33 return false;
36 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
37 ndr_err = call->ndr_pull(pull, NDR_IN, r);
38 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
39 talloc_free(r);
40 return false;
43 if (DEBUGLEVEL >= 10) {
44 NDR_PRINT_IN_DEBUG(wbint_Ping, r);
47 ZERO_STRUCT(r->out);
48 r->out.out_data = talloc_zero(r, uint32_t);
49 if (r->out.out_data == NULL) {
50 talloc_free(r);
51 return false;
54 _wbint_Ping(p, r);
56 if (p->rng_fault_state) {
57 talloc_free(r);
58 /* Return true here, srv_pipe_hnd.c will take care */
59 return true;
62 if (DEBUGLEVEL >= 10) {
63 NDR_PRINT_OUT_DEBUG(wbint_Ping, r);
66 push = ndr_push_init_ctx(r, NULL);
67 if (push == NULL) {
68 talloc_free(r);
69 return false;
72 ndr_err = call->ndr_push(push, NDR_OUT, r);
73 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
74 talloc_free(r);
75 return false;
78 blob = ndr_push_blob(push);
79 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
80 talloc_free(r);
81 return false;
84 talloc_free(r);
86 return true;
89 static bool api_wbint_LookupSid(pipes_struct *p)
91 const struct ndr_interface_call *call;
92 struct ndr_pull *pull;
93 struct ndr_push *push;
94 enum ndr_err_code ndr_err;
95 DATA_BLOB blob;
96 struct wbint_LookupSid *r;
98 call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPSID];
100 r = talloc(talloc_tos(), struct wbint_LookupSid);
101 if (r == NULL) {
102 return false;
105 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
106 talloc_free(r);
107 return false;
110 pull = ndr_pull_init_blob(&blob, r, NULL);
111 if (pull == NULL) {
112 talloc_free(r);
113 return false;
116 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
117 ndr_err = call->ndr_pull(pull, NDR_IN, r);
118 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
119 talloc_free(r);
120 return false;
123 if (DEBUGLEVEL >= 10) {
124 NDR_PRINT_IN_DEBUG(wbint_LookupSid, r);
127 ZERO_STRUCT(r->out);
128 r->out.type = talloc_zero(r, enum lsa_SidType);
129 if (r->out.type == NULL) {
130 talloc_free(r);
131 return false;
134 r->out.domain = talloc_zero(r, const char *);
135 if (r->out.domain == NULL) {
136 talloc_free(r);
137 return false;
140 r->out.name = talloc_zero(r, const char *);
141 if (r->out.name == NULL) {
142 talloc_free(r);
143 return false;
146 r->out.result = _wbint_LookupSid(p, r);
148 if (p->rng_fault_state) {
149 talloc_free(r);
150 /* Return true here, srv_pipe_hnd.c will take care */
151 return true;
154 if (DEBUGLEVEL >= 10) {
155 NDR_PRINT_OUT_DEBUG(wbint_LookupSid, r);
158 push = ndr_push_init_ctx(r, NULL);
159 if (push == NULL) {
160 talloc_free(r);
161 return false;
164 ndr_err = call->ndr_push(push, NDR_OUT, r);
165 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
166 talloc_free(r);
167 return false;
170 blob = ndr_push_blob(push);
171 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
172 talloc_free(r);
173 return false;
176 talloc_free(r);
178 return true;
181 static bool api_wbint_LookupName(pipes_struct *p)
183 const struct ndr_interface_call *call;
184 struct ndr_pull *pull;
185 struct ndr_push *push;
186 enum ndr_err_code ndr_err;
187 DATA_BLOB blob;
188 struct wbint_LookupName *r;
190 call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPNAME];
192 r = talloc(talloc_tos(), struct wbint_LookupName);
193 if (r == NULL) {
194 return false;
197 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
198 talloc_free(r);
199 return false;
202 pull = ndr_pull_init_blob(&blob, r, NULL);
203 if (pull == NULL) {
204 talloc_free(r);
205 return false;
208 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
209 ndr_err = call->ndr_pull(pull, NDR_IN, r);
210 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
211 talloc_free(r);
212 return false;
215 if (DEBUGLEVEL >= 10) {
216 NDR_PRINT_IN_DEBUG(wbint_LookupName, r);
219 ZERO_STRUCT(r->out);
220 r->out.type = talloc_zero(r, enum lsa_SidType);
221 if (r->out.type == NULL) {
222 talloc_free(r);
223 return false;
226 r->out.sid = talloc_zero(r, struct dom_sid);
227 if (r->out.sid == NULL) {
228 talloc_free(r);
229 return false;
232 r->out.result = _wbint_LookupName(p, r);
234 if (p->rng_fault_state) {
235 talloc_free(r);
236 /* Return true here, srv_pipe_hnd.c will take care */
237 return true;
240 if (DEBUGLEVEL >= 10) {
241 NDR_PRINT_OUT_DEBUG(wbint_LookupName, r);
244 push = ndr_push_init_ctx(r, NULL);
245 if (push == NULL) {
246 talloc_free(r);
247 return false;
250 ndr_err = call->ndr_push(push, NDR_OUT, r);
251 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
252 talloc_free(r);
253 return false;
256 blob = ndr_push_blob(push);
257 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
258 talloc_free(r);
259 return false;
262 talloc_free(r);
264 return true;
267 static bool api_wbint_Sid2Uid(pipes_struct *p)
269 const struct ndr_interface_call *call;
270 struct ndr_pull *pull;
271 struct ndr_push *push;
272 enum ndr_err_code ndr_err;
273 DATA_BLOB blob;
274 struct wbint_Sid2Uid *r;
276 call = &ndr_table_wbint.calls[NDR_WBINT_SID2UID];
278 r = talloc(talloc_tos(), struct wbint_Sid2Uid);
279 if (r == NULL) {
280 return false;
283 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
284 talloc_free(r);
285 return false;
288 pull = ndr_pull_init_blob(&blob, r, NULL);
289 if (pull == NULL) {
290 talloc_free(r);
291 return false;
294 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
295 ndr_err = call->ndr_pull(pull, NDR_IN, r);
296 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
297 talloc_free(r);
298 return false;
301 if (DEBUGLEVEL >= 10) {
302 NDR_PRINT_IN_DEBUG(wbint_Sid2Uid, r);
305 ZERO_STRUCT(r->out);
306 r->out.uid = talloc_zero(r, uint64_t);
307 if (r->out.uid == NULL) {
308 talloc_free(r);
309 return false;
312 r->out.result = _wbint_Sid2Uid(p, r);
314 if (p->rng_fault_state) {
315 talloc_free(r);
316 /* Return true here, srv_pipe_hnd.c will take care */
317 return true;
320 if (DEBUGLEVEL >= 10) {
321 NDR_PRINT_OUT_DEBUG(wbint_Sid2Uid, r);
324 push = ndr_push_init_ctx(r, NULL);
325 if (push == NULL) {
326 talloc_free(r);
327 return false;
330 ndr_err = call->ndr_push(push, NDR_OUT, r);
331 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
332 talloc_free(r);
333 return false;
336 blob = ndr_push_blob(push);
337 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
338 talloc_free(r);
339 return false;
342 talloc_free(r);
344 return true;
348 /* Tables */
349 static struct api_struct api_wbint_cmds[] =
351 {"WBINT_PING", NDR_WBINT_PING, api_wbint_Ping},
352 {"WBINT_LOOKUPSID", NDR_WBINT_LOOKUPSID, api_wbint_LookupSid},
353 {"WBINT_LOOKUPNAME", NDR_WBINT_LOOKUPNAME, api_wbint_LookupName},
354 {"WBINT_SID2UID", NDR_WBINT_SID2UID, api_wbint_Sid2Uid},
357 void wbint_get_pipe_fns(struct api_struct **fns, int *n_fns)
359 *fns = api_wbint_cmds;
360 *n_fns = sizeof(api_wbint_cmds) / sizeof(struct api_struct);
363 NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
365 if (cli->pipes_struct == NULL) {
366 return NT_STATUS_INVALID_PARAMETER;
369 switch (opnum)
371 case NDR_WBINT_PING: {
372 struct wbint_Ping *r = (struct wbint_Ping *)_r;
373 ZERO_STRUCT(r->out);
374 r->out.out_data = talloc_zero(mem_ctx, uint32_t);
375 if (r->out.out_data == NULL) {
376 return NT_STATUS_NO_MEMORY;
379 _wbint_Ping(cli->pipes_struct, r);
380 return NT_STATUS_OK;
383 case NDR_WBINT_LOOKUPSID: {
384 struct wbint_LookupSid *r = (struct wbint_LookupSid *)_r;
385 ZERO_STRUCT(r->out);
386 r->out.type = talloc_zero(mem_ctx, enum lsa_SidType);
387 if (r->out.type == NULL) {
388 return NT_STATUS_NO_MEMORY;
391 r->out.domain = talloc_zero(mem_ctx, const char *);
392 if (r->out.domain == NULL) {
393 return NT_STATUS_NO_MEMORY;
396 r->out.name = talloc_zero(mem_ctx, const char *);
397 if (r->out.name == NULL) {
398 return NT_STATUS_NO_MEMORY;
401 r->out.result = _wbint_LookupSid(cli->pipes_struct, r);
402 return NT_STATUS_OK;
405 case NDR_WBINT_LOOKUPNAME: {
406 struct wbint_LookupName *r = (struct wbint_LookupName *)_r;
407 ZERO_STRUCT(r->out);
408 r->out.type = talloc_zero(mem_ctx, enum lsa_SidType);
409 if (r->out.type == NULL) {
410 return NT_STATUS_NO_MEMORY;
413 r->out.sid = talloc_zero(mem_ctx, struct dom_sid);
414 if (r->out.sid == NULL) {
415 return NT_STATUS_NO_MEMORY;
418 r->out.result = _wbint_LookupName(cli->pipes_struct, r);
419 return NT_STATUS_OK;
422 case NDR_WBINT_SID2UID: {
423 struct wbint_Sid2Uid *r = (struct wbint_Sid2Uid *)_r;
424 ZERO_STRUCT(r->out);
425 r->out.uid = talloc_zero(mem_ctx, uint64_t);
426 if (r->out.uid == NULL) {
427 return NT_STATUS_NO_MEMORY;
430 r->out.result = _wbint_Sid2Uid(cli->pipes_struct, r);
431 return NT_STATUS_OK;
434 default:
435 return NT_STATUS_NOT_IMPLEMENTED;
439 NTSTATUS rpc_wbint_init(void)
441 return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "wbint", "wbint", &ndr_table_wbint, api_wbint_cmds, sizeof(api_wbint_cmds) / sizeof(struct api_struct));