mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
r8227: add STR_LARGE_SIZE flag, to support strings where the size is length+1,
metze
(This used to be commit cdd03fe87d
)
This commit is contained in:
parent
b7952f8058
commit
3d3a86f95d
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user