コード例 #1
0
        private bool ADServiceAccountCmdletBaseProcessCSRoutine()
        {
            ADObject         directoryObjectFromIdentity;
            ADServiceAccount item = this._cmdletParameters["Identity"] as ADServiceAccount;

            this.SetPipelinedSessionInfo(item.SessionInfo);
            CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo();

            this._factory.SetCmdletSessionInfo(cmdletSessionInfo);
            ICollection <string> extendedPropertiesToFetch = this.GetExtendedPropertiesToFetch();

            if (extendedPropertiesToFetch == null || extendedPropertiesToFetch.Count == 0)
            {
                directoryObjectFromIdentity = this._factory.GetDirectoryObjectFromIdentity(item, cmdletSessionInfo.DefaultPartitionPath);
            }
            else
            {
                directoryObjectFromIdentity = this._factory.GetExtendedObjectFromIdentity(item, cmdletSessionInfo.DefaultPartitionPath, extendedPropertiesToFetch, false);
            }
            if (base.ShouldProcessOverride(directoryObjectFromIdentity.DistinguishedName, this._cmdletVerb))
            {
                this.PerformOperation(directoryObjectFromIdentity);
            }
            return(true);
        }
コード例 #2
0
 internal static void InsertClaimTransformRule(ADParameterSet parameters, CmdletSessionInfo cmdletSessionInfo)
 {
     if (parameters.GetSwitchParameterBooleanValue("DenyAll"))
     {
         parameters["Rule"] = ADCBACUtil.CreateClaimTransformDenyRule(null);
     }
     if (!parameters.GetSwitchParameterBooleanValue("AllowAll"))
     {
         if (!parameters.Contains("AllowAllExcept") || parameters["AllowAllExcept"] == null)
         {
             if (parameters.Contains("DenyAllExcept") && parameters["DenyAllExcept"] != null)
             {
                 string[] claimTypeName = ADCBACUtil.GetClaimTypeName((ADClaimType[])parameters["DenyAllExcept"], cmdletSessionInfo, "DenyAllExcept");
                 parameters["Rule"] = ADCBACUtil.CreateClaimTransformDenyRule(claimTypeName);
             }
             return;
         }
         else
         {
             string[] strArrays = ADCBACUtil.GetClaimTypeName((ADClaimType[])parameters["AllowAllExcept"], cmdletSessionInfo, "AllowAllExcept");
             parameters["Rule"] = ADCBACUtil.CreateClaimTransformAllowRule(strArrays);
             return;
         }
     }
     else
     {
         parameters["Rule"] = ADCBACUtil.CreateClaimTransformAllowRule(null);
         return;
     }
 }
コード例 #3
0
        private bool GetADGroupMemberProcessCSRoutine()
        {
            this._partitionPath   = this._cmdletParameters["Partition"] as string;
            this._identityADGroup = this._cmdletParameters["Identity"] as ADGroup;
            this._isRecursive     = this._cmdletParameters.GetSwitchParameterBooleanValue("Recursive");
            base.SetPipelinedSessionInfo(this._identityADGroup.SessionInfo);
            CmdletSessionInfo        cmdletSessionInfo = base.GetCmdletSessionInfo();
            ADGroupFactory <ADGroup> aDGroupFactory    = new ADGroupFactory <ADGroup>();

            aDGroupFactory.SetCmdletSessionInfo(cmdletSessionInfo);
            this.ValidateParameters();
            ADObject directoryObjectFromIdentity = aDGroupFactory.GetDirectoryObjectFromIdentity(this._identityADGroup, cmdletSessionInfo.DefaultPartitionPath);

            using (ADAccountManagement aDAccountManagement = new ADAccountManagement(cmdletSessionInfo.ADSessionInfo))
            {
                ADPrincipal[] groupMembers     = aDAccountManagement.GetGroupMembers(cmdletSessionInfo.DefaultPartitionPath, directoryObjectFromIdentity.DistinguishedName, this._isRecursive);
                ADPrincipal[] aDPrincipalArray = groupMembers;
                for (int i = 0; i < (int)aDPrincipalArray.Length; i++)
                {
                    ADPrincipal aDPrincipal = aDPrincipalArray[i];
                    base.WriteObject(aDPrincipal);
                }
            }
            return(true);
        }
コード例 #4
0
        private bool SetADFGPPSubjectEndProcessCSRoutine()
        {
            Hashtable hashtables             = new Hashtable();
            ADFineGrainedPasswordPolicy item = this._cmdletParameters["Identity"] as ADFineGrainedPasswordPolicy;

            if (item.IsSearchResult)
            {
                this.SetPipelinedSessionInfo(item.SessionInfo);
            }
            CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo();

            this._factory.SetCmdletSessionInfo(cmdletSessionInfo);
            if (this._operationType != SetSubjectOperationType.AddSubject)
            {
                if (this._operationType == SetSubjectOperationType.RemoveSubject)
                {
                    hashtables.Add(PropertyModifyOp.Remove.ToString(), this._appliesToDNList.ToArray());
                }
            }
            else
            {
                hashtables.Add(PropertyModifyOp.Add.ToString(), this._appliesToDNList.ToArray());
            }
            this._cmdletParameters["AppliesTo"] = new ADMultivalueHashtableParameter <string>(hashtables);
            return(true);
        }
コード例 #5
0
ファイル: NewADUser.cs プロジェクト: modulexcite/pash-1
        protected internal override void ValidateParameters()
        {
            base.ValidateParameters();
            CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo();

            if (cmdletSessionInfo.ADRootDSE.ServerType == ADServerType.ADDS && string.IsNullOrEmpty((string)this._cmdletParameters["SamAccountName"]))
            {
                this._cmdletParameters["SamAccountName"] = this._cmdletParameters["Name"];
            }
            bool?item = (bool?)this._cmdletParameters["ChangePasswordAtLogon"];

            if (item.HasValue)
            {
                bool?nullable = (bool?)this._cmdletParameters["PasswordNeverExpires"];
                if (nullable.HasValue)
                {
                    bool?item1 = (bool?)this._cmdletParameters["ChangePasswordAtLogon"];
                    if (item1.Value)
                    {
                        bool?nullable1 = (bool?)this._cmdletParameters["PasswordNeverExpires"];
                        if (nullable1.Value)
                        {
                            object[] objArray = new object[1];
                            objArray[0] = "PasswordNeverExpires";
                            throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.AcctChangePwdNotWorksWhenPwdNotExpires, objArray));
                        }
                    }
                }
            }
        }
コード例 #6
0
ファイル: ADReplicationUtil.cs プロジェクト: nickchal/pash
		internal static void ToExtendedAttributeMetadataValue(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			string value = directoryObj["sourceXmlAttribute"].Value as string;
			if (!string.Equals("msDS-ReplAttributeMetaData", value, StringComparison.OrdinalIgnoreCase))
			{
				if (string.Equals("msDS-ReplValueMetaData", value, StringComparison.OrdinalIgnoreCase))
				{
					AttributeConverters.ToExtendedObject(extendedAttribute, directoryAttributes, userObj, directoryObj, cmdletSessionInfo);
				}
				return;
			}
			else
			{
				string str = directoryObj["pszAttributeName"].Value as string;
				if (string.IsNullOrEmpty(str))
				{
					userObj.SetValue(extendedAttribute, null);
					return;
				}
				else
				{
					userObj.SetValue(extendedAttribute, directoryObj[str]);
					return;
				}
			}
		}
コード例 #7
0
 private bool SetADPrincipalGroupMembershipProcessCSRoutine()
 {
     if (this._cmdletParameters.Contains("Identity"))
     {
         ADPrincipal item = this._cmdletParameters["Identity"] as ADPrincipal;
         this.SetPipelinedSessionInfo(item.SessionInfo);
         CmdletSessionInfo cmdletSessionInfo = base.GetCmdletSessionInfo();
         this._factory.SetCmdletSessionInfo(cmdletSessionInfo);
         base.ValidateParameters();
         this.ValidateMemberOfParameter();
         try
         {
             ADPrincipal extendedObjectFromIdentity = this._factory.GetExtendedObjectFromIdentity(item, cmdletSessionInfo.DefaultPartitionPath);
             this._validExtendedPrincipalList.Add(extendedObjectFromIdentity);
         }
         catch (ADIdentityNotFoundException aDIdentityNotFoundException1)
         {
             ADIdentityNotFoundException aDIdentityNotFoundException = aDIdentityNotFoundException1;
             base.ThrowTerminatingError(ADUtilities.GetErrorRecord(aDIdentityNotFoundException, "SetADPrincipalGroupMembership:ProcessRecordOverride", item));
         }
         return(true);
     }
     else
     {
         object[] objArray = new object[1];
         objArray[0] = "Identity";
         throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.ParameterRequired, objArray));
     }
 }
