pike.git / lib / modules / Protocols.pmod / LDAP.pmod / client.pike

version» Context lines:

pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:67:   // RFC 2307 (LDAP as network information services; draft?)      #include "ldap_globals.h"      #if constant(SSL.Cipher)   import SSL.Constants;   #endif      import ".";    + import Standards.ASN1.Types; +    // ------------------------      // ASN.1 decode macros      #define ASN1_GET_RESULTAPP(X) ((X)->elements[1]->get_tag())   #define ASN1_GET_DN(X) ((X)->elements[0]->value)   #define ASN1_GET_ATTR_ARRAY(X) (sizeof ((X)->elements) > 1 && \    (array) ((X)->elements[1]->elements))   #define ASN1_GET_ATTR_NAME(X) ((X)->elements[0]->value)   #define ASN1_GET_ATTR_VALUES(X) ((X)->elements[1]->elements->value)
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:743:    last_rv = 0;   }       private mixed send_bind_op(string name, string password) {    // Simple BIND operation       object msgval, vers, namedn, auth;    string pass = password;    password = "censored";    -  vers = Standards.ASN1.Types.asn1_integer(ldap_version); -  namedn = Standards.ASN1.Types.asn1_octet_string(name); +  vers = Integer(ldap_version); +  namedn = OctetString(name);    auth = ASN1_CONTEXT_OCTET_STRING(0, pass);    // SASL credentials ommited       msgval = ASN1_APPLICATION_SEQUENCE(0, ({vers, namedn, auth}));       return do_op(msgval);    }       private mixed send_starttls_op(object|void context) {   
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:768: Inside #if constant(SSL.Cipher)
   // can we do this now?    if(ldapfd->context)    {    THROW(({"LDAP: TLS/SSL already established.\n",backtrace()}));    }       // NOTE: should we be on the lookout for requests in flight?          -  msgval = ASN1_APPLICATION_SEQUENCE(23, ({Standards.ASN1.Types.OctetString("1.3.6.1.4.1.1466.20037")})); +  msgval = ASN1_APPLICATION_SEQUENCE(23, ({OctetString("1.3.6.1.4.1.1466.20037")}));       do_op(msgval);    int result = ASN1_RESULTCODE(.ldap_privates.ldap_der_decode (readbuf));    if(result!=0) return 0;    // otherwise, we can try to negotiate.    if(!context)    {    context = SSL.Context();    }    object _f = ldapfd;
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:970:    return !last_rv->error_number();       } // delete       private int|string send_compare_op(string dn, string attr, string value) {    // COMPARE       object msgval;       msgval = ASN1_APPLICATION_SEQUENCE(14, -  ({ Standards.ASN1.Types.asn1_octet_string(dn), -  Standards.ASN1.Types.asn1_sequence( -  ({ Standards.ASN1.Types.asn1_octet_string(attr), -  Standards.ASN1.Types.asn1_octet_string(value) -  })) +  ({ OctetString(dn), +  Sequence( ({ OctetString(attr), OctetString(value) }) )    })    );       return do_op(msgval);    }          //!    //! Compares an attribute value with one in the directory.    //!
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1051:       object msgval;    string atype;    array(object) oatt = ({});       foreach(indices(attrs), atype) {    string aval;    array(object) ohlp = ({});       foreach(values(attrs[atype]), aval) -  ohlp += ({Standards.ASN1.Types.asn1_octet_string(aval)}); -  oatt += ({Standards.ASN1.Types.asn1_sequence( -  ({Standards.ASN1.Types.asn1_octet_string(atype), -  Standards.ASN1.Types.asn1_set(ohlp) +  ohlp += ({OctetString(aval)}); +  oatt += ({Sequence( +  ({OctetString(atype), +  Set(ohlp)    }))    });    }       msgval = ASN1_APPLICATION_SEQUENCE(8, -  ({Standards.ASN1.Types.asn1_octet_string(dn), -  Standards.ASN1.Types.asn1_sequence(oatt) -  })); +  ({ OctetString(dn), Sequence(oatt) }));       return do_op(msgval);    }          //! The Add Operation allows a client to request the addition    //! of an entry into the directory    //!    //! @param dn    //! The Distinguished Name of the entry to be added.
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1233:    }    });    }       return root_dse[attr];   }      protected object make_control (string control_type, void|string value,    void|int critical)   { -  array(object) seq = ({Standards.ASN1.Types.asn1_octet_string (control_type), -  Standards.ASN1.Types.Boolean (critical)}); -  if (value) seq += ({Standards.ASN1.Types.asn1_octet_string (value)}); -  return Standards.ASN1.Types.asn1_sequence (seq); +  array(object) seq = ({OctetString (control_type), +  Boolean (critical)}); +  if (value) seq += ({OctetString (value)}); +  return Sequence (seq);   }      protected multiset(string) supported_controls;      multiset(string) get_supported_controls()   //! Returns a multiset containing the controls supported by the   //! server. They are returned as object identifiers on string form.   //! A working connection is assumed.   //!   //! @seealso
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1313:    {    // SEARCH    // limitations: !!! sizelimit and timelimit should be unsigned int !!!       array(object) ohlp;       ohlp = ({filter});    if (arrayp(attrs)) { //explicitly defined attributes    array(object) o2 = ({});    foreach(attrs, string s2) -  o2 += ({Standards.ASN1.Types.asn1_octet_string(s2)}); -  ohlp += ({Standards.ASN1.Types.asn1_sequence(o2)}); +  o2 += ({OctetString(s2)}); +  ohlp += ({Sequence(o2)});    } else -  ohlp += ({Standards.ASN1.Types.asn1_sequence(({}))}); +  ohlp += ({Sequence(({}))});       return ASN1_APPLICATION_SEQUENCE(3, -  ({ Standards.ASN1.Types.asn1_octet_string(basedn), -  Standards.ASN1.Types.Enumerated(scope), -  Standards.ASN1.Types.Enumerated(deref), -  Standards.ASN1.Types.asn1_integer(sizelimit), -  Standards.ASN1.Types.asn1_integer(timelimit), -  Standards.ASN1.Types.Boolean(attrsonly ? -1 : 0), +  ({ OctetString(basedn), +  Enumerated(scope), +  Enumerated(deref), +  Integer(sizelimit), +  Integer(timelimit), +  Boolean(attrsonly ? -1 : 0),    @ohlp    })) ;    }       //! Search LDAP directory.    //!    //! @param filter    //! Search filter to override the one from the LDAP URL. It's    //! either a string with the format specified in RFC 2254, or an    //! object returned by @[Protocols.LDAP.make_filter].
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1453: Inside #if 0
   // LDAP_SERVER_DOMAIN_SCOPE_OID    // "Tells server not to generate referrals" (NtLdap.h)    common_controls += ({make_control (LDAP_SERVER_DOMAIN_SCOPE_OID)});    }   #endif      #ifdef ENABLE_PAGED_SEARCH    get_supported_controls();   #endif    -  object cookie = Standards.ASN1.Types.asn1_octet_string(""); +  object cookie = OctetString("");    do {    PROFILE("send_search_op", {    array ctrls = common_controls;    IF_ELSE_PAGED_SEARCH (    if (supported_controls[LDAP_PAGED_RESULT_OID_STRING]) {    // LDAP Control Extension for Simple Paged Results Manipulation    // RFC 2696.    ctrls += ({make_control (    LDAP_PAGED_RESULT_OID_STRING, -  Standards.ASN1.Types.asn1_sequence( +  Sequence(    ({    // size -  Standards.ASN1.Types.asn1_integer(0x7fffffff), +  Integer(0x7fffffff),    cookie, // cookie    }))->get_der(),    sizeof(cookie->value))});    },);    object controls;    if (sizeof(ctrls)) {    controls = .ldap_privates.asn1_sequence(0, ctrls);    }       string|int raw;
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1826:    object o, msgval;    string atype;    array(object) oatt = ({}), attrarr;          foreach(indices(attropval), atype) {    if(!intp((attropval[atype])[0]))    return seterr(LDAP_PROTOCOL_ERROR);    attrarr = ({});    for(int ix=1; ix<sizeof(attropval[atype]); ix++) -  attrarr += ({Standards.ASN1.Types.asn1_octet_string( -  (attropval[atype])[ix])}); +  attrarr += ({ OctetString(attropval[atype][ix]) });   // if(sizeof(attrarr)) // attributevalue ? -  o = Standards.ASN1.Types.asn1_sequence( -  ({Standards.ASN1.Types.asn1_octet_string(atype), -  Standards.ASN1.Types.asn1_set(attrarr) -  })); +  o = Sequence( ({OctetString(atype), Set(attrarr) }));   // else   // o = Standards.ASN1.Encode.asn1_sequence(   // Standards.ASN1.Encode.asn1_octet_string(atype)); -  oatt += ({Standards.ASN1.Types.asn1_sequence( -  ({Standards.ASN1.Types.Enumerated((attropval[atype])[0]), -  o -  }))}); +  oatt += ({ Sequence( ({Enumerated((attropval[atype])[0]), o})) });    } //foreach       msgval = ASN1_APPLICATION_SEQUENCE(6, -  ({ Standards.ASN1.Types.asn1_octet_string(dn), -  Standards.ASN1.Types.asn1_sequence(oatt) -  })); +  ({ OctetString(dn), Sequence(oatt) }));       return do_op(msgval);    }       private int|string send_modifydn_op(string dn, string newrdn,    int deleteoldrdn, string newsuperior) {       object msgval; -  array seq=({ Standards.ASN1.Types.asn1_octet_string(dn), -  Standards.ASN1.Types.asn1_octet_string(newrdn), -  Standards.ASN1.Types.asn1_boolean(deleteoldrdn) +  array seq=({ +  OctetString(dn), +  OctetString(newrdn), +  Boolean(deleteoldrdn)    });    if(newsuperior) -  seq+=({Standards.ASN1.Types.asn1_octet_string(newsuperior)}); +  seq+=({ OctetString(newsuperior)});       msgval = ASN1_APPLICATION_SEQUENCE(12, seq);       return do_op(msgval);    }       //! The Modify DN Operation allows a client to change the leftmost    //! (least significant) component of the name of an entry in the directory,    //! or to move a subtree of entries to a new location in the directory.    //!