summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorMatthew Chapman <matty@samba.org>1999-02-12 00:16:09 +0000
committerMatthew Chapman <matty@samba.org>1999-02-12 00:16:09 +0000
commitfd96929ec1fa27e0affd4c4e9ba307c4ee30b978 (patch)
tree6bfb5226bc58be39aaf7cfb954dcb472ea256a11 /source3/rpc_parse
parentf38bfc7d9aa07c4e21448aa846956bd89a259a65 (diff)
downloadsamba-fd96929ec1fa27e0affd4c4e9ba307c4ee30b978.tar.gz
samba-fd96929ec1fa27e0affd4c4e9ba307c4ee30b978.tar.bz2
samba-fd96929ec1fa27e0affd4c4e9ba307c4ee30b978.zip
UNICODE cleanup (see lib/util_unistr.c).
No more ugly static library buffers and all functions take a destination string length (especially unistrcpy was rather dangerous; we were only saved by the fact that datagrams are limited in size). (This used to be commit a1d39af1ce1d451b811dbd7c2ba391214851b87e)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_misc.c11
-rw-r--r--source3/rpc_parse/parse_reg.c10
-rw-r--r--source3/rpc_parse/parse_rpc.c6
3 files changed, 14 insertions, 13 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index 7c3f446908..04a9ba4544 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -328,8 +328,7 @@ creates a UNISTR structure.
********************************************************************/
void make_unistr(UNISTR *str, char *buf)
{
- /* store the string (null-terminated copy) */
- str_to_unistr16(str->buffer, buf);
+ ascii_to_unistr(str->buffer, buf, sizeof(str->buffer));
}
/*******************************************************************
@@ -371,8 +370,8 @@ void make_buffer3_str(BUFFER3 *str, char *buf, int len)
str->buf_max_len = len * 2;
str->buf_len = len * 2;
- /* store the string (null-terminated 8 bit chars into 16 bit chars) */
- str_to_unistr8(str->buffer, buf);
+ /* store the string (little endian buffer) */
+ ascii_to_unibuf(str->buffer, buf, str->buf_len);
}
/*******************************************************************
@@ -572,8 +571,8 @@ void make_unistr2(UNISTR2 *str, const char *buf, int len)
str->undoc = 0;
str->uni_str_len = len;
- /* store the string (null-terminated 8 bit chars into 16 bit chars) */
- str_to_unistr16((str->buffer), buf);
+ /* store the string (wide chars) */
+ ascii_to_unistr(str->buffer, buf, len);
}
/*******************************************************************
diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c
index 84d9650105..3aa9bbbc2a 100644
--- a/source3/rpc_parse/parse_reg.c
+++ b/source3/rpc_parse/parse_reg.c
@@ -769,19 +769,21 @@ void make_reg_r_info(REG_R_INFO *r_r,
uint32 status)
{
char buf[512];
- int len = str_to_unistr8(buf, os_type);
+ int len;
+
+ len = ascii_to_unibuf(buf, os_type, sizeof(buf)) - buf;
r_r->ptr1 = 1;
r_r->level = level;
r_r->ptr_type = 1;
- make_buffer2(&(r_r->uni_type), buf, len*2);
+ make_buffer2(&(r_r->uni_type), buf, len);
r_r->ptr2 = 1;
- r_r->unknown_0 = len*2;
+ r_r->unknown_0 = len;
r_r->ptr3 = 1;
- r_r->unknown_1 = len*2;
+ r_r->unknown_1 = len;
r_r->status = status;
}
diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c
index 63f738466b..c4a7e35895 100644
--- a/source3/rpc_parse/parse_rpc.c
+++ b/source3/rpc_parse/parse_rpc.c
@@ -707,9 +707,9 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp,
if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE))
{
- str_to_unistr8(rsp->domain, domain);
- str_to_unistr8(rsp->user , user );
- str_to_unistr8(rsp->wks , wks );
+ ascii_to_unibuf(rsp->domain, domain, sizeof(rsp->domain));
+ ascii_to_unibuf(rsp->user , user , sizeof(rsp->user ));
+ ascii_to_unibuf(rsp->wks , wks , sizeof(rsp->wks ));
}
else
{