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