s3/rpc_client: change type of offset to uint64_t
authorNoel Power <noel.power@suse.com>
Mon, 8 Jan 2024 15:12:35 +0000 (15:12 +0000)
committerJule Anger <janger@samba.org>
Mon, 26 Feb 2024 09:34:15 +0000 (09:34 +0000)
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@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit a61eb7032896265eaef3ba225aafd6f293e7569d)

source3/rpc_client/wsp_cli.c

index b21f55c86f0924d3517e4f33eb52f1e10801e3aa..450bd2525e0ff9a89c2983bb9bb19ac4e01f4d20 100644 (file)
@@ -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;
@@ -902,7 +902,7 @@ 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 offset,
                               DATA_BLOB *rows_buf,
                               uint64_t *pcount,
                               uint64_t **pvec_address/*,
@@ -1010,7 +1010,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 offset,
        DATA_BLOB *rows_buf,
        uint32_t len,
        struct wsp_cbasestoragevariant *val)
@@ -1116,7 +1116,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 offset,
                               DATA_BLOB *rows_buf, uint32_t len,
                               struct wsp_cbasestoragevariant *val)
 {