[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Sat Jul 23 03:09:02 MDT 2011


The branch, master has been updated
       via  824a300 s3:libsmb: cli_set_secdesc() only needs a const struct security_descriptor
       via  82413e8 libcli/security: add some const to marshall_sec_desc[_buf]()
       via  6219bb9 s3:libsmb: remove unused cli_query_secdesc_old()
       via  baee2fb s3:libsmb_xattr: make use of the new cli_query_secdesc()
       via  7302277 s3-utils/net_rpc.c: replace cli_query_secdesc_old()
       via  c436a7d s3-utils/net_rpc_printer.c: replace cli_query_secdesc_old()
       via  eacd555 s3-utils/smbcacls.c: replace cli_query_secdesc_old()
       via  78f267d s3-client/client.c: replace cli_query_secdesc_old()
       via  6911b04 s3-torture: run_nttrans_create(): replace cli_query_secdesc_old()
       via  cb4fc92 s3-libsmb: introduce new cli_query_secdesc() which returns NTSTATUS
       via  768646c s3-libsmb: rename cli_query_secdesc() to cli_query_secdesc_old()
       via  40e9d0c s3-libsmb: finally remove cli_read_old()
       via  8bdbdd4 s3-libsmb/libsmb_file.c: replace cli_read_old() with cli_read()
       via  473b16d s3-torture/nbio.c: replace cli_read_old() with cli_read()
       via  7833353 s3-torture/utable.c: replace cli_read_old() with cli_read()
       via  ebc53c3 s3-utils/net_rpc_printer.c: print more info on write error
       via  fd7631c s3-utils/net_rpc_printer.c: return on read error in net_copy_file()
       via  4b76c10 s3-torture/denytest.c: replace cli_read_old() with cli_read()
       via  affc9d4 s3-libgpo/gpo_filesync.c: return on read error
       via  bffc521 s3-client/clitar.c: replace cli_read_old() with cli_read()
       via  6d69574 s3-torture: run_oplock2(): replace cli_read_old() with cli_read()
       via  963aa98 s3-torture: run_fdsesstest(): replace cli_read_old() with cli_read()
       via  995978a s3-torture: run_fdpasstest(): replace cli_read_old() with cli_read()
       via  cfec548 s3-torture: run_locktest7(): replace cli_read_old() with cli_read()
       via  4971a0a s3-torture: run_locktest7(): goto fail on read error
      from  1832c95 Fix bug 8314] - smbd crash with unknown user.

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


- Log -----------------------------------------------------------------
commit 824a300d2be8403dc9723a39e4bef88c43e46cc4
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Jul 23 09:55:06 2011 +0200

    s3:libsmb: cli_set_secdesc() only needs a const struct security_descriptor
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Sat Jul 23 11:08:19 CEST 2011 on sn-devel-104

commit 82413e829e03cc73b2caccea09e33f900fa99a4e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Jul 23 09:54:31 2011 +0200

    libcli/security: add some const to marshall_sec_desc[_buf]()
    
    metze

commit 6219bb98999876c9729f2c1923841709b13313d5
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Jul 23 09:54:04 2011 +0200

    s3:libsmb: remove unused cli_query_secdesc_old()
    
    metze

commit baee2fbcfd784cababf012b22a7d4be268b4af7b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Jul 23 09:43:32 2011 +0200

    s3:libsmb_xattr: make use of the new cli_query_secdesc()
    
    metze

