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.46 2002/11/27 22:04:32 marcus Exp $ + // $Id: client.pike,v 1.47 2003/07/01 15:21:52 anders 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:353:    //! @tt{"ldap://hostname/basedn?attrlist?scope?ext"@}    //!    //! @param context    //! TLS context of connection    //!    //! @seealso    //! @[LDAP.client.bind], @[LDAP.client.search]    void create(string|void url, object|void context)    {    -  info = ([ "code_revision" : ("$Revision: 1.46 $"/" ")[1] ]); +  info = ([ "code_revision" : ("$Revision: 1.47 $"/" ")[1] ]);       if(!url || !sizeof(url))    url = LDAP_DEFAULT_URL;       lauth = parse_url(url);       if(!stringp(lauth->scheme) ||    ((lauth->scheme != "ldap")   #if constant(SSL.sslfile)    && (lauth->scheme != "ldaps")
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:432:    set_scope(lauth->scope);    if(lauth->basedn)    set_basedn(lauth->basedn);       } // create       private mixed send_bind_op(string name, string password) {    // Simple BIND operation       object msgval, vers, namedn, auth, app; +  string pass = password; +  password = "censored";       vers = Standards.ASN1.Types.asn1_integer(ldap_version);    namedn = Standards.ASN1.Types.asn1_octet_string(name); -  auth = ASN1_CONTEXT_OCTET_STRING(0, password); +  auth = ASN1_CONTEXT_OCTET_STRING(0, pass);    // SASL credentials ommited       msgval = ASN1_APPLICATION_SEQUENCE(0, ({vers, namedn, auth}));       return (do_op(msgval));    }       //! @decl int bind()    //! @decl int bind(string dn, string password)    //! @decl int bind(string dn, string password, int version)
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:479:    //! Only simple authentication type is implemented. So be warned    //! clear text passwords are sent to the directory server.    //!    //! @note    //! The API change: the returning code was changed in Pike 7.3+    //! to follow his logic better.    int bind (string|void dn, string|void password, int|void version) {       int id;    mixed raw; +  string pass = password; +  password = "censored";       if (!version)    version = LDAP_DEFAULT_VERSION;    if (chk_ver())    return(0);    if (!stringp(dn))    dn = mappingp(lauth->ext) ? lauth->ext->bindname||"" : ""; -  if (!stringp(password)) -  password = ""; +  if (!stringp(pass)) +  pass = "";    ldap_version = version;    if(ldap_version == 3) {    dn = string_to_utf8(dn); -  password = string_to_utf8(password); +  pass = string_to_utf8(pass);    } -  if(intp(raw = send_bind_op(dn, password))) { +  if(intp(raw = send_bind_op(dn, pass))) {    THROW(({error_string()+"\n",backtrace()}));    return(-ldap_errno);    }       binded = 0;    last_rv = result(({raw}),1);    if (!last_rv->error_number())    binded = 1;    DWRITE_HI(sprintf("client.BIND: %s\n", last_rv->error_string()));    seterr (last_rv->error_number());