/// <summary> /// The Initialize is invoked to initialize the environment for server. /// </summary> /// <param name="serverConfig">Values for server configuration whether it is DC or Non DCalues</param> /// <param name="anonymousAccess">Values for setting access to anonymous requester</param> /// <param name="windowsServer">SUT's OS version</param> /// <param name="noOfHandles">Specifies the maximum number of handles /// that can be opened by OpenPolicy and OpenPolcy2 methods at any instant of time</param> /// <param name="isDomainAdmin">Set true if the user is Domain Admin, else set false</param> public void Initialize( ProtocolServerConfig serverConfig, AnonymousAccess anonymousAccess, Server windowsServer, int noOfHandles, bool isDomainAdmin) { lsadClientStack = new LsaClient(); lsadAdapter = Site.GetAdapter <ILsadManagedAdapter>(); if (serverConfig == ProtocolServerConfig.DomainController || serverConfig == ProtocolServerConfig.PrimaryDomainController) { isDC = true; this.strServerName = this.PDCNetbiosName; } else if (serverConfig == ProtocolServerConfig.ReadOnlyDomainController) { isDC = true; this.strServerName = this.RODCNetbiosName; } else if (serverConfig == ProtocolServerConfig.NonDomainController) { isDC = false; this.strServerName = this.DMNetbiosName; } if (isDomainAdmin) { this.userName = this.DomainAdministratorName; IsInDomainAdminsGroup = true; } else if (!isDomainAdmin) { this.userName = DomainUserName; IsInDomainAdminsGroup = false; } fullDomain = this.PrimaryDomainDnsName; domain = this.PrimaryDomainNetBiosName; this.timeout = TimeSpan.FromMilliseconds(GetDoubleProperty(propertyGroup + "TimeoutMilliseconds")); secretNameOfSecretObject = ValidName; isWindows = !ServerVersion.NonWin.Equals(PDCOSVersion) && !ServerVersion.Invalid.Equals(PDCOSVersion); this.disposed = false; this.serverName = utilities.ConversionfromStringtoushortArray(this.strServerName); DomainGUID = this.PrimaryDomainSrvGUID.ToLower(); AccountCredential transportCredential = new AccountCredential(string.Empty, this.userName, this.DomainUserPassword); lsadClientStack.BindOverNamedPipe( this.strServerName, transportCredential, null, RpceAuthenticationLevel.RPC_C_AUTHN_LEVEL_NONE, this.timeout); base.Initialize(Site); lsadUUID = constLsadUUID; lsadendPoint = constLsadendPoint; lsadProtocolSequence = constLsadProtocolSequence; stPolicyInformation.PHandle = 0; stPolicyInformation.AccessforHandle = ACCESS_MASK.ACCOUNT_ADJUST_PRIVILEGES; serverPlatform = windowsServer; ////SID SubAuthorityCount value. objAccountSid[0].SubAuthorityCount = SIDCount; ////_RPC_SID.SubAuthority array size. objAccountSid[0].SubAuthority = new uint[SID]; htAccHandle.Clear(); htAddAccRight.Clear(); checkTrustHandle = false; isitSetTrustedDomainInfo = false; trustObjectCreateinformation.doesTdoSupportForestInformation = false; trustObjectCreateinformation.intTdoHandleNumber = 0; trustObjectCreateinformation.isForestInformationPresent = false; trustObjectCreateinformation.strDomainSid = string.Empty; trustObjectCreateinformation.strTdoDnsName = string.Empty; trustObjectCreateinformation.strTdoNetBiosName = string.Empty; trustObjectCreateinformation.uintTdoDesiredAccess = 0; trustObjectCreateinformation.uintTrustAttr = 0; trustObjectCreateinformation.uintTrustDir = 0; trustObjectCreateinformation.uintTrustType = 0; domainState = serverConfig; stSecretInformation.strNameOfSecretObject = string.Empty; stSecretInformation.UIntSecretHandleAccessCount = 1; }
/// <summary> /// Default Anonymous mode /// </summary> public ScoopItService() { var anonymousScoopItAccess = new AnonymousAccess(); this.InitScoopItService(anonymousScoopItAccess.AccessCredentials); }