commit 7302277e43e9353cfc1a17048ebb43b0c109127a
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 17:07:30 2011 +0200

    s3-utils/net_rpc.c: replace cli_query_secdesc_old()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit c436a7d8129f7a1d0fd0ecad17d90c6738da5c0a
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 17:00:23 2011 +0200

    s3-utils/net_rpc_printer.c: replace cli_query_secdesc_old()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit eacd555f704e6929dcdddf96e4b7f6316272d368
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 16:56:04 2011 +0200

    s3-utils/smbcacls.c: replace cli_query_secdesc_old()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 78f267df699a053a532a69cd4187917d6213deb1
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 16:51:10 2011 +0200

    s3-client/client.c: replace cli_query_secdesc_old()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 6911b046064b234c592fedee33c77e4c0b7762e8
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 15:50:13 2011 +0200

    s3-torture: run_nttrans_create(): replace cli_query_secdesc_old()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit cb4fc9217727c14cc5f92acf99160b7612974850
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 15:11:31 2011 +0200

    s3-libsmb: introduce new cli_query_secdesc() which returns NTSTATUS
    
    Replacement for cli_query_secdesc_old()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 768646c9a23c3b2d295af77826e82d3087076e36
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 15:02:23 2011 +0200

    s3-libsmb: rename cli_query_secdesc() to cli_query_secdesc_old()
    
    Will introduce new cli_query_secdesc() function
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 40e9d0c440fb436f48e854d8b44b31fef47aaee7
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 14:23:56 2011 +0200

    s3-libsmb: finally remove cli_read_old()
    
    Replaced by new cli_read() which returns NTSTATUS instead of ssize_t.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 8bdbdd46f4aca2d4a1cc0babf1300b9eb158b8bb
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 14:22:29 2011 +0200

    s3-libsmb/libsmb_file.c: replace cli_read_old() with cli_read()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 473b16dcbf31f385905738be56f5cba86c14cb01
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 14:01:12 2011 +0200

    s3-torture/nbio.c: replace cli_read_old() with cli_read()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 78333531ded3e2ec85d4478b8a194561687fddc8
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 13:46:57 2011 +0200

    s3-torture/utable.c: replace cli_read_old() with cli_read()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit ebc53c3575a91d199e17aa1ec0befdd40919a6fc
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 13:44:49 2011 +0200

    s3-utils/net_rpc_printer.c: print more info on write error
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit fd7631c633ec0909b3d28f94f038e1e01f9e4886
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 13:39:05 2011 +0200

    s3-utils/net_rpc_printer.c: return on read error in net_copy_file()
    
    replace cli_read_old() with cli_read()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 4b76c108ba2e567a7a2c96274590488a39d1c045
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 13:06:13 2011 +0200

    s3-torture/denytest.c: replace cli_read_old() with cli_read()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit affc9d4b610305dd6f4142869399befc58056ae6
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 12:44:56 2011 +0200

    s3-libgpo/gpo_filesync.c: return on read error
    
    replace cli_read_old() with cli_read()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit bffc521a8aa00ece7d330c6735c8ca787c91ba61
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 12:35:03 2011 +0200

    s3-client/clitar.c: replace cli_read_old() with cli_read()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 6d695749c741cf021ed8df1fa40f6fd8a25cf4a1
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 12:29:59 2011 +0200

    s3-torture: run_oplock2(): replace cli_read_old() with cli_read()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 963aa9856c9214815cbe6841db0e83d9d5f000eb
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 12:19:34 2011 +0200

    s3-torture: run_fdsesstest(): replace cli_read_old() with cli_read()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 995978ae965ecb922c7a579d4e84836cfb937955
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Jul 22 12:12:42 2011 +0200

    s3-torture: run_fdpasstest(): replace cli_read_old() with cli_read()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit cfec548aa0cdd726911efb7fd5c501e464dfc3e0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Jul 23 09:16:27 2011 +0200

    s3-torture: run_locktest7(): replace cli_read_old() with cli_read()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 4971a0a2bc5cc75d0142829d0fc16f1f2a06af17
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Jul 23 09:10:09 2011 +0200

    s3-torture: run_locktest7(): goto fail on read error
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 libcli/security/secdesc.c             |    4 +-
 libcli/security/secdesc.h             |    4 +-
 source3/client/client.c               |   10 ++--
 source3/client/clitar.c               |    9 ++--
 source3/libgpo/gpo_filesync.c         |    8 ++-
 source3/libsmb/clireadwrite.c         |   14 ------
 source3/libsmb/clisecdesc.c           |   22 +++++----
 source3/libsmb/libsmb_file.c          |   10 ++--
 source3/libsmb/libsmb_xattr.c         |   26 +++++-----
 source3/libsmb/proto.h                |    8 +--
 source3/torture/denytest.c            |   20 ++++++--
 source3/torture/nbio.c                |   19 ++++++--
 source3/torture/test_nttrans_create.c |    2 +-
 source3/torture/torture.c             |   83 ++++++++++++++++++++++-----------
 source3/torture/utable.c              |    2 +-
 source3/utils/net_rpc.c               |    2 +-
 source3/utils/net_rpc_printer.c       |   32 +++++++++----
 source3/utils/smbcacls.c              |    7 ++-
 18 files changed, 165 insertions(+), 117 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/security/secdesc.c b/libcli/security/secdesc.c
