s4-libnet: Fix setting the group handle and return codes.
authorAndreas Schneider <asn@samba.org>
Thu, 6 Dec 2012 13:45:24 +0000 (14:45 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 13 Dec 2012 00:01:13 +0000 (01:01 +0100)
Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Dec 13 01:01:14 CET 2012 on sn-devel-104

source4/libnet/groupman.c

index 97236bd7ad7ca121e34606deb9092354cdc3946c..9771ea5496690de4234163e5a215f42adf87a74b 100644 (file)
@@ -94,10 +94,12 @@ NTSTATUS libnet_rpc_groupadd_recv(struct composite_context *c, TALLOC_CTX *mem_c
        struct groupadd_state *s;
        
        status = composite_wait(c);
-       if (NT_STATUS_IS_OK(status)) {
-               s = talloc_get_type(c, struct groupadd_state);
+       if (NT_STATUS_IS_OK(status) && io) {
+               s = talloc_get_type(c->private_data, struct groupadd_state);
+               io->out.group_handle = s->group_handle;
        }
 
+       talloc_free(c);
        return status;
 }
 
@@ -115,8 +117,11 @@ static void continue_groupadd_created(struct tevent_req *subreq)
        if (!composite_is_ok(c)) return;
 
        c->status = s->creategroup.out.result;
-       if (!composite_is_ok(c)) return;
-       
+       if (!NT_STATUS_IS_OK(c->status)) {
+               composite_error(c, c->status);
+               return;
+       }
+
        composite_done(c);
 }