r24706: Move nmblookup tests to separate blackbox testsuite.
[samba.git] / source4 / winbind / wb_cmd_userdomgroups.c
index 6021412e21e52da1e6ede2c2db5331a843eb7da8..649fe489cc69646c26341721f6b96540d308ceaa 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,
    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"
 #include "libcli/composite/composite.h"
+#include "libcli/security/security.h"
 #include "winbind/wb_server.h"
-#include "smbd/service_stream.h"
+#include "winbind/wb_helper.h"
 #include "smbd/service_task.h"
-#include "lib/events/events.h"
-#include "librpc/gen_ndr/ndr_security.h"
 
 struct cmd_userdomgroups_state {
        struct composite_context *ctx;
@@ -46,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;
@@ -64,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);
@@ -85,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);