Beispiel #1
0
        internal LdapOrFilter(Asn1Filter[] filter)
        {
            var ldapFilter = new LdapFilter[filter.Length];

            for (int i = 0; i < filter.Length; i++)
            {
                ldapFilter[i] = LdapFilter.Create(filter[i]);
            }
            Filter = ldapFilter;
        }
        internal LdapSearchRequest(Asn1LdapMessage message)
            : base(message)
        {
            var search = message.ProtocolOp.SearchRequest;

            BaseObject   = new LdapDistinguishedName(search.BaseObject.Span);
            Scope        = search.Scope;
            DerefAliases = search.DerefAliases;
            if (DerefAliases < DerefAliases.NeverDerefAliases || DerefAliases > DerefAliases.DerefAlways)
            {
                throw new LdapProtocolException("invalid derefAliases");
            }
            SizeLimit = search.SizeLimit;
            if (SizeLimit == 0)
            {
                SizeLimit = Int32.MaxValue;
            }
            else if (SizeLimit < 0)
            {
                throw new LdapProtocolException("invalid sizeLimit");
            }
            TimeLimit = TimeSpan.FromSeconds(search.TimeLimit);
            if (TimeLimit < TimeSpan.Zero)
            {
                throw new LdapProtocolException("invalid timeLimit");
            }
            TypesOnly = search.TypesOnly;
            Filter    = LdapFilter.Create(search.Filter);
            if (search.Attributes.Length > 0)
            {
                var attributes = new LdapAttributeSelection[search.Attributes.Length];
                for (int i = 0; i < search.Attributes.Length; i++)
                {
                    attributes[i] = new LdapAttributeSelection(search.Attributes[i].Span);
                }
                Attributes = attributes;
            }
            else
            {
                Attributes = Array.Empty <LdapAttributeSelection>();
            }
        }