コード例 #8
0
        protected bool GetADReplicationQueueOperationProcessCSRoutine()
        {
            ADEntity rootDSE;
            string   item = this._cmdletParameters["Server"] as string;

            if (!base.DoesServerNameRepresentDomainName(item))
            {
                CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo();
                this._factory.SetCmdletSessionInfo(cmdletSessionInfo);
                string[] strArrays = new string[1];
                strArrays[0] = "msDS-ReplPendingOps";
                string[] strArrays1 = strArrays;
                using (ADObjectSearcher aDObjectSearcher = new ADObjectSearcher(cmdletSessionInfo.ADSessionInfo))
                {
                    rootDSE = aDObjectSearcher.GetRootDSE(strArrays1);
                }
                foreach (ADReplicationQueueOperation extendedObjectFromDirectoryObject in this._factory.GetExtendedObjectFromDirectoryObject(rootDSE, "msDS-ReplPendingOps", "DS_REPL_OP"))
                {
                    base.WriteObject(extendedObjectFromDirectoryObject);
                }
                return(true);
            }
            else
            {
                object[] objArray = new object[1];
                objArray[0] = item;
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.ServerIsNotDirectoryServer, objArray));
            }
        }
コード例 #9
0
        protected bool ADSetCmdletBaseBeginCSRoutine()
        {
            bool flag;

            if (this._cmdletParameters.Contains("Instance"))
            {
                O item = (O)(this._cmdletParameters["Instance"] as O);
                this.SetPipelinedSessionInfo(item.SessionInfo);
                CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo();
                this._factory.SetCmdletSessionInfo(cmdletSessionInfo);
                this.ValidateParameters();
                if (item.IsSearchResult)
                {
                    if (item.GetType() == typeof(O))
                    {
                        this._factory.ValidateObjectClass(item);
                        ADObject directoryObjectFromIdentity = this._factory.GetDirectoryObjectFromIdentity(item, cmdletSessionInfo.DefaultPartitionPath);
                        using (ADActiveObject aDActiveObject = new ADActiveObject(base.GetSessionInfo(), directoryObjectFromIdentity))
                        {
                            if (base.ShouldProcessOverride(item.IdentifyingString, "Set"))
                            {
                                this._factory.UpdateFromObject(item, directoryObjectFromIdentity);
                                this._factory.PreCommitProcesing(ADFactory <O> .DirectoryOperation.Update, item, this._cmdletParameters, directoryObjectFromIdentity);
                                aDActiveObject.Update();
                                if (this._factory.PostCommitProcesing(ADFactory <O> .DirectoryOperation.Update, item, this._cmdletParameters, directoryObjectFromIdentity))
                                {
                                    aDActiveObject.Update();
                                }
                                if (this._cmdletParameters.Contains("PassThru"))
                                {
                                    O extendedObjectFromDN = this._factory.GetExtendedObjectFromDN(directoryObjectFromIdentity.DistinguishedName);
                                    if (extendedObjectFromDN != null)
                                    {
                                        base.WriteObject(extendedObjectFromDN);
                                    }
                                }
                                this._setProcessed = true;
                                return(true);
                            }
                            else
                            {
                                flag = false;
                            }
                        }
                        return(flag);
                    }
                    else
                    {
                        object[] str = new object[1];
                        str[0] = typeof(O).ToString();
                        throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.InstanceMustBeOfType, str));
                    }
                }
                else
                {
                    throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.OnlySearchResultsSupported, new object[0]));
                }
            }
            return(true);
        }
コード例 #10
0
        // Methods
        internal override void PerServerProcessRecord()
        {
            ADObjectFactory <ADObject> factory           = new ADObjectFactory <ADObject>();
            CmdletSessionInfo          cmdletSessionInfo = this.GetCmdletSessionInfo();

            factory.SetCmdletSessionInfo(cmdletSessionInfo);
            base._factory.SetCmdletSessionInfo(cmdletSessionInfo);
            string[] propertiesToFetch = new string[] { "msDS-NCReplCursors" };
            string[] partitionList     = base._cmdletParameters["PartitionFilter"] as string[];
            if (partitionList == null)
            {
                partitionList = new string[] { "Default" };
            }
            foreach (string str in ADForestPartitionInfo.ConstructPartitionList(cmdletSessionInfo.ADRootDSE, partitionList, false))
            {
                ADObject identityObj = new ADObject(str);
                try
                {
                    identityObj = factory.GetExtendedObjectFromIdentity(identityObj, cmdletSessionInfo.DefaultPartitionPath, propertiesToFetch);
                }
                catch (Exception exception)
                {
                    if (!(exception is ADIdentityNotFoundException) && !(exception is ADReferralException))
                    {
                        throw exception;
                    }
                    continue;
                }
                foreach (ADReplicationUpToDatenessVectorTable table in base._factory.GetExtendedObjectFromDirectoryObject(identityObj, "msDS-NCReplCursors", "DS_REPL_CURSOR"))
                {
                    base.WriteObject(table);
                }
            }
        }
コード例 #11
0
ファイル: ADDomainUtil.cs プロジェクト: modulexcite/pash-1
        public static string FindDomainNCHead(string identity, CmdletSessionInfo session)
        {
            ADObject aDObject;

            using (ADObjectSearcher aDObjectSearcher = new ADObjectSearcher(session.ADSessionInfo))
            {
                aDObjectSearcher.SearchRoot = string.Concat("CN=Partitions,", session.ADRootDSE.ConfigurationNamingContext);
                aDObjectSearcher.Scope      = ADSearchScope.OneLevel;
                IADOPathNode[] aDOPathNodeArray = new IADOPathNode[3];
                aDOPathNodeArray[0] = ADOPathUtil.CreateFilterClause(ADOperator.Eq, "objectCategory", "crossRef");
                aDOPathNodeArray[1] = ADOPathUtil.CreateFilterClause(ADOperator.Band, "systemFlags", 3);
                IADOPathNode[] aDOPathNodeArray1 = new IADOPathNode[3];
                aDOPathNodeArray1[0]    = ADOPathUtil.CreateFilterClause(ADOperator.Eq, "nCName", identity);
                aDOPathNodeArray1[1]    = ADOPathUtil.CreateFilterClause(ADOperator.Eq, "nETBIOSName", identity);
                aDOPathNodeArray1[2]    = ADOPathUtil.CreateFilterClause(ADOperator.Eq, "dnsRoot", identity);
                aDOPathNodeArray[2]     = ADOPathUtil.CreateOrClause(aDOPathNodeArray1);
                aDObjectSearcher.Filter = ADOPathUtil.CreateAndClause(aDOPathNodeArray);
                aDObjectSearcher.Properties.Add("nCName");
                aDObject = aDObjectSearcher.FindOne();
            }
            if (aDObject != null)
            {
                return(aDObject.GetValue("nCName") as string);
            }
            else
            {
                return(null);
            }
        }
コード例 #12
0
ファイル: AccountExpiresUtils.cs プロジェクト: nickchal/pash
		public static IADOPathNode ToSearchAccountExpirationDate(string extendedAttribute, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo)
		{
			bool flag;
			BinaryADOPathNode binaryADOPathNode = filterClause as BinaryADOPathNode;
			if (binaryADOPathNode == null)
			{
				throw new ArgumentException(StringResources.SearchConverterNotBinaryNode);
			}
			else
			{
				PropertyADOPathNode propertyADOPathNode = new PropertyADOPathNode(directoryAttributes[0]);
				IDataNode rightNode = binaryADOPathNode.RightNode as IDataNode;
				if (rightNode == null)
				{
					throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode);
				}
				else
				{
					ObjectADOPathNode objectADOPathNode = new ObjectADOPathNode(rightNode.DataObject);
					objectADOPathNode.EncodeAsteriskChar = rightNode.EncodeAsteriskChar;
					IADOPathNode searchDateTimeUsingSchemaInfo = new BinaryADOPathNode(binaryADOPathNode.Operator, propertyADOPathNode, objectADOPathNode);
					searchDateTimeUsingSchemaInfo = SearchConverters.ToSearchDateTimeUsingSchemaInfo(extendedAttribute, directoryAttributes, searchDateTimeUsingSchemaInfo, cmdletSessionInfo);
					bool flag1 = true;
					if (binaryADOPathNode.Operator != ADOperator.Eq)
					{
						if (binaryADOPathNode.Operator == ADOperator.Like)
						{
							if (rightNode.DataObject as string == null)
							{
								flag = false;
							}
							else
							{
								flag = ADOPathUtil.IsValueAllAsterisk((string)rightNode.DataObject);
							}
							flag1 = flag;
						}
					}
					else
					{
						flag1 = false;
					}
					if (!flag1)
					{
						return searchDateTimeUsingSchemaInfo;
					}
					else
					{
						IADOPathNode[] aDOPathNodeArray = new IADOPathNode[2];
						aDOPathNodeArray[0] = ADOPathUtil.CreateFilterClause(ADOperator.Eq, directoryAttributes[0], 0);
						aDOPathNodeArray[1] = ADOPathUtil.CreateFilterClause(ADOperator.Eq, directoryAttributes[0], 0x7fffffffffffffffL);
						IADOPathNode aDOPathNode = ADOPathUtil.CreateNotClause(ADOPathUtil.CreateOrClause(aDOPathNodeArray));
						IADOPathNode[] aDOPathNodeArray1 = new IADOPathNode[2];
						aDOPathNodeArray1[0] = searchDateTimeUsingSchemaInfo;
						aDOPathNodeArray1[1] = aDOPathNode;
						return ADOPathUtil.CreateAndClause(aDOPathNodeArray1);
					}
				}
			}
		}
