From 89af6fd745a6f49668bae5b5c2d239d3671fb299 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Fri, 15 Dec 2000 09:31:56 +0000 Subject: lib/util_unistr.c: rewrote unistr2_to_ascii() to correct a bug seen on SGI boxes. rpc_parse/parse_misc.c: rpc_parse/parse_prs.c: rewrote of BUFFER5 handling to NOT byteswap when it was already in network byte order. rpc_parse/parse_samr.c: cleanup of samr_io_q_lookup_domain(), remove the over-parsing by 2 bytes. rpc_server/srv_lsa.c: UNISTR2 strings need to be NULL terminated to pleased W2K. rpc_server/srv_spoolss_nt.c: use snprintf instead of safe_strcpy as we want the string truncated at 32 chars. That should fix SUN and SGI box not able to act as printserver and the problem with joining from a W2K wks. J.F. (This used to be commit 69fe739303b105f2c488f266f13977da1b6b201d) --- source3/rpc_parse/parse_prs.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'source3/rpc_parse/parse_prs.c') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index e800c20290..5621a2c210 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -562,6 +562,47 @@ BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *d return True; } +/****************************************************************** + Stream an array of unicode string, length/buffer specified separately, + in uint16 chars. We use DBG_RW_PCVAL, not DBG_RW_PSVAL here + as the unicode string is already in little-endian format. + ********************************************************************/ + +BOOL prs_buffer5(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER5 *str) +{ + char *p; + char *q = prs_mem_get(ps, str->buf_len * sizeof(uint16)); + if (q == NULL) + return False; + + if (UNMARSHALLING(ps)) { + str->buffer = (uint16 *)prs_alloc_mem(ps,str->buf_len * sizeof(uint16)); + if (str->buffer == NULL) + return False; + memset(str->buffer, '\0', str->buf_len * sizeof(uint16)); + } + + /* If the string is empty, we don't have anything to stream */ + if (str->buf_len==0) + return True; + + p = (char *)str->buffer; + + /* 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->buf_len) + } else { + DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, + ps->io, q, p, str->buf_len * sizeof(uint16)) + } + + ps->data_offset += (str->buf_len * sizeof(uint16)); + + return True; +} + /****************************************************************** Stream a "not" unicode string, length/buffer specified separately, in byte chars. String is in little-endian format. -- cgit