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.31 2002/12/04 13:55:56 mast Exp $ + // $Id: client.pike,v 1.32 2003/07/01 15:38:10 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:351:    //! @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.31 $"/" ")[1] ]); +  info = ([ "code_revision" : ("$Revision: 1.32 $"/" ")[1] ]);       if(!url || !sizeof(url))    url = LDAP_DEFAULT_URL;       lauth = parse_url(url);       if(!stringp(lauth->scheme) ||    ((lauth->scheme != "ldap") && (lauth->scheme != "ldaps"))) {    THROW(({"Unknown scheme in server URL.\n",backtrace()}));    }
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:416:    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:457:    //! Only @tt{2@} or @tt{3@} can be entered.    //!    //! @note    //! Only simple authentication type is implemented. So be warned    //! clear text passwords are sent to the directory server.    int bind (string|void dn, string|void password, int|void version) {       int id;    mixed raw;    object rv; +  string pass = password; +  password = "censored";       if (!version)    version = LDAP_DEFAULT_VERSION;    if (chk_ver())    return(-ldap_errno);    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);    }       rv = result(({raw}),1);    if (!rv->error_number())    binded = 1;    DWRITE_HI(sprintf("client.BIND: %s\n", rv->error_string()));    return (seterr (rv->error_number()));