[SCM] Samba Shared Repository - branch master updated

Noel Power npower at samba.org
Tue Jan 30 17:23:01 UTC 2024


The branch, master has been updated
       via  9b2f2302ee4 s3/rpc_client: cleanup unmarshalling of variant types from row columns
       via  6ecb614b8ec s3/utils: use full 64 bit address for getrows (with 64bit offsets)
       via  efa60ff3105 s3/rpc_client: Remove stray unnecessary comment
       via  a61eb703289 s3/rpc_client: change type of offset to uint64_t
       via  718c411201b librpc/idl: remove duplicate definitition
       via  3d063f212f6 librpc/idl: fix typo in wsp_csort member
       via  d097c38992e librpc/wsp: Unknown property used in 'current directory' searches
      from  a48f8ae3077 docs-xml: Build and install man page for wspsearch

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


- Log -----------------------------------------------------------------
commit 9b2f2302ee4828ae54f5903a3bf649ffd255fb4a
Author: Noel Power <noel.power at suse.com>
Date:   Wed Jan 10 14:43:58 2024 +0000

    s3/rpc_client: cleanup unmarshalling of variant types from row columns
    
    Prior to this change fn 'extract_variant_addresses' actually returns offsets
    to the variant stored not the addresses, additionally the param in the
    signature of the method is named offset where the param in reality is a
    base address.
    This change makes fn 'extract_variant_addresses' actually return addresses
    instead of offsets and also changes the name of the incoming param. The
    resulting changes are propaged to callers which hopefully makes what the
    code is actually doing a little clearer
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Noel Power <npower at samba.org>
    Autobuild-Date(master): Tue Jan 30 17:22:37 UTC 2024 on atb-devel-224

commit 6ecb614b8ec6953ba15e8061fce9b395615b035a
Author: Noel Power <noel.power at suse.com>
Date:   Mon Jan 8 15:56:38 2024 +0000

    s3/utils: use full 64 bit address for getrows (with 64bit offsets)
    
    if 64bit offsets are used the hi 32-bits of address are stored in
    the ulreserved2 member of the message header field and the low 32-bits
    are stored in the ulclientbase member of the cpmgetrows message
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit efa60ff3105ac80ffff6d2a5d82dd0615ddb7578
Author: Noel Power <noel.power at suse.com>
Date:   Wed Jan 10 10:59:23 2024 +0000

    s3/rpc_client: Remove stray unnecessary comment
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a61eb7032896265eaef3ba225aafd6f293e7569d
Author: Noel Power <noel.power at suse.com>
Date:   Mon Jan 8 15:12:35 2024 +0000

    s3/rpc_client: change type of offset to uint64_t
    
    Offset can be a 32 or 64 bit address depending on the indexing addressing
    mode negotiated by the client
    With a 32 bit param we can only specify a 32 bit base address. This change
    alone doesn't affect anything as it is the client itself that choses and
    passes the base address offset and wspsearch is the only current user of
    this code.
    In this case even with 64bit addressing negotiated the address passed
    represents only the lower 32-bits part of the address.
    However, for coverage purposes it would be better for the client to use an
    address that covers the full 64bit range of the address (when 64 bit
    addressing is negotiated).
    This change will alow the wspsearch client in a future commit to pass a
    base address value with both the hi and low 32 bits values set to make up
    the full 64 bit address.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 718c411201bfddc16497472c1b245bfcc29366f2
Author: Noel Power <noel.power at suse.com>
Date:   Tue Dec 19 11:35:58 2023 +0000

    librpc/idl: remove duplicate definitition
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3d063f212f6c3dd2a5450884c06794c23dc98d09
Author: Noel Power <noel.power at suse.com>
Date:   Thu Nov 16 09:22:56 2023 +0000

    librpc/idl: fix typo in wsp_csort member
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d097c38992ea1bed038cc918727842c679126bb7
Author: Noel Power <noel.power at suse.com>
Date:   Mon Dec 18 11:37:38 2023 +0000

    librpc/wsp: Unknown property used in 'current directory' searches
    
    This property seems to be used instead of 'Scope' when the windows
    search UI has selected current dir
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 librpc/idl/wsp.idl           |  9 ++----
 librpc/wsp/extra-props.csv   |  4 +++
 source3/rpc_client/wsp_cli.c | 71 ++++++++++++++++++++++++--------------------
 source3/utils/wspsearch.c    | 22 ++++++++++++--
 4 files changed, 65 insertions(+), 41 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/idl/wsp.idl b/librpc/idl/wsp.idl
