summaryrefslogtreecommitdiffstats
path: root/source3/rpc_parse/parse_prs.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-02-20 23:22:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:10:16 -0500
commit4ea92f30985466489a3b3faf5a1c90667175aad6 (patch)
tree24e18123b87b06642767c05649989f37ff2628c6 /source3/rpc_parse/parse_prs.c
parentb7e7a5ef20d1da508afa6ad5a3bf852049951711 (diff)
downloadsamba-4ea92f30985466489a3b3faf5a1c90667175aad6.tar.gz
samba-4ea92f30985466489a3b3faf5a1c90667175aad6.tar.xz
samba-4ea92f30985466489a3b3faf5a1c90667175aad6.zip
r13581: Correctly parse a non-null terminated, little-endian UCS2 string in the
PAC_LOGON_NAME structure. This was broken on big-endian machines (Solaris SPARC and ppc). Fixes Bug #3330. Jerry, this should be in 3.0.21c. Guenther (This used to be commit 9732490811f8f02ee547ddc6e2694e1122a3a518)
Diffstat (limited to 'source3/rpc_parse/parse_prs.c')
-rw-r--r--source3/rpc_parse/parse_prs.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index c4f9f512ab7..857a24cf0e0 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -1333,6 +1333,49 @@ BOOL prs_string_alloc(const char *name, prs_struct *ps, int depth, const char **
}
/*******************************************************************
+ Stream a null-terminated string of fixed len.
+ ********************************************************************/
+
+BOOL prs_string_len(const char *name, prs_struct *ps, int depth, char *str, int len)
+{
+ char *q;
+ int i;
+ BOOL charmode = True;
+
+ q = prs_mem_get(ps, len+1);
+ if (q == NULL)
+ return False;
+
+ for(i = 0; i < len; i++) {
+ if (UNMARSHALLING(ps))
+ str[i] = q[i];
+ else
+ q[i] = str[i];
+ }
+
+ /* The terminating null. */
+ str[i] = '\0';
+
+ if (MARSHALLING(ps)) {
+ q[i] = '\0';
+ }
+
+ ps->data_offset += len+1;
+
+ DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
+ if (charmode) {
+ print_asc(5, (unsigned char*)str, len);
+ } else {
+ for (i = 0; i < len; i++)
+ DEBUG(5,("%04x ", str[i]));
+ }
+ DEBUG(5,("\n"));
+
+ return True;
+}
+
+
+/*******************************************************************
prs_uint16 wrapper. Call this and it sets up a pointer to where the
uint16 should be stored, or gets the size if reading.
********************************************************************/