18.104.22.168.2 SamrOemChangePasswordUser2 (Opnum 54)
The SamrOemChangePasswordUser2 method changes a user's password.
long SamrOemChangePasswordUser2( [in] handle_t BindingHandle, [in, unique] PRPC_STRING ServerName, [in] PRPC_STRING UserName, [in, unique] PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldLm, [in, unique] PENCRYPTED_LM_OWF_PASSWORD OldLmOwfPasswordEncryptedWithNewLm
BindingHandle: An RPC binding handle parameter as specified in [C706] section 1.
ServerName: A counted string, encoded in the OEM character set, containing the NETBIOS name of the server; this parameter MAY<53> be ignored by the server.
UserName: A counted string, encoded in the OEM character set, containing the name of the user whose password is to be changed; see message processing later in this section for details on how this value is used as a database key to locate the account that is the target of this password change operation.
NewPasswordEncryptedWithOldLm: A cleartext password encrypted according to the specification of SAMPR_ENCRYPTED_USER_PASSWORD (section 22.214.171.124), where the key is the LM hash of the existing password for the target user (as presented by the client). The cleartext password MUST be encoded in an OEM code page character set (as opposed to UTF-16).
OldLmOwfPasswordEncryptedWithNewLm: The LM hash of the target user's existing password (as presented by the client) encrypted according to the specification of ENCRYPTED_LM_OWF_PASSWORD (section 126.96.36.199), where the key is the LM hash of the cleartext password obtained from decrypting NewPasswordEncryptedWithOldLm (see the preceding description for decryption details).
Upon receiving this message, the server MUST process the data from the message subject to the following constraints:
All database operations MUST occur in a single transaction.
The server MUST encode the UserName parameter into UTF-16 using the OEM code page.
Let U be the user account with the sAMAccountName attribute value of UserName. The server MUST return STATUS_WRONG_PASSWORD if no such account exists.
Let Stored-LM-Hash be the value of the dBCSPwd attribute from the database decrypted using the algorithm specified in section 188.8.131.52, using U's RelativeId as the key. If this attribute does not exist, STATUS_WRONG_PASSWORD MUST be returned.
Let Presented-Clear-Text be the cleartext value sent by the client. This value is obtained by decrypting NewPasswordEncryptedWithOldLm according to the specification of SAMPR_ENCRYPTED_USER_PASSWORD using Stored-LM-Hash as the key, and then translating the result into a UTF-16 encoded string (using the OEM code page).
Let Presented-Old-LM-Hash be the value of OldLmOwfPasswordEncryptedWithNewLm that has been decrypted per the specification of ENCRYPTED_LM_OWF_PASSWORD, using the LM hash of Presented-Clear-Text as the key.
If Presented-Old-LM-Hash is not equal to Stored-LM-Hash, the server MUST satisfy the constraints in section 184.108.40.206.6, abort processing, and return STATUS_WRONG_PASSWORD.
The server MUST update the clearTextPassword attribute with Presented-Clear-Text.