index 4ae81d7247d..fceaf0a85f2 100644
--- a/librpc/idl/wsp.idl
+++ b/librpc/idl/wsp.idl
@@ -379,7 +379,7 @@ interface msftewds
 
 	/* MS-WSP 2.2.1.10 CSort */
 	typedef [public] struct {
-		uint32 pidcolimn;
+		uint32 pidcolumn;
 		uint32 dworder;
 		uint32 dwindividual;
 		uint32 locale;
@@ -1284,18 +1284,13 @@ interface msftewds
 		uint32 prgirownext[cdepthnext];
 	} wsp_findindicesout;
 
-	typedef [public] struct {
-		uint32 hcursor;
-		uint32 chapt;
-	} wsp_cpmsresetstartpos;
-
 	typedef [public, nodiscriminant, switch_type(uint32)] union {
 		[case(CPMCONNECT)] wsp_cpmconnectin cpmconnect;
 		[case(CPMCREATEQUERY)] wsp_cpmcreatequeryin cpmcreatequery;
 		[case(CPMFREECURSOR)] wsp_cpmfreecursorin cpmfreecursor;
 		[case(CPMGETROWS)] wsp_cpmgetrowsin cpmgetrows;
 		[case(CPMSETBINDINGSIN)] wsp_cpmsetbindingsin cpmsetbindings;
-		[case(CPMRESTARTPOSITIONIN)] wsp_cpmsresetstartpos cpmresetstartpos;
+		[case(CPMRESTARTPOSITIONIN)] wsp_cpmrestartpositionin cpmrrestartpos;
 		[case(CPMGETQUERYSTATUS)] wsp_cpmgetquerystatusin cpmgetquerystatus;
 		[case(CPMGETQUERYSTATUSEX)] wsp_cpmgetquerystatusexin cpmgetquerystatusex;
 		[case(CPMSETSCOPEPRIORITIZATION)]  wsp_cpmsetscopeprioritizationin cpmsetscopeprioritizationin;
diff --git a/librpc/wsp/extra-props.csv b/librpc/wsp/extra-props.csv
index d26238beb71..a81cc61242e 100644
--- a/librpc/wsp/extra-props.csv
+++ b/librpc/wsp/extra-props.csv
@@ -55,6 +55,10 @@ DocThumbnail,{f29f85e0-4ff9-1068-ab91-08002b27b3d9},17,FALSE,FALSE,,Buffer,,,
 RankVector,{49691c90-7e17-101a-a91c-08002b2ecda9},2,FALSE,FALSE,,UInt32,,TRUE,
 All,{49691c90-7e17-101a-a91c-08002b2ecda9},6,FALSE,FALSE,,String,,,
 System.Search.RowID,{49691c90-7e17-101a-a91c-08002b2ecda9},15,FALSE,FALSE,,Int32,,,
+#ParentDir isn't the real name of this prop (but we need a name), this prop
+#seems like Scope except it should only match the directory specified by
+#the property but not any subfolders (e.g. doesn't match subdirs)
+ParentDir,{49691c90-7e17-101a-a91c-08002b2ecda9},19,FALSE,FALSE,,String,,,
 #PercivedType, FileCount &  TotalFileSize are defined by gregors wireshark wip
 PercivedType,{28636aa6-953d-11d2-b5d6-00c04fd918d0},9,FALSE,FALSE,,Int32,,,
 FileCount,{28636aa6-953d-11d2-b5d6-00c04fd918d0},12,FALSE,FALSE,,UInt64,,,
diff --git a/source3/rpc_client/wsp_cli.c b/source3/rpc_client/wsp_cli.c
index b21f55c86f0..d8a9aca46ff 100644
--- a/source3/rpc_client/wsp_cli.c
+++ b/source3/rpc_client/wsp_cli.c
@@ -761,7 +761,7 @@ void create_seekat_getrows_request(TALLOC_CTX * ctx,
 
 static bool extract_rowbuf_variable_type(TALLOC_CTX *ctx,
 		uint16_t type,
-		uint32_t offset,
+		uint64_t offset,
 		DATA_BLOB *rows_buf, uint32_t len,
 		struct wsp_cbasestoragevariant  *val)
 {
@@ -770,7 +770,7 @@ static bool extract_rowbuf_variable_type(TALLOC_CTX *ctx,
 	ndr_flags_type ndr_flags = NDR_SCALARS | NDR_BUFFERS;
 	DATA_BLOB variant_blob = data_blob_null;
 	if (offset >= rows_buf->length) {
-		DBG_ERR("offset %d outside buffer range (buf len - %zu)",
+		DBG_ERR("offset %"PRIu64" outside buffer range (buf len - %zu)",
 			offset,
 			rows_buf->length);
 		return false;
@@ -894,7 +894,7 @@ static bool convert_variant_array_to_vector(TALLOC_CTX *ctx,
  * an array of n elements for a vector or array of 1 element
  * if non-vector item.
  *
- * addresses stored in pvec_address are adjusted by offset
+ * addresses stored in pvec_address
  *
  */
 static enum ndr_err_code extract_variant_addresses(TALLOC_CTX *ctx,
@@ -902,11 +902,10 @@ static enum ndr_err_code extract_variant_addresses(TALLOC_CTX *ctx,
 			       bool is_64bit,
 			       struct ndr_pull *ndr_pull,
 			       ndr_flags_type flags,
-			       uint32_t offset,
+			       uint64_t baseaddress,
 			       DATA_BLOB *rows_buf,
 			       uint64_t *pcount,
-			       uint64_t **pvec_address/*,
-			       struct wsp_cbasestoragevariant ***variant_array*/)
+			       uint64_t **pvec_address)
 {
 	bool is_vector = tablevar->vtype & VT_VECTOR;
 	uint64_t count;
@@ -958,12 +957,10 @@ static enum ndr_err_code extract_variant_addresses(TALLOC_CTX *ctx,
 		addr = addr_32;
 	}
 
-	addr = addr - offset;
-
-	if (addr >= rows_buf->length) {
+	if ((addr - baseaddress) >= rows_buf->length) {
 		DBG_ERR("offset %"PRIu64" outside buffer range "
 			"(buf len - %zu)\n",
-			addr,
+			addr - baseaddress,
 			rows_buf->length);
 		err = NDR_ERR_VALIDATE;
 		goto out;
@@ -980,22 +977,27 @@ static enum ndr_err_code extract_variant_addresses(TALLOC_CTX *ctx,
 	if (is_vector == false) {
 		vec_address[0] = addr;
 	} else {
-		uint64_t array_addr = addr;
+		uint64_t array_offset = addr - baseaddress;
 		uint64_t i;
 		for (i = 0; i < count; i++) {
 			if (is_64bit) {
 				vec_address[i] =
 					PULL_LE_I64(rows_buf->data,
-						array_addr);
-				array_addr = array_addr + 8;
+						array_offset);
+				array_offset = array_offset + 8;
 			} else {
 				vec_address[i] =
 					(uint32_t)PULL_LE_I32(rows_buf->data,
-							array_addr);
-				array_addr = array_addr + 4;
+							array_offset);
+				array_offset = array_offset + 4;
+			}
+			if (array_offset >= rows_buf->length) {
+				DBG_ERR("offset %"PRIu64" outside buffer range "
+					"(buf len - %zu)\n",
+					array_offset,
+					rows_buf->length);
+				err = NDR_ERR_VALIDATE;
 			}
-			/* adjust address */
-			vec_address[i] -= offset;
 		}
 	}
 	err  = NDR_ERR_SUCCESS;
@@ -1010,7 +1012,7 @@ static enum ndr_err_code extract_crowvariant_variable(TALLOC_CTX *ctx,
 	bool is_64bit,
 	struct ndr_pull *ndr_pull,
 	ndr_flags_type flags,
-	uint32_t offset,
+	uint64_t baseaddress,
 	DATA_BLOB *rows_buf,
 	uint32_t len,
 	struct wsp_cbasestoragevariant *val)
@@ -1029,7 +1031,7 @@ static enum ndr_err_code extract_crowvariant_variable(TALLOC_CTX *ctx,
 			is_64bit,
 			ndr_pull,
 			flags,
-			offset,
+			baseaddress,
 			rows_buf,
 			&count,
 			&vec_address);
@@ -1063,12 +1065,12 @@ static enum ndr_err_code extract_crowvariant_variable(TALLOC_CTX *ctx,
 
 	for (i = 0; i < count; i++) {
 		uint32_t tmplen = len;
-		uint64_t addr;
-		addr = vec_address[i];
-		if (addr >= rows_buf->length) {
+		uint64_t buf_offset;
+		buf_offset = vec_address[i] - baseaddress;
+		if (buf_offset >= rows_buf->length) {
 			DBG_ERR("offset %"PRIu64" outside buffer range "
 				"(buf len - %zu)\n",
-				addr,
+				buf_offset,
 				rows_buf->length);
 			err = NDR_ERR_VALIDATE;
 			goto out;
@@ -1084,11 +1086,11 @@ static enum ndr_err_code extract_crowvariant_variable(TALLOC_CTX *ctx,
 			 * from the point the value is stored at
 			 * till the end of the buffer
 			 */
-			tmplen = rows_buf->length - addr;
+			tmplen = rows_buf->length - buf_offset;
 		}
 		if (!extract_rowbuf_variable_type(ctx,
 					tablevar->vtype & ~VT_VECTOR,
-					addr,
+					buf_offset,
 					rows_buf,
 					tmplen,
 					variant_array[i])) {
@@ -1116,7 +1118,7 @@ static enum ndr_err_code extract_crowvariant(TALLOC_CTX *ctx,
 			       bool is_64bit,
 			       struct ndr_pull *ndr_pull,
 			       ndr_flags_type flags,
-			       uint32_t offset,
+			       uint64_t baseaddress,
 			       DATA_BLOB *rows_buf, uint32_t len,
 			       struct wsp_cbasestoragevariant *val)
 {
@@ -1136,7 +1138,7 @@ static enum ndr_err_code extract_crowvariant(TALLOC_CTX *ctx,
 				is_64bit,
 				ndr_pull,
 				flags,
-				offset,
+				baseaddress,
 				rows_buf,
 				len,
 				val);
@@ -1159,7 +1161,6 @@ out:
 
 static enum ndr_err_code process_columns(TALLOC_CTX *ctx,
 					 bool is_64bit,
-					 uint32_t cbreserved,
 					 uint64_t baseaddress,
 					 struct wsp_cpmsetbindingsin *bindingin,
 					 DATA_BLOB *rows_buf,
@@ -1225,7 +1226,6 @@ static enum ndr_err_code process_columns(TALLOC_CTX *ctx,
 					val_offset));
 		}
 		if (tab_col->valueused) {
-			uint64_t offset = baseaddress + cbreserved;
 			uint32_t len = 0;
 			val_offset = nrow_offset + tab_col->valueoffset.value;
 			if (val_offset >=  rows_buf->length) {
@@ -1285,7 +1285,7 @@ static enum ndr_err_code process_columns(TALLOC_CTX *ctx,
 					is_64bit,
 					ndr_pull,
 					ndr_flags,
-					offset,
+					baseaddress,
 					rows_buf,
 					len,
 					&cols[i]);
@@ -1317,13 +1317,20 @@ enum ndr_err_code extract_rowsarray(
 				talloc_zero_array(ctx,
 					  struct wsp_cbasestoragevariant,
 					  bindingsin->ccolumns);
+		uint64_t adjusted_address;
 		if (cols == NULL) {
 			return NDR_ERR_ALLOC;
 		}
+
+		/*
+		 * cater for paddingrows (see MS-WSP 2.2.3.12)
+		 * Rows buffer starts cbreserved bytes into messages
+		 */
+		adjusted_address = baseaddress + cbreserved;
+
 		err = process_columns(ctx,
 				      is_64bit,
-				      cbreserved,
-				      baseaddress,
+				      adjusted_address,
 				      bindingsin,
 				      rows_buf,
 				      i,
diff --git a/source3/utils/wspsearch.c b/source3/utils/wspsearch.c
index 2c56c97736b..063b952d468 100644
--- a/source3/utils/wspsearch.c
+++ b/source3/utils/wspsearch.c
@@ -350,6 +350,10 @@ static NTSTATUS create_getrows(TALLOC_CTX *ctx,
 	uint32_t INITIAL_ROWS = 32;
 	uint32_t requested_rows = INITIAL_ROWS;
 	uint32_t rows_printed;
+	uint64_t baseaddress;
+	uint32_t offset_lowbits = 0xdeabd860;
+	uint32_t offset_hibits  = 0xfeeddeaf;
+
 	TALLOC_CTX *row_ctx;
 	bool loop_again;
 
@@ -377,10 +381,24 @@ static NTSTATUS create_getrows(TALLOC_CTX *ctx,
 					skip,
 					requested_rows,
 					40,
-					0xDEAbd860,
+					offset_lowbits,
 					bindings->brow,
 					0);
 
+		if (is_64bit) {
+			/*
+			 * MS-WSP 2.2.2
+			 * ulreservered holds the high 32-bits part of
+			 * a 64-bit offset if 64-bit offsets are being used.
+			 */
+			request->header.ulreserved2 = offset_hibits;
+			baseaddress = request->header.ulreserved2;
+			baseaddress <<= 32;
+			baseaddress += offset_lowbits;
+		} else {
+			baseaddress = offset_lowbits;
+		}
+
 		status = wsp_request_response(request,
 				wsp_ctx,
 				request,
@@ -419,7 +437,7 @@ static NTSTATUS create_getrows(TALLOC_CTX *ctx,
 				is_64bit,
 				disp_all_cols,
 				bindings, 40,
-				0xDEAbd860,
+				baseaddress,
 				response->message.cpmgetrows.rowsreturned,
 				&rows_printed);
 			if (!NT_STATUS_IS_OK(status)) {


-- 
Samba Shared Repository



More information about the samba-cvs mailing list