コード例 #13
0
ファイル: GroupTypeUtils.cs プロジェクト: nickchal/pash
		public static void ToDirectoryGroupScope(string extendedAttribute, string[] directoryAttributes, ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			ADGroupScope aDGroupScope = ADGroupScope.DomainLocal;
			if (extendedData != null)
			{
				if (extendedData.Value != null)
				{
					ADGroupScope value = (ADGroupScope)extendedData.Value;
					int directoryGroupTypeValue = GroupTypeUtils.GetDirectoryGroupTypeValue(value);
					if (!directoryObj.Contains(directoryAttributes[0]))
					{
						directoryObj.Add(directoryAttributes[0], directoryGroupTypeValue);
					}
					else
					{
						int num = (int)directoryObj[directoryAttributes[0]].Value;
						if (GroupTypeUtils.TryGetExtendedGroupScopeValue(num, out aDGroupScope))
						{
							int directoryGroupTypeValue1 = GroupTypeUtils.GetDirectoryGroupTypeValue(aDGroupScope);
							num = num & ~directoryGroupTypeValue1;
						}
						directoryObj[directoryAttributes[0]].Value = num + directoryGroupTypeValue;
						return;
					}
				}
				else
				{
					return;
				}
			}
		}
コード例 #14
0
 private static IDictionary <string, ADObject> GetProtectedFromDeletionCache(CmdletSessionInfo cmdletSessionInfo)
 {
     if (!cmdletSessionInfo.CmdletSessionCache.ContainsSubcache("ProtectedFromDeletionCache"))
     {
         cmdletSessionInfo.CmdletSessionCache.SetSubcache("ProtectedFromDeletionCache", new Dictionary <string, ADObject>());
     }
     return(cmdletSessionInfo.CmdletSessionCache.GetSubcache("ProtectedFromDeletionCache") as Dictionary <string, ADObject>);
 }
コード例 #15
0
        private bool ADNewCmdletBaseProcessCSRoutine()
        {
            bool flag;

            this.ValidateParameters();
            CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo();

            this._factory.SetCmdletSessionInfo(cmdletSessionInfo);
            string item = this._cmdletParameters["Path"] as string;

            if (string.IsNullOrEmpty(item))
            {
                item = this.GetDefaultCreationPath();
                if (string.IsNullOrEmpty(item))
                {
                    object[] objArray = new object[1];
                    objArray[0] = "Path";
                    throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.ParameterRequired, objArray));
                }
            }
            string str  = this.GenerateObjectClass(this._factory, this._cmdletParameters, this._cmdletParameters);
            string str1 = this.GenerateDN(this._factory, this._cmdletParameters, this._cmdletParameters, item);

            this._currentIdentity = str1;
            ADObject aDObject = new ADObject(str1, str);

            using (ADActiveObject aDActiveObject = new ADActiveObject(cmdletSessionInfo.ADSessionInfo, aDObject))
            {
                if (base.ShouldProcessOverride(aDObject.DistinguishedName, "New"))
                {
                    this._factory.UpdateFromParameters(this._defaultParamSet, null, null, null, null, aDObject);
                    if (this._cmdletParameters.Contains("Instance"))
                    {
                        this._factory.UpdateFromTemplate((O)(this._cmdletParameters["Instance"] as O), aDObject);
                    }
                    this._factory.UpdateFromParameters(this._cmdletParameters, null, this._cmdletParameters["OtherAttributes"] as Hashtable, null, null, aDObject);
                    this._factory.PreCommitProcesing(ADFactory <O> .DirectoryOperation.Create, (O)(this._cmdletParameters["Instance"] as O), this._cmdletParameters, aDObject);
                    aDActiveObject.Create();
                    aDObject.TrackChanges = true;
                    bool flag1 = this._factory.PostCommitProcesing(ADFactory <O> .DirectoryOperation.Create, (O)(this._cmdletParameters["Instance"] as O), this._cmdletParameters, aDObject);
                    if (flag1)
                    {
                        aDActiveObject.Update();
                    }
                    if (this._cmdletParameters.GetSwitchParameterBooleanValue("PassThru"))
                    {
                        O extendedObjectFromDN = this._factory.GetExtendedObjectFromDN(aDObject.DistinguishedName);
                        base.WriteObject(extendedObjectFromDN);
                    }
                    return(true);
                }
                else
                {
                    flag = false;
                }
            }
            return(flag);
        }
コード例 #16
0
        private bool SetADComputerServiceAccountBeginCSRoutine()
        {
            object item = this._cmdletParameters["ServiceAccount"];

            ADServiceAccount[] aDServiceAccountArray = item as ADServiceAccount[];
            if (aDServiceAccountArray == null)
            {
                ADServiceAccount aDServiceAccount = item as ADServiceAccount;
                if (aDServiceAccount != null)
                {
                    ADServiceAccount[] aDServiceAccountArray1 = new ADServiceAccount[1];
                    aDServiceAccountArray1[0] = aDServiceAccount;
                    aDServiceAccountArray     = aDServiceAccountArray1;
                }
            }
            if (aDServiceAccountArray == null)
            {
                ArgumentException argumentException = new ArgumentException(StringResources.ObjectNotFound);
                base.ThrowTerminatingError(new ErrorRecord(argumentException, "SetADComputerServiceAccount:BeginProcessingOverride", ErrorCategory.ObjectNotFound, this));
            }
            else
            {
                List <string>           strs = new List <string>();
                List <ADServiceAccount> aDServiceAccounts = new List <ADServiceAccount>();
                Hashtable hashtables = new Hashtable();
                ADServiceAccountFactory <ADServiceAccount> aDServiceAccountFactory = new ADServiceAccountFactory <ADServiceAccount>();
                ADServiceAccount[] aDServiceAccountArray2 = aDServiceAccountArray;
                for (int i = 0; i < (int)aDServiceAccountArray2.Length; i++)
                {
                    ADServiceAccount aDServiceAccount1 = aDServiceAccountArray2[i];
                    base.SetPipelinedSessionInfo(aDServiceAccount1.SessionInfo);
                    CmdletSessionInfo cmdletSessionInfo = base.GetCmdletSessionInfo();
                    aDServiceAccountFactory.SetCmdletSessionInfo(cmdletSessionInfo);
                    try
                    {
                        ADObject directoryObjectFromIdentity = aDServiceAccountFactory.GetDirectoryObjectFromIdentity(aDServiceAccount1, cmdletSessionInfo.DefaultPartitionPath);
                        strs.Add(directoryObjectFromIdentity.DistinguishedName);
                        this._resolvedServiceAccountList.Add(directoryObjectFromIdentity);
                    }
                    catch (ADIdentityNotFoundException aDIdentityNotFoundException1)
                    {
                        ADIdentityNotFoundException aDIdentityNotFoundException = aDIdentityNotFoundException1;
                        DebugLogger.LogError("SetADComputerServiceAccount", aDIdentityNotFoundException.ToString());
                        aDServiceAccounts.Add(aDServiceAccount1);
                    }
                }
                if (aDServiceAccounts.Count > 0)
                {
                    ArgumentException argumentException1 = new ArgumentException(StringResources.ObjectNotFound);
                    base.ThrowTerminatingError(new ErrorRecord(argumentException1, "SetADComputerServiceAccount:BeginProcessingOverride", ErrorCategory.ObjectNotFound, aDServiceAccounts.ToArray()));
                }
                hashtables.Add(this._modifyOpString, strs.ToArray());
                this._cmdletParameters.RemoveParameter("ServiceAccount");
                this._cmdletParameters["ServiceAccount"] = new ADMultivalueHashtableParameter <string>(hashtables);
            }
            return(true);
        }
コード例 #17
0
        protected internal override void ValidateParameters()
        {
            base.ValidateParameters();
            CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo();

            if (cmdletSessionInfo.ADRootDSE.ServerType == ADServerType.ADDS && string.IsNullOrEmpty((string)this._cmdletParameters["SamAccountName"]))
            {
                this._cmdletParameters["SamAccountName"] = this._cmdletParameters["Name"];
            }
        }
