コード例 #1
0
ファイル: ADStoreCtx_Query.cs プロジェクト: mikem8361/runtime
        protected static string MatchingIntConverter(FilterBase filter, string suggestedAdProperty)
        {
            Debug.Assert(filter.Value is QbeMatchType);

            QbeMatchType qmt = (QbeMatchType)filter.Value;

            return(ExtensionTypeConverter(suggestedAdProperty, qmt.Value.GetType(), qmt.Value, qmt.Match));
        }
コード例 #2
0
        private static bool IntMatcher(FilterBase filter, string winNTPropertyName, DirectoryEntry de)
        {
            QbeMatchType valueToMatch = (QbeMatchType)filter.Value;
            bool         result       = false;

            if (null == valueToMatch.Value)
            {
                if ((de.Properties.Contains(winNTPropertyName) == false) ||
                    (de.Properties[winNTPropertyName].Count == 0) ||
                    (de.Properties[winNTPropertyName].Value == null))
                {
                    result = true;
                }
            }
            else
            {
                if (de.Properties.Contains(winNTPropertyName))
                {
                    int value           = (int)de.Properties[winNTPropertyName].Value;
                    int comparisonValue = (int)valueToMatch.Value;

                    switch (valueToMatch.Match)
                    {
                    case MatchType.Equals:
                        result = (value == comparisonValue);
                        break;

                    case MatchType.NotEquals:
                        result = (value != comparisonValue);
                        break;

                    case MatchType.GreaterThan:
                        result = (value > comparisonValue);
                        break;

                    case MatchType.GreaterThanOrEquals:
                        result = (value >= comparisonValue);
                        break;

                    case MatchType.LessThan:
                        result = (value < comparisonValue);
                        break;

                    case MatchType.LessThanOrEquals:
                        result = (value <= comparisonValue);
                        break;

                    default:
                        result = false;
                        break;
                    }
                }
            }

            return(result);
        }
コード例 #3
0
ファイル: ADStoreCtx_Query.cs プロジェクト: mikem8361/runtime
        protected static string DefaultValutMatchingDateTimeConverter(FilterBase filter, string suggestedAdProperty)
        {
            Debug.Assert(filter.Value is QbeMatchType);

            QbeMatchType qmt = (QbeMatchType)filter.Value;

            Debug.Assert(qmt.Value is DateTime);

            return(DateTimeFilterBuilder(suggestedAdProperty, (DateTime)qmt.Value, LdapConstants.defaultUtcTime, false, qmt.Match));
        }
コード例 #4
0
ファイル: AdvancedFilters.cs プロジェクト: modulexcite/pash-1
 public void LastPasswordSetTime(DateTime passwordSetTime, MatchType match)
 {
     if (this.passwordSetTimeVal != null)
     {
         this.passwordSetTimeVal.Match = match;
         this.passwordSetTimeVal.Value = passwordSetTime;
     }
     else
     {
         this.passwordSetTimeVal = new QbeMatchType((object)passwordSetTime, match);
     }
     this.passwordSetTimeChanged = true;
 }
コード例 #5
0
ファイル: AdvancedFilters.cs プロジェクト: modulexcite/pash-1
 public void LastBadPasswordAttempt(DateTime lastAttempt, MatchType match)
 {
     if (this.badPasswordAttemptVal != null)
     {
         this.badPasswordAttemptVal.Match = match;
         this.badPasswordAttemptVal.Value = lastAttempt;
     }
     else
     {
         this.badPasswordAttemptVal = new QbeMatchType((object)lastAttempt, match);
     }
     this.badPasswordAttemptChanged = true;
 }
コード例 #6
0
 public void LastLogonTime(DateTime logonTime, MatchType match)
 {
     if (null == _logonTimeVal)
     {
         _logonTimeVal = new QbeMatchType(logonTime, match);
     }
     else
     {
         _logonTimeVal.Match = match;
         _logonTimeVal.Value = logonTime;
     }
     _logonTimeChanged = true;
 }
