Branch: Tag:

2005-04-07

2005-04-07 18:36:15 by Martin Stjernholm <mast@lysator.liu.se>

Added get_cached_filter.

Rev: lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1.95

2:      // LDAP client protocol implementation for Pike.   // - // $Id: client.pike,v 1.94 2005/04/07 18:16:02 mast Exp $ + // $Id: client.pike,v 1.95 2005/04/07 18:36:15 mast Exp $   //   // Honza Petrous, hop@unibase.cz   //
560: Inside #if undefined(PARSE_RFCS)
   void create(string|mapping(string:mixed)|void url, object|void context)    {    -  info = ([ "code_revision" : ("$Revision: 1.94 $"/" ")[1] ]); +  info = ([ "code_revision" : ("$Revision: 1.95 $"/" ")[1] ]);       if(!url || !sizeof(url))    url = LDAP_DEFAULT_URL;
1123:    attrs[attr] = 1;       mapping(string:array(string)) res = -  simple_read ("", get_cached_filter ("(objectClass=*)", ldap_version), -  indices (attrs)); +  simple_read ("", get_cached_filter ("(objectClass=*)"), indices (attrs));       foreach (indices (res), string attr)    // Microsoft AD has several attributes in its root DSE that
1186:    return Protocols.LDAP.make_filter (filter, ldap_version);   }    + object get_cached_filter (string filter) + //! This is a wrapper for @[Protocols.LDAP.get_cached_filter] which + //! passes the LDAP protocol version currently in use by this + //! connection. + //! + //! @throws + //! If there's a parse error in the filter then a + //! @[Protocols.LDAP.FilterError] is thrown as from + //! @[Protocols.LDAP.make_filter]. + { +  return Protocols.LDAP.get_cached_filter (filter, ldap_version); + } +    object get_default_filter()   //! Returns the ASN1 object parsed from the filter specified in the   //! LDAP URL, or zero if the URL doesn't specify any filter.
1494:    object|int search_request =    make_search_op (object_name, 0, ldap_deref,    ldap_sizelimit, ldap_timelimit, attrsonly, -  filter || get_cached_filter ("(objectClass=*)", ldap_version), +  filter || get_cached_filter ("(objectClass=*)"),    attrs);       if(intp(search_request)) {
1923:    subschema_response = root_dse;    else {    subschema_response = -  simple_read (dn, get_cached_filter ("(objectClass=*)", ldap_version), -  ({"subschemaSubentry"})); +  simple_read (dn, get_cached_filter ("(objectClass=*)"), ({"subschemaSubentry"}));    utf8_decode_dns = 1;    }   
1933:    if (sizeof (subschema_dns) == 1)    return simple_read (    utf8_decode_dns ? utf8_to_string (subschema_dns[0]) : subschema_dns[0], -  get_cached_filter ("(objectClass=subschema)", ldap_version), attrs); +  get_cached_filter ("(objectClass=subschema)"), attrs);       else {    // This should afaics only occur for the root DSE, but it's a
1945:    foreach (subschema_dns, string subschema_dn) {    if (mapping(string:array(string)) subres = simple_read (    utf8_decode_dns ? utf8_to_string (subschema_dn) : subschema_dn, -  get_cached_filter ("(objectClass=subschema)", ldap_version), attrs)) +  get_cached_filter ("(objectClass=subschema)"), attrs))    foreach (indices (subres), string attr)    res[attr] += subres[attr];    }