s4-libnet: fix user and group enumeration functions after lsa changes.
[ira/wip.git] / source4 / libnet / libnet_group.c
1 /* 
2    Unix SMB/CIFS implementation.
3    
4    Copyright (C) Rafal Szczesniak  2007
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20
21 #include "includes.h"
22 #include "libnet/libnet.h"
23 #include "libcli/composite/composite.h"
24 #include "librpc/gen_ndr/lsa.h"
25 #include "librpc/gen_ndr/ndr_lsa_c.h"
26 #include "librpc/gen_ndr/samr.h"
27 #include "librpc/gen_ndr/ndr_samr_c.h"
28 #include "libcli/security/security.h"
29
30
31 struct create_group_state {
32         struct libnet_context *ctx;
33         struct libnet_CreateGroup r;
34         struct libnet_DomainOpen domain_open;
35         struct libnet_rpc_groupadd group_add;
36
37         /* information about the progress */
38         void (*monitor_fn)(struct monitor_msg *);
39 };
40
41
42 static void continue_domain_opened(struct composite_context *ctx);
43 static void continue_rpc_group_added(struct composite_context *ctx);
44
45
46 struct composite_context* libnet_CreateGroup_send(struct libnet_context *ctx,
47                                                   TALLOC_CTX *mem_ctx,
48                                                   struct libnet_CreateGroup *r,
49                                                   void (*monitor)(struct monitor_msg*))
50 {
51         struct composite_context *c;
52         struct create_group_state *s;
53         struct composite_context *create_req;
54         bool prereq_met = false;
55
56         /* composite context allocation and setup */
57         c = composite_create(mem_ctx, ctx->event_ctx);
58         if (c == NULL) return NULL;
59
60         s = talloc_zero(c, struct create_group_state);
61         if (composite_nomem(s, c)) return c;
62
63         c->private_data = s;
64
65         s->ctx = ctx;
66         s->r   = *r;
67         ZERO_STRUCT(s->r.out);
68
69         /* prerequisite: make sure we have a valid samr domain handle */
70         prereq_met = samr_domain_opened(ctx, s->r.in.domain_name, &c, &s->domain_open,
71                                         continue_domain_opened, monitor);
72         if (!prereq_met) return c;
73
74         /* prepare arguments of rpc group add call */
75         s->group_add.in.groupname     = r->in.group_name;
76         s->group_add.in.domain_handle = ctx->samr.handle;
77
78         /* send the request */
79         create_req = libnet_rpc_groupadd_send(ctx->samr.pipe, &s->group_add, monitor);
80         if (composite_nomem(create_req, c)) return c;
81
82         composite_continue(c, create_req, continue_rpc_group_added, c);
83         return c;
84 }
85
86
87 static void continue_domain_opened(struct composite_context *ctx)
88 {
89         struct composite_context *c;
90         struct create_group_state *s;
91         struct composite_context *create_req;
92         
93         c = talloc_get_type(ctx->async.private_data, struct composite_context);
94         s = talloc_get_type(c->private_data, struct create_group_state);
95
96         c->status = libnet_DomainOpen_recv(ctx, s->ctx, c, &s->domain_open);
97         if (!composite_is_ok(c)) return;
98
99         /* prepare arguments of groupadd call */
100         s->group_add.in.groupname     = s->r.in.group_name;
101         s->group_add.in.domain_handle = s->ctx->samr.handle;
102
103         /* send the request */
104         create_req = libnet_rpc_groupadd_send(s->ctx->samr.pipe, &s->group_add,
105                                               s->monitor_fn);
106         if (composite_nomem(create_req, c)) return;
107
108         composite_continue(c, create_req, continue_rpc_group_added, c);
109 }
110
111
112 static void continue_rpc_group_added(struct composite_context *ctx)
113 {
114         struct composite_context *c;
115         struct create_group_state *s;
116
117         c = talloc_get_type(ctx->async.private_data, struct composite_context);
118         s = talloc_get_type(c->private_data, struct create_group_state);
119
120         /* receive result of group add call */
121         c->status = libnet_rpc_groupadd_recv(ctx, c, &s->group_add);
122         if (!composite_is_ok(c)) return;
123
124         /* we're done */
125         composite_done(c);
126 }
127
128
129 /**
130  * Receive result of CreateGroup call
131  *
132  * @param c composite context returned by send request routine
133  * @param mem_ctx memory context of this call
134  * @param r pointer to a structure containing arguments and result of this call
135  * @return nt status
136  */
137 NTSTATUS libnet_CreateGroup_recv(struct composite_context *c,
138                                  TALLOC_CTX *mem_ctx,
139                                  struct libnet_CreateGroup *r)
140 {
141         NTSTATUS status;
142         struct create_group_state *s;
143
144         status = composite_wait(c);
145         if (!NT_STATUS_IS_OK(status)) {
146                 s = talloc_get_type(c->private_data, struct create_group_state);
147                 r->out.error_string = talloc_strdup(mem_ctx, nt_errstr(status));
148         }
149
150         return status;
151 }
152
153
154 /**
155  * Create domain group
156  *
157  * @param ctx initialised libnet context
158  * @param mem_ctx memory context of this call
159  * @param io pointer to structure containing arguments and result of this call
160  * @return nt status
161  */
162 NTSTATUS libnet_CreateGroup(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
163                             struct libnet_CreateGroup *io)
164 {
165         struct composite_context *c;
166
167         c = libnet_CreateGroup_send(ctx, mem_ctx, io, NULL);
168         return libnet_CreateGroup_recv(c, mem_ctx, io);
169 }
170
171
172 struct group_info_state {
173         struct libnet_context *ctx;
174         const char *domain_name;
175         const char *group_name;
176         struct libnet_LookupName lookup;
177         struct libnet_DomainOpen domopen;
178         struct libnet_rpc_groupinfo info;
179         
180         /* information about the progress */
181         void (*monitor_fn)(struct monitor_msg *);
182 };
183
184
185 static void continue_domain_open_info(struct composite_context *ctx);
186 static void continue_name_found(struct composite_context *ctx);
187 static void continue_group_info(struct composite_context *ctx);
188
189 /**
190  * Sends request to get group information
191  *
192  * @param ctx initialised libnet context
193  * @param mem_ctx memory context of this call
194  * @param io pointer to structure containing arguments the call
195  * @param monitor function pointer for receiving monitor messages
196  * @return composite context of this request
197  */
198 struct composite_context* libnet_GroupInfo_send(struct libnet_context *ctx,
199                                                 TALLOC_CTX *mem_ctx,
200                                                 struct libnet_GroupInfo *io,
201                                                 void (*monitor)(struct monitor_msg*))
202 {
203         struct composite_context *c;
204         struct group_info_state *s;
205         bool prereq_met = false;
206         struct composite_context *lookup_req;
207
208         /* composite context allocation and setup */
209         c = composite_create(mem_ctx, ctx->event_ctx);
210         if (c == NULL) return NULL;
211
212         s = talloc_zero(c, struct group_info_state);
213         if (composite_nomem(s, c)) return c;
214
215         c->private_data = s;
216
217         /* store arguments in the state structure */
218         s->monitor_fn = monitor;
219         s->ctx = ctx;   
220         s->domain_name = talloc_strdup(c, io->in.domain_name);
221         s->group_name  = talloc_strdup(c, io->in.group_name);
222
223         /* prerequisite: make sure the domain is opened */
224         prereq_met = samr_domain_opened(ctx, s->domain_name, &c, &s->domopen,
225                                         continue_domain_open_info, monitor);
226         if (!prereq_met) return c;
227         
228         /* prepare arguments for LookupName call */
229         s->lookup.in.name        = s->group_name;
230         s->lookup.in.domain_name = s->domain_name;
231
232         /* send the request */
233         lookup_req = libnet_LookupName_send(s->ctx, c, &s->lookup, s->monitor_fn);
234         if (composite_nomem(lookup_req, c)) return c;
235
236         /* set the next stage */
237         composite_continue(c, lookup_req, continue_name_found, c);
238         return c;
239 }
240
241
242 /*
243  * Stage 0.5 (optional): receive opened domain and send lookup name request
244  */
245 static void continue_domain_open_info(struct composite_context *ctx)
246 {
247         struct composite_context *c;
248         struct group_info_state *s;
249         struct composite_context *lookup_req;
250         
251         c = talloc_get_type(ctx->async.private_data, struct composite_context);
252         s = talloc_get_type(c->private_data, struct group_info_state);
253         
254         /* receive domain handle */
255         c->status = libnet_DomainOpen_recv(ctx, s->ctx, c, &s->domopen);
256         if (!composite_is_ok(c)) return;
257
258         /* prepare arguments for LookupName call */
259         s->lookup.in.name        = s->group_name;
260         s->lookup.in.domain_name = s->domain_name;
261
262         /* send the request */
263         lookup_req = libnet_LookupName_send(s->ctx, c, &s->lookup, s->monitor_fn);
264         if (composite_nomem(lookup_req, c)) return;
265         
266         /* set the next stage */
267         composite_continue(c, lookup_req, continue_name_found, c);
268 }
269
270
271 /*
272  * Stage 1: Receive SID found and send request for group info
273  */
274 static void continue_name_found(struct composite_context *ctx)
275 {
276         struct composite_context *c;
277         struct group_info_state *s;
278         struct composite_context *info_req;
279
280         c = talloc_get_type(ctx->async.private_data, struct composite_context);
281         s = talloc_get_type(c->private_data, struct group_info_state);
282
283         /* receive SID assiociated with name found */
284         c->status = libnet_LookupName_recv(ctx, c, &s->lookup);
285         if (!composite_is_ok(c)) return;
286         
287         /* Is is a group SID actually ? */
288         if (s->lookup.out.sid_type != SID_NAME_DOM_GRP &&
289             s->lookup.out.sid_type != SID_NAME_ALIAS) {
290                 composite_error(c, NT_STATUS_NO_SUCH_GROUP);
291         }
292
293         /* prepare arguments for groupinfo call */
294         s->info.in.domain_handle = s->ctx->samr.handle;
295         s->info.in.groupname     = s->group_name;
296         s->info.in.sid           = s->lookup.out.sidstr;
297         /* we're looking for all information available */
298         s->info.in.level         = GROUPINFOALL;
299
300         /* send the request */
301         info_req = libnet_rpc_groupinfo_send(s->ctx->samr.pipe, &s->info, s->monitor_fn);
302         if (composite_nomem(info_req, c)) return;
303
304         /* set the next stage */
305         composite_continue(c, info_req, continue_group_info, c);
306 }
307
308
309 /*
310  * Stage 2: Receive group information
311  */
312 static void continue_group_info(struct composite_context *ctx)
313 {
314         struct composite_context *c;
315         struct group_info_state *s;
316
317         c = talloc_get_type(ctx->async.private_data, struct composite_context);
318         s = talloc_get_type(c->private_data, struct group_info_state);
319
320         /* receive group information */
321         c->status = libnet_rpc_groupinfo_recv(ctx, c, &s->info);
322         if (!composite_is_ok(c)) return;
323
324         /* we're done */
325         composite_done(c);
326 }
327
328
329 /*
330  * Receive group information
331  *
332  * @param c composite context returned by libnet_GroupInfo_send
333  * @param mem_ctx memory context of this call
334  * @param io pointer to structure receiving results of the call
335  * @result nt status
336  */
337 NTSTATUS libnet_GroupInfo_recv(struct composite_context* c, TALLOC_CTX *mem_ctx,
338                                struct libnet_GroupInfo *io)
339 {
340         NTSTATUS status;
341         struct group_info_state *s;
342         
343         status = composite_wait(c);
344         if (NT_STATUS_IS_OK(status)) {
345                 /* put the results into io structure if everything went fine */
346                 s = talloc_get_type(c->private_data, struct group_info_state);
347                 
348                 io->out.group_sid = talloc_steal(mem_ctx, s->lookup.out.sid);
349                 io->out.num_members = s->info.out.info.all.num_members;
350                 io->out.description = talloc_steal(mem_ctx, s->info.out.info.all.description.string);
351
352                 io->out.error_string = talloc_strdup(mem_ctx, "Success");
353
354         } else {
355                 io->out.error_string = talloc_asprintf(mem_ctx, "Error: %s", nt_errstr(status));
356         }
357
358         talloc_free(c);
359
360         return status;
361 }
362
363
364 /**
365  * Obtains specified group information
366  * 
367  * @param ctx initialised libnet context
368  * @param mem_ctx memory context of the call
369  * @param io pointer to a structure containing arguments and results of the call
370  */
371 NTSTATUS libnet_GroupInfo(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
372                           struct libnet_GroupInfo *io)
373 {
374         struct composite_context *c = libnet_GroupInfo_send(ctx, mem_ctx,
375                                                             io, NULL);
376         return libnet_GroupInfo_recv(c, mem_ctx, io);
377 }
378
379
380 struct grouplist_state {
381         struct libnet_context *ctx;
382         const char *domain_name;
383         struct lsa_DomainInfo dominfo;
384         int page_size;
385         uint32_t resume_index;
386         struct grouplist *groups;
387         uint32_t count;
388
389         struct libnet_DomainOpen domain_open;
390         struct lsa_QueryInfoPolicy query_domain;
391         struct samr_EnumDomainGroups group_list;
392
393         void (*monitor_fn)(struct monitor_msg*);
394 };
395
396
397 static void continue_lsa_domain_opened(struct composite_context *ctx);
398 static void continue_domain_queried(struct rpc_request *req);
399 static void continue_samr_domain_opened(struct composite_context *ctx);
400 static void continue_domain_queried(struct rpc_request *req);
401 static void continue_groups_enumerated(struct rpc_request *req);
402
403
404 /**
405  * Sends request to list (enumerate) group accounts
406  *
407  * @param ctx initialised libnet context
408  * @param mem_ctx memory context of this call
409  * @param io pointer to structure containing arguments and results of this call
410  * @param monitor function pointer for receiving monitor messages
411  * @return compostite context of this request
412  */
413 struct composite_context *libnet_GroupList_send(struct libnet_context *ctx,
414                                                 TALLOC_CTX *mem_ctx,
415                                                 struct libnet_GroupList *io,
416                                                 void (*monitor)(struct monitor_msg*))
417 {
418         struct composite_context *c;
419         struct grouplist_state *s;
420         struct rpc_request *query_req;
421         bool prereq_met = false;
422
423         /* composite context allocation and setup */
424         c = composite_create(mem_ctx, ctx->event_ctx);
425         if (c == NULL) return NULL;
426
427         s = talloc_zero(c, struct grouplist_state);
428         if (composite_nomem(s, c)) return c;
429         
430         c->private_data = s;
431
432         /* store the arguments in the state structure */
433         s->ctx          = ctx;
434         s->page_size    = io->in.page_size;
435         s->resume_index = (uint32_t)io->in.resume_index;
436         s->domain_name  = talloc_strdup(c, io->in.domain_name);
437         s->monitor_fn   = monitor;
438
439         /* make sure we have lsa domain handle before doing anything */
440         prereq_met = lsa_domain_opened(ctx, s->domain_name, &c, &s->domain_open,
441                                        continue_lsa_domain_opened, monitor);
442         if (!prereq_met) return c;
443
444         /* prepare arguments of QueryDomainInfo call */
445         s->query_domain.in.handle = &ctx->lsa.handle;
446         s->query_domain.in.level  = LSA_POLICY_INFO_DOMAIN;
447         s->query_domain.out.info  = talloc_zero(c, union lsa_PolicyInformation *);
448         if (composite_nomem(s->query_domain.out.info, c)) return c;
449
450         /* send the request */
451         query_req = dcerpc_lsa_QueryInfoPolicy_send(ctx->lsa.pipe, c, &s->query_domain);
452         if (composite_nomem(query_req, c)) return c;
453         
454         composite_continue_rpc(c, query_req, continue_domain_queried, c);
455         return c;
456 }
457
458
459 /*
460  * Stage 0.5 (optional): receive lsa domain handle and send
461  * request to query domain info
462  */
463 static void continue_lsa_domain_opened(struct composite_context *ctx)
464 {
465         struct composite_context *c;
466         struct grouplist_state *s;
467         struct rpc_request *query_req;
468         
469         c = talloc_get_type(ctx->async.private_data, struct composite_context);
470         s = talloc_get_type(c->private_data, struct grouplist_state);
471
472         /* receive lsa domain handle */
473         c->status = libnet_DomainOpen_recv(ctx, s->ctx, c, &s->domain_open);
474         if (!composite_is_ok(c)) return;
475
476         /* prepare arguments of QueryDomainInfo call */
477         s->query_domain.in.handle = &s->ctx->lsa.handle;
478         s->query_domain.in.level  = LSA_POLICY_INFO_DOMAIN;
479         s->query_domain.out.info  = talloc_zero(c, union lsa_PolicyInformation *);
480         if (composite_nomem(s->query_domain.out.info, c)) return;
481
482         /* send the request */
483         query_req = dcerpc_lsa_QueryInfoPolicy_send(s->ctx->lsa.pipe, c, &s->query_domain);
484         if (composite_nomem(query_req, c)) return;
485
486         composite_continue_rpc(c, query_req, continue_domain_queried, c);
487 }
488
489
490 /*
491  * Stage 1: receive domain info and request to enum groups
492  * provided a valid samr handle is opened
493  */
494 static void continue_domain_queried(struct rpc_request *req)
495 {
496         struct composite_context *c;
497         struct grouplist_state *s;
498         struct rpc_request *enum_req;
499         bool prereq_met = false;
500         
501         c = talloc_get_type(req->async.private_data, struct composite_context);
502         s = talloc_get_type(c->private_data, struct grouplist_state);
503
504         /* receive result of rpc request */
505         c->status = dcerpc_ndr_request_recv(req);
506         if (!composite_is_ok(c)) return;
507
508         /* get the returned domain info */
509         s->dominfo = (*s->query_domain.out.info)->domain;
510
511         /* make sure we have samr domain handle before continuing */
512         prereq_met = samr_domain_opened(s->ctx, s->domain_name, &c, &s->domain_open,
513                                         continue_samr_domain_opened, s->monitor_fn);
514         if (!prereq_met) return;
515
516         /* prepare arguments od EnumDomainGroups call */
517         s->group_list.in.domain_handle  = &s->ctx->samr.handle;
518         s->group_list.in.max_size       = s->page_size;
519         s->group_list.in.resume_handle  = &s->resume_index;
520         s->group_list.out.resume_handle = &s->resume_index;
521
522         /* send the request */
523         enum_req = dcerpc_samr_EnumDomainGroups_send(s->ctx->samr.pipe, c, &s->group_list);
524         if (composite_nomem(enum_req, c)) return;
525
526         composite_continue_rpc(c, enum_req, continue_groups_enumerated, c);
527 }
528
529
530 /*
531  * Stage 1.5 (optional): receive samr domain handle
532  * and request to enumerate accounts
533  */
534 static void continue_samr_domain_opened(struct composite_context *ctx)
535 {
536         struct composite_context *c;
537         struct grouplist_state *s;
538         struct rpc_request *enum_req;
539
540         c = talloc_get_type(ctx->async.private_data, struct composite_context);
541         s = talloc_get_type(c->private_data, struct grouplist_state);
542
543         /* receive samr domain handle */
544         c->status = libnet_DomainOpen_recv(ctx, s->ctx, c, &s->domain_open);
545         if (!composite_is_ok(c)) return;
546
547         /* prepare arguments of EnumDomainGroups call */
548         s->group_list.in.domain_handle  = &s->ctx->samr.handle;
549         s->group_list.in.max_size       = s->page_size;
550         s->group_list.in.resume_handle  = &s->resume_index;
551         s->group_list.out.resume_handle = &s->resume_index;
552
553         /* send the request */
554         enum_req = dcerpc_samr_EnumDomainGroups_send(s->ctx->samr.pipe, c, &s->group_list);
555         if (composite_nomem(enum_req, c)) return;
556
557         composite_continue_rpc(c, enum_req, continue_groups_enumerated, c);
558 }
559
560
561 /*
562  * Stage 2: receive enumerated groups and their rids
563  */
564 static void continue_groups_enumerated(struct rpc_request *req)
565 {
566         struct composite_context *c;
567         struct grouplist_state *s;
568         int i;
569
570         c = talloc_get_type(req->async.private_data, struct composite_context);
571         s = talloc_get_type(c->private_data, struct grouplist_state);
572
573         /* receive result of rpc request */
574         c->status = dcerpc_ndr_request_recv(req);
575         if (!composite_is_ok(c)) return;
576
577         /* get the actual status of the rpc call result
578            (instead of rpc layer) */
579         c->status = s->group_list.out.result;
580
581         /* we're interested in status "ok" as well as two
582            enum-specific status codes */
583         if (NT_STATUS_IS_OK(c->status) ||
584             NT_STATUS_EQUAL(c->status, STATUS_MORE_ENTRIES) ||
585             NT_STATUS_EQUAL(c->status, NT_STATUS_NO_MORE_ENTRIES)) {
586                 
587                 /* get enumerated accounts counter and resume handle (the latter allows
588                    making subsequent call to continue enumeration) */
589                 s->resume_index = *s->group_list.out.resume_handle;
590                 s->count        = s->group_list.out.num_entries;
591
592                 /* prepare returned group accounts array */
593                 s->groups       = talloc_array(c, struct grouplist, s->group_list.out.sam->count);
594                 if (composite_nomem(s->groups, c)) return;
595
596                 for (i = 0; i < s->group_list.out.sam->count; i++) {
597                         struct dom_sid *group_sid;
598                         struct samr_SamEntry *entry = &s->group_list.out.sam->entries[i];
599                         struct dom_sid *domain_sid = (*s->query_domain.out.info)->domain.sid;
600                         
601                         /* construct group sid from returned rid and queried domain sid */
602                         group_sid = dom_sid_add_rid(c, domain_sid, entry->idx);
603                         if (composite_nomem(group_sid, c)) return;
604
605                         /* groupname */
606                         s->groups[i].groupname = talloc_strdup(c, entry->name.string);
607                         if (composite_nomem(s->groups[i].groupname, c)) return;
608
609                         /* sid string */
610                         s->groups[i].sid = dom_sid_string(c, group_sid);
611                         if (composite_nomem(s->groups[i].sid, c)) return;
612                 }
613
614                 /* that's it */
615                 composite_done(c);
616
617         } else {
618                 /* something went wrong */
619                 composite_error(c, c->status);
620         }
621 }
622
623
624 /**
625  * Receive result of GroupList call
626  *
627  * @param c composite context returned by send request routine
628  * @param mem_ctx memory context of this call
629  * @param io pointer to structure containing arguments and result of this call
630  * @param nt status
631  */
632 NTSTATUS libnet_GroupList_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
633                                struct libnet_GroupList *io)
634 {
635         NTSTATUS status;
636         struct grouplist_state *s;
637
638         if (c == NULL || mem_ctx == NULL || io == NULL) {
639                 return NT_STATUS_INVALID_PARAMETER;
640         }
641
642         status = composite_wait(c);
643         if (NT_STATUS_IS_OK(status) ||
644             NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES) ||
645             NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_ENTRIES)) {
646                 
647                 s = talloc_get_type(c->private_data, struct grouplist_state);
648                 
649                 /* get results from composite context */
650                 io->out.count        = s->count;
651                 io->out.resume_index = s->resume_index;
652                 io->out.groups       = talloc_steal(mem_ctx, s->groups);
653
654                 if (NT_STATUS_IS_OK(status)) {
655                         io->out.error_string = talloc_asprintf(mem_ctx, "Success");
656                 } else {
657                         /* success, but we're not done yet */
658                         io->out.error_string = talloc_asprintf(mem_ctx, "Success (status: %s)",
659                                                                nt_errstr(status));
660                 }
661
662         } else {
663                 io->out.error_string = talloc_asprintf(mem_ctx, "Error: %s", nt_errstr(status));
664         }
665
666         return status;
667 }
668
669
670 /**
671  * Enumerate domain groups
672  *
673  * @param ctx initialised libnet context
674  * @param mem_ctx memory context of this call
675  * @param io pointer to structure containing arguments and result of this call
676  * @return nt status
677  */
678 NTSTATUS libnet_GroupList(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
679                           struct libnet_GroupList *io)
680 {
681         struct composite_context *c;
682
683         c = libnet_GroupList_send(ctx, mem_ctx, io, NULL);
684         return libnet_GroupList_recv(c, mem_ctx, io);
685 }