in TestSuites/ADFamily/src/Adapter/MS-LSAD/PolicyObjects.cs [1432:2241]
public ErrorStatus SetInformationPolicy(int handleInput, InformationClass informationType)
{
InformationClass policyInformationClass2 = new InformationClass();
_LSAPR_POLICY_INFORMATION policyInfoinServer = new _LSAPR_POLICY_INFORMATION();
this.Invalidhandlle = false;
this.invalidParam = false;
#region CheckforInvalidParameter
////Setting invalidParam to true for Information Class which will return Invalid Parameter
if ((informationType == InformationClass.PolicyAuditFullQueryInformation)
|| (informationType == InformationClass.PolicyAuditFullSetInformation)
|| ((informationType == InformationClass.PolicyAccountDomainInformation) && (isDC == true))
|| (informationType == InformationClass.PolicyPdAccountInformation)
|| (informationType == InformationClass.PolicyModificationInformation)
|| (informationType == InformationClass.Invalid))
{
this.invalidParam = true;
}
#endregion CheckforInvalidParameter
#region CheckforInvalidHandleCase
////Only check InvalidHandle in case of NOT InvalidParam
if (stPolicyInformation.PHandle != handleInput && !this.invalidParam)
{
////CreateAnInvalidHandle() will create invalid handle to check requirement of Invalid Handle
objSecretHandle = utilities.CreateAnInvalidHandle(false);
this.InvalidPolicyHandle = objSecretHandle;
PolicyHandle = this.InvalidPolicyHandle;
this.Invalidhandlle = true;
}
else
{
PolicyHandle = this.ValidPolicyHandle;
this.Invalidhandlle = false;
}
#endregion CheckforInvalidHandleCase
#region checkInformationClassvalues
////Passing Input to set Information as per Information class and setting intCheckInfoClass to return status
switch (informationType)
{
case InformationClass.PolicyAccountDomainInformation:
policyInformationClass2 = InformationClass.PolicyAccountDomainInformation;
if (isDC)
{
intCheckInfoClass = LsadUtilities.ReturnInvalidParameter;
}
else
{
policyInfoinServer.PolicyAccountDomainInfo = new _LSAPR_POLICY_ACCOUNT_DOM_INFO();
policyInfoinServer.PolicyAccountDomainInfo.DomainName = new _RPC_UNICODE_STRING();
policyInfoinServer.PolicyAccountDomainInfo.DomainName.Buffer =
utilities.ConversionfromStringtoushortArray(domain);
policyInfoinServer.PolicyAccountDomainInfo.DomainName.Length =
(ushort)(2 * (policyInfoinServer.PolicyAccountDomainInfo.DomainName.Buffer.Length));
policyInfoinServer.PolicyAccountDomainInfo.DomainName.MaximumLength =
(ushort)((policyInfoinServer.PolicyAccountDomainInfo.DomainName.Length)+2);
policyInfoinServer.PolicyAccountDomainInfo.DomainSid =
utilities.GetSid(DomainSid.Valid, GetAccountDomainSidNonDC);
intCheckInfoClass = LsadUtilities.ReturnSuccess;
}
break;
case InformationClass.PolicyPrimaryDomainInformation:
policyInformationClass2 = InformationClass.PolicyPrimaryDomainInformation;
policyInfoinServer.PolicyPrimaryDomainInfo = new _LSAPR_POLICY_PRIMARY_DOM_INFO();
policyInfoinServer.PolicyPrimaryDomainInfo.Name = new _RPC_UNICODE_STRING();
policyInfoinServer.PolicyPrimaryDomainInfo.Name.Buffer =
utilities.ConversionfromStringtoushortArray(domain);
policyInfoinServer.PolicyPrimaryDomainInfo.Name.Length =
(ushort)(2 * policyInfoinServer.PolicyPrimaryDomainInfo.Name.Buffer.Length);
policyInfoinServer.PolicyPrimaryDomainInfo.Name.MaximumLength =
(ushort)((policyInfoinServer.PolicyPrimaryDomainInfo.Name.Length)+2);
policyInfoinServer.PolicyPrimaryDomainInfo.Sid =
utilities.GetSid(DomainSid.Valid, this.PrimaryDomainSID);
if ((this.uintAccessMask & ACCESS_MASK.POLICY_TRUST_ADMIN) != ACCESS_MASK.POLICY_TRUST_ADMIN)
{
intCheckInfoClass = LsadUtilities.ReturnAccessDenied;
}
else
{
intCheckInfoClass = LsadUtilities.ReturnSuccess;
}
break;
case InformationClass.PolicyAuditEventsInformation:
policyInformationClass2 = InformationClass.PolicyAuditEventsInformation;
policyInfoinServer.PolicyAuditEventsInfo = new _LSAPR_POLICY_AUDIT_EVENTS_INFO();
policyInfoinServer.PolicyAuditEventsInfo.AuditingMode = (byte)AuditingMode;
policyInfoinServer.PolicyAuditEventsInfo.EventAuditingOptions = new EventAuditingOptions_Values[1];
policyInfoinServer.PolicyAuditEventsInfo.EventAuditingOptions[0] =
EventAuditingOptions_Values.POLICY_AUDIT_EVENT_SUCCESS;
policyInfoinServer.PolicyAuditEventsInfo.MaximumAuditEventCount = MaximumAuditEventCount;
if (informationType == InformationClass.PolicyAuditEventsInformation
&& policyInfoinServer.PolicyAuditEventsInfo.MaximumAuditEventCount != 0)
{
#region MS-LSAD_R60
Site.CaptureRequirementIfIsNotNull(
policyInfoinServer.PolicyAuditEventsInfo.EventAuditingOptions,
"MS-LSAD",
60,
@"If the ""MaximumAuditingEventCount"" field of the
LSAPR_POLICY_AUDIT_EVENTS_INFO structure has a value other than 0, the
""EventAuditingOptions"" field MUST NOT be NULL.");
#endregion
}
if ((this.uintAccessMask & ACCESS_MASK.POLICY_SET_AUDIT_REQUIREMENTS) !=
ACCESS_MASK.POLICY_SET_AUDIT_REQUIREMENTS)
{
intCheckInfoClass = LsadUtilities.ReturnAccessDenied;
}
else
{
intCheckInfoClass = LsadUtilities.ReturnSuccess;
}
break;
case InformationClass.PolicyAuditFullQueryInformation:
policyInformationClass2 = InformationClass.PolicyAuditFullQueryInformation;
policyInfoinServer.PolicyAuditFullQueryInfo = new _POLICY_AUDIT_FULL_QUERY_INFO();
intCheckInfoClass = LsadUtilities.ReturnInvalidParameter;
break;
case InformationClass.PolicyAuditFullSetInformation:
policyInformationClass2 = InformationClass.PolicyAuditFullSetInformation;
policyInfoinServer.PolicyAuditFullSetInfo = new _POLICY_AUDIT_FULL_SET_INFO();
if (this.isWindows)
{
if (PDCOSVersion >= ServerVersion.Win2003)
{
intCheckInfoClass = LsadUtilities.ReturnInvalidParameter;
}
}
else if ((this.uintAccessMask & ACCESS_MASK.POLICY_AUDIT_LOG_ADMIN) !=
ACCESS_MASK.POLICY_AUDIT_LOG_ADMIN)
{
intCheckInfoClass = LsadUtilities.ReturnAccessDenied;
}
break;
case InformationClass.PolicyAuditLogInformation:
policyInformationClass2 = InformationClass.PolicyAuditLogInformation;
policyInfoinServer.PolicyAuditLogInfo = new _POLICY_AUDIT_LOG_INFO();
if ((this.uintAccessMask & ACCESS_MASK.POLICY_AUDIT_LOG_ADMIN) !=
ACCESS_MASK.POLICY_AUDIT_LOG_ADMIN)
{
intCheckInfoClass = LsadUtilities.ReturnAccessDenied;
}
else
{
intCheckInfoClass = LsadUtilities.ReturnNotSupported;
}
break;
case InformationClass.PolicyDnsDomainInformation:
policyInformationClass2 = InformationClass.PolicyDnsDomainInformation;
policyInfoinServer.PolicyDnsDomainInfo = new _LSAPR_POLICY_DNS_DOMAIN_INFO();
if ((this.uintAccessMask & ACCESS_MASK.POLICY_TRUST_ADMIN) != ACCESS_MASK.POLICY_TRUST_ADMIN)
{
intCheckInfoClass = LsadUtilities.ReturnAccessDenied;
}
else
{
policyInfoinServer.PolicyDnsDomainInfo.Name = new _RPC_UNICODE_STRING();
policyInfoinServer.PolicyDnsDomainInfo.Name.Buffer =
utilities.ConversionfromStringtoushortArray(domain);
policyInfoinServer.PolicyDnsDomainInfo.Name.Length =
(ushort)(2 * (policyInfoinServer.PolicyDnsDomainInfo.Name.Buffer.Length));
policyInfoinServer.PolicyDnsDomainInfo.Name.MaximumLength =
(ushort)((policyInfoinServer.PolicyDnsDomainInfo.Name.Length)+2);
policyInfoinServer.PolicyDnsDomainInfo.DnsDomainName = new _RPC_UNICODE_STRING();
policyInfoinServer.PolicyDnsDomainInfo.DnsDomainName.Buffer =
utilities.ConversionfromStringtoushortArray(fullDomain);
policyInfoinServer.PolicyDnsDomainInfo.DnsDomainName.Length =
(ushort)(2 * (policyInfoinServer.PolicyDnsDomainInfo.DnsDomainName.Buffer.Length));
policyInfoinServer.PolicyDnsDomainInfo.DnsDomainName.MaximumLength =
(ushort)((policyInfoinServer.PolicyDnsDomainInfo.DnsDomainName.Length)+2);
policyInfoinServer.PolicyDnsDomainInfo.DnsForestName = new _RPC_UNICODE_STRING();
policyInfoinServer.PolicyDnsDomainInfo.DnsForestName.Buffer =
utilities.ConversionfromStringtoushortArray(fullDomain);
policyInfoinServer.PolicyDnsDomainInfo.DnsForestName.Length =
(ushort)(2 * (policyInfoinServer.PolicyDnsDomainInfo.DnsForestName.Buffer.Length));
policyInfoinServer.PolicyDnsDomainInfo.DnsForestName.MaximumLength =
(ushort)((policyInfoinServer.PolicyDnsDomainInfo.DnsForestName.Length)+2);
policyInfoinServer.PolicyDnsDomainInfo.DomainGuid =
new Guid(DomainGUID);
policyInfoinServer.PolicyDnsDomainInfo.Sid =
utilities.GetSid(DomainSid.Valid, this.PrimaryDomainSID);
intCheckInfoClass = LsadUtilities.ReturnSuccess;
}
break;
case InformationClass.PolicyDnsDomainInformationInt:
policyInformationClass2 = InformationClass.PolicyDnsDomainInformationInt;
policyInfoinServer.PolicyDnsDomainInfoInt = new _LSAPR_POLICY_DNS_DOMAIN_INFO();
if ((this.uintAccessMask & ACCESS_MASK.POLICY_TRUST_ADMIN) != ACCESS_MASK.POLICY_TRUST_ADMIN)
{
intCheckInfoClass = LsadUtilities.ReturnAccessDenied;
}
else
{
policyInfoinServer.PolicyDnsDomainInfoInt.Name = new _RPC_UNICODE_STRING();
policyInfoinServer.PolicyDnsDomainInfoInt.Name.Buffer =
utilities.ConversionfromStringtoushortArray(domain);
policyInfoinServer.PolicyDnsDomainInfoInt.Name.Length =
(ushort)(2 * (policyInfoinServer.PolicyDnsDomainInfoInt.Name.Buffer.Length));
policyInfoinServer.PolicyDnsDomainInfoInt.Name.MaximumLength =
(ushort)((policyInfoinServer.PolicyDnsDomainInfoInt.Name.Length)+2);
policyInfoinServer.PolicyDnsDomainInfoInt.DnsDomainName = new _RPC_UNICODE_STRING();
policyInfoinServer.PolicyDnsDomainInfoInt.DnsDomainName.Buffer =
utilities.ConversionfromStringtoushortArray(fullDomain);
policyInfoinServer.PolicyDnsDomainInfoInt.DnsDomainName.Length =
(ushort)(2 * (policyInfoinServer.PolicyDnsDomainInfoInt.DnsDomainName.Buffer.Length));
policyInfoinServer.PolicyDnsDomainInfoInt.DnsDomainName.MaximumLength =
(ushort)((policyInfoinServer.PolicyDnsDomainInfoInt.DnsDomainName.Length)+2);
policyInfoinServer.PolicyDnsDomainInfoInt.DnsForestName = new _RPC_UNICODE_STRING();
policyInfoinServer.PolicyDnsDomainInfoInt.DnsForestName.Buffer =
utilities.ConversionfromStringtoushortArray(fullDomain);
policyInfoinServer.PolicyDnsDomainInfoInt.DnsForestName.Length =
(ushort)(2 * (policyInfoinServer.PolicyDnsDomainInfoInt.DnsForestName.Buffer.Length));
policyInfoinServer.PolicyDnsDomainInfoInt.DnsForestName.MaximumLength =
(ushort)((policyInfoinServer.PolicyDnsDomainInfoInt.DnsForestName.Length)+2);
policyInfoinServer.PolicyDnsDomainInfoInt.DomainGuid =
new Guid(DomainGUID);
policyInfoinServer.PolicyDnsDomainInfoInt.Sid =
utilities.GetSid(DomainSid.Valid, this.PrimaryDomainSID);
intCheckInfoClass = LsadUtilities.ReturnSuccess;
}
break;
case InformationClass.PolicyLocalAccountDomainInformation:
policyInformationClass2 = InformationClass.PolicyLocalAccountDomainInformation;
policyInfoinServer.PolicyLocalAccountDomainInfo = new _LSAPR_POLICY_ACCOUNT_DOM_INFO();
policyInfoinServer.PolicyLocalAccountDomainInfo.DomainName = new _RPC_UNICODE_STRING();
policyInfoinServer.PolicyLocalAccountDomainInfo.DomainName.Buffer =
utilities.ConversionfromStringtoushortArray(domain);
policyInfoinServer.PolicyLocalAccountDomainInfo.DomainName.Length =
(ushort)(2 * policyInfoinServer.PolicyLocalAccountDomainInfo.DomainName.Buffer.Length);
policyInfoinServer.PolicyLocalAccountDomainInfo.DomainName.MaximumLength =
(ushort)((policyInfoinServer.PolicyLocalAccountDomainInfo.DomainName.Length)+2);
policyInfoinServer.PolicyLocalAccountDomainInfo.DomainSid =
utilities.GetSid(DomainSid.Valid, GetLocalAccountDomainSid);
if (this.serverPlatform == Server.Windows2k8)
{
if ((this.uintAccessMask & ACCESS_MASK.POLICY_TRUST_ADMIN) != ACCESS_MASK.POLICY_TRUST_ADMIN)
{
intCheckInfoClass = LsadUtilities.ReturnAccessDenied;
}
else
{
intCheckInfoClass = LsadUtilities.ReturnSuccess;
}
}
break;
case InformationClass.PolicyLsaServerRoleInformation:
policyInformationClass2 = InformationClass.PolicyLsaServerRoleInformation;
policyInfoinServer.PolicyServerRoleInfo = new _POLICY_LSA_SERVER_ROLE_INFO();
if (GetIntProperty(propertyGroup + "ServerRoleSelected") == 3)
{
policyInfoinServer.PolicyServerRoleInfo.LsaServerRole =
_POLICY_LSA_SERVER_ROLE.PolicyServerRolePrimary;
}
if (GetIntProperty(propertyGroup + "ServerRoleSelected") == 2)
{
policyInfoinServer.PolicyServerRoleInfo.LsaServerRole =
_POLICY_LSA_SERVER_ROLE.PolicyServerRoleBackup;
}
if ((this.uintAccessMask & ACCESS_MASK.POLICY_SERVER_ADMIN) != ACCESS_MASK.POLICY_SERVER_ADMIN)
{
intCheckInfoClass = LsadUtilities.ReturnAccessDenied;
}
else
{
intCheckInfoClass = LsadUtilities.ReturnSuccess;
}
break;
case InformationClass.PolicyModificationInformation:
policyInformationClass2 = InformationClass.PolicyModificationInformation;
policyInfoinServer.PolicyModificationInfo = new _POLICY_MODIFICATION_INFO();
intCheckInfoClass = LsadUtilities.ReturnInvalidParameter;
break;
case InformationClass.PolicyPdAccountInformation:
policyInformationClass2 = InformationClass.PolicyPdAccountInformation;
policyInfoinServer.PolicyPdAccountInfo = new _LSAPR_POLICY_PD_ACCOUNT_INFO();
intCheckInfoClass = LsadUtilities.ReturnInvalidParameter;
break;
case InformationClass.PolicyReplicaSourceInformation:
policyInformationClass2 = InformationClass.PolicyReplicaSourceInformation;
policyInfoinServer.PolicyReplicaSourceInfo = new _LSAPR_POLICY_REPLICA_SRCE_INFO();
policyInfoinServer.PolicyReplicaSourceInfo.ReplicaAccountName = new _RPC_UNICODE_STRING();
policyInfoinServer.PolicyReplicaSourceInfo.ReplicaAccountName.Buffer =
utilities.ConversionfromStringtoushortArray(ReplicasourceName);
policyInfoinServer.PolicyReplicaSourceInfo.ReplicaAccountName.Length =
(ushort)(2 * policyInfoinServer.PolicyReplicaSourceInfo.ReplicaAccountName.Buffer.Length);
policyInfoinServer.PolicyReplicaSourceInfo.ReplicaAccountName.MaximumLength =
(ushort)((policyInfoinServer.PolicyReplicaSourceInfo.ReplicaAccountName.Length)+2);
policyInfoinServer.PolicyReplicaSourceInfo.ReplicaSource = new _RPC_UNICODE_STRING();
policyInfoinServer.PolicyReplicaSourceInfo.ReplicaSource.Buffer =
utilities.ConversionfromStringtoushortArray(ReplicaAccountName);
policyInfoinServer.PolicyReplicaSourceInfo.ReplicaSource.Length =
(ushort)(2 * policyInfoinServer.PolicyReplicaSourceInfo.ReplicaSource.Buffer.Length);
policyInfoinServer.PolicyReplicaSourceInfo.ReplicaSource.MaximumLength =
(ushort)((policyInfoinServer.PolicyReplicaSourceInfo.ReplicaSource.Length)+2);
if ((this.uintAccessMask & ACCESS_MASK.POLICY_SERVER_ADMIN) != ACCESS_MASK.POLICY_SERVER_ADMIN)
{
intCheckInfoClass = LsadUtilities.ReturnAccessDenied;
}
else
{
intCheckInfoClass = LsadUtilities.ReturnSuccess;
}
break;
case InformationClass.PolicyMachineAccountInformation:
policyInformationClass2 = InformationClass.PolicyMachineAccountInformation;
policyInfoinServer.PolicyMachineAccountInfo = new _LSAPR_POLICY_MACHINE_ACCT_INFO();
policyInfoinServer.PolicyMachineAccountInfo.Rid = 0;
policyInfoinServer.PolicyMachineAccountInfo.Sid = utilities.GetSid(DomainSid.Valid, GetLocalAccountDomainSid);
if ((this.uintAccessMask & ACCESS_MASK.POLICY_SERVER_ADMIN) != ACCESS_MASK.POLICY_SERVER_ADMIN)
{
intCheckInfoClass = LsadUtilities.ReturnAccessDenied;
}
else
{
intCheckInfoClass = LsadUtilities.ReturnSuccess;
}
break;
default:
#region invalidenumcheck
intCheckInfoClass = LsadUtilities.ReturnInvalidParameter;
#endregion
break;
}
#endregion checkInformationClassvalues
uintMethodStatus = lsadClientStack.LsarSetInformationPolicy(
PolicyHandle.Value,
(_POLICY_INFORMATION_CLASS)policyInformationClass2,
policyInfoinServer);
if ((uint)uintMethodStatus == (uint)ErrorStatus.Success)
{
if (informationType == InformationClass.PolicyAuditEventsInformation
&& policyInfoinServer.PolicyAuditEventsInfo.MaximumAuditEventCount != 0)
{
#region MS-LSAD_R60
Site.CaptureRequirementIfIsNotNull(
policyInfoinServer.PolicyAuditEventsInfo.EventAuditingOptions,
"MS-LSAD",
60,
@"If the ""MaximumAuditingEventCount"" field of the
LSAPR_POLICY_AUDIT_EVENTS_INFO structure has a value other than 0, the
""EventAuditingOptions"" field MUST NOT be NULL.");
#endregion
}
}
////Capturing Invalid Parameter Requirements based on Different Information classes
if (this.invalidParam)
{
if (informationType == InformationClass.PolicyAccountDomainInformation && (isDC == true))
{
#region MS-LSAD_R386
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.InvalidParameter),
(uint)uintMethodStatus,
"MS-LSAD",
386,
@"If the Value of InformationClass parameter in LsarSetInformationPolicy is
PolicyAccountDomainInformation then on domain controller, server MUST fail
the request with the STATUS_INVALID_PARAMETER.");
#endregion
}
if (informationType == InformationClass.PolicyAuditFullQueryInformation)
{
#region MS-LSAD_R377
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.InvalidParameter),
(uint)uintMethodStatus,
"MS-LSAD",
377,
@"If InformationClass value of LsarSetInformationPolicy is
PolicyAuditFullQueryInformation then type of access required is cannot be set;
the request MUST fail with STATUS_InvalidParameter.");
#endregion
#region MS-LSAD_R393
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.InvalidParameter),
(uint)uintMethodStatus,
"MS-LSAD",
393,
@"If the Value of InformationClass parameter in LsarSetInformationPolicy is
PolicyAuditFullQueryInformation then Server MUST return STATUS_InvalidParameter
because this is not a policy element that can be set.");
#endregion
}
if (informationType == InformationClass.PolicyModificationInformation)
{
#region MS-LSAD_R375
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.InvalidParameter),
(uint)uintMethodStatus,
"MS-LSAD",
375,
@"If InformationClass value of LsarSetInformationPolicy is
PolicyModificationInformation then type of access required
is cannot be set; the request MUST fail with STATUS_InvalidParameter.");
#endregion
#region MS-LSAD_R391
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.InvalidParameter),
(uint)uintMethodStatus,
"MS-LSAD",
391,
@"If the Value of InformationClass parameter in LsarSetInformationPolicy is
PolicyModificationInformation then Server MUST return STATUS_InvalidParameter
because this is not a policy element that can be set.");
#endregion
}
if (informationType == InformationClass.PolicyPdAccountInformation)
{
#region MS-LSAD_R385
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.InvalidParameter),
(uint)uintMethodStatus,
"MS-LSAD",
385,
@"If the Value of InformationClass parameter in LsarSetInformationPolicy is
PolicyPdAccountInformation then Server MUST return STATUS_InvalidParameter
because this is not a policy element that can be set.");
#endregion
}
////Capturing Invalid Handle case Requirement
if (informationType == InformationClass.PolicyAuditFullSetInformation)
{
#region MS-LSAD_R392
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.InvalidParameter),
(uint)uintMethodStatus,
"MS-LSAD",
392,
@"If InformationClass value of LsarSetInformationPolicy is PolicyAuditFullSetInformation
then Win2k3,2k8 and Vista will return Invalid Parameter");
#endregion
}
}
else if (this.Invalidhandlle == true)
{
utilities.CreateAnInvalidHandle(true);
#region MS-LSAD_R367
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.InvalidHandle),
(uint)uintMethodStatus,
"MS-LSAD",
367,
@"If PolicyHandle of LsarSetInformationPolicy is not a Valid context handle,
the server MUST return STATUS_InvalidHandle.");
#endregion
}
//Validating Requirement for Success, Not Implemented and Access Denied Status
if (!this.Invalidhandlle)
{
#region Capturing_Requirement for Status other than Invalid Handle
switch (intCheckInfoClass)
{
////Validating success requirements
case 0:
#region MS-LSAD_R363
Site.CaptureRequirementIfAreEqual<uint>(
(uint)ErrorStatus.Success,
(uint)uintMethodStatus,
"MS-LSAD",
363,
@"The return Value for Opnum LsarSetInformationPolicy that an implementation MUST
return is STATUS_Success(0x00000000) when the request was successfully completed");
#endregion
#region MS-LSAD_R366
Site.CaptureRequirementIfIsTrue(
((PolicyHandle != IntPtr.Zero) && (uintMethodStatus != NtStatus.STATUS_ACCESS_DENIED)),
"MS-LSAD",
366,
@"PolicyHandle parameter of LsarSetInformationPolicy MUST reference a context that was
granted an access commensurate with the InformationClass value requested.");
#endregion
break;
////Capturing Requirement for general Invalid Parameter case
case 1:
#region MS-LSAD_R364
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.InvalidParameter),
(uint)uintMethodStatus,
"MS-LSAD",
364,
@"The LsarSetInformationPolicy implementation MUST return
STATUS_InvalidParameter(oxC000000D) when one of the parameters is incorrect.
For instance, this can happen if InformationClass is not supported or some of the
supplied policy data is inValid.");
#endregion
break;
////Capturing requirement for Not_Implemented status
case 2:
#region MS-LSAD_R365
Site.CaptureRequirementIfAreEqual<uint>(
(uint)ErrorStatus.NotImplemented,
(uint)uintMethodStatus,
"MS-LSAD",
365,
@"The LsarSetInformationPolicy implementation MUST return is
STATUS_NotImplemented(0xC0000002) when an information class cannot be set.");
#endregion
#region MS-LSAD_R382
Site.CaptureRequirementIfAreEqual<uint>(
(uint)ErrorStatus.NotImplemented,
(uint)uintMethodStatus,
"MS-LSAD",
382,
@"If the Value of InformationClass parameter in LsarSetInformationPolicy is
PolicyAuditLogInformation then Server MUST return the STATUS_NotImplemented
error code because this is not a policy element that can be set.");
#endregion
break;
////capturing requirement for Access denied status
case 3:
if (informationType == InformationClass.PolicyPrimaryDomainInformation)
{
#region MS-LSAD_R371
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.AccessDenied),
(uint)uintMethodStatus,
"MS-LSAD",
371,
@"If InformationClass value of LsarSetInformationPolicy is
PolicyPrimaryDomainInformation then type of access required
MUST be POLICY_TRUST_ADMIN");
#endregion
}
if (informationType == InformationClass.PolicyAuditEventsInformation)
{
#region MS-LSAD_R370
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.AccessDenied),
(uint)uintMethodStatus,
"MS-LSAD",
370,
@"If InformationClass value of LsarSetInformationPolicy is PolicyAuditEventsInformation
then type of access required MUST be POLICY_SET_AUDIT_REQUIREMENTS");
#endregion
}
if (informationType == InformationClass.PolicyAuditFullSetInformation)
{
#region MS-LSAD_R376
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.AccessDenied),
(uint)uintMethodStatus,
"MS-LSAD",
376,
@"If InformationClass value of LsarSetInformationPolicy is PolicyAuditFullSetInformation
then type of access required MUST be POLICY_AUDIT_LOG_ADMIN");
#endregion
}
if (informationType == InformationClass.PolicyAuditLogInformation)
{
#region MS-LSAD_R369
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.AccessDenied),
(uint)uintMethodStatus,
"MS-LSAD",
369,
@"If InformationClass value of LsarSetInformationPolicy is PolicyAuditLogInformation
then type of access required MUST be POLICY_AUDIT_LOG_ADMIN");
#endregion
}
if (informationType == InformationClass.PolicyDnsDomainInformation)
{
#region MS-LSAD_R378
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.AccessDenied),
(uint)uintMethodStatus,
"MS-LSAD",
378,
@"If InformationClass value of LsarSetInformationPolicy is PolicyDnsDomainInformation
then type of access required MUST be POLICY_TRUST_ADMIN.");
#endregion
}
if (informationType == InformationClass.PolicyDnsDomainInformationInt)
{
#region MS-LSAD_R379
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.AccessDenied),
(uint)uintMethodStatus,
"MS-LSAD",
379,
@"If InformationClass value of LsarSetInformationPolicy is PolicyDnsDomainInformationInt
then type of access required MUST be POLICY_TRUST_ADMIN.");
#endregion
}
if (informationType == InformationClass.PolicyLocalAccountDomainInformation)
{
if (this.serverPlatform == Server.Windows2k8)
{
#region MS-LSAD_R380
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.AccessDenied),
(uint)uintMethodStatus,
"MS-LSAD",
380,
@"If InformationClass value of LsarSetInformationPolicy is
PolicyLocalAccountDomainInformation then type of access required
MUST be POLICY_TRUST_ADMIN.");
#endregion
}
}
if (informationType == InformationClass.PolicyLsaServerRoleInformation)
{
#region MS-LSAD_R372
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.AccessDenied),
(uint)uintMethodStatus,
"MS-LSAD",
372,
@"If InformationClass value of LsarSetInformationPolicy is
PolicyLsaServerRoleInformation then type of access required
MUST be POLICY_SERVER_ADMIN");
#endregion
}
if (informationType == InformationClass.PolicyReplicaSourceInformation)
{
#region MS-LSAD_R373
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.AccessDenied),
(uint)uintMethodStatus,
"MS-LSAD",
373,
@"If InformationClass value of LsarSetInformationPolicy is
PolicyReplicaSourceInformation then type of access required
MUST be POLICY_SERVER_ADMIN");
#endregion
}
if (informationType == InformationClass.PolicyPdAccountInformation)
{
#region MS-LSAD_R300
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.AccessDenied),
(uint)uintMethodStatus,
"MS-LSAD",
300,
@"If InformationClass value of LsarQueryInformationPolicy is PolicyPdAccountInformation
then Type of access required MUST be POLICY_GET_PRIVATE_INFORMATION(0x00000004)");
#endregion
}
#region MS-LSAD_R368
Site.CaptureRequirementIfAreEqual<uint>(
((uint)ErrorStatus.AccessDenied),
(uint)uintMethodStatus,
"MS-LSAD",
368,
@"If the context of LsarSetInformationPolicy does not have sufficient access,
the server MUST return STATUS_AccessDenied.");
#endregion
break;
default:
break;
}
#endregion Capturing_Requirement for Status other than Invalid Handle
}
return (ErrorStatus)uintMethodStatus;
}