public SubstringFilter(
     AttributeDescription type,
     Asn1SequenceOf<SubstringFilter_substrings_element> substrings)
 {
     this.type = type;
     this.substrings = substrings;
 }
 public AttributeList_element(
     AttributeDescription type,
     Asn1SetOf<AttributeValue> vals)
 {
     this.type = type;
     this.vals = vals;
 }
 public AttributeTypeAndValues(
     AttributeDescription type,
     Asn1SetOf<AttributeValue> vals)
 {
     this.type = type;
     this.vals = vals;
 }
 public AttributeValueAssertion(
     AttributeDescription attributeDesc,
     AssertionValue assertionValue)
 {
     this.attributeDesc = attributeDesc;
     this.assertionValue = assertionValue;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// This constructor allows primitive data to be passed for all 
 /// primitive elements.  It will create new object wrappers for 
 /// the primitive data and set other elements to references to 
 /// the given objects 
 /// </summary>
 public Attribute(byte[] type_,
     _SetOfAttributeValue vals_
     )
     : base()
 {
     type = new AttributeDescription (type_);
      vals = vals_;
      SetKey (_Lightweight_Directory_Access_Protocol_V3Values._rtkey);
 }
 public MatchingRuleAssertion(
     MatchingRuleId matchingRule,
     AttributeDescription type,
     AssertionValue matchValue,
     Asn1Boolean dnAttributes)
 {
     this.matchingRule = matchingRule;
     this.type = type;
     this.matchValue = matchValue;
     this.dnAttributes = dnAttributes;
 }
        /// <summary>
        /// Creates a SearchRequest packet.
        /// </summary>
        /// <param name="context">The user context which contains message ID.</param>
        /// <param name="dn">The DN to be searched.</param>
        /// <param name="sizeLimit">Size limit.</param>
        /// <param name="timeLimit">Time limit, in seconds.</param>
        /// <param name="scope">Search scope. Base, single level, or subtree.</param>
        /// <param name="dereferenceAliases">Dereference aliase options.</param>
        /// <param name="filter">Search filter.</param>
        /// <param name="typesOnly">
        /// Specifies whether the search returns only the attribute names without the attribute values.
        /// </param>
        /// <param name="attributes">The attributes to be retrieved.</param>
        /// <returns>The packet that contains the request.</returns>
        internal override AdtsSearchRequestPacket CreateSearchRequest(
            AdtsLdapContext context,
            string dn,
            long sizeLimit,
            long timeLimit,
            MsLdap.SearchScope scope,
            MsLdap.DereferenceAlias dereferenceAliases,
            Asn1Choice filter,
            bool typesOnly,
            params string[] attributes)
        {
            int length = (attributes != null) ? attributes.Length : 0;

            AttributeDescription[] attributeDescriptionArray = new AttributeDescription[length];
            for (int i = 0; i < length; i++)
            {
                attributeDescriptionArray[i] = new AttributeDescription(attributes[i]);
            }
            AttributeDescriptionList attributeList = new AttributeDescriptionList(attributeDescriptionArray);

            SearchRequest searchRequest = new SearchRequest(
                new LDAPDN(dn ?? string.Empty),
                new SearchRequest_scope((long)scope),
                new SearchRequest_derefAliases((long)dereferenceAliases),
                new Asn1Integer(sizeLimit),
                new Asn1Integer(timeLimit),
                new Asn1Boolean(typesOnly),
                (Filter)filter,
                attributeList);

            LDAPMessage_protocolOp operation = new LDAPMessage_protocolOp();
            operation.SetData(LDAPMessage_protocolOp.searchRequest, searchRequest);

            LDAPMessage message = new LDAPMessage(new MessageID(context.MessageId), operation, null);
            AdtsSearchRequestPacket packet = new AdtsSearchRequestPacket();
            packet.ldapMessagev3 = message;
            packet.messageId = context.MessageId;

            return packet;
        }
Ejemplo n.º 8
0
        public override void Decode(Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength)
        {
            int llen = (explicitTagging) ?
            MatchTag (buffer, Asn1Tag.SEQUENCE) : implicitLength;

             Init ();

             // decode SEQUENCE

             Asn1BerDecodeContext _context =
            new Asn1BerDecodeContext (buffer, llen);

             IntHolder elemLen = new IntHolder();

             // decode type

             if (_context.MatchElemTag (Asn1Tag.UNIV, Asn1Tag.PRIM, 4, elemLen, false)) {
            type = new AttributeDescription();
            type.Decode (buffer, true, elemLen.mValue);
             }
             else throw new Asn1MissingRequiredException (buffer);

             // decode vals

             if (_context.MatchElemTag (Asn1Tag.UNIV, Asn1Tag.CONS, 17, elemLen, false)) {
            vals = new _SetOfAttributeValue();
            vals.Decode (buffer, true, elemLen.mValue);
             }
             else throw new Asn1MissingRequiredException (buffer);

             if (explicitTagging && llen == Asn1Status.INDEFLEN) {
            MatchTag (buffer, Asn1Tag.EOC);
             }
        }
Ejemplo n.º 9
0
 public void Init()
 {
     type = null;
      vals = null;
 }
Ejemplo n.º 10
0
 public void Init()
 {
     type = null;
     vals = null;
 }
Ejemplo n.º 11
0
        public override int BerDecode(IAsn1DecodingBuffer buffer, bool explicitTag = true)
        {
            int     allLen = 0;
            Asn1Tag contextTag;

            allLen += TagBerDecode(buffer, out contextTag);

            int valueLen;

            allLen += LengthBerDecode(buffer, out valueLen);

            switch (contextTag.TagValue)
            {
            case 0:
                field0  = new Asn1SetOf <Filter>();
                allLen += field0.BerDecode(buffer, false);
                SetData(1, field0);
                break;

            case 1:
                field1  = new Asn1SetOf <Filter>();
                allLen += field1.BerDecode(buffer, false);
                SetData(2, field1);
                break;

            case 2:
                field2  = new Filter();
                allLen += field2.BerDecode(buffer, false);
                SetData(3, field2);
                break;

            case 3:
                field3  = new AttributeValueAssertion();
                allLen += field3.BerDecode(buffer, false);
                SetData(4, field3);
                break;

            case 4:
                field4  = new SubstringFilter();
                allLen += field4.BerDecode(buffer, false);
                SetData(5, field4);
                break;

            case 5:
                field5  = new AttributeValueAssertion();
                allLen += field5.BerDecode(buffer, false);
                SetData(6, field5);
                break;

            case 6:
                field6  = new AttributeValueAssertion();
                allLen += field6.BerDecode(buffer, false);
                SetData(7, field6);
                break;

            case 7:
                field7  = new AttributeDescription();
                allLen += field7.BerDecode(buffer, false);
                SetData(8, field7);
                break;

            case 8:
                field8  = new AttributeValueAssertion();
                allLen += field8.BerDecode(buffer, false);
                SetData(9, field8);
                break;

            case 9:
                field9  = new MatchingRuleAssertion();
                allLen += field9.BerDecode(buffer, false);
                SetData(10, field9);
                break;

            default:
                throw new Asn1DecodingUnexpectedData(ExceptionMessages.DecodingUnexpectedData + " AuthenticationChoice");
            }
            return(allLen);
        }