summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/lib/util_unistr.c14
-rw-r--r--source3/rpc_server/srv_pipe.c6
-rw-r--r--source3/smbd/chgpasswd.c2
4 files changed, 13 insertions, 13 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index e564163421..c408545907 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -566,8 +566,8 @@ void split_at_last_component(char *path, char *front, char sep, char *back);
int PutUniCode(char *dst,char *src);
char *skip_unicode_string(char *buf,int n);
-char *unistrn2(uint16 *src, int len);
-char *unistr2(uint16 *src);
+char *unistrn2(char *src, int len);
+char *unistr2(char *src);
char *unistr2_to_str(UNISTR2 *str);
uint32 buffer2_to_uint32(BUFFER2 *str);
char *buffer2_to_str(BUFFER2 *str);
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index 641f891f83..2e908cbd7a 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -62,7 +62,7 @@ Return a ascii version of a little-endian unicode string.
Hack alert: uses fixed buffer(s) and only handles ascii strings
********************************************************************/
-char *unistrn2(uint16 *src, int len)
+char *unistrn2(char *src, int len)
{
static char lbufs[8][MAXUNI];
static int nexti;
@@ -71,9 +71,9 @@ char *unistrn2(uint16 *src, int len)
nexti = (nexti+1)%8;
- for (p = lbuf; *src && p-lbuf < MAXUNI-2 && len > 0; len--, src++)
+ for (p = lbuf; *src && p-lbuf < MAXUNI-2 && len > 0; len--, src += 2)
{
- *p++ = (*src & 0xff);
+ *p++ = SVAL(src, 0) & 0xFF;
}
*p = 0;
@@ -88,16 +88,16 @@ Return a ascii version of a little-endian unicode string.
Hack alert: uses fixed buffer(s) and only handles ascii strings
********************************************************************/
-char *unistr2(uint16 *src)
+char *unistr2(char *src)
{
char *lbuf = lbufs[nexti];
char *p;
nexti = (nexti+1)%8;
- for (p = lbuf; *src && p-lbuf < MAXUNI-2; p++, src++)
+ for (p = lbuf; *src && p-lbuf < MAXUNI-2; p++, src += 2)
{
- *p = (*src & 0xff);
+ *p = SVAL(src, 0) & 0xFF;
}
*p = 0;
@@ -260,7 +260,7 @@ char *unistr(char *buf)
for (p = lbuf; *buf && p-lbuf < MAXUNI-2; p++, buf += 2)
{
- *p = *buf;
+ *p = SVAL(buf, 0) & 0xFF;
}
*p = 0;
return lbuf;
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index f8d882cd0c..5908fe06b5 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -225,9 +225,9 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p)
if (IS_BITS_SET_ALL(p->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_UNICODE))
{
- fstrcpy(p->user_name, unistrn2((uint16*)p->ntlmssp_resp.user , p->ntlmssp_resp.hdr_usr .str_str_len/2));
- fstrcpy(p->domain , unistrn2((uint16*)p->ntlmssp_resp.domain, p->ntlmssp_resp.hdr_domain.str_str_len/2));
- fstrcpy(p->wks , unistrn2((uint16*)p->ntlmssp_resp.wks , p->ntlmssp_resp.hdr_wks .str_str_len/2));
+ fstrcpy(p->user_name, unistrn2(p->ntlmssp_resp.user , p->ntlmssp_resp.hdr_usr .str_str_len/2));
+ fstrcpy(p->domain , unistrn2(p->ntlmssp_resp.domain, p->ntlmssp_resp.hdr_domain.str_str_len/2));
+ fstrcpy(p->wks , unistrn2(p->ntlmssp_resp.wks , p->ntlmssp_resp.hdr_wks .str_str_len/2));
}
else
{
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index 9791d3a38e..a2e75ecc43 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -693,7 +693,7 @@ BOOL check_oem_password(char *user,
int uni_pw_len = new_pw_len;
char *pw;
new_pw_len /= 2;
- pw = unistrn2((uint16*)(&lmdata[512-uni_pw_len]), new_pw_len);
+ pw = unistrn2(&lmdata[512-uni_pw_len], new_pw_len);
memcpy(new_passwd, pw, new_pw_len+1);
}
else