summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr/ndr_basic.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-30 23:19:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:05 -0500
commit74dd7d90622a518e54bbbdc4e37fa44cd4181e1e (patch)
tree5d697a9cf92ed6a5d13ca87e2ca4bd566ffc7f6f /source4/librpc/ndr/ndr_basic.c
parentcf97155ab40ce39e913056f4ff1d74c65831d7d2 (diff)
downloadsamba-74dd7d90622a518e54bbbdc4e37fa44cd4181e1e.tar.gz
samba-74dd7d90622a518e54bbbdc4e37fa44cd4181e1e.tar.bz2
samba-74dd7d90622a518e54bbbdc4e37fa44cd4181e1e.zip
r3395: added support for "string32" type, to fix the fixed width string
problem that tim found. (This used to be commit 2cf35cb4d2513a7be46065e12c6fd1e2b90f4b8a)
Diffstat (limited to 'source4/librpc/ndr/ndr_basic.c')
-rw-r--r--source4/librpc/ndr/ndr_basic.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index 239b28e3e7..19db8c99a3 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -673,6 +673,22 @@ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s)
*s = as;
break;
+ case LIBNDR_FLAG_STR_FIXLEN32:
+ len1 = 32;
+ NDR_PULL_NEED_BYTES(ndr, len1*byte_mul);
+ ret = convert_string_talloc(ndr, chset, CH_UNIX,
+ ndr->data+ndr->offset,
+ len1*byte_mul,
+ (void **)&as);
+ if (ret == -1) {
+ return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
+ "Bad character conversion");
+ }
+ NDR_CHECK(ndr_pull_advance(ndr, len1*byte_mul));
+ *s = as;
+ break;
+
+
default:
return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
ndr->flags & LIBNDR_STRING_FLAGS);
@@ -807,6 +823,18 @@ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s)
ndr->offset += c_len*byte_mul;
break;
+ case LIBNDR_FLAG_STR_FIXLEN32:
+ NDR_PUSH_NEED_BYTES(ndr, byte_mul*32);
+ ret = convert_string(CH_UNIX, chset,
+ s, s_len + 1,
+ ndr->data+ndr->offset, byte_mul*32);
+ if (ret == -1) {
+ return ndr_push_error(ndr, NDR_ERR_CHARCNV,
+ "Bad character conversion");
+ }
+ ndr->offset += byte_mul*32;
+ break;
+
default:
return ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
ndr->flags & LIBNDR_STRING_FLAGS);