The branch, master has been updated
       via  229d934 s4-libnet: Fix setting the group handle and return codes.
       via  bdc2f4b util: Remove unused fde_stdin in samba_runcmd.
       via  74fb61d s3-lib: Don't close the listener twice if we goto failed.
      from  a44e58a s3: Fix a typo in a debug message

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 229d934d2fb653e02b38d242bf01f199434cd1f3
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Dec 6 14:45:24 2012 +0100

    s4-libnet: Fix setting the group handle and return codes.
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Günther Deschner <g...@samba.org>
    
    Autobuild-User(master): Günther Deschner <g...@samba.org>
    Autobuild-Date(master): Thu Dec 13 01:01:14 CET 2012 on sn-devel-104

commit bdc2f4bd91c3eb0ce0fa87d2d21668e064b106b6
Author: Andreas Schneider <a...@samba.org>
Date:   Wed Dec 12 19:15:58 2012 +0100

    util: Remove unused fde_stdin in samba_runcmd.
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Günther Deschner <g...@samba.org>

commit 74fb61d496348391a324fc69bb7b167597939d5b
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Dec 6 11:11:15 2012 +0100

    s3-lib: Don't close the listener twice if we goto failed.
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Günther Deschner <g...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/util/util_runcmd.c    |   27 +++++----------------------
 source3/lib/sock_exec.c   |    2 +-
 source4/libnet/groupman.c |   13 +++++++++----
 3 files changed, 15 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/util_runcmd.c b/lib/util/util_runcmd.c
index cc274c2..bc5cc10 100644
--- a/lib/util/util_runcmd.c
+++ b/lib/util/util_runcmd.c
@@ -33,7 +33,6 @@
 struct samba_runcmd_state {
        int stdout_log_level;
        int stderr_log_level;
-       struct tevent_fd *fde_stdin;
        struct tevent_fd *fde_stdout;
        struct tevent_fd *fde_stderr;
        int fd_stdin, fd_stdout, fd_stderr;
@@ -50,6 +49,10 @@ static int samba_runcmd_state_destructor(struct 
samba_runcmd_state *state)
                waitpid(state->pid, NULL, 0);
                state->pid = -1;
        }
+
+       if (state->fd_stdin != -1) {
+               close(state->fd_stdin);
+       }
        return 0;
 }
 
@@ -85,6 +88,7 @@ struct tevent_req *samba_runcmd_send(TALLOC_CTX *mem_ctx,
 
        state->stdout_log_level = stdout_log_level;
        state->stderr_log_level = stderr_log_level;
+       state->fd_stdin = -1;
 
        state->arg0 = talloc_strdup(state, argv0[0]);
        if (tevent_req_nomem(state->arg0, req)) {
@@ -149,7 +153,6 @@ struct tevent_req *samba_runcmd_send(TALLOC_CTX *mem_ctx,
                if (tevent_req_nomem(state->fde_stdout, req)) {
                        close(state->fd_stdout);
                        close(state->fd_stderr);
-                       close(state->fd_stdin);
                        return tevent_req_post(req, ev);
                }
                tevent_fd_set_auto_close(state->fde_stdout);
@@ -161,22 +164,10 @@ struct tevent_req *samba_runcmd_send(TALLOC_CTX *mem_ctx,
                                                  req);
                if (tevent_req_nomem(state->fde_stdout, req)) {
                        close(state->fd_stderr);
-                       close(state->fd_stdin);
                        return tevent_req_post(req, ev);
                }
                tevent_fd_set_auto_close(state->fde_stderr);
 
-               state->fde_stdin = tevent_add_fd(ev, state,
-                                                state->fd_stdin,
-                                                0,
-                                                samba_runcmd_io_handler,
-                                                req);
-               if (tevent_req_nomem(state->fde_stdin, req)) {
-                       close(state->fd_stdin);
-                       return tevent_req_post(req, ev);
-               }
-               tevent_fd_set_auto_close(state->fde_stdin);
-
                if (!timeval_is_zero(&endtime)) {
                        tevent_req_set_endtime(req, ev, endtime);
                }
@@ -251,14 +242,6 @@ static void samba_runcmd_io_handler(struct tevent_context 
*ev,
        } else if (fde == state->fde_stderr) {
                level = state->stderr_log_level;
                fd = state->fd_stderr;
-       } else if (fde == state->fde_stdin) {
-               char c;
-               if (read(state->fd_stdin, &c, 1) != 1) {
-                       /* the child has closed its stdin */
-                       talloc_free(fde);
-                       state->fde_stdin = NULL;
-                       return;
-               }
        } else {
                return;
        }
diff --git a/source3/lib/sock_exec.c b/source3/lib/sock_exec.c
index 403b38b..3d2ace9 100644
--- a/source3/lib/sock_exec.c
+++ b/source3/lib/sock_exec.c
@@ -68,11 +68,11 @@ static int socketpair_tcp(int fd[2])
 
        if ((fd[0] = accept(listener, (struct sockaddr *)&sock, &socklen)) == 
-1) goto failed;
 
-       close(listener);
        if (connect_done == 0) {
                if (connect(fd[1], (struct sockaddr *)&sock, socklen) != 0
                    && errno != EISCONN) goto failed;
        }
+       close(listener);
 
        set_blocking(fd[1], 1);
 
diff --git a/source4/libnet/groupman.c b/source4/libnet/groupman.c
index 97236bd..9771ea5 100644
--- a/source4/libnet/groupman.c
+++ b/source4/libnet/groupman.c
@@ -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);
 }
 


-- 
Samba Shared Repository

Reply via email to