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);
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;
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;
only handles ascii strings
********************************************************************/
#define MAXUNI 1024
-int struni2(uint16 *p, const char *buf)
+int struni2(char *p, const char *buf)
{
int len = 0;
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);
}
}
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
{
void make_unistr(UNISTR *str, char *buf)
{
/* store the string (null-terminated copy) */
- struni2(str->buffer, buf);
+ struni2((char *)(str->buffer), buf);
}
/*******************************************************************
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);
}
/*******************************************************************
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);
}
/*******************************************************************
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;
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
{
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
{
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