From 3365a2fd234966ecfcd06d2295cbd085c7bbd8c6 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 19 Nov 1999 01:37:16 +0000 Subject: The First Necessary UNICODE String Support. the random workstation trust account password is TOTAL garbage. i mean, complete garbage. it's nowhere CLOSE to being a UNICODE string. therefore we can't just take every second character. created nt_owf_genW() which creates NT#(password) instead of NT#(Unicode(pw)). followed through to the password setting in srv_samr.c (This used to be commit 172601b84ae94044b27ded917d4e0e21e47a5a66) --- source3/rpc_server/srv_samr.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c index a220e38b07..e55a6b2ce8 100644 --- a/source3/rpc_server/srv_samr.c +++ b/source3/rpc_server/srv_samr.c @@ -2052,7 +2052,8 @@ static BOOL set_user_info_24(SAM_USER_INFO_24 *id24, uint32 rid) struct sam_passwd new_pwd; static uchar nt_hash[16]; static uchar lm_hash[16]; - pstring new_pw; + UNISTR2 new_pw; + uint32 len; if (pwd == NULL) { @@ -2062,16 +2063,15 @@ static BOOL set_user_info_24(SAM_USER_INFO_24 *id24, uint32 rid) pwdb_init_sam(&new_pwd); copy_sam_passwd(&new_pwd, pwd); - if (!decode_pw_buffer(id24->pass, new_pw, sizeof(new_pw), True)) + if (!decode_pw_buffer(id24->pass, (char *)new_pw.buffer, 256, &len)) { return False; } -#ifdef DEBUG_PASSWORD - DEBUG(0,("New Password: %s\n", new_pw)); -#endif + new_pw.uni_max_len = len / 2; + new_pw.uni_str_len = len / 2; - nt_lm_owf_gen(new_pw, nt_hash, lm_hash); + nt_lm_owf_genW(&new_pw, nt_hash, lm_hash); new_pwd.smb_passwd = lm_hash; new_pwd.smb_nt_passwd = nt_hash; @@ -2088,7 +2088,8 @@ static BOOL set_user_info_23(SAM_USER_INFO_23 *id23, uint32 rid) struct sam_passwd new_pwd; static uchar nt_hash[16]; static uchar lm_hash[16]; - pstring new_pw; + UNISTR2 new_pw; + uint32 len; if (id23 == NULL) { @@ -2104,16 +2105,15 @@ static BOOL set_user_info_23(SAM_USER_INFO_23 *id23, uint32 rid) copy_sam_passwd(&new_pwd, pwd); copy_id23_to_sam_passwd(&new_pwd, id23); - if (!decode_pw_buffer(id23->pass, new_pw, sizeof(new_pw), True)) + if (!decode_pw_buffer(id23->pass, (char*)new_pw.buffer, 256, &len)) { return False; } -#ifdef DEBUG_PASSWORD - DEBUG(0,("New Password: %s\n", new_pw)); -#endif + new_pw.uni_max_len = len / 2; + new_pw.uni_str_len = len / 2; - nt_lm_owf_gen(new_pw, nt_hash, lm_hash); + nt_lm_owf_genW(&new_pw, nt_hash, lm_hash); new_pwd.smb_passwd = lm_hash; new_pwd.smb_nt_passwd = nt_hash; -- cgit