コード例 #18
0
        private bool ADTargetScopeEnumerationServerProcessCSRoutine()
        {
            bool hasValue;

            this._currentCmdletSessionInfo = this.GetCmdletSessionInfo();
            foreach (ADSessionInfo credential in this._sessionPipe)
            {
                if (this._currentCmdletSessionInfo.ADSessionInfo != null)
                {
                    credential.Credential = this._currentCmdletSessionInfo.ADSessionInfo.Credential;
                }
                this._currentCmdletSessionInfo.ADRootDSE     = null;
                this._currentCmdletSessionInfo.ADSessionInfo = credential;
                try
                {
                    using (ADObjectSearcher aDObjectSearcher = new ADObjectSearcher(credential))
                    {
                        this._currentCmdletSessionInfo.ADRootDSE             = aDObjectSearcher.GetRootDSE();
                        this._currentCmdletSessionInfo.ADRootDSE.SessionInfo = credential;
                    }
                    if (this.UseGCPortIfAvailable && !credential.ConnectedToGC && !credential.UsingExplicitPort)
                    {
                        bool?globalCatalogReady = this._currentCmdletSessionInfo.ADRootDSE.GlobalCatalogReady;
                        if (!globalCatalogReady.GetValueOrDefault())
                        {
                            hasValue = false;
                        }
                        else
                        {
                            hasValue = globalCatalogReady.HasValue;
                        }
                        if (hasValue)
                        {
                            credential.SetEffectivePort(LdapConstants.LDAP_GC_PORT);
                        }
                    }
                    this._currentCmdletSessionInfo.ConnectedADServerType = this.GetConnectedStore();
                    this._currentCmdletSessionInfo.DefaultQueryPath      = this.GetDefaultQueryPath();
                    this._currentCmdletSessionInfo.DefaultCreationPath   = this.GetDefaultCreationPath();
                    this._currentCmdletSessionInfo.DefaultPartitionPath  = this.GetDefaultPartitionPath();
                    this.PerServerProcessRecord();
                }
                catch (ADServerDownException aDServerDownException1)
                {
                    ADServerDownException aDServerDownException = aDServerDownException1;
                    base.WriteErrorBuffered(this.ConstructErrorRecord(aDServerDownException));
                }
                catch (AuthenticationException authenticationException1)
                {
                    AuthenticationException authenticationException = authenticationException1;
                    base.WriteErrorBuffered(this.ConstructErrorRecord(authenticationException));
                }
            }
            return(true);
        }
コード例 #19
0
        private bool ADRenameCmdletBaseProcessCSRoutine()
        {
            bool flag;
            O    item = (O)this._cmdletParameters["Identity"];

            this.SetPipelinedSessionInfo(item.SessionInfo);
            CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo();

            this._factory.SetCmdletSessionInfo(cmdletSessionInfo);
            this.ValidateParameters();
            string defaultPartitionPath = this._cmdletParameters["Partition"] as string;

            if (defaultPartitionPath == null)
            {
                defaultPartitionPath = this.GetDefaultPartitionPath();
                if (defaultPartitionPath == null && !item.IsSearchResult)
                {
                    object[] objArray = new object[1];
                    objArray[0] = "Partition";
                    throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.ParameterRequired, objArray));
                }
            }
            ADObject directoryObjectFromIdentity = this._factory.GetDirectoryObjectFromIdentity(item, defaultPartitionPath);

            using (ADActiveObject aDActiveObject = new ADActiveObject(cmdletSessionInfo.ADSessionInfo, directoryObjectFromIdentity))
            {
                string str = this.GenerateNewRDN(this._factory, this._cmdletParameters, this._cmdletParameters, directoryObjectFromIdentity.DistinguishedName);
                if (base.ShouldProcessOverride(directoryObjectFromIdentity.DistinguishedName, "Rename"))
                {
                    O o = default(O);
                    if (this._factory.PreCommitProcesing(ADFactory <O> .DirectoryOperation.Rename, o, this._cmdletParameters, directoryObjectFromIdentity))
                    {
                        aDActiveObject.Update();
                    }
                    aDActiveObject.Rename(str);
                    O o1 = default(O);
                    this._factory.PostCommitProcesing(ADFactory <O> .DirectoryOperation.Rename, o1, this._cmdletParameters, directoryObjectFromIdentity);
                    if (this._cmdletParameters.GetSwitchParameterBooleanValue("PassThru"))
                    {
                        string value                = directoryObjectFromIdentity["distinguishedName"].Value as string;
                        string parentPath           = ADPathModule.GetParentPath(value, null, ADPathFormat.X500);
                        string str1                 = ADPathModule.MakePath(parentPath, str, ADPathFormat.X500);
                        O      extendedObjectFromDN = this._factory.GetExtendedObjectFromDN(str1);
                        base.WriteObject(extendedObjectFromDN);
                    }
                    return(true);
                }
                else
                {
                    flag = false;
                }
            }
            return(flag);
        }
コード例 #20
0
        private bool MoveADDirectoryServerBeginCSRoutine()
        {
            this._inputSiteObj = this._cmdletParameters["Site"] as ADReplicationSite;
            base.SetPipelinedSessionInfo(this._inputSiteObj.SessionInfo);
            CmdletSessionInfo cmdletSessionInfo = base.GetCmdletSessionInfo();
            ADReplicationSiteFactory <ADReplicationSite> aDReplicationSiteFactory = new ADReplicationSiteFactory <ADReplicationSite>();

            aDReplicationSiteFactory.SetCmdletSessionInfo(cmdletSessionInfo);
            this._siteDirObj = aDReplicationSiteFactory.GetDirectoryObjectFromIdentity(this._inputSiteObj, cmdletSessionInfo.ADRootDSE.ConfigurationNamingContext);
            return(true);
        }
コード例 #21
0
        private static void UpdateNTMixedDomainMode(CmdletSessionInfo cmdletSessionInfo, int ntMixedDomainMode)
        {
            ADObject aDObject = new ADObject();

            aDObject.DistinguishedName = cmdletSessionInfo.ADRootDSE.DefaultNamingContext;
            using (ADActiveObject aDActiveObject = new ADActiveObject(cmdletSessionInfo.ADSessionInfo, aDObject))
            {
                aDObject.TrackChanges = true;
                aDObject.Add("ntMixedDomain", ntMixedDomainMode);
                aDActiveObject.Update();
            }
        }
コード例 #22
0
        private double GetInactiveTimeSpanDays(CmdletSessionInfo cmdletSessionInfo)
        {
            double    num = 0;
            double    num1;
            ADRootDSE rootDSE = this.GetRootDSE();
            string    defaultNamingContext = rootDSE.DefaultNamingContext;

            if (rootDSE.ServerType != ADServerType.ADDS || defaultNamingContext == null)
            {
                return(15);
            }
            else
            {
                SearchADAccountCmdlet._accountInactiveTimeSpanLock.EnterReadLock();
                try
                {
                    if (!SearchADAccountCmdlet._accountInactiveTimeSpanCache.TryGetValue(defaultNamingContext, out num))
                    {
                        double           value            = 15;
                        ADObjectSearcher aDObjectSearcher = SearchUtility.BuildSearcher(cmdletSessionInfo.ADSessionInfo, defaultNamingContext, ADSearchScope.Base);
                        using (aDObjectSearcher)
                        {
                            aDObjectSearcher.Filter = ADOPathUtil.CreateFilterClause(ADOperator.Like, "objectClass", "*");
                            aDObjectSearcher.Properties.Add("msDS-LogonTimeSyncInterval");
                            ADObject aDObject = aDObjectSearcher.FindOne();
                            if (aDObject != null && aDObject.Contains("msDS-LogonTimeSyncInterval") && aDObject["msDS-LogonTimeSyncInterval"].Count > 0)
                            {
                                value = (double)((int)aDObject["msDS-LogonTimeSyncInterval"].Value);
                            }
                        }
                        SearchADAccountCmdlet._accountInactiveTimeSpanLock.EnterWriteLock();
                        try
                        {
                            SearchADAccountCmdlet._accountInactiveTimeSpanCache[defaultNamingContext] = value;
                        }
                        finally
                        {
                            SearchADAccountCmdlet._accountInactiveTimeSpanLock.ExitWriteLock();
                        }
                        return(value);
                    }
                    else
                    {
                        num1 = num;
                    }
                }
                finally
                {
                    SearchADAccountCmdlet._accountInactiveTimeSpanLock.ExitReadLock();
                }
                return(num1);
            }
        }
コード例 #23
0
ファイル: ADCmdletBase`1.cs プロジェクト: modulexcite/pash-1
        internal virtual CmdletSessionInfo GetCmdletSessionInfo()
        {
            ADSessionInfo sessionInfo = this.GetSessionInfo();

            this.ConstructSessionCache(this._sessionInfo);
            if (this._cachedCmdletSessionInfo == null || this._cachedCmdletSessionInfo.ADSessionInfo != sessionInfo)
            {
                sessionInfo.ServerType        = this.GetConnectedStore();
                this._cachedCmdletSessionInfo = new CmdletSessionInfo(sessionInfo, this.GetRootDSE(), this.GetDefaultQueryPath(), this.GetDefaultPartitionPath(), this.GetDefaultCreationPath(), sessionInfo.ServerType, this._cmdletSessionCache, this, this, this._cmdletParameters);
            }
            return(this._cachedCmdletSessionInfo);
        }
コード例 #24
0
ファイル: ADFactoryBase`1.cs プロジェクト: modulexcite/pash-1
 internal virtual void SetCmdletSessionInfo(CmdletSessionInfo cmdletSessionInfo)
 {
     if (cmdletSessionInfo != null)
     {
         this._cmdletSessionInfo = cmdletSessionInfo;
         this._connectedStore    = this._cmdletSessionInfo.ConnectedADServerType;
         return;
     }
     else
     {
         throw new ArgumentNullException("cmdletSessionInfo");
     }
 }
コード例 #25
0
ファイル: AccountExpiresUtils.cs プロジェクト: nickchal/pash
		public static void ToDirectoryAccountExpirationDate(string extendedAttribute, string[] directoryAttributes, ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			if (extendedData.Count != 0 && extendedData[0] != null)
			{
				DateTime item = (DateTime)extendedData[0];
				if (item.Ticks != 0x89f7ff5f7b58000L)
				{
					AttributeConverters.ToDirectoryDateTime(extendedAttribute, directoryAttributes, extendedData, directoryObj, cmdletSessionInfo);
					return;
				}
			}
			directoryObj.SetValue(directoryAttributes[0], 0x7fffffffffffffffL);
		}
