コード例 #1
0
        public void SamrOemChangePasswordUser2_SUCCESS()
        {
            IChecker PtfAssert   = TestClassBase.BaseTestSite.Assert;
            string   oldPassword = "******";
            string   newPassword = "******";

            CreateTempUser createTempUser = new CreateTempUser(
                _samrProtocolAdapter,
                testUserName,
                oldPassword,
                AdtsUserAccountControl.ADS_UF_NORMAL_ACCOUNT);

            BaseTestSite.Log.Add(LogEntryKind.TestStep,
                                 string.Format("Create test user, username:{0} password:{1}.", testUserName, oldPassword));
            Common.UpdatesStorage.GetInstance().PushUpdate(createTempUser);

            BaseTestSite.Log.Add(LogEntryKind.TestStep,
                                 string.Format("Set user must change password to user:{0}.", testUserName));
            Common.Utilities.UserMustChangePassword(
                _samrProtocolAdapter.pdcFqdn,
                _samrProtocolAdapter.ADDSPortNum,
                _samrProtocolAdapter.primaryDomainUserContainerDN,
                testUserName);

            Site.Log.Add(LogEntryKind.TestStep, "Initialize: Create Samr Bind to the server.");
            _samrProtocolAdapter.SamrBind(
                GetPdcDnsName(),
                _samrProtocolAdapter.primaryDomainFqdn,
                _samrProtocolAdapter.DomainAdministratorName,
                _samrProtocolAdapter.DomainUserPassword,
                false,
                true);

            SamrCryptography samrCryptography = new SamrCryptography(oldPassword, newPassword);

            BaseTestSite.Log.Add(LogEntryKind.TestStep,
                                 string.Format("SamrOemChangePasswordUser2, OldPassword:{0}, NewPassword:{1}.", oldPassword, newPassword));
            HRESULT hResult = (HRESULT)SAMRProtocolAdapter.RpcAdapter.SamrOemChangePasswordUser2(
                SAMRProtocolAdapter.RpcAdapter.Handle,
                DtypUtility.ToRpcString(_samrProtocolAdapter.pdcNetBIOSName),
                DtypUtility.ToRpcString(testUserName),
                samrCryptography.GetNewPasswordEncryptedWithOldLm(PasswordType.Oem),
                samrCryptography.GetOldLmEncryptedWithNewLm());

            PtfAssert.AreEqual(HRESULT.STATUS_SUCCESS, hResult, "SamrOemChangePasswordUser2 returns success.");
        }