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.36 2002/01/23 06:59:29 hop Exp $ + // $Id: client.pike,v 1.37 2002/02/14 01:46:18 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: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.36 $"/" ")[1] ]); +  info = ([ "code_revision" : ("$Revision: 1.37 $"/" ")[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:873:    Standards.ASN1.Types.asn1_integer(sizelimit),    Standards.ASN1.Types.asn1_integer(timelimit),    ASN1_BOOLEAN(attrsonly ? -1 : 0),    @ohlp    })) ;       return (do_op(msgval));    }       -  // API function (ldap_search) -  // -  // search(string filter, int|void attrsonly, array(string)|void attrs) -  // -  // filter: search filter -  // attrsonly: flag -  // attrsy: attribute(s) name +  //! @param filter +  //! search filter +  //! @param attrsonly +  //! flag +  //! @param attrs +  //! attribute(s) name    object|int search (string|void filter, int|void attrsonly, array(string)|void attrs) {       int id,nv;    mixed raw;    array(string) rawarr = ({});    mixed rv;       filter=filter||lauth->filter; // default from LDAP URI       DWRITE_HI("client.SEARCH: " + (string)filter + "\n");
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:949:    seterr (rv->error_number());    //if (rv->error_number() || !rv->num_entries()) // if error or entries=0    // rv = rv->error_number();       DWRITE_HI(sprintf("client.SEARCH: %s (entries: %d)\n", rv->error_string(), rv->num_entries()));    return(rv);       } // search       -  // API function (ldap_setbasedn) -  // -  // set_basedn(string base_dn) -  // -  // base_dn: base DN for search +  //! @param base_dn +  //! base DN for search    string set_basedn (string base_dn) {       string old_dn = ldap_basedn;       if(ldap_version == 3) {    base_dn = string_to_utf8(base_dn);    }    ldap_basedn = base_dn;    DWRITE_HI("client.SET_BASEDN = " + base_dn + "\n");    return(old_dn);
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:994:    }    else    if(scope != 0 && scope != 1 && scope != 2)    return (-1);       ldap_scope = scope;    DWRITE_HI("client.SET_SCOPE = " + (string)scope + "\n");    return(old_scope);    }    -  // API function (ldap_setoption) -  // -  // set_option(int option_type, mixed value) -  // -  // option_type: LDAP_OPT_xxx -  // value: new value for option +  //! @param option_type +  //! LDAP_OPT_xxx +  //! @param value +  //! new value for option    int set_option (int opttype, int value) {       DWRITE_HI("client.SET_OPTION: " + (string)opttype + " = " + (string)value + "\n");    switch (opttype) {    case 1: // LDAP_OPT_DEREF    //if (intp(value))    ldap_deref = value;    //else    // return(-1);    break;
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1030:    // return(-1);    break;    case 4: // LDAP_OPT_REFERRALS    default: return(-1);    }          return(0);    }    -  // API function (ldap_getoption) -  // -  // get_option(int option_type) -  // -  // option_type: LDAP_OPT_xxx +  //! @param option_type +  //! LDAP_OPT_xxx    int get_option (int opttype) {          DWRITE_HI("client.GET_OPTION: " + (string)opttype + "\n");    switch (opttype) {    case 1: // LDAP_OPT_DEREF    return(ldap_deref);    case 2: // LDAP_OPT_SIZELIMIT    return(ldap_sizelimit);    case 3: // LDAP_OPT_TIMELIMIT
pike.git/lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1215:    return(-ldap_errno);    }       rv = result(({raw}));    DWRITE_HI(sprintf("client.MODIFY: %s\n", rv->error_string()));    return (seterr (rv->error_number()));       } // modify       -  // API function -  // -  // parse_url(string ldapuri) -  // -  // ldapuri: LDAP URL +  //! @param ldapuri +  //! LDAP URL    mapping|int parse_url (string ldapuri) {       // ldap://machine.at.home.cz:123/c=cz?attr1,attr2,attr3?sub?(uid=*)?!bindname=uid=hop,dc=unibase,dc=cz"       string url=ldapuri, s, scheme;    array ar;    mapping res;       s = (url / ":")[0];    url = url[sizeof(s)..];