/*********************************************************** Code to check and change the OEM hashed password. ************************************************************/ BOOL pass_oem_change(char *user, uchar *lmdata, uchar *lmhash, uchar *ntdata, uchar *nthash) { fstring new_passwd; struct smb_passwd *sampw; BOOL ret = check_oem_password( user, lmdata, lmhash, ntdata, nthash, &sampw, new_passwd, sizeof(new_passwd)); /* * At this point we have the new case-sensitive plaintext * password in the fstring new_passwd. If we wanted to synchronise * with UNIX passwords we would call a UNIX password changing * function here. However it would have to be done as root * as the plaintext of the old users password is not * available. JRA. */ if ( ret && lp_unix_password_sync()) { ret = chgpasswd(user,"", new_passwd, True); } if (ret) { ret = change_oem_password( sampw, new_passwd, False ); } memset(new_passwd, 0, sizeof(new_passwd)); return ret; }
/**************************************************************************** update the encrypted smbpasswd file from the plaintext username and password *****************************************************************************/ BOOL update_smbpassword_file( struct passwd *pass, fstring password) { struct smb_passwd smbpw; BOOL ret; /* Fake up an smb_passwd. */ smbpw.smb_userid = pass->pw_uid; smbpw.smb_name = pass->pw_name; smbpw.smb_passwd = NULL; smbpw.smb_nt_passwd = NULL; smbpw.acct_ctrl = ACB_NORMAL; /* Here, the flag is one, because we want to ignore the XXXXXXX'd out password */ ret = change_oem_password( &smbpw, password, 1); if (ret == False) DEBUG(3,("update_smbpasswd_entry: change_oem_password returned False\n")); return ret; }