summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-02-08 23:40:49 +0000
committerLuke Leighton <lkcl@samba.org>1999-02-08 23:40:49 +0000
commit99a9b0f7c4f85f46102457cf4707e8948b77fb3f (patch)
tree3bb95603cd8656e486e62ce557d368e0766b1ace /source3
parent37c9693fc8055773812ed86d91f9dfcc554eea30 (diff)
downloadsamba-99a9b0f7c4f85f46102457cf4707e8948b77fb3f.tar.gz
samba-99a9b0f7c4f85f46102457cf4707e8948b77fb3f.tar.bz2
samba-99a9b0f7c4f85f46102457cf4707e8948b77fb3f.zip
UNICODE byte ordering issue: typecast to uint16* replaced with SSVAL()
(This used to be commit 9084b7e33dfe717bd8d5604ee71d137e3baef0f5)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/lib/util_unistr.c12
-rw-r--r--source3/libsmb/smbencrypt.c2
-rw-r--r--source3/rpc_parse/parse_misc.c6
-rw-r--r--source3/rpc_parse/parse_reg.c4
-rw-r--r--source3/rpc_parse/parse_rpc.c6
-rw-r--r--source3/rpc_server/srv_pipe.c6
-rw-r--r--source3/smbd/chgpasswd.c2
8 files changed, 21 insertions, 21 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 301fcbe755..8f2d73f95f 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -566,13 +566,13 @@ 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 *buf, int len);
+char *unistrn2(char *buf, int len);
char *unistr2(uint16 *buf);
char *unistr2_to_str(UNISTR2 *str);
uint32 buffer2_to_uint32(BUFFER2 *str);
char *buffer2_to_str(BUFFER2 *str);
char *buffer2_to_multistr(BUFFER2 *str);
-int struni2(uint16 *p, const char *buf);
+int struni2(char *p, const char *buf);
char *unistr(char *buf);
int unistrcpy(char *dst, char *src);
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index c58820cfec..50bb73f4fb 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -56,7 +56,7 @@ Return a ascii version of a unicode string
Hack alert: uses fixed buffer(s) and only handles ascii strings
********************************************************************/
#define MAXUNI 1024
-char *unistrn2(uint16 *buf, int len)
+char *unistrn2(char *buf, int len)
{
static char lbufs[8][MAXUNI];
static int nexti;
@@ -65,9 +65,9 @@ char *unistrn2(uint16 *buf, int len)
nexti = (nexti+1)%8;
- for (p = lbuf; *buf && p-lbuf < MAXUNI-2 && len > 0; len--, p++, buf++)
+ for (p = lbuf; *buf && p-lbuf < MAXUNI-2 && len > 0; len--, p++, buf+=2)
{
- *p = *buf;
+ SSVAL(p, 0, *buf);
}
*p = 0;
@@ -189,7 +189,7 @@ return number of unicode chars copied, excluding the null character.
only handles ascii strings
********************************************************************/
#define MAXUNI 1024
-int struni2(uint16 *p, const char *buf)
+int struni2(char *p, const char *buf)
{
int len = 0;
@@ -197,9 +197,9 @@ int struni2(uint16 *p, const char *buf)
if (buf != NULL)
{
- for (; *buf && len < MAXUNI-2; len++, p++, buf++)
+ for (; *buf && len < MAXUNI-2; len++, p += 2, buf++)
{
- *p = *buf;
+ SSVAL(p, 0, *buf);
}
}
diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c
index 9234088404..dd801e5982 100644
--- a/source3/libsmb/smbencrypt.c
+++ b/source3/libsmb/smbencrypt.c
@@ -209,7 +209,7 @@ BOOL make_oem_passwd_hash(char data[516], const char *passwd, uchar old_pw_hash[
generate_random_buffer((unsigned char *)data, 516, False);
if (unicode)
{
- struni2( (uint16*)(&data[512 - new_pw_len]), passwd);
+ struni2( &data[512 - new_pw_len], passwd);
}
else
{
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index 6b3fc9415e..e1a7d3c6a5 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -329,7 +329,7 @@ creates a UNISTR structure.
void make_unistr(UNISTR *str, char *buf)
{
/* store the string (null-terminated copy) */
- struni2(str->buffer, buf);
+ struni2((char *)(str->buffer), buf);
}
/*******************************************************************
@@ -372,7 +372,7 @@ void make_buffer3_str(BUFFER3 *str, char *buf, int len)
str->buf_len = len * 2;
/* store the string (null-terminated 8 bit chars into 16 bit chars) */
- struni2((uint16*)str->buffer, buf);
+ struni2(str->buffer, buf);
}
/*******************************************************************
@@ -573,7 +573,7 @@ void make_unistr2(UNISTR2 *str, char *buf, int len)
str->uni_str_len = len;
/* store the string (null-terminated 8 bit chars into 16 bit chars) */
- struni2(str->buffer, buf);
+ struni2((char *)(str->buffer), buf);
}
/*******************************************************************
diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c
index b0086f402a..a3d8ebb64a 100644
--- a/source3/rpc_parse/parse_reg.c
+++ b/source3/rpc_parse/parse_reg.c
@@ -768,8 +768,8 @@ void make_reg_r_info(REG_R_INFO *r_r,
uint32 level, char *os_type,
uint32 status)
{
- uint8 buf[512];
- int len = struni2((uint16*)buf, os_type);
+ char buf[512];
+ int len = struni2(buf, os_type);
r_r->ptr1 = 1;
r_r->level = level;
diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c
index 9ce83bea83..12e94ace77 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))
{
- struni2((uint16*)rsp->domain, domain);
- struni2((uint16*)rsp->user , user );
- struni2((uint16*)rsp->wks , wks );
+ struni2(rsp->domain, domain);
+ struni2(rsp->user , user );
+ struni2(rsp->wks , wks );
}
else
{
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