コード例 #26
0
        private bool ADTargetScopeEnumerationServerPreProcessPipelineCSRoutine()
        {
            if (!this._cmdletParameters.ContainsKey("Target"))
            {
                ADScopeType?item = (ADScopeType?)(this._cmdletParameters["Scope"] as ADScopeType?);
                if (item.Value != ADScopeType.Server)
                {
                    CmdletSessionInfo  cmdletSessionInfo  = this.GetCmdletSessionInfo();
                    ADDomainController aDDomainController = new ADDomainController(cmdletSessionInfo.ADRootDSE.DNSHostName);
                    ADDomainControllerFactory <ADDomainController> aDDomainControllerFactory = new ADDomainControllerFactory <ADDomainController>();
                    aDDomainControllerFactory.SetCmdletSessionInfo(cmdletSessionInfo);
                    ADDomainController extendedObjectFromIdentity = aDDomainControllerFactory.GetExtendedObjectFromIdentity(aDDomainController, null, null, false);
                    ADScopeType?       nullable       = (ADScopeType?)(this._cmdletParameters["Scope"] as ADScopeType?);
                    ADScopeType        valueOrDefault = nullable.GetValueOrDefault();
                    if (nullable.HasValue)
                    {
                        switch (valueOrDefault)
                        {
                        case ADScopeType.Domain:
                        {
                            string[] domain = new string[1];
                            domain[0] = extendedObjectFromIdentity.Domain;
                            this._cmdletParameters["Target"] = domain;
                            break;
                        }

                        case ADScopeType.Forest:
                        {
                            string[] forest = new string[1];
                            forest[0] = extendedObjectFromIdentity.Forest;
                            this._cmdletParameters["Target"] = forest;
                            break;
                        }

                        case ADScopeType.Site:
                        {
                            string[] site = new string[1];
                            site[0] = extendedObjectFromIdentity.Site;
                            this._cmdletParameters["Target"] = site;
                            break;
                        }
                        }
                    }
                }
                else
                {
                    throw new ADException(StringResources.ServerTargetParameterNotSpecified);
                }
            }
            return(true);
        }
コード例 #27
0
        private bool SetADFGPPSubjectBeginCSRoutine()
        {
            ADFineGrainedPasswordPolicy item = this._cmdletParameters["Identity"] as ADFineGrainedPasswordPolicy;

            if (item.IsSearchResult)
            {
                this.SetPipelinedSessionInfo(item.SessionInfo);
            }
            CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo();

            this._factory.SetCmdletSessionInfo(cmdletSessionInfo);
            base.ValidateParameters();
            return(true);
        }
コード例 #28
0
        private static int GetNTMixedDomainMode(CmdletSessionInfo cmdletSessionInfo)
        {
            int value;
            ADObjectSearcher aDObjectSearcher = SearchUtility.BuildSearcher(cmdletSessionInfo.ADSessionInfo, cmdletSessionInfo.ADRootDSE.DefaultNamingContext, ADSearchScope.Base);

            using (aDObjectSearcher)
            {
                aDObjectSearcher.Filter = ADOPathUtil.CreateFilterClause(ADOperator.Like, "objectClass", "*");
                aDObjectSearcher.Properties.Add("ntMixedDomain");
                ADObject aDObject = aDObjectSearcher.FindOne();
                value = (int)aDObject["ntMixedDomain"].Value;
            }
            return(value);
        }
コード例 #29
0
        protected internal virtual string GetIdentityObjectDN()
        {
            O item = (O)(this._cmdletParameters["Identity"] as O);
            CmdletSessionInfo cmdletSessionInfo           = this.GetCmdletSessionInfo();
            ADObject          directoryObjectFromIdentity = this._factory.GetDirectoryObjectFromIdentity(item, cmdletSessionInfo.DefaultPartitionPath);

            if (directoryObjectFromIdentity == null)
            {
                return(null);
            }
            else
            {
                return(directoryObjectFromIdentity.DistinguishedName);
            }
        }
コード例 #30
0
        internal static string[] GetClaimTypeName(ADClaimType[] claims, CmdletSessionInfo cmdletSessionInfo, string extendedAttribute)
        {
            List <string> strs = new List <string>();

            ADClaimType[] aDClaimTypeArray = claims;
            for (int i = 0; i < (int)aDClaimTypeArray.Length; i++)
            {
                ADClaimType aDClaimType = aDClaimTypeArray[i];
                string      str         = ADPathModule.MakePath(cmdletSessionInfo.ADRootDSE.ConfigurationNamingContext, "CN=Claims Configuration,CN=Services,", ADPathFormat.X500);
                str = ADPathModule.MakePath(str, "CN=Claim Types,", ADPathFormat.X500);
                string attributeValueFromObjectName = (string)AttributeConverters.GetAttributeValueFromObjectName <ADClaimTypeFactory <ADClaimType>, ADClaimType>(aDClaimType, str, "Name", extendedAttribute, cmdletSessionInfo);
                strs.Add(attributeValueFromObjectName);
            }
            return(strs.ToArray());
        }