index 2c8fbc5..fcd0828 100644
--- a/libcli/security/secdesc.c
+++ b/libcli/security/secdesc.c
@@ -261,7 +261,7 @@ struct security_descriptor *dup_sec_desc(TALLOC_CTX *ctx, const struct security_
  Convert a secdesc into a byte stream
 ********************************************************************/
 NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
-			   struct security_descriptor *secdesc,
+			   const struct security_descriptor *secdesc,
 			   uint8_t **data, size_t *len)
 {
 	DATA_BLOB blob;
@@ -287,7 +287,7 @@ NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
 ********************************************************************/
 
 NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
-			       struct sec_desc_buf *secdesc_buf,
+			       const struct sec_desc_buf *secdesc_buf,
 			       uint8_t **data, size_t *len)
 {
 	DATA_BLOB blob;
diff --git a/libcli/security/secdesc.h b/libcli/security/secdesc.h
index 1e6d2e5..b8190a1 100644
--- a/libcli/security/secdesc.h
+++ b/libcli/security/secdesc.h
@@ -56,14 +56,14 @@ struct security_descriptor *dup_sec_desc(TALLOC_CTX *ctx, const struct security_
  Convert a secdesc into a byte stream
 ********************************************************************/
 NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
-			   struct security_descriptor *secdesc,
+			   const struct security_descriptor *secdesc,
 			   uint8_t **data, size_t *len);
 
 /*******************************************************************
  Convert a secdesc_buf into a byte stream
 ********************************************************************/
 NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
-			       struct sec_desc_buf *secdesc_buf,
+			       const struct sec_desc_buf *secdesc_buf,
 			       uint8_t **data, size_t *len);
 
 /*******************************************************************
diff --git a/source3/client/client.c b/source3/client/client.c
index 142eea2..e6fffcb 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -586,12 +586,12 @@ static NTSTATUS display_finfo(struct cli_state *cli_state, struct file_info *fin
 				   afname, nt_errstr(status)));
 		} else {
 			struct security_descriptor *sd = NULL;
-			sd = cli_query_secdesc(cli_state, fnum, ctx);
-			if (!sd) {
-				status = cli_nt_error(cli_state);
+			status = cli_query_secdesc(cli_state, fnum,
+						   ctx, &sd);
+			if (!NT_STATUS_IS_OK(status)) {
 				DEBUG( 0, ("display_finfo() failed to "
-					"get security descriptor: %s",
-					nt_errstr(status)));
+					   "get security descriptor: %s",
+					   nt_errstr(status)));
 			} else {
 				display_sec_desc(sd);
 			}
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 8882461..cc642c3 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -616,7 +616,7 @@ static NTSTATUS do_atar(const char *rname_in, char *lname,
 	bool shallitime=True;
 	char *data = NULL;
 	int read_size = 65520;
-	int datalen=0;
+	size_t datalen=0;
 	char *rname = NULL;
 	TALLOC_CTX *ctx = talloc_stackframe();
 	NTSTATUS status = NT_STATUS_OK;
@@ -693,10 +693,9 @@ static NTSTATUS do_atar(const char *rname_in, char *lname,
 
 			DEBUG(3,("nread=%.0f\n",(double)nread));
 
-			datalen = cli_read_old(cli, fnum, data, nread, read_size);
-
-			if (datalen == -1) {
-				status = cli_nt_error(cli);
+			status = cli_read(cli, fnum, data, nread,
+					  read_size, &datalen);
+			if (!NT_STATUS_IS_OK(status)) {
 				DEBUG(0,("Error reading file %s : %s\n",
 					 rname, nt_errstr(status)));
 				break;
diff --git a/source3/libgpo/gpo_filesync.c b/source3/libgpo/gpo_filesync.c
index cdcdcfb..ead9261 100644
--- a/source3/libgpo/gpo_filesync.c
+++ b/source3/libgpo/gpo_filesync.c
@@ -66,10 +66,14 @@ NTSTATUS gpo_copy_file(TALLOC_CTX *mem_ctx,
 	}
 
 	while (1) {
+		size_t n = 0;
 
-		int n = cli_read_old(cli, fnum, data, nread, read_size);
+		result = cli_read(cli, fnum, data, nread, read_size, &n);
+		if (!NT_STATUS_IS_OK(result)) {
+			goto out;
+		}
 
-		if (n <= 0)
+		if (n == 0)
 			break;
 
 		if (write(fd, data, n) != n) {
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c
index 5406007..413668d 100644
--- a/source3/libsmb/clireadwrite.c
+++ b/source3/libsmb/clireadwrite.c
@@ -691,20 +691,6 @@ static NTSTATUS cli_read_sink(char *buf, size_t n, void *priv)
 	return NT_STATUS_OK;
 }
 
-ssize_t cli_read_old(struct cli_state *cli, uint16_t fnum, char *buf,
-		 off_t offset, size_t size)
-{
-	NTSTATUS status;
-	SMB_OFF_T ret;
-
-	status = cli_pull(cli, fnum, offset, size, size,
-			  cli_read_sink, &buf, &ret);
-	if (!NT_STATUS_IS_OK(status)) {
-		return -1;
-	}
-	return ret;
-}
-
 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
 		 char *buf, off_t offset, size_t size,
 		 size_t *nread)
diff --git a/source3/libsmb/clisecdesc.c b/source3/libsmb/clisecdesc.c
index d703b1f..70596d6 100644
--- a/source3/libsmb/clisecdesc.c
+++ b/source3/libsmb/clisecdesc.c
@@ -21,17 +21,14 @@
 #include "libsmb/libsmb.h"
 #include "../libcli/security/secdesc.h"
 
-/****************************************************************************
-  query the security descriptor for a open file
- ****************************************************************************/
-struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
-			    TALLOC_CTX *mem_ctx)
+NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
+			   TALLOC_CTX *mem_ctx, struct security_descriptor **sd)
 {
 	uint8_t param[8];
 	uint8_t *rdata=NULL;
 	uint32_t rdata_count=0;
-	struct security_descriptor *psd = NULL;
 	NTSTATUS status;
+	struct security_descriptor *lsd;
 
 	SIVAL(param, 0, fnum);
 	SIVAL(param, 4, 0x7);
@@ -54,26 +51,31 @@ struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fn
 	}
 
 	status = unmarshall_sec_desc(mem_ctx, (uint8 *)rdata, rdata_count,
-				     &psd);
-
+				     &lsd);
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(10, ("unmarshall_sec_desc failed: %s\n",
 			   nt_errstr(status)));
 		goto cleanup;
 	}
 
