示例#1
0
        private static bool SamAccountNameMatcher(FilterBase filter, string winNTPropertyName, DirectoryEntry de)
        {
            string str;
            string value = (string)filter.Value;
            int    num   = value.IndexOf('\\');

            if (num != value.Length - 1)
            {
                if (num != -1)
                {
                    str = value.Substring(num + 1);
                }
                else
                {
                    str = value;
                }
                string str1 = str;
                if (de.Properties["Name"].Count <= 0 || de.Properties["Name"].Value == null)
                {
                    return(false);
                }
                else
                {
                    return(QbeMatcher.WildcardStringMatch(filter, str1, (string)de.Properties["Name"].Value));
                }
            }
            else
            {
                throw new InvalidOperationException(StringResources.StoreCtxNT4IdentityClaimWrongForm);
            }
        }
示例#2
0
        private static bool MultiStringMatcher(FilterBase filter, string winNTPropertyName, DirectoryEntry de)
        {
            bool   flag;
            string value = (string)filter.Value;

            if (value != null)
            {
                if (de.Properties.Contains(winNTPropertyName) && de.Properties[winNTPropertyName].Count != 0)
                {
                    IEnumerator enumerator = de.Properties[winNTPropertyName].GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            string current = (string)enumerator.Current;
                            if (current == null)
                            {
                                continue;
                            }
                            flag = QbeMatcher.WildcardStringMatch(filter, value, current);
                            return(flag);
                        }
                        return(false);
                    }
                    finally
                    {
                        IDisposable disposable = enumerator as IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                    return(flag);
                }
            }
            else
            {
                if (!de.Properties.Contains(winNTPropertyName) || de.Properties[winNTPropertyName].Count == 0 || ((string)de.Properties[winNTPropertyName].Value).Length == 0)
                {
                    return(true);
                }
            }
            return(false);
        }
示例#3
0
        private static bool StringMatcher(FilterBase filter, string winNTPropertyName, DirectoryEntry de)
        {
            string value = (string)filter.Value;

            if (value != null)
            {
                if (de.Properties.Contains(winNTPropertyName))
                {
                    string str = (string)de.Properties[winNTPropertyName].Value;
                    if (str != null)
                    {
                        return(QbeMatcher.WildcardStringMatch(filter, value, str));
                    }
                }
            }
            else
            {
                if (!de.Properties.Contains(winNTPropertyName) || de.Properties[winNTPropertyName].Count == 0 || ((string)de.Properties[winNTPropertyName].Value).Length == 0)
                {
                    return(true);
                }
            }
            return(false);
        }