The branch, master has been updated
       via  f2c5a0a s3-libsmb: let cli_lock64 return NTSTATUS instead of bool
       via  57194d8 s3-libsmb: introduce cli_lock32()
      from  330c00a dbcheck: use get_lDAPDisplayName_by_attid()

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


- Log -----------------------------------------------------------------
commit f2c5a0afd2e219e8d845db08d6d13de65b710f5c
Author: Björn Baumbach <[email protected]>
Date:   Mon Jul 11 11:19:21 2011 +0200

    s3-libsmb: let cli_lock64 return NTSTATUS instead of bool
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    
    Autobuild-User: Stefan Metzmacher <[email protected]>
    Autobuild-Date: Mon Jul 11 12:48:38 CEST 2011 on sn-devel-104

commit 57194d8c5d47133c9145e6ed2b51f4e18f8bd1ec
Author: Björn Baumbach <[email protected]>
Date:   Mon Jul 11 11:13:18 2011 +0200

    s3-libsmb: introduce cli_lock32()
    
    Same like cli_lock() but return NTSTATUS instead of bool
    
    Signed-off-by: Stefan Metzmacher <[email protected]>

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

Summary of changes:
 source3/libsmb/clifile.c   |   26 +++++++++++++++++++++-----
 source3/libsmb/proto.h     |    7 +++++--
 source3/torture/locktest.c |   16 +++++++---------
 3 files changed, 33 insertions(+), 16 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 24a099b..a5be748 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -2580,6 +2580,22 @@ NTSTATUS cli_locktype(struct cli_state *cli, uint16_t 
fnum,
  note that timeout is in units of 2 milliseconds
 ****************************************************************************/
 
+NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum,
+                 uint32_t offset, uint32_t len, int timeout,
+                 enum brl_type lock_type)
+{
+       NTSTATUS status;
+
+       status = cli_locktype(cli, fnum, offset, len, timeout,
+                             (lock_type == READ_LOCK? 1 : 0));
+       return status;
+}
+
+/****************************************************************************
+ Lock a file.
+ note that timeout is in units of 2 milliseconds
+****************************************************************************/
+
 bool cli_lock(struct cli_state *cli, uint16_t fnum,
                  uint32_t offset, uint32_t len, int timeout,
                  enum brl_type lock_type)
@@ -2705,9 +2721,9 @@ NTSTATUS cli_unlock(struct cli_state *cli,
  Lock a file with 64 bit offsets.
 ****************************************************************************/
 
-bool cli_lock64(struct cli_state *cli, uint16_t fnum,
-               uint64_t offset, uint64_t len, int timeout,
-               enum brl_type lock_type)
+NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
+                   uint64_t offset, uint64_t len, int timeout,
+                   enum brl_type lock_type)
 {
        uint16_t vwv[8];
        uint8_t bytes[20];
@@ -2716,7 +2732,7 @@ bool cli_lock64(struct cli_state *cli, uint16_t fnum,
        NTSTATUS status;
 
        if (! (cli->capabilities & CAP_LARGE_FILES)) {
-               return cli_lock(cli, fnum, offset, len, timeout, lock_type);
+               return cli_lock32(cli, fnum, offset, len, timeout, lock_type);
        }
 
        ltype = (lock_type == READ_LOCK? 1 : 0);
@@ -2748,7 +2764,7 @@ bool cli_lock64(struct cli_state *cli, uint16_t fnum,
 
        cli->timeout = saved_timeout;
 
-       return NT_STATUS_IS_OK(status);
+       return status;
 }
 
 /****************************************************************************
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index 2883af2..151df40 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -390,6 +390,8 @@ NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
                      int timeout, unsigned char locktype);
 bool cli_lock(struct cli_state *cli, uint16_t fnum,
              uint32_t offset, uint32_t len, int timeout, enum brl_type 
lock_type);
+NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
+                   uint32_t len, int timeout, enum brl_type lock_type);
 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
                                 struct event_context *ev,
                                 struct cli_state *cli,
@@ -398,8 +400,9 @@ struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
                                 uint64_t len);
 NTSTATUS cli_unlock_recv(struct tevent_req *req);
 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, 
uint32_t len);
-bool cli_lock64(struct cli_state *cli, uint16_t fnum,
-               uint64_t offset, uint64_t len, int timeout, enum brl_type 
lock_type);
+NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
+                   uint64_t offset, uint64_t len, int timeout,
+                   enum brl_type lock_type);
 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
                                 struct event_context *ev,
                                 struct cli_state *cli,
diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c
index d27eb5f..a5ccf24 100644
--- a/source3/torture/locktest.c
+++ b/source3/torture/locktest.c
@@ -289,17 +289,16 @@ static bool test_one(struct cli_state 
*cli[NSERVERS][NCONNECTIONS],
        uint64_t len = rec->len;
        enum brl_type op = rec->lock_type;
        int server;
-       bool ret[NSERVERS];
        NTSTATUS status[NSERVERS];
 
        switch (rec->lock_op) {
        case OP_LOCK:
                /* set a lock */
                for (server=0;server<NSERVERS;server++) {
-                       ret[server] = cli_lock64(cli[server][conn], 
-                                                fnum[server][conn][f],
-                                                start, len, LOCK_TIMEOUT, op);
-                       status[server] = cli_nt_error(cli[server][conn]);
+                       status[server] = cli_lock64(cli[server][conn],
+                                                   fnum[server][conn][f],
+                                                   start, len, LOCK_TIMEOUT,
+                                                   op);
                        if (!exact_error_codes && 
                            NT_STATUS_EQUAL(status[server], 
                                            NT_STATUS_FILE_LOCK_CONFLICT)) {
@@ -320,10 +319,9 @@ static bool test_one(struct cli_state 
*cli[NSERVERS][NCONNECTIONS],
        case OP_UNLOCK:
                /* unset a lock */
                for (server=0;server<NSERVERS;server++) {
-                       ret[server] = 
NT_STATUS_IS_OK(cli_unlock64(cli[server][conn], 
-                                                  fnum[server][conn][f],
-                                                  start, len));
-                       status[server] = cli_nt_error(cli[server][conn]);
+                       status[server] = cli_unlock64(cli[server][conn],
+                                                     fnum[server][conn][f],
+                                                     start, len);
                }
                if (showall || 
                    (!hide_unlock_fails && 
!NT_STATUS_EQUAL(status[0],status[1]))) {


-- 
Samba Shared Repository

Reply via email to