Add my copyright.
[gd/samba/.git] / source3 / librpc / gen_ndr / srv_unixinfo.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * server auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "librpc/gen_ndr/srv_unixinfo.h"
8
9 static bool api_unixinfo_SidToUid(pipes_struct *p)
10 {
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 unixinfo_SidToUid *r;
17
18         call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_SIDTOUID];
19
20         r = talloc(talloc_tos(), struct unixinfo_SidToUid);
21         if (r == NULL) {
22                 return false;
23         }
24
25         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
26                 talloc_free(r);
27                 return false;
28         }
29
30         pull = ndr_pull_init_blob(&blob, r);
31         if (pull == NULL) {
32                 talloc_free(r);
33                 return false;
34         }
35
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;
41         }
42
43         if (DEBUGLEVEL >= 10) {
44                 NDR_PRINT_IN_DEBUG(unixinfo_SidToUid, r);
45         }
46
47         ZERO_STRUCT(r->out);
48         r->out.uid = talloc_zero(r, uint64_t);
49         if (r->out.uid == NULL) {
50                 talloc_free(r);
51                 return false;
52         }
53
54         r->out.result = _unixinfo_SidToUid(p, r);
55
56         if (p->rng_fault_state) {
57                 talloc_free(r);
58                 /* Return true here, srv_pipe_hnd.c will take care */
59                 return true;
60         }
61
62         if (DEBUGLEVEL >= 10) {
63                 NDR_PRINT_OUT_DEBUG(unixinfo_SidToUid, r);
64         }
65
66         push = ndr_push_init_ctx(r);
67         if (push == NULL) {
68                 talloc_free(r);
69                 return false;
70         }
71
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;
76         }
77
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;
82         }
83
84         talloc_free(r);
85
86         return true;
87 }
88
89 static bool api_unixinfo_UidToSid(pipes_struct *p)
90 {
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 unixinfo_UidToSid *r;
97
98         call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_UIDTOSID];
99
100         r = talloc(talloc_tos(), struct unixinfo_UidToSid);
101         if (r == NULL) {
102                 return false;
103         }
104
105         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
106                 talloc_free(r);
107                 return false;
108         }
109
110         pull = ndr_pull_init_blob(&blob, r);
111         if (pull == NULL) {
112                 talloc_free(r);
113                 return false;
114         }
115
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;
121         }
122
123         if (DEBUGLEVEL >= 10) {
124                 NDR_PRINT_IN_DEBUG(unixinfo_UidToSid, r);
125         }
126
127         ZERO_STRUCT(r->out);
128         r->out.sid = talloc_zero(r, struct dom_sid);
129         if (r->out.sid == NULL) {
130                 talloc_free(r);
131                 return false;
132         }
133
134         r->out.result = _unixinfo_UidToSid(p, r);
135
136         if (p->rng_fault_state) {
137                 talloc_free(r);
138                 /* Return true here, srv_pipe_hnd.c will take care */
139                 return true;
140         }
141
142         if (DEBUGLEVEL >= 10) {
143                 NDR_PRINT_OUT_DEBUG(unixinfo_UidToSid, r);
144         }
145
146         push = ndr_push_init_ctx(r);
147         if (push == NULL) {
148                 talloc_free(r);
149                 return false;
150         }
151
152         ndr_err = call->ndr_push(push, NDR_OUT, r);
153         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
154                 talloc_free(r);
155                 return false;
156         }
157
158         blob = ndr_push_blob(push);
159         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
160                 talloc_free(r);
161                 return false;
162         }
163
164         talloc_free(r);
165
166         return true;
167 }
168
169 static bool api_unixinfo_SidToGid(pipes_struct *p)
170 {
171         const struct ndr_interface_call *call;
172         struct ndr_pull *pull;
173         struct ndr_push *push;
174         enum ndr_err_code ndr_err;
175         DATA_BLOB blob;
176         struct unixinfo_SidToGid *r;
177
178         call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_SIDTOGID];
179
180         r = talloc(talloc_tos(), struct unixinfo_SidToGid);
181         if (r == NULL) {
182                 return false;
183         }
184
185         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
186                 talloc_free(r);
187                 return false;
188         }
189
190         pull = ndr_pull_init_blob(&blob, r);
191         if (pull == NULL) {
192                 talloc_free(r);
193                 return false;
194         }
195
196         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
197         ndr_err = call->ndr_pull(pull, NDR_IN, r);
198         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
199                 talloc_free(r);
200                 return false;
201         }
202
203         if (DEBUGLEVEL >= 10) {
204                 NDR_PRINT_IN_DEBUG(unixinfo_SidToGid, r);
205         }
206
207         ZERO_STRUCT(r->out);
208         r->out.gid = talloc_zero(r, uint64_t);
209         if (r->out.gid == NULL) {
210                 talloc_free(r);
211                 return false;
212         }
213
214         r->out.result = _unixinfo_SidToGid(p, r);
215
216         if (p->rng_fault_state) {
217                 talloc_free(r);
218                 /* Return true here, srv_pipe_hnd.c will take care */
219                 return true;
220         }
221
222         if (DEBUGLEVEL >= 10) {
223                 NDR_PRINT_OUT_DEBUG(unixinfo_SidToGid, r);
224         }
225
226         push = ndr_push_init_ctx(r);
227         if (push == NULL) {
228                 talloc_free(r);
229                 return false;
230         }
231
232         ndr_err = call->ndr_push(push, NDR_OUT, r);
233         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
234                 talloc_free(r);
235                 return false;
236         }
237
238         blob = ndr_push_blob(push);
239         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
240                 talloc_free(r);
241                 return false;
242         }
243
244         talloc_free(r);
245
246         return true;
247 }
248
249 static bool api_unixinfo_GidToSid(pipes_struct *p)
250 {
251         const struct ndr_interface_call *call;
252         struct ndr_pull *pull;
253         struct ndr_push *push;
254         enum ndr_err_code ndr_err;
255         DATA_BLOB blob;
256         struct unixinfo_GidToSid *r;
257
258         call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_GIDTOSID];
259
260         r = talloc(talloc_tos(), struct unixinfo_GidToSid);
261         if (r == NULL) {
262                 return false;
263         }
264
265         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
266                 talloc_free(r);
267                 return false;
268         }
269
270         pull = ndr_pull_init_blob(&blob, r);
271         if (pull == NULL) {
272                 talloc_free(r);
273                 return false;
274         }
275
276         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
277         ndr_err = call->ndr_pull(pull, NDR_IN, r);
278         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
279                 talloc_free(r);
280                 return false;
281         }
282
283         if (DEBUGLEVEL >= 10) {
284                 NDR_PRINT_IN_DEBUG(unixinfo_GidToSid, r);
285         }
286
287         ZERO_STRUCT(r->out);
288         r->out.sid = talloc_zero(r, struct dom_sid);
289         if (r->out.sid == NULL) {
290                 talloc_free(r);
291                 return false;
292         }
293
294         r->out.result = _unixinfo_GidToSid(p, r);
295
296         if (p->rng_fault_state) {
297                 talloc_free(r);
298                 /* Return true here, srv_pipe_hnd.c will take care */
299                 return true;
300         }
301
302         if (DEBUGLEVEL >= 10) {
303                 NDR_PRINT_OUT_DEBUG(unixinfo_GidToSid, r);
304         }
305
306         push = ndr_push_init_ctx(r);
307         if (push == NULL) {
308                 talloc_free(r);
309                 return false;
310         }
311
312         ndr_err = call->ndr_push(push, NDR_OUT, r);
313         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
314                 talloc_free(r);
315                 return false;
316         }
317
318         blob = ndr_push_blob(push);
319         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
320                 talloc_free(r);
321                 return false;
322         }
323
324         talloc_free(r);
325
326         return true;
327 }
328
329 static bool api_unixinfo_GetPWUid(pipes_struct *p)
330 {
331         const struct ndr_interface_call *call;
332         struct ndr_pull *pull;
333         struct ndr_push *push;
334         enum ndr_err_code ndr_err;
335         DATA_BLOB blob;
336         struct unixinfo_GetPWUid *r;
337
338         call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_GETPWUID];
339
340         r = talloc(talloc_tos(), struct unixinfo_GetPWUid);
341         if (r == NULL) {
342                 return false;
343         }
344
345         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
346                 talloc_free(r);
347                 return false;
348         }
349
350         pull = ndr_pull_init_blob(&blob, r);
351         if (pull == NULL) {
352                 talloc_free(r);
353                 return false;
354         }
355
356         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
357         ndr_err = call->ndr_pull(pull, NDR_IN, r);
358         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
359                 talloc_free(r);
360                 return false;
361         }
362
363         if (DEBUGLEVEL >= 10) {
364                 NDR_PRINT_IN_DEBUG(unixinfo_GetPWUid, r);
365         }
366
367         ZERO_STRUCT(r->out);
368         r->out.count = r->in.count;
369         r->out.infos = talloc_zero_array(r, struct unixinfo_GetPWUidInfo, *r->out.count);
370         if (r->out.infos == NULL) {
371                 talloc_free(r);
372                 return false;
373         }
374
375         r->out.result = _unixinfo_GetPWUid(p, r);
376
377         if (p->rng_fault_state) {
378                 talloc_free(r);
379                 /* Return true here, srv_pipe_hnd.c will take care */
380                 return true;
381         }
382
383         if (DEBUGLEVEL >= 10) {
384                 NDR_PRINT_OUT_DEBUG(unixinfo_GetPWUid, r);
385         }
386
387         push = ndr_push_init_ctx(r);
388         if (push == NULL) {
389                 talloc_free(r);
390                 return false;
391         }
392
393         ndr_err = call->ndr_push(push, NDR_OUT, r);
394         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
395                 talloc_free(r);
396                 return false;
397         }
398
399         blob = ndr_push_blob(push);
400         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
401                 talloc_free(r);
402                 return false;
403         }
404
405         talloc_free(r);
406
407         return true;
408 }
409
410
411 /* Tables */
412 static struct api_struct api_unixinfo_cmds[] = 
413 {
414         {"UNIXINFO_SIDTOUID", NDR_UNIXINFO_SIDTOUID, api_unixinfo_SidToUid},
415         {"UNIXINFO_UIDTOSID", NDR_UNIXINFO_UIDTOSID, api_unixinfo_UidToSid},
416         {"UNIXINFO_SIDTOGID", NDR_UNIXINFO_SIDTOGID, api_unixinfo_SidToGid},
417         {"UNIXINFO_GIDTOSID", NDR_UNIXINFO_GIDTOSID, api_unixinfo_GidToSid},
418         {"UNIXINFO_GETPWUID", NDR_UNIXINFO_GETPWUID, api_unixinfo_GetPWUid},
419 };
420
421 void unixinfo_get_pipe_fns(struct api_struct **fns, int *n_fns)
422 {
423         *fns = api_unixinfo_cmds;
424         *n_fns = sizeof(api_unixinfo_cmds) / sizeof(struct api_struct);
425 }
426
427 NTSTATUS rpc_unixinfo_init(void)
428 {
429         return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "unixinfo", "unixinfo", api_unixinfo_cmds, sizeof(api_unixinfo_cmds) / sizeof(struct api_struct));
430 }