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

version» Context lines:

pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1:   // LDAP client protocol implementation for Pike.   // - // $Id: client.pike,v 1.17 2000/07/20 15:00:12 hop Exp $ + // $Id: client.pike,v 1.18 2000/07/25 09:59:19 hop 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:43:   // 1999-03-28 - rewritten ldap_[op] startup code   //   // v1.11 1999-04-10 - search filter now processed multiple wild '*' chars   // [ Escaping untested, yet ]   // v1.13 2000-02-12 - fixed search NOT op bug (end revision normalized)   //   // v1.14 2000-02-17 - added decoding of UTF8 strings for v3 protocol   //   // newer versions - see CVS at roxen.com (hop)   // + // - corrected deUTF8 values in result + // -   //   // Specifications:   //   // RFC 1558 (search filter representations)   // RFC 1777,1778,1779 (version2 spec)   // RFC 1823 (v2 API)   // RFC 2251,2252,2253,2254,2255,2256 (version3 spec)   // draft-ietf-asid-ldap-c-api-00.txt (v3 API)   // RFC2279 (UTF-8)   //
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:250:       // API function (ldap_open)    //    // create(string|void server)    //    // server: server URL in form "ldap://hostname/basedn???!bindname=    void create(string|void server)    {       if(!server || !sizeof(server)) -  server = (string)LDAP_DEFAULT_HOST; +  server = LDAP_DEFAULT_URL;       lauth = parse_url(server);       if(!stringp(lauth->scheme) || (lauth->scheme != "ldap")) {    THROW(({"Unknown scheme in server URL.\n",backtrace()}));    }    -  ::create(lauth->host||LDAP_DEFAULT_HOST, lauth->port||LDAP_DEFAULT_PORT); +  if(!lauth->host) +  lauth += ([ "host" : parse_url(LDAP_DEFAULT_URL)->host ]); +  if(!lauth->port) +  lauth += ([ "port" : parse_url(LDAP_DEFAULT_URL)->port ]); +  +  ::create(lauth->host, lauth->port);    if(!::connected) {    THROW(({"Failed to connect to LDAP server.\n",backtrace()}));    }    DWRITE(sprintf("client.create: remote = %s\n", query_address())); -  DWRITE_HI("client.OPEN: " + lauth->host||LDAP_DEFAULT_HOST + (string)(lauth->port||LDAP_DEFAULT_PORT) + " - OK\n"); +  DWRITE_HI("client.OPEN: " + lauth->host + ":" + (string)(lauth->port) + " - OK\n");       binded = 0;       if(lauth->scope)    set_scope(lauth->scope);    if(lauth->basedn)    set_basedn(lauth->basedn);       } // create   
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:729:    // filter: search filter    // attrsonly: flag    // attrsy: attribute(s) name    object|int search (string filter, int|void attrsonly, array(string)|void attrs) {       int id;    mixed raw;    array(string) rawarr = ({});    mixed rv;    +  filter=filter||lauth->filter; // default from LDAP URI +     DWRITE_HI("client.SEARCH: " + (string)filter + "\n");    if (chk_ver())    return(-ldap_errno);    if (chk_binded())    return(-ldap_errno);    if(ldap_version == 3) {    filter = string_to_utf8(filter);    }    if(intp(raw = send_search_op(ldap_basedn, ldap_scope, ldap_deref,    ldap_sizelimit, ldap_timelimit, attrsonly, filter,
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:971: Inside #if defined(LDAP_URL_STRICT)
   if (url[..2] != "://")    return(-1);   #endif       s = (url[3..] / "/")[0];    url = url[sizeof(s)+4..];       res += ([ "host" : (s / ":")[0] ]);       if(sizeof(s / ":") > 1) -  res += ([ "port" : (s / ":")[1] ]); +  res += ([ "port" : (int)((s / ":")[1]) ]);       ar = url / "?";       switch (sizeof(ar)) {    case 5: if (sizeof(ar[4])) {    mapping extensions = ([]);    foreach(ar[4] / ",", string ext) {    int ix = predef::search(ext, "=");    if(ix)    extensions += ([ ext[..(ix-1)] : replace(ext[ix+1..],QUOTED_COMMA, ",") ]);