コード例 #7
0
ファイル: AdvancedFilters.cs プロジェクト: nickchal/pash
		public void AccountExpirationDate(DateTime expirationTime, MatchType match)
		{
			if (this.expirationTimeVal != null)
			{
				this.expirationTimeVal.Match = match;
				this.expirationTimeVal.Value = expirationTime;
			}
			else
			{
				this.expirationTimeVal = new QbeMatchType((object)expirationTime, match);
			}
			this.expirationTimeChanged = true;
		}
コード例 #8
0
 public void LastBadPasswordAttempt(DateTime lastAttempt, MatchType match)
 {
     if (null == _badPasswordAttemptVal)
     {
         _badPasswordAttemptVal = new QbeMatchType(lastAttempt, match);
     }
     else
     {
         _badPasswordAttemptVal.Match = match;
         _badPasswordAttemptVal.Value = lastAttempt;
     }
     _badPasswordAttemptChanged = true;
 }
コード例 #9
0
 public void LastPasswordSetTime(DateTime passwordSetTime, MatchType match)
 {
     if (null == _passwordSetTimeVal)
     {
         _passwordSetTimeVal = new QbeMatchType(passwordSetTime, match);
     }
     else
     {
         _passwordSetTimeVal.Match = match;
         _passwordSetTimeVal.Value = passwordSetTime;
     }
     _passwordSetTimeChanged = true;
 }
コード例 #10
0
ファイル: AdvancedFilters.cs プロジェクト: nickchal/pash
		public void AccountLockoutTime(DateTime lockoutTime, MatchType match)
		{
			if (this.lockoutTimeVal != null)
			{
				this.lockoutTimeVal.Match = match;
				this.lockoutTimeVal.Value = lockoutTime;
			}
			else
			{
				this.lockoutTimeVal = new QbeMatchType((object)lockoutTime, match);
			}
			this.lockoutTimeChanged = true;
		}
コード例 #11
0
 public void BadLogonCount(int badLogonCount, MatchType match)
 {
     if (null == _badLogonCountVal)
     {
         _badLogonCountVal = new QbeMatchType(badLogonCount, match);
     }
     else
     {
         _badLogonCountVal.Match = match;
         _badLogonCountVal.Value = badLogonCount;
     }
     _badLogonCountChanged = true;
 }
コード例 #12
0
ファイル: AdvancedFilters.cs プロジェクト: modulexcite/pash-1
 public void AccountExpirationDate(DateTime expirationTime, MatchType match)
 {
     if (this.expirationTimeVal != null)
     {
         this.expirationTimeVal.Match = match;
         this.expirationTimeVal.Value = expirationTime;
     }
     else
     {
         this.expirationTimeVal = new QbeMatchType((object)expirationTime, match);
     }
     this.expirationTimeChanged = true;
 }
コード例 #13
0
 public void AccountExpirationDate(DateTime expirationTime, MatchType match)
 {
     if (null == _expirationTimeVal)
     {
         _expirationTimeVal = new QbeMatchType(expirationTime, match);
     }
     else
     {
         _expirationTimeVal.Match = match;
         _expirationTimeVal.Value = expirationTime;
     }
     _expirationTimeChanged = true;
 }
コード例 #14
0
ファイル: AdvancedFilters.cs プロジェクト: modulexcite/pash-1
 public void AccountLockoutTime(DateTime lockoutTime, MatchType match)
 {
     if (this.lockoutTimeVal != null)
     {
         this.lockoutTimeVal.Match = match;
         this.lockoutTimeVal.Value = lockoutTime;
     }
     else
     {
         this.lockoutTimeVal = new QbeMatchType((object)lockoutTime, match);
     }
     this.lockoutTimeChanged = true;
 }
コード例 #15
0
ファイル: AdvancedFilters.cs プロジェクト: modulexcite/pash-1
 public void BadLogonCount(int badLogonCount, MatchType match)
 {
     if (this.badLogonCountVal != null)
     {
         this.badLogonCountVal.Match = match;
         this.badLogonCountVal.Value = badLogonCount;
     }
     else
     {
         this.badLogonCountVal = new QbeMatchType((object)badLogonCount, match);
     }
     this.badLogonCountChanged = true;
 }
