The branch, master has been updated
       via  d1c2fe89073 libsmb: Make cli_posix_unlink/rmdir proper 
tevent_req/subreq pairs
       via  65c269d5382 libsmb: Use tevent_req_simple_finish_ntstatus()
       via  743b922ad96 libsmb: Use tevent_req_simple_finish_ntstatus()
      from  e7351603890 ctdb_mutex_ceph_rados_helper: revert strtoull_err() 
usage

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


- Log -----------------------------------------------------------------
commit d1c2fe89073bf463a5791d433f60bc9381bdad62
Author: Volker Lendecke <[email protected]>
Date:   Thu Feb 28 21:47:51 2019 +0100

    libsmb: Make cli_posix_unlink/rmdir proper tevent_req/subreq pairs
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Sat Mar  2 00:55:56 UTC 2019 on sn-devel-144

commit 65c269d53821bbb2e050ee5f557d6b8806f8ac76
Author: Volker Lendecke <[email protected]>
Date:   Thu Feb 28 21:18:06 2019 +0100

    libsmb: Use tevent_req_simple_finish_ntstatus()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 743b922ad9626b49b2bd2a314c9ecbe56b82cf3b
Author: Volker Lendecke <[email protected]>
Date:   Thu Feb 28 21:18:06 2019 +0100

    libsmb: Use tevent_req_simple_finish_ntstatus()
    
    Less lines... Just rediscovered this function :-)
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

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

Summary of changes:
 source3/libsmb/cli_smb2_fnum.c | 17 ++----------
 source3/libsmb/clifile.c       | 63 ++++++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 19 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index 795dc557c45..4352e504cfc 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -857,15 +857,8 @@ static void cli_smb2_rmdir_disp_set(struct tevent_req 
*subreq)
 
 static void cli_smb2_rmdir_closed(struct tevent_req *subreq)
 {
-       struct tevent_req *req = tevent_req_callback_data(
-               subreq, struct tevent_req);
-       NTSTATUS status;
-
-       status = cli_smb2_close_fnum_recv(subreq);
-       if (tevent_req_nterror(req, status)) {
-               return;
-       }
-       tevent_req_done(req);
+       NTSTATUS status = cli_smb2_close_fnum_recv(subreq);
+       tevent_req_simple_finish_ntstatus(subreq, status);
 }
 
 NTSTATUS cli_smb2_rmdir_recv(struct tevent_req *req)
@@ -4247,11 +4240,7 @@ static void cli_smb2_shadow_copy_data_fnum_done(struct 
tevent_req *subreq)
        status = smb2cli_ioctl_recv(subreq, state,
                                &state->out_input_buffer,
                                &state->out_output_buffer);
-       TALLOC_FREE(subreq);
-       if (tevent_req_nterror(req, status)) {
-               return;
-       }
-       tevent_req_done(req);
+       tevent_req_simple_finish_ntstatus(subreq, status);
 }
 
 static NTSTATUS cli_smb2_shadow_copy_data_fnum_recv(struct tevent_req *req,
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 7d72dc82858..49e58c0d252 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -5486,13 +5486,43 @@ static void cli_posix_unlink_internal_done(struct 
tevent_req *subreq)
        tevent_req_simple_finish_ntstatus(subreq, status);
 }
 
+static NTSTATUS cli_posix_unlink_internal_recv(struct tevent_req *req)
+{
+       return tevent_req_simple_recv_ntstatus(req);
+}
+
+struct cli_posix_unlink_state {
+       uint8_t dummy;
+};
+
+static void cli_posix_unlink_done(struct tevent_req *subreq);
+
 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
                                        struct tevent_context *ev,
                                        struct cli_state *cli,
                                        const char *fname)
 {
-       return cli_posix_unlink_internal_send(mem_ctx, ev, cli, fname,
-                                             SMB_POSIX_UNLINK_FILE_TARGET);
+       struct tevent_req *req = NULL, *subreq = NULL;
+       struct cli_posix_unlink_state *state;
+
+       req = tevent_req_create(
+               mem_ctx, &state, struct cli_posix_unlink_state);
+       if (req == NULL) {
+               return NULL;
+       }
+       subreq = cli_posix_unlink_internal_send(
+               mem_ctx, ev, cli, fname, SMB_POSIX_UNLINK_FILE_TARGET);
+       if (tevent_req_nomem(subreq, req)) {
+               return tevent_req_post(req, ev);
+       }
+       tevent_req_set_callback(subreq, cli_posix_unlink_done, req);
+       return req;
+}
+
+static void cli_posix_unlink_done(struct tevent_req *subreq)
+{
+       NTSTATUS status = cli_posix_unlink_internal_recv(subreq);
+       tevent_req_simple_finish_ntstatus(subreq, status);
 }
 
 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req)
@@ -5549,14 +5579,37 @@ NTSTATUS cli_posix_unlink(struct cli_state *cli, const 
char *fname)
  rmdir - POSIX semantics.
 ****************************************************************************/
 
+struct cli_posix_rmdir_state {
+       uint8_t dummy;
+};
+
+static void cli_posix_rmdir_done(struct tevent_req *subreq);
+
 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
                                        struct tevent_context *ev,
                                        struct cli_state *cli,
                                        const char *fname)
 {
-       return cli_posix_unlink_internal_send(
-               mem_ctx, ev, cli, fname,
-               SMB_POSIX_UNLINK_DIRECTORY_TARGET);
+       struct tevent_req *req = NULL, *subreq = NULL;
+       struct cli_posix_rmdir_state *state;
+
+       req = tevent_req_create(mem_ctx, &state, struct cli_posix_rmdir_state);
+       if (req == NULL) {
+               return NULL;
+       }
+       subreq = cli_posix_unlink_internal_send(
+               mem_ctx, ev, cli, fname, SMB_POSIX_UNLINK_DIRECTORY_TARGET);
+       if (tevent_req_nomem(subreq, req)) {
+               return tevent_req_post(req, ev);
+       }
+       tevent_req_set_callback(subreq, cli_posix_rmdir_done, req);
+       return req;
+}
+
+static void cli_posix_rmdir_done(struct tevent_req *subreq)
+{
+       NTSTATUS status = cli_posix_unlink_internal_recv(subreq);
+       tevent_req_simple_finish_ntstatus(subreq, status);
 }
 
 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)


-- 
Samba Shared Repository

Reply via email to