diff options
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/idl/idl_types.h | 1 | ||||
-rw-r--r-- | source4/librpc/ndr/libndr.h | 3 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_string.c | 17 |
3 files changed, 19 insertions, 2 deletions
diff --git a/source4/librpc/idl/idl_types.h b/source4/librpc/idl/idl_types.h index 21f4beb8e7..1a6371d8f9 100644 --- a/source4/librpc/idl/idl_types.h +++ b/source4/librpc/idl/idl_types.h @@ -10,6 +10,7 @@ #define STR_CONFORMANT LIBNDR_FLAG_STR_CONFORMANT #define STR_CHARLEN LIBNDR_FLAG_STR_CHARLEN #define STR_UTF8 LIBNDR_FLAG_STR_UTF8 +#define STR_LARGE_SIZE LIBNDR_FLAG_STR_LARGE_SIZE /* a UCS2 string prefixed with [size] [offset] [length], all 32 bits diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h index 24cb80c994..2f99c75ce7 100644 --- a/source4/librpc/ndr/libndr.h +++ b/source4/librpc/ndr/libndr.h @@ -113,7 +113,8 @@ struct ndr_print { #define LIBNDR_FLAG_STR_CHARLEN (1<<11) #define LIBNDR_FLAG_STR_UTF8 (1<<12) #define LIBNDR_FLAG_STR_FIXLEN15 (1<<13) -#define LIBNDR_STRING_FLAGS (0x3FFC) +#define LIBNDR_FLAG_STR_LARGE_SIZE (1<<14) +#define LIBNDR_STRING_FLAGS (0x7FFC) #define LIBNDR_FLAG_REF_ALLOC (1<<20) diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c index 008b58dab9..42316a8003 100644 --- a/source4/librpc/ndr/ndr_string.c +++ b/source4/librpc/ndr/ndr_string.c @@ -66,6 +66,7 @@ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s) switch (flags & LIBNDR_STRING_FLAGS) { case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4: case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM: + case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_STR_LARGE_SIZE: NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &len1)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &ofs)); if (ofs != 0) { @@ -93,6 +94,18 @@ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s) } NDR_CHECK(ndr_pull_advance(ndr, (len2 + c_len_term)*byte_mul)); + if (ndr->flags & LIBNDR_FLAG_STR_LARGE_SIZE) { + if (len1 != 0 && len2 == 0) { + DEBUG(6,("len1[%u] != (len2[%u]) '%s'\n", len1, len2, as)); + } else if (len1 != (len2 + 1)) { + DEBUG(6,("len1[%u] != (len2[%u]+1) '%s'\n", len1, len2, as)); + } + } else { + if (len1 != len2) { + DEBUG(6,("len1[%u] != len2[%u] '%s'\n", len1, len2, as)); + } + } + /* this is a way of detecting if a string is sent with the wrong termination */ if (ndr->flags & LIBNDR_FLAG_STR_NOTERM) { @@ -331,7 +344,9 @@ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s) break; case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM: - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len)); + c_len_term = 0; + case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_STR_LARGE_SIZE: + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len+c_len_term)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len)); NDR_PUSH_NEED_BYTES(ndr, c_len*byte_mul); |