2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1999-2005 The OpenLDAP Foundation.
5 * Portions Copyright 2001-2003 Pierangelo Masarati.
6 * Portions Copyright 1999-2003 Howard Chu.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted only as authorized by the OpenLDAP
13 * A copy of this license is available in the file LICENSE in the
14 * top-level directory of the distribution or, alternatively, at
15 * <http://www.OpenLDAP.org/license.html>.
18 * This work was initially developed by the Howard Chu for inclusion
19 * in OpenLDAP Software and subsequently enhanced by Pierangelo
24 #error "include servers/slapd/back-ldap/back-ldap.h before this file!"
25 #endif /* SLAPD_LDAP_H */
30 #include "proto-meta.h"
32 /* String rewrite library */
39 /* from back-ldap.h before rwm removal */
57 struct rewrite_info *rwm_rw;
58 #else /* !ENABLE_REWRITE */
59 /* some time the suffix massaging without librewrite
61 BerVarray rwm_suffix_massage;
62 #endif /* !ENABLE_REWRITE */
65 * Attribute/objectClass mapping
67 struct ldapmap rwm_oc;
68 struct ldapmap rwm_at;
71 /* Whatever context ldap_back_dn_massage needs... */
72 typedef struct dncookie {
73 struct ldaprwmap *rwmap;
85 #define META_BIND_NRETRIES 3
86 #define META_BIND_TIMEOUT 1000
88 int ldap_back_dn_massage(dncookie *dc, struct berval *dn,
91 extern int ldap_back_conn_cmp( const void *c1, const void *c2);
92 extern int ldap_back_conn_dup( void *c1, void *c2 );
93 extern void ldap_back_conn_free( void *c );
95 /* attributeType/objectClass mapping */
96 int mapping_cmp (const void *, const void *);
97 int mapping_dup (void *, void *);
99 void ldap_back_map_init ( struct ldapmap *lm, struct ldapmapping ** );
100 int ldap_back_mapping ( struct ldapmap *map, struct berval *s,
101 struct ldapmapping **m, int remap );
102 void ldap_back_map ( struct ldapmap *map, struct berval *s, struct berval *m,
104 #define BACKLDAP_MAP 0
105 #define BACKLDAP_REMAP 1
107 ldap_back_map_filter(
108 struct ldapmap *at_map,
109 struct ldapmap *oc_map,
116 struct ldapmap *at_map,
122 extern int ldap_back_map_config(
123 struct ldapmap *oc_map,
124 struct ldapmap *at_map,
131 ldap_back_filter_map_rewrite(
137 /* suffix massaging by means of librewrite */
138 #ifdef ENABLE_REWRITE
139 extern int suffix_massage_config( struct rewrite_info *info,
140 struct berval *pvnc, struct berval *nvnc,
141 struct berval *prnc, struct berval *nrnc);
142 #endif /* ENABLE_REWRITE */
143 extern int ldap_back_referral_result_rewrite( dncookie *dc, BerVarray a_vals );
144 extern int ldap_dnattr_rewrite( dncookie *dc, BerVarray a_vals );
145 extern int ldap_dnattr_result_rewrite( dncookie *dc, BerVarray a_vals );
147 /* (end of) from back-ldap.h before rwm removal */
149 struct metasingleconn {
151 #define META_NOT_CANDIDATE 0
152 #define META_CANDIDATE 1
153 #define META_LAST_CONN -1
156 struct berval msc_bound_ndn;
157 struct berval msc_cred;
159 #define META_UNBOUND 0
161 #define META_ANONYMOUS 2
164 #define META_LAST(lsc) ((lsc)->msc_candidate == META_LAST_CONN)
167 struct slap_conn *mc_conn;
168 struct rewrite_info *mc_rwinfo;
171 * means that the connection is bound;
172 * of course only one target actually is ...
175 #define META_BOUND_NONE -1
176 #define META_BOUND_ALL -2
177 /* supersedes the connection stuff */
178 struct metasingleconn *mc_conns;
183 struct berval mt_psuffix; /* pretty suffix */
184 struct berval mt_nsuffix; /* normalized suffix */
185 struct berval mt_binddn;
186 struct berval mt_bindpw;
188 struct berval mt_pseudorootdn;
189 struct berval mt_pseudorootpw;
191 struct ldaprwmap mt_rwmap;
195 ldap_pvt_thread_mutex_t mutex;
198 #define META_DNCACHE_DISABLED 0
199 #define META_DNCACHE_FOREVER -1
200 long int ttl; /* seconds; 0: no cache, -1: no expiry */
207 #define META_DEFAULT_TARGET_NONE -1
208 struct metatarget **targets;
210 struct rewrite_info *rwinfo;
213 struct metadncache cache;
215 ldap_pvt_thread_mutex_t conn_mutex;
221 #define META_OP_ALLOW_MULTIPLE 0x00
222 #define META_OP_REQUIRE_SINGLE 0x01
223 #define META_OP_REQUIRE_ALL 0x02
224 extern struct metaconn *
253 back_meta_LTX_init_module(
274 meta_back_is_candidate(
275 struct berval *nsuffix,
280 meta_back_count_candidates(
286 meta_back_is_candidate_unique(
292 meta_back_select_unique_candidate(
298 meta_clear_unused_candidates(
306 meta_clear_one_candidate(
307 struct metasingleconn *lc,
312 * Dn cache stuff (experimental)
326 #define META_TARGET_NONE (-1)
328 meta_dncache_get_target(
329 struct metadncache *cache,
334 meta_dncache_update_entry(
335 struct metadncache *cache,
341 meta_dncache_delete_entry(
342 struct metadncache *cache,
353 #endif /* SLAPD_META_H */