コード例 #31
0
        private bool SetADDCPrpProcessCSRoutine()
        {
            this._identityDCObj = this._cmdletParameters["Identity"] as ADDomainController;
            this.SetPipelinedSessionInfo(this._identityDCObj.SessionInfo);
            CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo();
            ADDomainControllerFactory <ADDomainController> aDDomainControllerFactory = new ADDomainControllerFactory <ADDomainController>();

            aDDomainControllerFactory.SetCmdletSessionInfo(cmdletSessionInfo);
            ADObject      directoryObjectFromIdentity = aDDomainControllerFactory.GetDirectoryObjectFromIdentity(this._identityDCObj, cmdletSessionInfo.DefaultPartitionPath);
            StringBuilder stringBuilder = new StringBuilder("Set-ADObject -identity $args[0] ");

            if (this._operationType != SetADDCPasswordReplicationPolicyOperationType.AddPasswordReplicationPolicy)
            {
                if (this._operationType == SetADDCPasswordReplicationPolicyOperationType.RemovePasswordReplicationPolicy)
                {
                    stringBuilder.Append(" -Remove ");
                }
            }
            else
            {
                stringBuilder.Append(" -Add ");
            }
            stringBuilder.Append(" $args[1] ");
            if (base.ShouldProcessOverride(directoryObjectFromIdentity.IdentifyingString))
            {
                try
                {
                    object[] objArray = new object[2];
                    objArray[0] = directoryObjectFromIdentity;
                    objArray[1] = this._principalsToAddOrRemove;
                    base.InvokeCommand.InvokeScript(stringBuilder.ToString(), false, PipelineResultTypes.Output, null, objArray);
                }
                catch (RuntimeException runtimeException1)
                {
                    RuntimeException runtimeException = runtimeException1;
                    object[]         message          = new object[1];
                    message[0] = runtimeException.Message;
                    string str = string.Format(CultureInfo.CurrentCulture, "Failed adding or removing the password-replication-policy:  {0}", message);
                    DebugLogger.LogError("SetADDCPasswordReplicationPolicy", str);
                    base.WriteError(new ErrorRecord(runtimeException, "0", ErrorCategory.WriteError, this._identityDCObj));
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #32
0
 private bool GetADDCPrpProcessCSRoutine()
 {
     if (this._cmdletParameters.Contains("Identity"))
     {
         ADDomainController item = this._cmdletParameters["Identity"] as ADDomainController;
         this.SetPipelinedSessionInfo(item.SessionInfo);
         CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo();
         this._factory.SetCmdletSessionInfo(cmdletSessionInfo);
         this._returnObjectFactory.SetCmdletSessionInfo(cmdletSessionInfo);
         string[] sourceProperty = new string[1];
         sourceProperty[0] = this.SourceProperty;
         ADObject directoryObjectFromIdentity = this._factory.GetDirectoryObjectFromIdentity(item, cmdletSessionInfo.DefaultPartitionPath, sourceProperty);
         base.WritePropertiesToOutput(item, directoryObjectFromIdentity);
     }
     return(true);
 }
コード例 #33
0
ファイル: ADReplicationUtil.cs プロジェクト: nickchal/pash
		internal static void ToExtendedReplicationPartnerType(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			string value = directoryObj[directoryAttributes[0]].Value as string;
			if (!string.Equals("msDS-NCReplInboundNeighbors", value, StringComparison.OrdinalIgnoreCase))
			{
				if (string.Equals("msDS-NCReplOutboundNeighbors", value, StringComparison.OrdinalIgnoreCase))
				{
					userObj.Add(extendedAttribute, ADPartnerType.Outbound);
				}
				return;
			}
			else
			{
				userObj.Add(extendedAttribute, ADPartnerType.Inbound);
				return;
			}
		}
コード例 #34
0
        private bool ADGetCmdletBaseBeginCSRoutine()
        {
            IADOPathNode ldapFilterADOPathNode = null;
            bool         flag = false;

            this._showDeleted = this._cmdletParameters.GetSwitchParameterBooleanValue("IncludeDeletedObjects");
            if (this._cmdletParameters.Contains("Filter") || this._cmdletParameters.Contains("LDAPFilter"))
            {
                CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo();
                this._factory.SetCmdletSessionInfo(cmdletSessionInfo);
                this.ValidateParameters();
                this.BuildPropertySet();
            }
            if (!this._cmdletParameters.Contains("Filter"))
            {
                if (this._cmdletParameters.Contains("LDAPFilter"))
                {
                    ldapFilterADOPathNode = new LdapFilterADOPathNode(this._cmdletParameters["LDAPFilter"] as string);
                    flag = true;
                }
            }
            else
            {
                string item = this._cmdletParameters["Filter"] as string;
                try
                {
                    var obj = this._factory;
                    ConvertSearchFilterDelegate convertSearchFilterDelegate = new ConvertSearchFilterDelegate(obj.BuildSearchFilter);
                    VariableExpressionConverter variableExpressionConverter = new VariableExpressionConverter(new EvaluateVariableDelegate(this.EvaluateFilterVariable));
                    QueryParser queryParser = new QueryParser(item, variableExpressionConverter, convertSearchFilterDelegate);
                    ldapFilterADOPathNode = queryParser.FilterExpressionTree;
                }
                catch (ADFilterParsingException aDFilterParsingException1)
                {
                    ADFilterParsingException aDFilterParsingException = aDFilterParsingException1;
                    base.ThrowTerminatingError(base.ConstructErrorRecord(aDFilterParsingException));
                }
                flag = true;
            }
            this._filterProcessed = flag;
            if (flag)
            {
                this.OutputSearchResults(ldapFilterADOPathNode);
            }
            return(true);
        }
コード例 #35
0
ファイル: ADReplicationUtil.cs プロジェクト: nickchal/pash
		internal static void ToExtendedIsLinkValue(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			string value = directoryObj[directoryAttributes[0]].Value as string;
			if (!string.Equals("msDS-ReplAttributeMetaData", value, StringComparison.OrdinalIgnoreCase))
			{
				if (string.Equals("msDS-ReplValueMetaData", value, StringComparison.OrdinalIgnoreCase))
				{
					userObj.Add(extendedAttribute, true);
				}
				return;
			}
			else
			{
				userObj.Add(extendedAttribute, false);
				return;
			}
		}
コード例 #36
0
        protected internal override void ValidateParameters()
        {
            CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo();

            if (base.ParameterSetName == "Identity" && this._cmdletParameters["Identity"] == null)
            {
                if (!ProviderUtils.IsCurrentDriveAD(base.SessionState))
                {
                    this._cmdletParameters["Identity"] = new ADDomainController(cmdletSessionInfo.ADRootDSE.DNSHostName);
                }
                else
                {
                    this._cmdletParameters["Identity"] = new ADDomainController(((ADDriveInfo)base.SessionState.Drive.Current).Session.RootDSE.DNSHostName);
                    return;
                }
            }
        }
コード例 #37
0
ファイル: ADReplicationUtil.cs プロジェクト: nickchal/pash
		internal static void ToExtendedReplicationFailureType(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			string value = directoryObj[directoryAttributes[0]].Value as string;
			if (!string.Equals("msDS-ReplConnectionFailures", value, StringComparison.OrdinalIgnoreCase))
			{
				if (string.Equals("msDS-ReplLinkFailures", value, StringComparison.OrdinalIgnoreCase))
				{
					userObj.Add(extendedAttribute, ADReplicationFailureType.Link);
				}
				return;
			}
			else
			{
				userObj.Add(extendedAttribute, ADReplicationFailureType.Connection);
				return;
			}
		}
コード例 #38
0
ファイル: ADComputerUtil.cs プロジェクト: nickchal/pash
		internal static void ToDirectoryComputerSamAccountName(string extendedAttribute, string[] directoryAttributes, ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			if (extendedData == null || extendedData.Value == null)
			{
				AttributeConverters.ToDirectoryObject(extendedAttribute, directoryAttributes, extendedData, directoryObj, cmdletSessionInfo);
				return;
			}
			else
			{
				string value = extendedData.Value as string;
				if (!string.IsNullOrEmpty(value) && !value.EndsWith("$", StringComparison.OrdinalIgnoreCase))
				{
					value = string.Concat(value, "$");
				}
				AttributeConverters.ToDirectoryObject(extendedAttribute, directoryAttributes, new ADPropertyValueCollection(value), directoryObj, cmdletSessionInfo);
				return;
			}
		}
コード例 #39
0
ファイル: ADFactoryUtil.cs プロジェクト: nickchal/pash
		internal static ADObject GetObjectFromIdentitySearcher(ADObjectSearcher searcher, ADEntity identityObj, string searchRoot, AttributeSetRequest attrs, CmdletSessionInfo cmdletSessionInfo, out string[] warningMessages)
		{
			ADObject aDObject;
			bool flag = false;
			warningMessages = new string[0];
			using (searcher)
			{
				searcher.Properties.AddRange(attrs.DirectoryAttributes);
				DebugLogger.LogInfo("ADFactoryUtil", string.Format("GetObjectFromIdentity: Searching for identity using filter: {0} searchbase: {1}", searcher.Filter.GetLdapFilterString(), searcher.SearchRoot));
				aDObject = searcher.FindOne(out flag);
				if (aDObject != null)
				{
					if (flag)
					{
						throw new ADMultipleMatchingIdentitiesException(StringResources.MultipleMatches);
					}
				}
				else
				{
					DebugLogger.LogInfo("ADFactoryUtil", string.Format("GetObjectFromIdentity: Identity not found.", new object[0]));
					object[] str = new object[2];
					str[0] = identityObj.ToString();
					str[1] = searchRoot;
					throw new ADIdentityNotFoundException(string.Format(CultureInfo.CurrentCulture, StringResources.IdentityNotFound, str));
				}
			}
			string str1 = ADForestPartitionInfo.ExtractPartitionInfo(cmdletSessionInfo.ADRootDSE, aDObject.DistinguishedName, false);
			if (cmdletSessionInfo.CmdletParameters.Contains("Partition"))
			{
				string item = cmdletSessionInfo.CmdletParameters["Partition"] as string;
				if (!ADPathModule.ComparePath(item, str1, ADPathFormat.X500))
				{
					string[] strArrays = new string[1];
					object[] objArray = new object[3];
					objArray[0] = identityObj.ToString();
					objArray[1] = str1;
					objArray[2] = item;
					strArrays[0] = string.Format(CultureInfo.CurrentCulture, StringResources.IdentityInWrongPartition, objArray);
					warningMessages = strArrays;
				}
			}
			cmdletSessionInfo.DefaultPartitionPath = str1;
			return aDObject;
		}
コード例 #40
0
		internal static ADObjectSearcher BuildAggregatedSearchFilterIdentityResolver(IdentityResolverDelegate[] identityDelegates, ADOperator op, object identity, string searchRoot, CmdletSessionInfo cmdletSessionInfo, out bool useSearchFilter)
		{
			ADObjectSearcher item;
			List<IADOPathNode> aDOPathNodes = new List<IADOPathNode>((int)identityDelegates.Length);
			IdentityResolverDelegate[] identityResolverDelegateArray = identityDelegates;
			for (int i = 0; i < (int)identityResolverDelegateArray.Length; i++)
			{
				bool V_1;
				IdentityResolverDelegate identityResolverDelegate = identityResolverDelegateArray[i];
				item = identityResolverDelegate(identity, searchRoot, cmdletSessionInfo, out V_1);
				if (item != null)
				{
					aDOPathNodes.Add(item.Filter);
				}
			}
			item = SearchUtility.BuildSearcher(cmdletSessionInfo.ADSessionInfo, searchRoot, ADSearchScope.Subtree);
			if (aDOPathNodes.Count <= 1)
			{
				if (aDOPathNodes.Count != 1)
				{
					item = null;
				}
				else
				{
					item.Filter = aDOPathNodes[0];
				}
			}
			else
			{
				if (ADOperator.Or != op)
				{
					item.Filter = ADOPathUtil.CreateAndClause(aDOPathNodes.ToArray());
				}
				else
				{
					item.Filter = ADOPathUtil.CreateOrClause(aDOPathNodes.ToArray());
				}
			}
			useSearchFilter = true;
			return item;
		}
コード例 #41
0
ファイル: ADComputerUtil.cs プロジェクト: nickchal/pash
		internal static void ToDirectoryServiceAccountSamAccountName(string extendedAttribute, string[] directoryAttributes, ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			int num;
			if (extendedData == null || extendedData.Value == null)
			{
				AttributeConverters.ToDirectoryObject(extendedAttribute, directoryAttributes, extendedData, directoryObj, cmdletSessionInfo);
				return;
			}
			else
			{
				string value = extendedData.Value as string;
				if (!string.IsNullOrEmpty(value))
				{
					bool flag = value.EndsWith("$", StringComparison.OrdinalIgnoreCase);
					int length = value.Length;
					if (flag)
					{
						num = 16;
					}
					else
					{
						num = 15;
					}
					if (length <= num)
					{
						if (!flag)
						{
							value = string.Concat(value, "$");
						}
					}
					else
					{
						object[] objArray = new object[1];
						objArray[0] = value;
						throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.ServiceAccountNameLengthInvalid, objArray));
					}
				}
				AttributeConverters.ToDirectoryObject(extendedAttribute, directoryAttributes, new ADPropertyValueCollection(value), directoryObj, cmdletSessionInfo);
				return;
			}
		}
コード例 #42
0
ファイル: AccountExpiresUtils.cs プロジェクト: nickchal/pash
		public static void ToExtendedAccountExpirationDate(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			if (directoryObj[directoryAttributes[0]].Value != null)
			{
				long value = (long)directoryObj[directoryAttributes[0]].Value;
				if (value == (long)0 || value == 0x7fffffffffffffffL)
				{
					userObj.Add(extendedAttribute, new ADPropertyValueCollection(null));
					return;
				}
				else
				{
					AttributeConverters.ToExtendedDateTimeFromLong(extendedAttribute, directoryAttributes, userObj, directoryObj, cmdletSessionInfo);
					return;
				}
			}
			else
			{
				userObj.Add(extendedAttribute, new ADPropertyValueCollection(null));
				return;
			}
		}
コード例 #43
0
		internal static ADObjectSearcher BuildGenericSearcher(string[] identityLdapAttributes, object identity, string searchRoot, CmdletSessionInfo cmdletSessionInfo, out bool useSearchFilter)
		{
			useSearchFilter = true;
			string str = identity as string;
			if (!string.IsNullOrEmpty(str))
			{
				ADObjectSearcher item = SearchUtility.BuildSearcher(cmdletSessionInfo.ADSessionInfo, searchRoot, ADSearchScope.Subtree);
				List<IADOPathNode> aDOPathNodes = new List<IADOPathNode>((int)identityLdapAttributes.Length);
				string[] strArrays = identityLdapAttributes;
				for (int i = 0; i < (int)strArrays.Length; i++)
				{
					string str1 = strArrays[i];
					if (str1 != "distinguishedName")
					{
						aDOPathNodes.Add(ADOPathUtil.CreateFilterClause(ADOperator.Eq, str1, str));
					}
					else
					{
						string str2 = Utils.EscapeDNForFilter(str);
						aDOPathNodes.Add(ADOPathUtil.CreateFilterClause(ADOperator.Eq, str1, str2));
					}
				}
				if (aDOPathNodes.Count <= 1)
				{
					item.Filter = aDOPathNodes[0];
				}
				else
				{
					item.Filter = ADOPathUtil.CreateOrClause(aDOPathNodes.ToArray());
				}
				return item;
			}
			else
			{
				return null;
			}
		}
コード例 #44
0
ファイル: ADReplicationUtil.cs プロジェクト: nickchal/pash
		internal static void ToExtendedTransportTypeFromDrsOptions(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			bool hasValue;
			bool flag;
			AttributeConverters.ToExtendedFlagFromInt(128, false, extendedAttribute, directoryAttributes, userObj, directoryObj, cmdletSessionInfo);
			bool? value = (bool?)(userObj[extendedAttribute].Value as bool?);
			bool? nullable = value;
			if (!nullable.GetValueOrDefault())
			{
				hasValue = false;
			}
			else
			{
				hasValue = nullable.HasValue;
			}
			if (!hasValue)
			{
				bool? nullable1 = value;
				if (nullable1.GetValueOrDefault())
				{
					flag = false;
				}
				else
				{
					flag = nullable1.HasValue;
				}
				if (flag)
				{
					userObj.SetValue(extendedAttribute, ADInterSiteTransportProtocolType.IP);
				}
				return;
			}
			else
			{
				userObj.SetValue(extendedAttribute, ADInterSiteTransportProtocolType.SMTP);
				return;
			}
		}
コード例 #45
0
ファイル: ADComputerUtil.cs プロジェクト: nickchal/pash
		internal static IADOPathNode ToSearchComputerSamAccountName(string extendedAttribute, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo)
		{
			BinaryADOPathNode binaryADOPathNode = filterClause as BinaryADOPathNode;
			if (binaryADOPathNode != null)
			{
				IDataNode rightNode = binaryADOPathNode.RightNode as IDataNode;
				if (rightNode != null)
				{
					string dataObject = rightNode.DataObject as string;
					if (dataObject != null)
					{
						bool flag = dataObject.EndsWith("$", StringComparison.OrdinalIgnoreCase);
						bool flag1 = dataObject.EndsWith("*", StringComparison.OrdinalIgnoreCase);
						ADOperator @operator = binaryADOPathNode.Operator;
						if ((@operator == ADOperator.Eq || @operator == ADOperator.Ne) && !flag)
						{
							object[] objArray = new object[3];
							objArray[0] = extendedAttribute;
							objArray[1] = "$";
							objArray[2] = filterClause;
							cmdletSessionInfo.CmdletMessageWriter.WriteWarningBuffered(string.Format(CultureInfo.CurrentCulture, StringResources.WarningSamAccountNameClauseLacksDollarSign, objArray));
						}
						else
						{
							if ((@operator == ADOperator.Like || @operator == ADOperator.NotLike) && !flag && !flag1)
							{
								object[] objArray1 = new object[3];
								objArray1[0] = extendedAttribute;
								objArray1[1] = "$";
								objArray1[2] = filterClause;
								cmdletSessionInfo.CmdletMessageWriter.WriteWarningBuffered(string.Format(CultureInfo.CurrentCulture, StringResources.WarningSamAccountNameClauseLacksDollarSign, objArray1));
							}
						}
						return SearchConverters.ToSearchObject(extendedAttribute, directoryAttributes, filterClause, cmdletSessionInfo);
					}
					else
					{
						object[] type = new object[2];
						type[0] = rightNode.DataObject.GetType();
						type[1] = extendedAttribute;
						throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterRHSInvalidType, type));
					}
				}
				else
				{
					throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode);
				}
			}
			else
			{
				throw new ArgumentException(StringResources.SearchConverterNotBinaryNode);
			}
		}