+	if (sd != NULL) {
+		*sd = lsd;
+	} else {
+		TALLOC_FREE(lsd);
+	}
+
  cleanup:
 
 	TALLOC_FREE(rdata);
 
-	return psd;
+	return status;
 }
 
 /****************************************************************************
   set the security descriptor for a open file
  ****************************************************************************/
 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
-			 struct security_descriptor *sd)
+			 const struct security_descriptor *sd)
 {
 	uint8_t param[8];
 	uint32 sec_info = 0;
diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c
index ebf4925..914b614 100644
--- a/source3/libsmb/libsmb_file.c
+++ b/source3/libsmb/libsmb_file.c
@@ -225,7 +225,7 @@ SMBC_read_ctx(SMBCCTX *context,
               void *buf,
               size_t count)
 {
-	int ret;
+	size_t ret;
 	char *server = NULL, *share = NULL, *user = NULL, *password = NULL;
 	char *path = NULL;
 	char *targetpath = NULL;
@@ -296,9 +296,9 @@ SMBC_read_ctx(SMBCCTX *context,
 	}
 	/*d_printf(">>>fstat: resolved path as %s\n", targetpath);*/
 
-	ret = cli_read_old(targetcli, file->cli_fd, (char *)buf, offset, count);
-
-	if (ret < 0) {
+	status = cli_read(targetcli, file->cli_fd, (char *)buf, offset,
+			  count, &ret);
+	if (!NT_STATUS_IS_OK(status)) {
 		errno = SMBC_errno(context, targetcli);
 		TALLOC_FREE(frame);
 		return -1;
@@ -306,7 +306,7 @@ SMBC_read_ctx(SMBCCTX *context,
 
 	file->offset += ret;
 
-	DEBUG(4, ("  --> %d\n", ret));
+	DEBUG(4, ("  --> %ld\n", (unsigned long)ret));
 
 	TALLOC_FREE(frame);
 	return ret;  /* Success, ret bytes of data ... */
diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c
index 00f9412..5ed3841 100644
--- a/source3/libsmb/libsmb_xattr.c
+++ b/source3/libsmb/libsmb_xattr.c
@@ -911,14 +911,14 @@ cacl_get(SMBCCTX *context,
 			return -1;
 		}
 
-		sd = cli_query_secdesc(targetcli, fnum, ctx);
-
-                if (!sd) {
-                        DEBUG(5,
-                              ("cacl_get Failed to query old descriptor\n"));
-                        errno = 0;
-                        return -1;
-                }
+		status = cli_query_secdesc(targetcli, fnum, ctx, &sd);
+		if (!NT_STATUS_IS_OK(status)) {
+			DEBUG(5,("cacl_get Failed to query old descriptor "
+				 "of %s: %s\n",
+				  targetpath, nt_errstr(status)));
+			errno = 0;
+			return -1;
+		}
 
                 cli_close(targetcli, fnum);
 
@@ -1570,11 +1570,11 @@ cacl_set(SMBCCTX *context,
 		return -1;
 	}
 
-	old = cli_query_secdesc(targetcli, fnum, ctx);
-
-	if (!old) {
-                DEBUG(5, ("cacl_set Failed to query old descriptor\n"));
-                errno = 0;
+	status = cli_query_secdesc(targetcli, fnum, ctx, &old);
+	if (!NT_STATUS_IS_OK(status)) {
+		DEBUG(5,("cacl_set Failed to query old descriptor of %s: %s\n",
+			 targetpath, nt_errstr(status)));
+		errno = 0;
 		return -1;
 	}
 
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index 7924091..1d2da7f 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -746,8 +746,6 @@ NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
 		  off_t start_offset, SMB_OFF_T size, size_t window_size,
 		  NTSTATUS (*sink)(char *buf, size_t n, void *priv),
 		  void *priv, SMB_OFF_T *received);
-ssize_t cli_read_old(struct cli_state *cli, uint16_t fnum, char *buf,
-		 off_t offset, size_t size);
 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
 		  char *buf, off_t offset, size_t size,
 		  size_t *nread);
@@ -787,10 +785,10 @@ NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
 
 /* The following definitions come from libsmb/clisecdesc.c  */
 
-struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
-			    TALLOC_CTX *mem_ctx);
+NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
+			  TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
-			 struct security_descriptor *sd);
+			 const struct security_descriptor *sd);
 
 /* The following definitions come from libsmb/clistr.c  */
 
diff --git a/source3/torture/denytest.c b/source3/torture/denytest.c
index 9fea7c5..8462894 100644
--- a/source3/torture/denytest.c
+++ b/source3/torture/denytest.c
@@ -1412,8 +1412,9 @@ bool torture_denytest1(int dummy)
 	uint16_t fnum1, fnum2;
 	int i;
 	bool correct = True;
-	NTSTATUS ret1, ret2;
+	NTSTATUS ret1, ret2, status;
 	const char *fnames[2] = {"\\denytest1.dat", "\\denytest1.exe"};
+	size_t nread;
 
 	if (!torture_open_connection(&cli1, 0)) {
 		return False;
@@ -1451,7 +1452,10 @@ bool torture_denytest1(int dummy)
 		} else {
 			char x = 1;
 			res = A_0;
-			if (cli_read_old(cli1, fnum2, (char *)&x, 0, 1) == 1) {
+
+			status = cli_read(cli1, fnum2, (char *)&x, 0, 1,
+					  &nread);
+			if (NT_STATUS_IS_OK(status) && nread == 1) {
 				res += A_R;
 			}
 			if (NT_STATUS_IS_OK(cli_writeall(cli1, fnum2, 0,
@@ -1506,8 +1510,9 @@ bool torture_denytest2(int dummy)
 	uint16_t fnum1, fnum2;
 	int i;
 	bool correct = True;
-	NTSTATUS ret1, ret2;
+	NTSTATUS ret1, ret2, status;
 	const char *fnames[2] = {"\\denytest2.dat", "\\denytest2.exe"};
+	size_t nread;
 
 	if (!torture_open_connection(&cli1, 0) || !torture_open_connection(&cli2, 1)) {
 		return False;
@@ -1543,9 +1548,12 @@ bool torture_denytest2(int dummy)
 		} else {
 			char x = 1;
 			res = A_0;
-			if (cli_read_old(cli2, fnum2, (char *)&x, 0, 1) == 1) {
-				res += A_R;
-			}
+
+                        status = cli_read(cli2, fnum2, (char *)&x, 0, 1,
+                                          &nread);
+                        if (NT_STATUS_IS_OK(status) && nread == 1) {
+                                res += A_R;
+                        }
 			if (NT_STATUS_IS_OK(cli_writeall(cli2, fnum2, 0,
 							 (uint8_t *)&x, 0, 1,
 							 NULL))) {
diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c
index e6caf74..4cf4cc7 100644
--- a/source3/torture/nbio.c
+++ b/source3/torture/nbio.c
@@ -212,12 +212,23 @@ void nb_writex(int handle, int offset, int size, int ret_size)
 
 void nb_readx(int handle, int offset, int size, int ret_size)
 {
-	int i, ret;
+	int i;
+	NTSTATUS status;
+	size_t nread;
 
 	i = find_handle(handle);
-	if ((ret=cli_read_old(c, ftable[i].fd, buf, offset, size)) != ret_size) {
-		printf("(%d) ERROR: read failed on handle %d ofs=%d size=%d res=%d fd %d errno %d (%s)\n",
-			line_count, handle, offset, size, ret, ftable[i].fd, errno, strerror(errno));
+	status = cli_read(c, ftable[i].fd, buf, offset, size, &nread);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("(%d) ERROR: read failed on handle %d ofs=%d size=%d "
+		       "fd %d nterror %s\n",
+		       line_count, handle, offset, size,
+		       ftable[i].fd, nt_errstr(status));
+		exit(1);
+	} else if (nread != ret_size) {
+		printf("(%d) ERROR: read failed on handle %d ofs=%d size=%d "
+		       "nread=%lu ret_size=%d fd %d\n",
+		       line_count, handle, offset, size, (unsigned long)nread,
+		       ret_size, ftable[i].fd);
 		exit(1);
 	}
 	children[nbio_id].bytes_in += ret_size;
diff --git a/source3/torture/test_nttrans_create.c b/source3/torture/test_nttrans_create.c
index 9869f02..f6444e8 100644
--- a/source3/torture/test_nttrans_create.c
+++ b/source3/torture/test_nttrans_create.c
@@ -78,7 +78,7 @@ bool run_nttrans_create(int dummy)
 		goto fail;
 	}
 
-	cli_query_secdesc(cli, fnum, talloc_tos());
+	cli_query_secdesc(cli, fnum, talloc_tos(), NULL);
 
 	status2 = cli_ntcreate(cli, fname, 0, WRITE_DAC_ACCESS,
 			       FILE_ATTRIBUTE_NORMAL,
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index c2bc6d2..36d263d 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -2301,6 +2301,7 @@ static bool run_locktest7(int dummy)
 	uint16_t fnum1;
 	char buf[200];
 	bool correct = False;
+	size_t nread;
 	NTSTATUS status;
 
 	if (!torture_open_connection(&cli1, 0)) {
@@ -2328,14 +2329,21 @@ static bool run_locktest7(int dummy)
 
 	status = cli_lock32(cli1, fnum1, 130, 4, 0, READ_LOCK);
 	if (!NT_STATUS_IS_OK(status)) {
-		printf("Unable to apply read lock on range 130:4, error was %s\n", nt_errstr(status));
+		printf("Unable to apply read lock on range 130:4, "
+		       "error was %s\n", nt_errstr(status));
 		goto fail;
 	} else {
 		printf("pid1 successfully locked range 130:4 for READ\n");
 	}
 
-	if (cli_read_old(cli1, fnum1, buf, 130, 4) != 4) {
-		printf("pid1 unable to read the range 130:4, error was %s\n", cli_errstr(cli1));
+	status = cli_read(cli1, fnum1, buf, 130, 4, &nread);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("pid1 unable to read the range 130:4, error was %s\n",
+		      nt_errstr(status));
+		goto fail;
+	} else if (nread != 4) {
+		printf("pid1 unable to read the range 130:4, "
+		       "recv %ld req %d\n", (unsigned long)nread, 4);
 		goto fail;
 	} else {
 		printf("pid1 successfully read the range 130:4\n");
@@ -2356,8 +2364,15 @@ static bool run_locktest7(int dummy)
 
 	cli_setpid(cli1, 2);
 
-	if (cli_read_old(cli1, fnum1, buf, 130, 4) != 4) {
-		printf("pid2 unable to read the range 130:4, error was %s\n", cli_errstr(cli1));
+	status = cli_read(cli1, fnum1, buf, 130, 4, &nread);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("pid2 unable to read the range 130:4, error was %s\n",
+		      nt_errstr(status));
+		goto fail;
+	} else if (nread != 4) {
+		printf("pid2 unable to read the range 130:4, "
+		       "recv %ld req %d\n", (unsigned long)nread, 4);
+		goto fail;
 	} else {
 		printf("pid2 successfully read the range 130:4\n");
 	}
@@ -2386,8 +2401,14 @@ static bool run_locktest7(int dummy)
 		printf("pid1 successfully locked range 130:4 for WRITE\n");
 	}
 
-	if (cli_read_old(cli1, fnum1, buf, 130, 4) != 4) {
-		printf("pid1 unable to read the range 130:4, error was %s\n", cli_errstr(cli1));
+	status = cli_read(cli1, fnum1, buf, 130, 4, &nread);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("pid1 unable to read the range 130:4, error was %s\n",
+		      nt_errstr(status));
+		goto fail;
+	} else if (nread != 4) {
+		printf("pid1 unable to read the range 130:4, "
+		       "recv %ld req %d\n", (unsigned long)nread, 4);
 		goto fail;
 	} else {
 		printf("pid1 successfully read the range 130:4\n");
@@ -2404,14 +2425,17 @@ static bool run_locktest7(int dummy)
 
 	cli_setpid(cli1, 2);
 
-	if (cli_read_old(cli1, fnum1, buf, 130, 4) != 4) {
-		printf("pid2 unable to read the range 130:4, error was %s\n", cli_errstr(cli1));
-		if (NT_STATUS_V(cli_nt_error(cli1)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
+	status = cli_read(cli1, fnum1, buf, 130, 4, &nread);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("pid2 unable to read the range 130:4, error was "
+		       "%s\n", nt_errstr(status));
+		if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_LOCK_CONFLICT)) {
 			printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n");
 			goto fail;
 		}
 	} else {
-		printf("pid2 successfully read the range 130:4 (should be denied)\n");
+		printf("pid2 successfully read the range 130:4 (should be denied) recv %ld\n",
+		       (unsigned long)nread);
 		goto fail;
 	}
 
@@ -2760,10 +2784,9 @@ static bool run_fdpasstest(int dummy)
 	cli_state_set_tid(cli2, cli_state_get_tid(cli1));


-- 
Samba Shared Repository


More information about the samba-cvs mailing list