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

version» Context lines:

pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1:   #pike __REAL_VERSION__      // LDAP client protocol implementation for Pike.   // - // $Id: client.pike,v 1.99 2006/05/11 12:36:25 mast Exp $ + // $Id: client.pike,v 1.100 2006/05/29 12:58:55 mast Exp $   //   // Honza Petrous, hop@unibase.cz   //   // ----------------------------------------------------------------------   //   // History:   //   // v0.0 1998-05-25 Starting up!   // v1.0 1998-06-21 Core functions (open, bind, unbind, delete, add,   // compare, search), only V2 operations,
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:222:    foreach (derattribs, object derattr) { \    string attr; \    {SET_ATTR;} \    } \    res += ({attrs}); \    } \    } \    } \    } while (0)    + #define IMPROVE_DECODE_ERRS(DECODE, ATTR, VALUE, DECODER_FN) do { \ +  if (mixed err = catch {DECODE;}) { \ +  mapping descr1, descr2; \ +  catch (descr1 = get_attr_type_descr (ATTR)); \ +  catch (descr2 = get_attr_type_descr (ATTR, 1)); \ +  catch { \ +  err[0] = \ +  sprintf ("Error decoding value %O for attribute %O " \ +  "using %O: %s" \ +  "Used attribute type %O, server reports %O\n", \ +  VALUE, ATTR, DECODER_FN, err[0], descr1, descr2); \ +  }; \ +  throw (err); \ +  } \ +  } while (0) +     if (ldap_version < 3) {    // Use the values raw.    if (flags & SEARCH_LOWER_ATTRS)    DECODE_ENTRIES (ASN1_GET_DN (derent), {    attrs[attr = lower_case (ASN1_GET_ATTR_NAME (derattr))] =    ASN1_GET_ATTR_VALUES (derattr);    });    else    DECODE_ENTRIES (ASN1_GET_DN (derent), {    attrs[attr = ASN1_GET_ATTR_NAME (derattr)] =
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:251:    if (flags & SEARCH_LOWER_ATTRS)    DECODE_ENTRIES (utf8_to_string (ASN1_GET_DN (derent)), {    attr = lower_case (ASN1_GET_ATTR_NAME (derattr));    if (function(string:string) decoder =    // Microsoft AD has several attributes in its root DSE    // that they have not bothered to include in their    // schema. So if this is the root being fetched then    // send the nowarn flag to get_attr_encoder to avoid    // complaints about that.    get_attr_decoder (attr, DO_IF_DEBUG (dn == ""))) -  attrs[attr] = map (ASN1_GET_ATTR_VALUES (derattr), decoder); +  IMPROVE_DECODE_ERRS ( +  attrs[attr] = map (ASN1_GET_ATTR_VALUES (derattr), decoder), +  attr, ASN1_GET_ATTR_VALUES (derattr), decoder);    else    attrs[attr] = ASN1_GET_ATTR_VALUES (derattr);    });    else    DECODE_ENTRIES (utf8_to_string (ASN1_GET_DN (derent)), {    attr = ASN1_GET_ATTR_NAME (derattr);    if (function(string:string) decoder =    get_attr_decoder (attr, DO_IF_DEBUG (dn == ""))) -  attrs[attr] = map (ASN1_GET_ATTR_VALUES (derattr), decoder); +  IMPROVE_DECODE_ERRS ( +  attrs[attr] = map (ASN1_GET_ATTR_VALUES (derattr), decoder), +  attr, ASN1_GET_ATTR_VALUES (derattr), decoder);    else    attrs[attr] = ASN1_GET_ATTR_VALUES (derattr);    });    }      #undef DECODE_ENTRIES       return res;    }   
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:553: Inside #if undefined(PARSE_RFCS)
   //! @[Protocol.LDAP.parse_ldap_url].    //!    //! @param context    //! TLS context of connection    //!    //! @seealso    //! @[LDAP.client.bind], @[LDAP.client.search]    void create(string|mapping(string:mixed)|void url, object|void context)    {    -  info = ([ "code_revision" : ("$Revision: 1.99 $"/" ")[1] ]); +  info = ([ "code_revision" : ("$Revision: 1.100 $"/" ")[1] ]);       if(!url || !sizeof(url))    url = LDAP_DEFAULT_URL;       if (mappingp (url))    lauth = url;    else    lauth = parse_ldap_url(url);       if(!stringp(lauth->scheme) ||