summaryrefslogtreecommitdiff
path: root/librpc/ndr
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-12-15 23:52:32 +1100
committerAndrew Tridgell <tridge@samba.org>2010-12-21 02:42:37 +0100
commitb9a2852fdd68a0691ff567557824be44bb08b27a (patch)
treef5cbeddab05757244ed4192c14b206e1fd562cd8 /librpc/ndr
parent8998f4b01310e4b45e75d8d5f3260b5ba5c1cdf9 (diff)
downloadsamba-b9a2852fdd68a0691ff567557824be44bb08b27a.tar.gz
samba-b9a2852fdd68a0691ff567557824be44bb08b27a.tar.bz2
samba-b9a2852fdd68a0691ff567557824be44bb08b27a.zip
dnsp: fixed parsing of dns_name structures
its not a pad byte, its a trailing zero
Diffstat (limited to 'librpc/ndr')
-rw-r--r--librpc/ndr/ndr_dnsp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/librpc/ndr/ndr_dnsp.c b/librpc/ndr/ndr_dnsp.c
index 256638aed3..77c2366d14 100644
--- a/librpc/ndr/ndr_dnsp.c
+++ b/librpc/ndr/ndr_dnsp.c
@@ -36,7 +36,7 @@ _PUBLIC_ void ndr_print_dnsp_name(struct ndr_print *ndr, const char *name,
*/
_PUBLIC_ enum ndr_err_code ndr_pull_dnsp_name(struct ndr_pull *ndr, int ndr_flags, const char **name)
{
- uint8_t len, count;
+ uint8_t len, count, final;
int i;
uint32_t total_len;
char *ret;
@@ -68,14 +68,15 @@ _PUBLIC_ enum ndr_err_code ndr_pull_dnsp_name(struct ndr_pull *ndr, int ndr_flag
ret[newlen-1] = 0;
total_len = newlen;
}
+ NDR_CHECK(ndr_pull_uint8(ndr, ndr_flags, &final));
(*name) = ret;
- NDR_PULL_ALIGN(ndr, 2);
return NDR_ERR_SUCCESS;
}
enum ndr_err_code ndr_push_dnsp_name(struct ndr_push *ndr, int ndr_flags, const char *name)
{
int count, total_len, i;
+
/* count the dots */
for (count=i=0; name[i]; i++) {
if (name[i] == '.') count++;
@@ -94,7 +95,7 @@ enum ndr_err_code ndr_push_dnsp_name(struct ndr_push *ndr, int ndr_flags, const
NDR_CHECK(ndr_push_bytes(ndr, (const uint8_t *)name, sublen));
name += sublen + 1;
}
- NDR_PUSH_ALIGN(ndr, 2);
+ NDR_CHECK(ndr_push_uint8(ndr, ndr_flags, 0));
return NDR_ERR_SUCCESS;
}