コード例 #16
0
ファイル: ADStoreCtx_Query.cs プロジェクト: mikem8361/runtime
        protected static string LastLogonConverter(FilterBase filter, string suggestedAdProperty)
        {
            Debug.Assert(filter.Value is QbeMatchType);

            QbeMatchType qmt = (QbeMatchType)filter.Value;

            Debug.Assert(qmt.Value is DateTime);
            Debug.Assert((suggestedAdProperty == "lastLogon") || (suggestedAdProperty == "lastLogonTimestamp"));

            return
                ("(|" +
                 DateTimeFilterBuilder("lastLogon", (DateTime)qmt.Value, LdapConstants.defaultUtcTime, false, qmt.Match) +
                 DateTimeFilterBuilder("lastLogonTimestamp", (DateTime)qmt.Value, LdapConstants.defaultUtcTime, true, qmt.Match) +
                 ")");
        }
コード例 #17
0
ファイル: AdvancedFilters.cs プロジェクト: chcosta/corefx
 public void AccountExpirationDate(DateTime expirationTime, MatchType match)
 {
     if (expirationTime == null)
     {
         _expirationTimeChanged = false;
         _expirationTimeVal = null;
     }
     else
     {
         if (null == _expirationTimeVal)
             _expirationTimeVal = new QbeMatchType(expirationTime, match);
         else
         {
             _expirationTimeVal.Match = match;
             _expirationTimeVal.Value = expirationTime;
         }
         _expirationTimeChanged = true;
     }
 }
コード例 #18
0
ファイル: AdvancedFilters.cs プロジェクト: chcosta/corefx
 public void AccountLockoutTime(DateTime lockoutTime, MatchType match)
 {
     if (lockoutTime == null)
     {
         _lockoutTimeChanged = false;
         _lockoutTimeVal = null;
     }
     else
     {
         if (null == _lockoutTimeVal)
             _lockoutTimeVal = new QbeMatchType(lockoutTime, match);
         else
         {
             _lockoutTimeVal.Match = match;
             _lockoutTimeVal.Value = lockoutTime;
         }
         _lockoutTimeChanged = true;
     }
 }
コード例 #19
0
ファイル: AdvancedFilters.cs プロジェクト: chcosta/corefx
 public void LastBadPasswordAttempt(DateTime lastAttempt, MatchType match)
 {
     if (lastAttempt == null)
     {
         _expirationTimeChanged = false;
         _expirationTimeVal = null;
     }
     else
     {
         if (null == _badPasswordAttemptVal)
             _badPasswordAttemptVal = new QbeMatchType(lastAttempt, match);
         else
         {
             _badPasswordAttemptVal.Match = match;
             _badPasswordAttemptVal.Value = lastAttempt;
         }
         _badPasswordAttemptChanged = true;
     }
 }
コード例 #20
0
 public void AccountLockoutTime(DateTime lockoutTime, MatchType match)
 {
     if (lockoutTime == null)
     {
         _lockoutTimeChanged = false;
         _lockoutTimeVal     = null;
     }
     else
     {
         if (null == _lockoutTimeVal)
         {
             _lockoutTimeVal = new QbeMatchType(lockoutTime, match);
         }
         else
         {
             _lockoutTimeVal.Match = match;
             _lockoutTimeVal.Value = lockoutTime;
         }
         _lockoutTimeChanged = true;
     }
 }
コード例 #21
0
ファイル: AdvancedFilters.cs プロジェクト: chcosta/corefx
 public void LastPasswordSetTime(DateTime passwordSetTime, MatchType match)
 {
     if (passwordSetTime == null)
     {
         _passwordSetTimeChanged = false;
         _passwordSetTimeVal = null;
     }
     else
     {
         if (null == _passwordSetTimeVal)
             _passwordSetTimeVal = new QbeMatchType(passwordSetTime, match);
         else
         {
             _passwordSetTimeVal.Match = match;
             _passwordSetTimeVal.Value = passwordSetTime;
         }
         _passwordSetTimeChanged = true;
     }
 }
