summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2000-08-16 03:44:04 +0000
committerGerald Carter <jerry@samba.org>2000-08-16 03:44:04 +0000
commita9b2a406826b857f41ea9da0984cb49addb30a2f (patch)
tree11eb1364ebb9037fe80bdaa0f88caf0bf567d7b7 /source3
parent4620c705492d1cdede5ab3b47b009273df87f123 (diff)
downloadsamba-a9b2a406826b857f41ea9da0984cb49addb30a2f.tar.gz
samba-a9b2a406826b857f41ea9da0984cb49addb30a2f.tar.bz2
samba-a9b2a406826b857f41ea9da0984cb49addb30a2f.zip
hack for unmarshalling unistr's on machines with BIG_ENDIAN arch
I think we have a lot more of these bugs lurking (i'm fairly confident of it). jerry (This used to be commit 3b14487c7e5218ff3e0ff3118ca1afd706e05247)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_parse/parse_prs.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 469de90434..f5a0bc642b 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -626,9 +626,17 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *
/* If we're using big-endian, reverse to get little-endian. */
if(ps->bigendian_data)
- DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, p, str->uni_str_len)
+ {
+ DBG_RW_PSVAL(charmode, name, depth, ps->data_offset,
+ ps->io, ps->bigendian_data, q, p,
+ str->uni_str_len)
+ }
else
- DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, p, str->uni_str_len * sizeof(uint16))
+ {
+ DBG_RW_PCVAL(charmode, name, depth, ps->data_offset,
+ ps->io, q, p, str->uni_str_len * sizeof(uint16))
+ }
+
ps->data_offset += (str->uni_str_len * sizeof(uint16));
return True;
@@ -762,12 +770,21 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str)
p += 2;
q += 2;
} else {
+#if WORDS_BIGENDIAN
+ RW_CVAL(ps->io, q+1, *p, 0);
+ p++;
+ RW_CVAL(ps->io, q, *p, 0);
+ p++;
+ q+=2;
+#else
RW_CVAL(ps->io, q, *p, 0);
p++;
q++;
RW_CVAL(ps->io, q, *p, 0);
p++;
q++;
+#endif /* WORDS_BIGENDIAN */
+
}
len++;