コード例 #46
0
		internal static ADObjectSearcher BuildGuidBaseSearcher(Guid? guidObject, CmdletSessionInfo cmdletSessionInfo)
		{
			string str = string.Concat("<GUID=", guidObject, ">");
			return SearchUtility.BuildSearcher(cmdletSessionInfo.ADSessionInfo, str, ADSearchScope.Base);
		}
コード例 #47
0
ファイル: ADFactoryUtil.cs プロジェクト: nickchal/pash
		internal static ADObjectSearcher GetADObjectSearcherFromIdentity(ADEntity identityObj, string searchRoot, bool showDeleted, IADOPathNode structuralObjectFilter, IADOPathNode identityFilter, IdentityResolverDelegate[] identityResolvers, CmdletSessionInfo cmdletSessionInfo)
		{
			ADObjectSearcher identity = null;
			IADOPathNode aDOPathNode = null;
			bool flag = true;
			IdentityResolverDelegate[] identityResolverDelegateArray = identityResolvers;
			int num = 0;
			while (num < (int)identityResolverDelegateArray.Length)
			{
				IdentityResolverDelegate identityResolverDelegate = identityResolverDelegateArray[num];
				if (identityObj.Identity == null)
				{
					identity = identityResolverDelegate(identityObj, searchRoot, cmdletSessionInfo, out flag);
				}
				else
				{
					identity = identityResolverDelegate(identityObj.Identity, searchRoot, cmdletSessionInfo, out flag);
				}
				if (identity == null)
				{
					num++;
				}
				else
				{
					if (!flag)
					{
						aDOPathNode = structuralObjectFilter;
						break;
					}
					else
					{
						IADOPathNode[] filter = new IADOPathNode[2];
						filter[0] = identity.Filter;
						filter[1] = structuralObjectFilter;
						aDOPathNode = ADOPathUtil.CreateAndClause(filter);
						break;
					}
				}
			}
			if (identity == null)
			{
				if (searchRoot != null)
				{
					if (identityFilter != null)
					{
						IADOPathNode[] aDOPathNodeArray = new IADOPathNode[2];
						aDOPathNodeArray[0] = identityFilter;
						aDOPathNodeArray[1] = structuralObjectFilter;
						aDOPathNode = ADOPathUtil.CreateAndClause(aDOPathNodeArray);
						identity = SearchUtility.BuildSearcher(cmdletSessionInfo.ADSessionInfo, searchRoot, ADSearchScope.Subtree);
					}
					else
					{
						object[] str = new object[2];
						str[0] = identityObj.ToString();
						str[1] = searchRoot;
						throw new ADIdentityNotFoundException(string.Format(CultureInfo.CurrentCulture, StringResources.IdentityNotFound, str));
					}
				}
				else
				{
					throw new ADIdentityResolutionException(StringResources.IdentityResolutionPartitionRequired);
				}
			}
			identity.Filter = aDOPathNode;
			identity.ShowDeleted = showDeleted;
			return identity;
		}