コード例 #22
0
        private static bool DateTimeMatcher(FilterBase filter, string winNTPropertyName, DirectoryEntry de)
        {
            DateTime     value;
            QbeMatchType qbeMatchType = (QbeMatchType)filter.Value;

            if (qbeMatchType.Value != null)
            {
                if (de.Properties.Contains(winNTPropertyName) && de.Properties[winNTPropertyName].Value != null)
                {
                    if (winNTPropertyName != "PasswordAge")
                    {
                        value = (DateTime)de.Properties[winNTPropertyName].Value;
                    }
                    else
                    {
                        PropertyValueCollection item = de.Properties["PasswordAge"];
                        if (item.Count == 0)
                        {
                            return(false);
                        }
                        else
                        {
                            int num = (int)item[0];
                            value = DateTime.UtcNow - new TimeSpan(0, 0, num);
                        }
                    }
                    int       num1  = DateTime.Compare(value, (DateTime)qbeMatchType.Value);
                    bool      flag  = true;
                    MatchType match = qbeMatchType.Match;
                    switch (match)
                    {
                    case MatchType.Equals:
                    {
                        flag = num1 == 0;
                        break;
                    }

                    case MatchType.NotEquals:
                    {
                        flag = num1 != 0;
                        break;
                    }

                    case MatchType.GreaterThan:
                    {
                        flag = num1 > 0;
                        break;
                    }

                    case MatchType.GreaterThanOrEquals:
                    {
                        flag = num1 >= 0;
                        break;
                    }

                    case MatchType.LessThan:
                    {
                        flag = num1 < 0;
                        break;
                    }

                    case MatchType.LessThanOrEquals:
                    {
                        flag = num1 <= 0;
                        break;
                    }

                    default:
                    {
                        flag = false;
                        break;
                    }
                    }
                    return(flag);
                }
            }
            else
            {
                if (!de.Properties.Contains(winNTPropertyName) || de.Properties[winNTPropertyName].Count == 0 || de.Properties[winNTPropertyName].Value == null)
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #23
0
ファイル: AdvancedFilters.cs プロジェクト: chcosta/corefx
 public void BadLogonCount(int badLogonCount, MatchType match)
 {
     if (null == _badLogonCountVal)
     {
         _badLogonCountVal = new QbeMatchType(badLogonCount, match);
     }
     else
     {
         _badLogonCountVal.Match = match;
         _badLogonCountVal.Value = badLogonCount;
     }
     _badLogonCountChanged = true;
 }
コード例 #24
0
        private static bool DateTimeMatcher(FilterBase filter, string winNTPropertyName, DirectoryEntry de)
        {
            QbeMatchType valueToMatch = (QbeMatchType)filter.Value;

            if (null == valueToMatch.Value)
            {
                if ((de.Properties.Contains(winNTPropertyName) == false) ||
                    (de.Properties[winNTPropertyName].Count == 0) ||
                    (de.Properties[winNTPropertyName].Value == null))
                {
                    return(true);
                }
            }
            else
            {
                Debug.Assert(valueToMatch.Value is DateTime);

                if (de.Properties.Contains(winNTPropertyName) && (de.Properties[winNTPropertyName].Value != null))
                {
                    DateTime value;

                    if (winNTPropertyName == "PasswordAge")
                    {
                        PropertyValueCollection values = de.Properties["PasswordAge"];

                        if (values.Count != 0)
                        {
                            Debug.Assert(values.Count == 1);
                            Debug.Assert(values[0] is Int32);

                            int secondsLapsed = (int)values[0];

                            value = DateTime.UtcNow - new TimeSpan(0, 0, secondsLapsed);
                        }
                        else
                        {
                            // If we don't have a passwordAge then this item will never match.
                            return(false);
                        }
                    }
                    else
                    {
                        value = (DateTime)de.Properties[winNTPropertyName].Value;
                    }

                    int  comparisonResult = DateTime.Compare(value, (DateTime)valueToMatch.Value);
                    bool result           = true;

                    switch (valueToMatch.Match)
                    {
                    case MatchType.Equals:
                        result = comparisonResult == 0;
                        break;

                    case MatchType.NotEquals:
                        result = comparisonResult != 0;
                        break;

                    case MatchType.GreaterThan:
                        result = comparisonResult > 0;
                        break;

                    case MatchType.GreaterThanOrEquals:
                        result = comparisonResult >= 0;
                        break;

                    case MatchType.LessThan:
                        result = comparisonResult < 0;
                        break;

                    case MatchType.LessThanOrEquals:
                        result = comparisonResult <= 0;
                        break;

                    default:
                        result = false;
                        break;
                    }

                    return(result);
                }
            }

            return(false);
        }
コード例 #25
0
ファイル: AdvancedFilters.cs プロジェクト: nickchal/pash
		public void BadLogonCount(int badLogonCount, MatchType match)
		{
			if (this.badLogonCountVal != null)
			{
				this.badLogonCountVal.Match = match;
				this.badLogonCountVal.Value = badLogonCount;
			}
			else
			{
				this.badLogonCountVal = new QbeMatchType((object)badLogonCount, match);
			}
			this.badLogonCountChanged = true;
		}
コード例 #26
0
        private static bool IntMatcher(FilterBase filter, string winNTPropertyName, DirectoryEntry de)
        {
            QbeMatchType value = (QbeMatchType)filter.Value;
            bool         flag  = false;

            if (value.Value != null)
            {
                if (de.Properties.Contains(winNTPropertyName))
                {
                    int       num    = (int)de.Properties[winNTPropertyName].Value;
                    int       value1 = (int)value.Value;
                    MatchType match  = value.Match;
                    switch (match)
                    {
                    case MatchType.Equals:
                    {
                        flag = num == value1;
                        break;
                    }

                    case MatchType.NotEquals:
                    {
                        flag = num != value1;
                        break;
                    }

                    case MatchType.GreaterThan:
                    {
                        flag = num > value1;
                        break;
                    }

                    case MatchType.GreaterThanOrEquals:
                    {
                        flag = num >= value1;
                        break;
                    }

                    case MatchType.LessThan:
                    {
                        flag = num < value1;
                        break;
                    }

                    case MatchType.LessThanOrEquals:
                    {
                        flag = num <= value1;
                        break;
                    }

                    default:
                    {
                        flag = false;
                        break;
                    }
                    }
                }
            }
            else
            {
                if (!de.Properties.Contains(winNTPropertyName) || de.Properties[winNTPropertyName].Count == 0 || de.Properties[winNTPropertyName].Value == null)
                {
                    flag = true;
                }
            }
            return(flag);
        }
コード例 #27
0
ファイル: AdvancedFilters.cs プロジェクト: nickchal/pash
		public void LastBadPasswordAttempt(DateTime lastAttempt, MatchType match)
		{
			if (this.badPasswordAttemptVal != null)
			{
				this.badPasswordAttemptVal.Match = match;
				this.badPasswordAttemptVal.Value = lastAttempt;
			}
			else
			{
				this.badPasswordAttemptVal = new QbeMatchType((object)lastAttempt, match);
			}
			this.badPasswordAttemptChanged = true;
		}
コード例 #28
0
ファイル: AdvancedFilters.cs プロジェクト: nickchal/pash
		public void LastPasswordSetTime(DateTime passwordSetTime, MatchType match)
		{
			if (this.passwordSetTimeVal != null)
			{
				this.passwordSetTimeVal.Match = match;
				this.passwordSetTimeVal.Value = passwordSetTime;
			}
			else
			{
				this.passwordSetTimeVal = new QbeMatchType((object)passwordSetTime, match);
			}
			this.passwordSetTimeChanged = true;
		}