Exemplo n.º 1
0
        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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 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;
 }
 public void LastLogonTime(DateTime logonTime, MatchType match)
 {
     if (null == _logonTimeVal)
     {
         _logonTimeVal = new QbeMatchType(logonTime, match);
     }
     else
     {
         _logonTimeVal.Match = match;
         _logonTimeVal.Value = logonTime;
     }
     _logonTimeChanged = true;
 }
Exemplo n.º 7
0
		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;
		}
 public void LastBadPasswordAttempt(DateTime lastAttempt, MatchType match)
 {
     if (null == _badPasswordAttemptVal)
     {
         _badPasswordAttemptVal = new QbeMatchType(lastAttempt, match);
     }
     else
     {
         _badPasswordAttemptVal.Match = match;
         _badPasswordAttemptVal.Value = lastAttempt;
     }
     _badPasswordAttemptChanged = true;
 }
 public void LastPasswordSetTime(DateTime passwordSetTime, MatchType match)
 {
     if (null == _passwordSetTimeVal)
     {
         _passwordSetTimeVal = new QbeMatchType(passwordSetTime, match);
     }
     else
     {
         _passwordSetTimeVal.Match = match;
         _passwordSetTimeVal.Value = passwordSetTime;
     }
     _passwordSetTimeChanged = true;
 }
Exemplo n.º 10
0
		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;
		}
Exemplo n.º 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;
 }
Exemplo n.º 12
0
 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;
 }
 public void AccountExpirationDate(DateTime expirationTime, MatchType match)
 {
     if (null == _expirationTimeVal)
     {
         _expirationTimeVal = new QbeMatchType(expirationTime, match);
     }
     else
     {
         _expirationTimeVal.Match = match;
         _expirationTimeVal.Value = expirationTime;
     }
     _expirationTimeChanged = true;
 }
Exemplo n.º 14
0
 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;
 }
Exemplo n.º 15
0
 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;
 }
Exemplo n.º 16
0
        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) +
                 ")");
        }
Exemplo n.º 17
0
 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;
     }
 }
Exemplo n.º 18
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;
     }
 }
Exemplo n.º 19
0
 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 21
0
 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;
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 23
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;
 }
Exemplo n.º 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);
        }
Exemplo n.º 25
0
		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;
		}
Exemplo n.º 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);
        }
Exemplo n.º 27
0
		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;
		}
Exemplo n.º 28
0
		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;
		}