コード例 #48
0
		internal static ADObjectSearcher SamAccountNameIdentityResolver(object identityObject, string searchBase, CmdletSessionInfo cmdletSessionInfo, out bool useSearchFilter)
		{
			useSearchFilter = true;
			if (identityObject != null)
			{
				ADPrincipal aDPrincipal = identityObject as ADPrincipal;
				if (aDPrincipal == null || aDPrincipal.SamAccountName == null)
				{
					return null;
				}
				else
				{
					ADObjectSearcher aDObjectSearcher = SearchUtility.BuildSearcher(cmdletSessionInfo.ADSessionInfo, searchBase, ADSearchScope.Subtree);
					aDObjectSearcher.Filter = ADOPathUtil.CreateFilterClause(ADOperator.Eq, "sAMAccountName", aDPrincipal.SamAccountName);
					return aDObjectSearcher;
				}
			}
			else
			{
				throw new ArgumentNullException("identityObject");
			}
		}
コード例 #49
0
		internal static ADObjectSearcher GuidSearchFilterIdentityResolver(object identityObject, string searchBase, CmdletSessionInfo cmdletSessionInfo, out bool useSearchFilter)
		{
			useSearchFilter = true;
			if (identityObject != null)
			{
				Guid? nullable = null;
				string str = identityObject as string;
				if (string.IsNullOrEmpty(str) || !Utils.TryParseGuid(str, out nullable))
				{
					if (!(identityObject is Guid))
					{
						ADObject aDObject = identityObject as ADObject;
						if (aDObject != null)
						{
							Guid? objectGuid = aDObject.ObjectGuid;
							if (objectGuid.HasValue)
							{
								return IdentityResolverMethods.BuildObjectGuidSearcher(aDObject.ObjectGuid, searchBase, cmdletSessionInfo);
							}
						}
						return null;
					}
					else
					{
						return IdentityResolverMethods.BuildObjectGuidSearcher(new Guid?((Guid)identityObject), searchBase, cmdletSessionInfo);
					}
				}
				else
				{
					return IdentityResolverMethods.BuildObjectGuidSearcher(nullable, searchBase, cmdletSessionInfo);
				}
			}
			else
			{
				throw new ArgumentNullException("identityObject");
			}
		}
コード例 #50
0
		internal virtual void InvokeToExtendedConverter(ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			this._toExtendedDelegate(base.ExtendedAttribute, this.DirectoryAttributes, userObj, directoryObj, cmdletSessionInfo);
		}
コード例 #51
0
		internal virtual IADOPathNode InvokeToSearcherConverter(IADOPathNode filter, CmdletSessionInfo cmdletSessionInfo)
		{
			return this._toSearchDelegate(base.ExtendedAttribute, this.DirectoryAttributes, filter, cmdletSessionInfo);
		}
コード例 #52
0
		internal virtual void InvokeToDirectoryConverter(ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			this._toDirectoryDelegate(base.ExtendedAttribute, this.DirectoryAttributes, extendedData, directoryObj, cmdletSessionInfo);
		}
コード例 #53
0
ファイル: ADReplicationUtil.cs プロジェクト: nickchal/pash
		internal static void ToExtendedServerFromSessionInfo(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			userObj.Add(extendedAttribute, cmdletSessionInfo.ADRootDSE.DNSHostName);
		}
コード例 #54
0
		internal static ADObjectSearcher BuildDNBaseSearcher(string DN, CmdletSessionInfo cmdletSessionInfo)
		{
			return SearchUtility.BuildSearcher(cmdletSessionInfo.ADSessionInfo, DN, ADSearchScope.Base);
		}
コード例 #55
0
ファイル: GroupTypeUtils.cs プロジェクト: nickchal/pash
		public static IADOPathNode ToSearchGroupScope(string extendedAttributeName, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo)
		{
			ADGroupScope aDGroupScope = ADGroupScope.DomainLocal;
			BinaryADOPathNode binaryADOPathNode = filterClause as BinaryADOPathNode;
			if (binaryADOPathNode == null)
			{
				throw new ArgumentException(StringResources.SearchConverterNotBinaryNode);
			}
			else
			{
				if (binaryADOPathNode.Operator == ADOperator.Eq || binaryADOPathNode.Operator == ADOperator.Ne)
				{
					IDataNode rightNode = binaryADOPathNode.RightNode as IDataNode;
					if (rightNode == null)
					{
						throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode);
					}
					else
					{
						if (!Utils.TryParseEnum<ADGroupScope>(rightNode.DataObject.ToString(), out aDGroupScope))
						{
							object[] str = new object[2];
							str[0] = rightNode.DataObject.ToString();
							str[1] = extendedAttributeName;
							throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterInvalidValue, str));
						}
						else
						{
							PropertyADOPathNode propertyADOPathNode = new PropertyADOPathNode(directoryAttributes[0]);
							ObjectADOPathNode objectADOPathNode = new ObjectADOPathNode((object)GroupTypeUtils.GetDirectoryGroupTypeValue(aDGroupScope));
							IADOPathNode aDOPathNode = new BinaryADOPathNode(ADOperator.Band, propertyADOPathNode, objectADOPathNode);
							if (binaryADOPathNode.Operator != ADOperator.Eq)
							{
								return ADOPathUtil.CreateNotClause(aDOPathNode);
							}
							else
							{
								return aDOPathNode;
							}
						}
					}
				}
				else
				{
					object[] objArray = new object[2];
					ADOperator[] aDOperatorArray = new ADOperator[2];
					aDOperatorArray[1] = ADOperator.Ne;
					objArray[0] = SearchConverters.ConvertOperatorListToString(aDOperatorArray);
					objArray[1] = extendedAttributeName;
					throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterSupportedOperatorListErrorMessage, objArray));
				}
			}
		}
コード例 #56
0
ファイル: GroupTypeUtils.cs プロジェクト: nickchal/pash
		public static void ToExtendedGroupCategory(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			if (!directoryObj.Contains(directoryAttributes[0]))
			{
				userObj.Add(extendedAttribute, new ADPropertyValueCollection(null));
				return;
			}
			else
			{
				int value = (int)directoryObj[directoryAttributes[0]].Value;
				if ((value & -2147483648) != -2147483648)
				{
					userObj.Add(extendedAttribute, ADGroupCategory.Distribution);
					return;
				}
				else
				{
					userObj.Add(extendedAttribute, ADGroupCategory.Security);
					return;
				}
			}
		}
コード例 #57
0
ファイル: GroupTypeUtils.cs プロジェクト: nickchal/pash
		public static void ToExtendedGroupScope(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			if (!directoryObj.Contains(directoryAttributes[0]))
			{
				userObj.Add(extendedAttribute, new ADPropertyValueCollection(null));
			}
			else
			{
				int value = (int)directoryObj[directoryAttributes[0]].Value;
				if ((value & 4) != 4)
				{
					if ((value & 2) != 2)
					{
						if ((value & 8) == 8)
						{
							userObj.Add(extendedAttribute, ADGroupScope.Universal);
							return;
						}
					}
					else
					{
						userObj.Add(extendedAttribute, ADGroupScope.Global);
						return;
					}
				}
				else
				{
					userObj.Add(extendedAttribute, ADGroupScope.DomainLocal);
					return;
				}
			}
		}
コード例 #58
0
ファイル: GPLinkUtil.cs プロジェクト: nickchal/pash
		internal static void ToExtendedGPLink(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			if (!directoryObj.Contains(directoryAttributes[0]))
			{
				userObj.Add(extendedAttribute, new ADPropertyValueCollection());
				return;
			}
			else
			{
				string value = directoryObj[directoryAttributes[0]].Value as string;
				userObj.Add(extendedAttribute, GPLinkUtil.ConvertLinkedGroupPolicyObjects(value));
				return;
			}
		}
コード例 #59
0
ファイル: GPLinkUtil.cs プロジェクト: nickchal/pash
		internal static IADOPathNode ToSearchGPLink(string extendedAttribute, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo)
		{
			return GPLinkUtil.BuildGPLinkFilter(extendedAttribute, directoryAttributes[0], filterClause);
		}
コード例 #60
0
		internal static ADObjectSearcher SidIdentityResolver(object identityObject, string searchBase, CmdletSessionInfo cmdletSessionInfo, out bool useSearchFilter)
		{
			useSearchFilter = true;
			if (identityObject != null)
			{
				SecurityIdentifier securityIdentifier = null;
				string str = identityObject as string;
				if (string.IsNullOrEmpty(str) || !Utils.TryParseSid(str, out securityIdentifier))
				{
					securityIdentifier = identityObject as SecurityIdentifier;
					if (securityIdentifier == null)
					{
						ADPrincipal aDPrincipal = identityObject as ADPrincipal;
						if (aDPrincipal == null || !(aDPrincipal.SID != null))
						{
							return null;
						}
						else
						{
							return IdentityResolverMethods.BuildSidBaseSearcher(aDPrincipal.SID, searchBase, cmdletSessionInfo);
						}
					}
					else
					{
						return IdentityResolverMethods.BuildSidBaseSearcher(securityIdentifier, searchBase, cmdletSessionInfo);
					}
				}
				else
				{
					return IdentityResolverMethods.BuildSidBaseSearcher(securityIdentifier, searchBase, cmdletSessionInfo);
				}
			}
			else
			{
				throw new ArgumentNullException("identityObject");
			}
		}