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.112 2008/06/20 16:24:18 srb Exp $ + // $Id: client.pike,v 1.113 2008/06/28 16:36:58 nilsson 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:110:    int ldap_sizelimit;    int ldap_timelimit;    mapping lauth = ([]);    object default_filter_obj; // Filter object parsed from lauth->filter.    result last_rv; // last returned value    // FIXME: Should remove last_rv to avoid ref cycles. The only    // problem is the get_referrals function.    }      //! @ignore - static function(string:string) get_attr_decoder (string attr, + protected function(string:string) get_attr_decoder (string attr,    DO_IF_DEBUG (void|int nowarn))   {    if (mapping(string:mixed) attr_descr = get_attr_type_descr (attr)) {    if (function(string:string) decoder =    syntax_decode_fns[attr_descr->syntax_oid])    return decoder;   #ifdef DEBUG    else if (!get_constant_name (attr_descr->syntax_oid))    werror ("Warning: Unknown syntax %O for attribute %O - "    "binary content assumed.\n", attr_descr->syntax_oid, attr);
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:132: Inside #if defined(DEBUG)
   }   #ifdef DEBUG    else if (!nowarn && !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;   }   //! @endignore    - static function(string:string) get_attr_encoder (string attr) + protected function(string:string) get_attr_encoder (string attr)   {    if (mapping(string:mixed) attr_descr = get_attr_type_descr (attr)) {    if (function(string:string) encoder =    syntax_encode_fns[attr_descr->syntax_oid])    return encoder;   #ifdef DEBUG    else if (!get_constant_name (attr_descr->syntax_oid))    werror ("Warning: Unknown syntax %O for attribute %O - "    "binary content assumed.\n", attr_descr->syntax_oid, attr);   #endif
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:251:    DECODE_ENTRIES (dn = ASN1_GET_DN (derent), {    attrs[attr = ASN1_GET_ATTR_NAME (derattr)] =    ASN1_GET_ATTR_VALUES (derattr);    });      #undef DECODE_ENTRIES       return res;    }    -  static void decode_entry (ResultEntry ent) +  protected void decode_entry (ResultEntry ent)    {    // 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"; \
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1128:    return 0;    }       last_rv = SIMPLE_RESULT (raw, 0, 0);    DWRITE_HI(sprintf("client.ADD: %s\n", last_rv->error_string()));    seterr (last_rv->error_number(), last_rv->error_string());    return !last_rv->error_number();       } // add    - static mapping(string:array(string)) simple_read (string object_name, + protected mapping(string:array(string)) simple_read (string object_name,    object filter,    array attrs)   // Makes a base object search for object_name. The result is returned   // as a mapping where the attribute types have been lowercased and the   // string values are unprocessed.   {    object|int search_request =    make_search_op(object_name, 0, 0, 0, 0, 0, filter, attrs);    //werror("search_request: %O\n", search_request);   
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1165:    // just as well pass a zero there. :P    if (intp(raw = readmsg(0))) {    THROW(({error_string()+"\n",backtrace()}));    return 0;    }    } while (1);       return res;   }    - static mapping(string:array(string)) root_dse; + protected mapping(string:array(string)) root_dse;      array(string) get_root_dse_attr (string attr)   //! Returns the value of an attribute in the root DSE (DSA-Specific   //! Entry) of the bound server. The result is cached. A working   //! connection is assumed.   //!   //! @returns   //! The return value is an array of the attribute values, which have   //! been UTF-8 decoded where appropriate.   //!
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1241:    else {    root_dse = res;    if (!root_dse[attr]) root_dse[attr] = 0;    }    });    }       return root_dse[attr];   }    - static object make_control (string control_type, void|string value, + protected object make_control (string control_type, void|string value,    void|int critical)   {    array(object) seq = ({Standards.ASN1.Types.asn1_octet_string (control_type),    ASN1_BOOLEAN (critical)});    if (value) seq += ({Standards.ASN1.Types.asn1_octet_string (value)});    return Standards.ASN1.Types.asn1_sequence (seq);   }    - static multiset(string) supported_controls; + 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   //! @[search]   {    if (!supported_controls) {
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:2025:       //! Compatibility alias for @[Protocols.LDAP.parse_ldap_url].    mapping(string:mixed) parse_url (string ldapuri)    {    return parse_ldap_url (ldapuri);    }         // Schema handling.    - static mapping(string:array(string)) query_subschema (string dn, + protected mapping(string:array(string)) query_subschema (string dn,    array(string) attrs)   // Queries the server for the specified attributes in the subschema   // applicable for the specified object. The return value is on the   // same form as from simple_read (specifically there's no UTF-8   // decoding of the values).   //   // If dn == "" then the attribute values might be joined from several   // schemas. (Might change since I'm not sure whether that's really   // useful or not - haven't got a good grasp on how multiple schemas   // interact in the same server. /mast)
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:2076:    foreach (indices (subres), string attr)    res[attr] += subres[attr];    }    return res;    }    }       return 0;   }    - static mapping(string:mixed) parse_schema_terms ( + protected mapping(string:mixed) parse_schema_terms (    string str,    mapping(string:string|multiset|mapping) known_terms,    string errmsg_prefix)   // Parses a string containing a parenthesized list of terms as used in   // several schema related attributes. The known_terms mapping   // specifies the syntax of the known terms. If there's an entry "" in   // it it's used for all other encountered terms.   {    string orig_str = str, oid;   
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:2263:    }    } while (!sscanf (str, ")%s", str));       if (str != "")    ERROR ("%sUnexpected data after ending ')' at pos %d: %O\n",    errmsg_prefix, sizeof (orig_str) - sizeof (str) - 1, orig_str);       return res;   }    - static constant attr_type_term_syntax = ([ + protected constant attr_type_term_syntax = ([    "NAME": "qdescrs",    "DESC": "qdstring",    "OBSOLETE": "flag",    "SUP": "oid",    "EQUALITY": "oid",    "ORDERING": "oid",    "SUBSTR": "oid",    "SYNTAX": "oidlen",    "SINGLE-VALUE": "flag",    "COLLECTIVE": "flag",
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:2288:    // 2252, but of course the iPlanet LDAP server manages to return    // "dsaOperation" instead of "dSAOperation". :P    "userapplications": "userApplications",    "directoryoperation": "directoryOperation",    "distributedoperation": "distributedOperation",    "dsaoperation": "dSAOperation"    ]),    "": "qdstrings"   ]);    - static mapping(string:mapping(string:mixed)) attr_type_descrs; + protected mapping(string:mapping(string:mixed)) attr_type_descrs;      mapping(string:mixed) get_attr_type_descr (string attr, void|int standard_attrs)   //! Returns the attribute type description for the given attribute,   //! which includes the name, object identifier, syntax, etc (see   //! section 4.2 in RFC 2252 for details).   //!   //! This might do a query to the server, but results are cached.   //!   //! @param attr   //! The name of the attribute. Might also be the object identifier
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:2509: Inside #if defined(PARSE_RFCS)
   write ("]);\n");    }    }   }      #endif      #else   constant this_program_does_not_exist=1;   #endif +