]> git.pld-linux.org Git - packages/postfix.git/blob - postfix-ldap2.patch
- allow compile with db, not db3.
[packages/postfix.git] / postfix-ldap2.patch
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
3 @@ -136,6 +136,9 @@
4      char   *myname = "dict_ldap_connect";
5      void    (*saved_alarm) (int);
6      int     rc = 0;
7 +#ifdef NSLDAP 
8 +    LDAPMemCache *dircache;
9 +#endif
10  
11      dict_errno = 0;
12  
13 @@ -172,7 +175,16 @@
14       * Configure alias dereferencing for this connection. Thanks to Mike
15       * Mattice for this.
16       */
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));
23 +    }
24 +#else
25      dict_ldap->ld->ld_deref = dict_ldap->dereference;
26 +#endif
27  
28      /*
29       * If this server requires a bind, do so. Thanks to Sam Tardieu for
30 @@ -207,7 +219,26 @@
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);
34 -
35 +#ifdef NSLDAP 
36 +       rc = ldap_memcache_init(dict_ldap->cache_expiry, dict_ldap->cache_size,
37 +                               NULL, NULL, &dircache);
38 +       if (rc != LDAP_SUCCESS) {
39 +           msg_warn
40 +               ("%s: Unable to configure cache for %s: %d (%s) -- continuing",
41 +                myname, dict_ldap->ldapsource, rc, ldap_err2string(rc));
42 +       } else {
43 +           rc = ldap_memcache_set(dict_ldap->ld, dircache);
44 +           if (rc != LDAP_SUCCESS) {
45 +               msg_warn
46 +                   ("%s: Unable to configure cache for %s: %d (%s) -- continuing",
47 +                    myname, dict_ldap->ldapsource, rc, ldap_err2string(rc));
48 +           } else {
49 +               if (msg_verbose)
50 +                   msg_info("%s: Caching enabled for %s",
51 +                            myname, dict_ldap->ldapsource);
52 +           }
53 +       }
54 +#else
55         rc = ldap_enable_cache(dict_ldap->ld, dict_ldap->cache_expiry,
56                                dict_ldap->cache_size);
57         if (rc != LDAP_SUCCESS) {
58 @@ -219,6 +250,7 @@
59                 msg_info("%s: Caching enabled for %s",
60                          myname, dict_ldap->ldapsource);
61         }
62 +#endif
63      }
64      if (msg_verbose)
65         msg_info("%s: Cached connection handle for LDAP source %s",
66 @@ -417,10 +449,24 @@
67             }
68             ldap_value_free(attr_values);
69         }
70 +#ifdef NSLDAP
71 +       rc = ldap_get_lderrno(dict_ldap->ld, NULL, NULL);
72 +       if (rc != LDAP_SUCCESS)
73 +           msg_warn
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)
79 +               msg_warn
80 +               ("%s: Had some trouble with entries returned by search: %s",
81 +               myname, ldap_err2string(rc));
82 +#else
83         if (dict_ldap->ld->ld_errno != LDAP_SUCCESS)
84             msg_warn
85                 ("%s: Had some trouble with entries returned by search: %s",
86                  myname, ldap_err2string(dict_ldap->ld->ld_errno));
87 +#endif
88         if (msg_verbose)
89             msg_info("%s: Search returned %s", myname,
90                      VSTRING_LEN(result) >
This page took 0.081312 seconds and 3 git commands to generate.