public void SamrConnect2_SUCCESS_NonDC() { IChecker PtfAssert = TestClassBase.BaseTestSite.Assert; Site.Log.Add(LogEntryKind.TestStep, string.Format("SamrBind, Server:{0}, Domain:{1}, User:{2}, Password{3}.", _samrProtocolAdapter.domainMemberFqdn, _samrProtocolAdapter.domainMemberNetBIOSName, _samrProtocolAdapter.DMAdminName, _samrProtocolAdapter.DMAdminPassword)); _samrProtocolAdapter.SamrBind( _samrProtocolAdapter.domainMemberFqdn, _samrProtocolAdapter.domainMemberNetBIOSName, _samrProtocolAdapter.DMAdminName, _samrProtocolAdapter.DMAdminPassword, false, false); Site.Log.Add(LogEntryKind.TestStep, string.Format("SamrConnect, Server:{0}, DesiredAccess: SAM_SERVER_READ.", _samrProtocolAdapter.domainMemberFqdn)); HRESULT methodStatus = (HRESULT)SAMRProtocolAdapter.RpcAdapter.SamrConnect2( _samrProtocolAdapter.domainMemberFqdn, out _serverHandle, (uint)SERVER_ACCESS_MASK.SAM_SERVER_READ); PtfAssert.AreEqual(HRESULT.STATUS_SUCCESS, methodStatus, "SamrConnect2 returns STATUS_SUCCESS"); PtfAssert.AreNotEqual(IntPtr.Zero, _serverHandle, "SamrConnect2 returns a non-NULL handle."); }
public void SamrConnect4_SUCCESS() { IChecker PtfAssert = TestClassBase.BaseTestSite.Assert; Site.Log.Add(LogEntryKind.TestStep, string.Format("SamrBind, Server:{0}, Domain:{1}, User:{2}, Password{3}.", _samrProtocolAdapter.pdcNetBIOSName, _samrProtocolAdapter.primaryDomainFqdn, _samrProtocolAdapter.DomainAdministratorName, _samrProtocolAdapter.DomainUserPassword)); _samrProtocolAdapter.SamrBind( _samrProtocolAdapter.pdcNetBIOSName, _samrProtocolAdapter.primaryDomainFqdn, _samrProtocolAdapter.DomainAdministratorName, _samrProtocolAdapter.DomainUserPassword, false, true); Site.Log.Add(LogEntryKind.TestStep, string.Format("SamrConnect4, Server:{0}, DesiredAccess: SAM_SERVER_READ.", _samrProtocolAdapter.pdcNetBIOSName)); HRESULT methodStatus = (HRESULT)SAMRProtocolAdapter.RpcAdapter.SamrConnect4( _samrProtocolAdapter.pdcNetBIOSName, out _serverHandle, 0x02u, (uint)SERVER_ACCESS_MASK.SAM_SERVER_READ); PtfAssert.AreEqual(HRESULT.STATUS_SUCCESS, methodStatus, "SamrConnect4 returns STATUS_SUCCESS"); PtfAssert.AreNotEqual(IntPtr.Zero, _serverHandle, "SamrConnect4 returns a non-NULL handle."); }
public void SamrEnumerateDomainsInSamServer_SUCCESS_NonDC() { HRESULT hResult; IChecker PtfAssert = TestClassBase.BaseTestSite.Assert; Site.Log.Add(LogEntryKind.TestStep, string.Format("SamrBind, Server:{0}, Domain:{1}, User:{2}, Password{3}.", _samrProtocolAdapter.domainMemberFqdn, _samrProtocolAdapter.domainMemberNetBIOSName, _samrProtocolAdapter.DMAdminName, _samrProtocolAdapter.DMAdminPassword)); _samrProtocolAdapter.SamrBind( _samrProtocolAdapter.domainMemberFqdn, _samrProtocolAdapter.domainMemberNetBIOSName, _samrProtocolAdapter.DMAdminName, _samrProtocolAdapter.DMAdminPassword, false, false); Site.Log.Add(LogEntryKind.TestStep, string.Format("SamrConnect5, Server:{0}, Desired Access: SAM_SERVER_ENUMERATE_DOMAINS.", _samrProtocolAdapter.domainMemberFqdn)); hResult = (HRESULT)_samrProtocolAdapter.SamrConnect5( _samrProtocolAdapter.domainMemberFqdn, (uint)SERVER_ACCESS_MASK.SAM_SERVER_ENUMERATE_DOMAINS, out _serverHandle); PtfAssert.AreEqual(HRESULT.STATUS_SUCCESS, hResult, "SamrConnect5 must return STATUS_SUCCESS."); uint?enumerationContext = 0; uint countReturned; _SAMPR_ENUMERATION_BUFFER?enumerationBuffer; Site.Log.Add(LogEntryKind.TestStep, "SamrEnumerateDomainsInSamServer, PreferedMaximumLength: 1024."); hResult = (HRESULT)SAMRProtocolAdapter.RpcAdapter.SamrEnumerateDomainsInSamServer( _serverHandle, ref enumerationContext, out enumerationBuffer, 1024, out countReturned); PtfAssert.AreEqual(HRESULT.STATUS_SUCCESS, hResult, "SamrEnumerateDomainsInSamServer must return STATUS_SUCCESS."); PtfAssert.AreNotEqual <uint>(0, countReturned, "The CountReturned is not zero."); PtfAssert.IsNotNull(enumerationBuffer, "EnumerationBuffer is not null."); PtfAssert.AreEqual <uint>(countReturned, enumerationBuffer.Value.EntriesRead, "Verify the EntriesRead property."); bool builtInDomainFound = false; foreach (var entry in enumerationBuffer.Value.Buffer) { string name = DtypUtility.ToString(entry.Name); if (string.Compare(name, "BUILTIN", true) == 0) { builtInDomainFound = true; } PtfAssert.AreEqual <uint>(0, entry.RelativeId, "[MS-SAMR]3.1.5.2.1 Buffer.Buffer.RelativeId is 0."); } PtfAssert.IsTrue(builtInDomainFound, "Client obtains a listing, without duplicates, of the name attribute of the built-in domain object."); }
public void SamrConnect5_SUCCESS() { IChecker PtfAssert = TestClassBase.BaseTestSite.Assert; Site.Log.Add(LogEntryKind.TestStep, string.Format("SamrBind: Server:{0}, Domain:{1}, User:{2}, Password{3}.", _samrProtocolAdapter.pdcNetBIOSName, _samrProtocolAdapter.primaryDomainFqdn, _samrProtocolAdapter.DomainAdministratorName, _samrProtocolAdapter.DomainUserPassword)); _samrProtocolAdapter.SamrBind( _samrProtocolAdapter.pdcNetBIOSName, _samrProtocolAdapter.primaryDomainFqdn, _samrProtocolAdapter.DomainAdministratorName, _samrProtocolAdapter.DomainUserPassword, false, true); Site.Log.Add(LogEntryKind.TestStep, string.Format("SamrConnect5: Server:{0}, DesiredAccess: SAM_SERVER_READ.", _samrProtocolAdapter.pdcNetBIOSName)); SAMPR_REVISION_INFO[] inRevisionInfo = new SAMPR_REVISION_INFO[1]; inRevisionInfo[0] = new SAMPR_REVISION_INFO(); inRevisionInfo[0].V1.Revision = _SAMPR_REVISION_INFO_V1_Revision_Values.V3; inRevisionInfo[0].V1.SupportedFeatures = SupportedFeatures_Values.V1; uint outVersion; SAMPR_REVISION_INFO outRevisionInfo; HRESULT methodStatus = (HRESULT)SAMRProtocolAdapter.RpcAdapter.SamrConnect5( _samrProtocolAdapter.pdcNetBIOSName, (uint)SERVER_ACCESS_MASK.SAM_SERVER_READ, 0x01u, inRevisionInfo[0], out outVersion, out outRevisionInfo, out _serverHandle); PtfAssert.AreEqual(HRESULT.STATUS_SUCCESS, methodStatus, "[MS-SAMR] 3.1.5.1.1 Otherwise, the server MUST return STATUS_SUCCESS."); PtfAssert.AreEqual(1u, outVersion, "[MS-SAMR] 3.1.5.1.1 The server MUST set OutVersion to 1 and OutRevisionInfo.Revision to 3."); PtfAssert.AreEqual(3u, (uint)outRevisionInfo.V1.Revision, "[MS-SAMR] 3.1.5.1.1 The server MUST set OutVersion to 1 and OutRevisionInfo.Revision to 3."); PtfAssert.AreEqual(0u, (uint)outRevisionInfo.V1.SupportedFeatures, "[MS-SAMR] 3.1.5.1.1 The remaining fields of OutRevisionInfo MUST be set to zero."); PtfAssert.AreNotEqual(IntPtr.Zero, _serverHandle, "SamrConnect5 returns a non-NULL handle."); }