1 --- snapshot-20000924/src/util/dict_ldap.c.wiget Sun May 7 23:59:29 2000
2 +++ snapshot-20000924/src/util/dict_ldap.c Mon Oct 2 17:34:39 2000
4 char *myname = "dict_ldap_connect";
5 void (*saved_alarm) (int);
8 + LDAPMemCache *dircache;
14 * Configure alias dereferencing for this connection. Thanks to Mike
17 +#if ( defined NSLDAP ) || ( defined LDAP_API_VERSION && LDAP_API_VERSION >= 2004 )
18 + rc = ldap_set_option(dict_ldap->ld, LDAP_OPT_DEREF,
19 + (void*)&dict_ldap->dereference);
20 + if (rc != LDAP_SUCCESS) {
21 + msg_warn("%s: Unable to set LDAP_OPT_DEREF to %d: %d (%s)",
22 + myname, dict_ldap->dereference, rc, ldap_err2string(rc));
25 dict_ldap->ld->ld_deref = dict_ldap->dereference;
29 * If this server requires a bind, do so. Thanks to Sam Tardieu for
31 ("%s: Enabling %ld-byte cache for %s with %ld-second expiry",
32 myname, dict_ldap->cache_size, dict_ldap->ldapsource,
33 dict_ldap->cache_expiry);
36 + rc = ldap_memcache_init(dict_ldap->cache_expiry, dict_ldap->cache_size,
37 + NULL, NULL, &dircache);
38 + if (rc != LDAP_SUCCESS) {
40 + ("%s: Unable to configure cache for %s: %d (%s) -- continuing",
41 + myname, dict_ldap->ldapsource, rc, ldap_err2string(rc));
43 + rc = ldap_memcache_set(dict_ldap->ld, dircache);
44 + if (rc != LDAP_SUCCESS) {
46 + ("%s: Unable to configure cache for %s: %d (%s) -- continuing",
47 + myname, dict_ldap->ldapsource, rc, ldap_err2string(rc));
50 + msg_info("%s: Caching enabled for %s",
51 + myname, dict_ldap->ldapsource);
55 rc = ldap_enable_cache(dict_ldap->ld, dict_ldap->cache_expiry,
56 dict_ldap->cache_size);
57 if (rc != LDAP_SUCCESS) {
59 msg_info("%s: Caching enabled for %s",
60 myname, dict_ldap->ldapsource);
65 msg_info("%s: Cached connection handle for LDAP source %s",
68 ldap_value_free(attr_values);
71 + rc = ldap_get_lderrno(dict_ldap->ld, NULL, NULL);
72 + if (rc != LDAP_SUCCESS)
74 + ("%s: Had some trouble with entries returned by search: %s",
75 + myname, ldap_err2string(rc));
76 +#elif ( defined LDAP_API_VERSION && LDAP_API_VERSION >= 2004 )
77 + ldap_get_option(dict_ldap->ld, LDAP_OPT_ERROR_NUMBER, &rc);
78 + if (rc != LDAP_SUCCESS)
80 + ("%s: Had some trouble with entries returned by search: %s",
81 + myname, ldap_err2string(rc));
83 if (dict_ldap->ld->ld_errno != LDAP_SUCCESS)
85 ("%s: Had some trouble with entries returned by search: %s",
86 myname, ldap_err2string(dict_ldap->ld->ld_errno));
89 msg_info("%s: Search returned %s", myname,