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.104 2007/05/23 10:32:38 mast Exp $ + // $Id: client.pike,v 1.105 2007/05/23 11:20: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:97:   #define ASN1_DECODE_RAWDEBUG(X) (.ldap_privates.ldap_der_decode(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.    string ldap_basedn; // baseDN    int ldap_scope; // SCOPE_*    int ldap_deref; // 0: ...    int ldap_sizelimit;    int ldap_timelimit;    mapping lauth = ([]);    object default_filter_obj; // Filter object parsed from lauth->filter.    result last_rv; // last returned value    }   
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:591: 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.104 $"/" ")[1] ]); +  info = ([ "code_revision" : ("$Revision: 1.105 $"/" ")[1] ]);       if(!url || !sizeof(url))    url = LDAP_DEFAULT_URL;       if (mappingp (url))    lauth = url;    else    lauth = parse_ldap_url(url);       if(!stringp(lauth->scheme) ||
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:821:    ldap_version = version;    if(ldap_version == 3) {    dn = string_to_utf8(dn);    pass = string_to_utf8(pass);    }    if(intp(raw = send_bind_op(dn, pass))) {    THROW(({error_string()+"\n",backtrace()}));    return 0;    }    -  bound_dn = 0; +  bound_dn = md5_password = 0;    last_rv = result(({raw}),1); -  if (!last_rv->error_number()) +  if (!last_rv->error_number()) {    bound_dn = dn; -  +  md5_password = Crypto.MD5()->update (pass)->digest(); +  }    DWRITE_HI(sprintf("client.BIND: %s\n", last_rv->error_string()));    seterr (last_rv->error_number(), last_rv->error_string());    return !!bound_dn;       } // bind          private int send_unbind_op() {    // UNBIND operation   
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:860:   #endif       //!    //! Unbinds from the directory and close the connection.    int unbind () {       if (send_unbind_op() < 1) {    THROW(({error_string()+"\n",backtrace()}));    return -ldap_errno;    } -  bound_dn = 0; +  bound_dn = md5_password = 0;    DWRITE_HI("client.UNBIND: OK\n");       } // unbind       private int|string send_op_withdn(int op, string dn) {    // DELETE, ...       return do_op(ASN1_APPLICATION_OCTET_STRING(op, dn));       }
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1651:   //! Returns the current base DN for searches using @[search] and   //! schema queries using @[get_attr_type_descr].   string get_basedn() {return utf8_to_string (ldap_basedn);}      //! Returns the bind DN currently in use for the connection. Zero is   //! returned if the connection isn't bound. The empty string is   //! returned if the connection is in use but no bind DN has been given   //! explicitly to @[bind].   string get_bound_dn() {return bound_dn;}    + //! Returns an MD5 hash of the password used for the bind operation, + //! or zero if the connection isn't bound. If no password was given to + //! @[bind] then an empty string was sent as password, and the MD5 + //! hash of that is therefore returned. + string get_bind_password_hash() {return md5_password;} +     //!    //! Sets value of scope for search operation.    //!    //! @param scope    //! The value can be one of the @expr{SCOPE_*@} constants or a    //! string @expr{"base"@}, @expr{"one"@} or @expr{"sub"@}.    //!    //! @returns    //! Returns the @expr{SCOPE_*@} constant for the old scope.    int set_scope (int|string scope) {