dns: Use new DNS debugclass in DNS server
[kai/samba.git] / source4 / winbind / wb_cmd_userdomgroups.c
index 2f994e8ea1449986793572a6112ddd9259645eda..c1258a94d2729355238157e8a54f4f40614f7e6e 100644 (file)
@@ -7,7 +7,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -16,8 +16,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
@@ -31,7 +30,7 @@ struct cmd_userdomgroups_state {
        struct composite_context *ctx;
        struct dom_sid *dom_sid;
        uint32_t user_rid;
-       int num_rids;
+       uint32_t num_rids;
        uint32_t *rids;
 };
 
@@ -45,11 +44,8 @@ struct composite_context *wb_cmd_userdomgroups_send(TALLOC_CTX *mem_ctx,
        struct composite_context *result, *ctx;
        struct cmd_userdomgroups_state *state;
 
-       result = talloc(mem_ctx, struct composite_context);
+       result = composite_create(mem_ctx, service->task->event_ctx);
        if (result == NULL) goto failed;
-       result->state = COMPOSITE_STATE_IN_PROGRESS;
-       result->async.fn = NULL;
-       result->event_ctx = service->task->event_ctx;
 
        state = talloc(result, struct cmd_userdomgroups_state);
        if (state == NULL) goto failed;
@@ -63,11 +59,12 @@ struct composite_context *wb_cmd_userdomgroups_send(TALLOC_CTX *mem_ctx,
        state->user_rid = sid->sub_auths[sid->num_auths-1];
 
        ctx = wb_sid2domain_send(state, service, sid);
-       if (ctx == NULL) goto failed;
 
-       ctx->async.fn = userdomgroups_recv_domain;
-       ctx->async.private_data = state;
-       return result;
+       composite_continue(state->ctx, ctx, userdomgroups_recv_domain, state);
+
+       if (ctx) {
+               return result;
+       }
 
  failed:
        talloc_free(result);
@@ -84,8 +81,8 @@ static void userdomgroups_recv_domain(struct composite_context *ctx)
        state->ctx->status = wb_sid2domain_recv(ctx, &domain);
        if (!composite_is_ok(state->ctx)) return;
 
-       ctx = wb_samr_userdomgroups_send(state, domain->samr_pipe,
-                                        domain->domain_handle,
+       ctx = wb_samr_userdomgroups_send(state, domain->libnet_ctx->samr.pipe,
+                                        &domain->libnet_ctx->samr.handle,
                                         state->user_rid);
        composite_continue(state->ctx, ctx, userdomgroups_recv_rids, state);
        
@@ -107,12 +104,12 @@ static void userdomgroups_recv_rids(struct composite_context *ctx)
 
 NTSTATUS wb_cmd_userdomgroups_recv(struct composite_context *c,
                                   TALLOC_CTX *mem_ctx,
-                                  int *num_sids, struct dom_sid ***sids)
+                                  uint32_t *num_sids, struct dom_sid ***sids)
 {
        struct cmd_userdomgroups_state *state =
                talloc_get_type(c->private_data,
                                struct cmd_userdomgroups_state);
-       int i;
+       uint32_t i;
        NTSTATUS status;
 
        status = composite_wait(c);
@@ -142,7 +139,7 @@ done:
 NTSTATUS wb_cmd_userdomgroups(TALLOC_CTX *mem_ctx,
                              struct wbsrv_service *service,
                              const struct dom_sid *sid,
-                             int *num_sids, struct dom_sid ***sids)
+                             uint32_t *num_sids, struct dom_sid ***sids)
 {
        struct composite_context *c =
                wb_cmd_userdomgroups_send(mem_ctx, service, sid);