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

version» Context lines:

pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:84:   #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)      #define ASN1_RESULTCODE(X) (int)((X)->elements[1]->elements[0]->value->cast_to_int())   #define ASN1_RESULTSTRING(X) ((X)->elements[1]->elements[2]->value)   #define ASN1_RESULTREFS(X) ((X)->elements[1]->elements[3]->elements) - #define ASN1_RAWDEBUG(X) ((X)->debug_string()) +        //! Contains the client implementation of the LDAP protocol.    //! All of the version 2 protocol features are implemented    //! but only the base parts of the version 3.       inherit .protocol;       private {    string bound_dn; // When actually bound, set to the bind DN.    string md5_password; // MD5 hash of the bind password, if any.
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:150:   #endif    }   #ifdef DEBUG    else if (!has_suffix (attr, ";binary") && !has_value (attr, ";binary;"))    werror ("Warning: Couldn't fetch attribute description for %O - "    "binary content assumed.\n", attr);   #endif    return 0;   }    - typedef string|Locale.Charset.DecodeError| -  array(string|Locale.Charset.DecodeError) ResultAttributeValue; + typedef string|Charset.DecodeError| +  array(string|Charset.DecodeError) ResultAttributeValue;      typedef mapping(string:ResultAttributeValue) ResultEntry;       //! Contains the result of a LDAP search.    //!    //! @seealso    //! @[LDAP.client.search], @[LDAP.client.result.fetch]    //!    class result // ------------------    {
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:261:    // Used in LDAPv3 only: Decode the dn and values as appropriate    // according to the schema. Note that attributes with the    // ";binary" option won't be matched by get_attr_type_descr and    // are therefore left untouched.      #define DECODE_DN(DN) do { \    if (mixed err = catch (DN = utf8_to_string (DN))) { \    string errmsg = describe_error (err) + \    "The string is the DN of an entry.\n"; \    if (flags & SEARCH_RETURN_DECODE_ERRORS) \ -  DN = Locale.Charset.DecodeError (DN, -1, 0, errmsg); \ +  DN = Charset.DecodeError (DN, -1, 0, errmsg); \    else \ -  throw (Locale.Charset.DecodeError (DN, -1, 0, errmsg)); \ +  throw (Charset.DecodeError (DN, -1, 0, errmsg)); \    } \    } while (0)       ResultAttributeValue dn = m_delete (ent, "dn");    if (stringp (dn))    DECODE_DN (dn);    else    DECODE_DN (dn[0]);      #ifdef LDAP_DECODE_DEBUG
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:289:    catch (descr2 = get_attr_type_descr (ATTR, 1)); \    string errmsg = \    sprintf ("%s" \    "The string occurred in the value of attribute %O " \    "in entry with DN %O.\n" \    "Used decoder %O for attribute type %O, " \    "server reports %O.\n", \    describe_error (err), ATTR, stringp (dn) ? dn : dn[0], \    decoder, descr1, descr2); \    if (flags & SEARCH_RETURN_DECODE_ERRORS) \ -  VALUE = Locale.Charset.DecodeError (VALUE, -1, 0, errmsg); \ +  VALUE = Charset.DecodeError (VALUE, -1, 0, errmsg); \    else \ -  throw (Locale.Charset.DecodeError (VALUE, -1, 0, errmsg)); \ +  throw (Charset.DecodeError (VALUE, -1, 0, errmsg)); \    } \    } while (0)      #else      #define DECODE_VALUE(ATTR, VALUE, DECODER) do { \    if (mixed err = catch {VALUE = DECODER (VALUE);}) { \    string errmsg = \    sprintf ("%s" \    "The string occurred in the value of attribute %O " \    "in entry with DN %O.\n", \    describe_error (err), ATTR, stringp (dn) ? dn : dn[0]); \    if (flags & SEARCH_RETURN_DECODE_ERRORS) \ -  VALUE = Locale.Charset.DecodeError (VALUE, -1, 0, errmsg); \ +  VALUE = Charset.DecodeError (VALUE, -1, 0, errmsg); \    else \ -  throw (Locale.Charset.DecodeError (VALUE, -1, 0, errmsg)); \ +  throw (Charset.DecodeError (VALUE, -1, 0, errmsg)); \    } \    } while (0)      #endif       foreach (ent; string attr; ResultAttributeValue vals) {    if (function(string:string) decoder =    get_attr_decoder (attr, DO_IF_DEBUG (stringp (dn) ?    dn == "" : dn[0] == ""))) {    if (stringp (vals)) {    DECODE_VALUE (attr, vals, decoder);    ent[attr] = vals;    }    else -  foreach (vals; int i; string|Locale.Charset.DecodeError val) { +  foreach (vals; int i; string|Charset.DecodeError val) {    DECODE_VALUE (attr, val, decoder);    vals[i] = val;    }    }    }      #undef DECODE_VALUE       ent->dn = dn;    }
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:455:    //!    //! @mapping    //! @member string attribute    //! An attribute in the entry. The value is an array containing    //! the returned attribute value(s) on string form, or a single    //! string if @[Protocols.LDAP.SEARCH_MULTIVAL_ARRAYS_ONLY] was    //! given to @[search] and the attribute is typed as single    //! valued.    //!    //! If @[Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS] was given -  //! to @[search] then @[Locale.Charset.DecodeError] objects are +  //! to @[search] then @[Charset.DecodeError] objects are    //! returned in place of a string whenever an attribute value    //! fails to be decoded.    //!    //! @member string "dn"    //! This special entry contains the object name of the entry as    //! a distinguished name.    //! -  //! This might also be a @[Locale.Charset.DecodeError] if +  //! This might also be a @[Charset.DecodeError] if    //! @[Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS] was given to    //! @[search].    //! @endmapping    //!    //! Zero is returned if the cursor is outside the valid range of    //! entries.    //!    //! @throws    //! Unless @[Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS] was -  //! given to @[search], a @[Locale.Charset.DecodeError] is thrown -  //! if there is an error decoding the DN or any attribute value. +  //! given to @[search], a @[Charset.DecodeError] is thrown if +  //! there is an error decoding the DN or any attribute value.    //!    //! @note    //! It's undefined whether or not destructive operations on the    //! returned mapping will affect future @[fetch] calls for the    //! same entry.    //!    //! @note    //! In Pike 7.6 and earlier, the special @expr{"dn"@} entry was    //! incorrectly returned in UTF-8 encoded form for LDAPv3    //! connections.
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:519:    }       //!    //! Returns distinguished name (DN) of the current entry in the    //! result list. Note that this is the same as getting the    //! @expr{"dn"@} field from the return value from @[fetch].    //!    //! @note    //! In Pike 7.6 and earlier, this field was incorrectly returned    //! in UTF-8 encoded form for LDAPv3 connections. -  string|Locale.Charset.DecodeError get_dn() +  string|Charset.DecodeError get_dn()    {    string|array(string) dn = fetch()->dn;    return stringp (dn) ? dn : dn[0]; // To cope with SEARCH_MULTIVAL_ARRAYS_ONLY.    }       //!    //! Initialized the result cursor to the first entry    //! in the result list.    //!    //! @seealso
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:556:    array(ResultEntry) fetch_all()    //! Convenience function to fetch all entries at once. The cursor    //! isn't affected.    //!    //! @returns    //! Returns an array where each element is the entry from the    //! result. Don't be destructive on the returned value.    //!    //! @throws    //! Unless @[Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS] was -  //! given to @[search], a @[Locale.Charset.DecodeError] is thrown -  //! if there is an error decoding the DN or any attribute value. +  //! given to @[search], a @[Charset.DecodeError] is thrown if +  //! there is an error decoding the DN or any attribute value.    //!    //! @seealso    //! @[fetch]    {    for (; first_undecoded_entry < sizeof (entry); first_undecoded_entry++)    decode_entry (entry[first_undecoded_entry]);    return entry;    }       } // end of class 'result' ---------------