Back to index

openldap  2.4.31
back-meta.h
Go to the documentation of this file.
00001 /* $OpenLDAP$ */
00002 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00003  *
00004  * Copyright 1999-2012 The OpenLDAP Foundation.
00005  * Portions Copyright 2001-2003 Pierangelo Masarati.
00006  * Portions Copyright 1999-2003 Howard Chu.
00007  * All rights reserved.
00008  *
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted only as authorized by the OpenLDAP
00011  * Public License.
00012  *
00013  * A copy of this license is available in the file LICENSE in the
00014  * top-level directory of the distribution or, alternatively, at
00015  * <http://www.OpenLDAP.org/license.html>.
00016  */
00017 /* ACKNOWLEDGEMENTS:
00018  * This work was initially developed by the Howard Chu for inclusion
00019  * in OpenLDAP Software and subsequently enhanced by Pierangelo
00020  * Masarati.
00021  */
00022 
00023 #ifndef SLAPD_LDAP_H
00024 #error "include servers/slapd/back-ldap/back-ldap.h before this file!"
00025 #endif /* SLAPD_LDAP_H */
00026 
00027 #ifndef SLAPD_META_H
00028 #define SLAPD_META_H
00029 
00030 #ifdef LDAP_DEVEL
00031 #define SLAPD_META_CLIENT_PR 1
00032 #endif /* LDAP_DEVEL */
00033 
00034 #include "proto-meta.h"
00035 
00036 /* String rewrite library */
00037 #include "rewrite.h"
00038 
00039 LDAP_BEGIN_DECL
00040 
00041 /*
00042  * Set META_BACK_PRINT_CONNTREE larger than 0 to dump the connection tree (debug only)
00043  */
00044 #ifndef META_BACK_PRINT_CONNTREE
00045 #define META_BACK_PRINT_CONNTREE 0
00046 #endif /* !META_BACK_PRINT_CONNTREE */
00047 
00048 /* from back-ldap.h before rwm removal */
00049 struct ldapmap {
00050        int drop_missing;
00051 
00052        Avlnode *map;
00053        Avlnode *remap;
00054 };
00055 
00056 struct ldapmapping {
00057        struct berval src;
00058        struct berval dst;
00059 };
00060 
00061 struct ldaprwmap {
00062        /*
00063         * DN rewriting
00064         */
00065 #ifdef ENABLE_REWRITE
00066        struct rewrite_info *rwm_rw;
00067 #else /* !ENABLE_REWRITE */
00068        /* some time the suffix massaging without librewrite
00069         * will be disabled */
00070        BerVarray rwm_suffix_massage;
00071 #endif /* !ENABLE_REWRITE */
00072 
00073        /*
00074         * Attribute/objectClass mapping
00075         */
00076        struct ldapmap rwm_oc;
00077        struct ldapmap rwm_at;
00078 };
00079 
00080 /* Whatever context ldap_back_dn_massage needs... */
00081 typedef struct dncookie {
00082        struct metatarget_t  *target;
00083 
00084 #ifdef ENABLE_REWRITE
00085        Connection           *conn;
00086        char                 *ctx;
00087        SlapReply            *rs;
00088 #else
00089        int                  normalized;
00090        int                  tofrom;
00091 #endif
00092 } dncookie;
00093 
00094 int ldap_back_dn_massage(dncookie *dc, struct berval *dn,
00095        struct berval *res);
00096 
00097 extern int ldap_back_conn_cmp( const void *c1, const void *c2);
00098 extern int ldap_back_conn_dup( void *c1, void *c2 );
00099 extern void ldap_back_conn_free( void *c );
00100 
00101 /* attributeType/objectClass mapping */
00102 int mapping_cmp (const void *, const void *);
00103 int mapping_dup (void *, void *);
00104 
00105 void ldap_back_map_init ( struct ldapmap *lm, struct ldapmapping ** );
00106 int ldap_back_mapping ( struct ldapmap *map, struct berval *s,
00107        struct ldapmapping **m, int remap );
00108 void ldap_back_map ( struct ldapmap *map, struct berval *s, struct berval *m,
00109        int remap );
00110 #define BACKLDAP_MAP 0
00111 #define BACKLDAP_REMAP      1
00112 char *
00113 ldap_back_map_filter(
00114        struct ldapmap *at_map,
00115        struct ldapmap *oc_map,
00116        struct berval *f,
00117        int remap );
00118 
00119 int
00120 ldap_back_map_attrs(
00121        Operation *op,
00122        struct ldapmap *at_map,
00123        AttributeName *a,
00124        int remap,
00125        char ***mapped_attrs );
00126 
00127 extern int ldap_back_map_config(
00128        struct ldapmap       *oc_map,
00129        struct ldapmap       *at_map,
00130        const char    *fname,
00131        int           lineno,
00132        int           argc,
00133        char          **argv );
00134 
00135 extern int
00136 ldap_back_filter_map_rewrite(
00137        dncookie      *dc,
00138        Filter        *f,
00139        struct berval *fstr,
00140        int           remap,
00141        void          *memctx );
00142 
00143 /* suffix massaging by means of librewrite */
00144 #ifdef ENABLE_REWRITE
00145 extern int
00146 suffix_massage_config( struct rewrite_info *info,
00147        struct berval *pvnc,
00148        struct berval *nvnc,
00149        struct berval *prnc,
00150        struct berval *nrnc );
00151 #endif /* ENABLE_REWRITE */
00152 extern int
00153 ldap_back_referral_result_rewrite(
00154        dncookie      *dc,
00155        BerVarray     a_vals,
00156        void          *memctx );
00157 extern int
00158 ldap_dnattr_rewrite(
00159        dncookie      *dc,
00160        BerVarray     a_vals );
00161 extern int
00162 ldap_dnattr_result_rewrite(
00163        dncookie      *dc,
00164        BerVarray     a_vals );
00165 
00166 /* (end of) from back-ldap.h before rwm removal */
00167 
00168 /*
00169  * A metasingleconn_t can be in the following, mutually exclusive states:
00170  *
00171  *     - none               (0x0U)
00172  *     - creating           META_BACK_FCONN_CREATING
00173  *     - initialized        META_BACK_FCONN_INITED
00174  *     - binding            LDAP_BACK_FCONN_BINDING
00175  *     - bound/anonymous    LDAP_BACK_FCONN_ISBOUND/LDAP_BACK_FCONN_ISANON
00176  *
00177  * possible modifiers are:
00178  *
00179  *     - privileged         LDAP_BACK_FCONN_ISPRIV
00180  *     - privileged, TLS    LDAP_BACK_FCONN_ISTLS
00181  *     - subjected to idassert     LDAP_BACK_FCONN_ISIDASR
00182  *     - tainted            LDAP_BACK_FCONN_TAINTED
00183  */
00184 
00185 #define META_BACK_FCONN_INITED            (0x00100000U)
00186 #define META_BACK_FCONN_CREATING   (0x00200000U)
00187 
00188 #define       META_BACK_CONN_INITED(lc)          LDAP_BACK_CONN_ISSET((lc), META_BACK_FCONN_INITED)
00189 #define       META_BACK_CONN_INITED_SET(lc)             LDAP_BACK_CONN_SET((lc), META_BACK_FCONN_INITED)
00190 #define       META_BACK_CONN_INITED_CLEAR(lc)           LDAP_BACK_CONN_CLEAR((lc), META_BACK_FCONN_INITED)
00191 #define       META_BACK_CONN_INITED_CPY(lc, mlc) LDAP_BACK_CONN_CPY((lc), META_BACK_FCONN_INITED, (mlc))
00192 #define       META_BACK_CONN_CREATING(lc)        LDAP_BACK_CONN_ISSET((lc), META_BACK_FCONN_CREATING)
00193 #define       META_BACK_CONN_CREATING_SET(lc)           LDAP_BACK_CONN_SET((lc), META_BACK_FCONN_CREATING)
00194 #define       META_BACK_CONN_CREATING_CLEAR(lc)  LDAP_BACK_CONN_CLEAR((lc), META_BACK_FCONN_CREATING)
00195 #define       META_BACK_CONN_CREATING_CPY(lc, mlc)      LDAP_BACK_CONN_CPY((lc), META_BACK_FCONN_CREATING, (mlc))
00196 
00197 struct metainfo_t;
00198 
00199 #define       META_NOT_CANDIDATE          ((ber_tag_t)0x0)
00200 #define       META_CANDIDATE                     ((ber_tag_t)0x1)
00201 #define       META_BINDING                ((ber_tag_t)0x2)
00202 #define       META_RETRYING               ((ber_tag_t)0x4)
00203 
00204 typedef struct metasingleconn_t {
00205 #define META_CND_ISSET(rs,f)              ( ( (rs)->sr_tag & (f) ) == (f) )
00206 #define META_CND_SET(rs,f)         ( (rs)->sr_tag |= (f) )
00207 #define META_CND_CLEAR(rs,f)              ( (rs)->sr_tag &= ~(f) )
00208 
00209 #define META_CANDIDATE_RESET(rs)   ( (rs)->sr_tag = 0 )
00210 #define META_IS_CANDIDATE(rs)             META_CND_ISSET( (rs), META_CANDIDATE )
00211 #define META_CANDIDATE_SET(rs)            META_CND_SET( (rs), META_CANDIDATE )
00212 #define META_CANDIDATE_CLEAR(rs)   META_CND_CLEAR( (rs), META_CANDIDATE )
00213 #define META_IS_BINDING(rs)        META_CND_ISSET( (rs), META_BINDING )
00214 #define META_BINDING_SET(rs)              META_CND_SET( (rs), META_BINDING )
00215 #define META_BINDING_CLEAR(rs)            META_CND_CLEAR( (rs), META_BINDING )
00216 #define META_IS_RETRYING(rs)              META_CND_ISSET( (rs), META_RETRYING )
00217 #define META_RETRYING_SET(rs)             META_CND_SET( (rs), META_RETRYING )
00218 #define META_RETRYING_CLEAR(rs)           META_CND_CLEAR( (rs), META_RETRYING )
00219        
00220        LDAP                 *msc_ld;
00221        time_t               msc_time;
00222        struct berval               msc_bound_ndn;
00223        struct berval        msc_cred;
00224        unsigned             msc_mscflags;
00225        /* NOTE: lc_lcflags is redefined to msc_mscflags to reuse the macros
00226         * defined for back-ldap */
00227 #define       lc_lcflags           msc_mscflags
00228 } metasingleconn_t;
00229 
00230 typedef struct metaconn_t {
00231        ldapconn_base_t             lc_base;
00232 #define       mc_base                     lc_base
00233 #define       mc_conn                     mc_base.lcb_conn
00234 #define       mc_local_ndn         mc_base.lcb_local_ndn
00235 #define       mc_refcnt            mc_base.lcb_refcnt
00236 #define       mc_create_time              mc_base.lcb_create_time
00237 #define       mc_time                     mc_base.lcb_time
00238        
00239        LDAP_TAILQ_ENTRY(metaconn_t)       mc_q;
00240 
00241        /* NOTE: msc_mscflags is used to recycle the #define
00242         * in metasingleconn_t */
00243        unsigned             msc_mscflags;
00244 
00245        /*
00246         * means that the connection is bound; 
00247         * of course only one target actually is ...
00248         */
00249        int                  mc_authz_target;
00250 #define META_BOUND_NONE            (-1)
00251 #define META_BOUND_ALL             (-2)
00252 
00253        struct metainfo_t    *mc_info;
00254 
00255        /* supersedes the connection stuff */
00256        metasingleconn_t     mc_conns[ 1 ];
00257        /* NOTE: mc_conns must be last, because
00258         * the required number of conns is malloc'ed
00259         * in one block with the metaconn_t structure */
00260 } metaconn_t;
00261 
00262 typedef enum meta_st_t {
00263 #if 0 /* todo */
00264        META_ST_EXACT = LDAP_SCOPE_BASE,
00265 #endif
00266        META_ST_SUBTREE = LDAP_SCOPE_SUBTREE,
00267        META_ST_SUBORDINATE = LDAP_SCOPE_SUBORDINATE,
00268        META_ST_REGEX /* last + 1 */
00269 } meta_st_t;
00270 
00271 typedef struct metasubtree_t {
00272        meta_st_t ms_type;
00273        union {
00274               struct berval msu_dn;
00275               struct {
00276                      regex_t msr_regex;
00277                      char *msr_regex_pattern;
00278               } msu_regex;
00279        } ms_un;
00280 #define ms_dn ms_un.msu_dn
00281 #define ms_regex ms_un.msu_regex.msr_regex
00282 #define ms_regex_pattern ms_un.msu_regex.msr_regex_pattern
00283 
00284        struct metasubtree_t *ms_next;
00285 } metasubtree_t;
00286 
00287 typedef struct metatarget_t {
00288        char                 *mt_uri;
00289        ldap_pvt_thread_mutex_t     mt_uri_mutex;
00290 
00291        /* TODO: we might want to enable different strategies
00292         * for different targets */
00293        LDAP_REBIND_PROC     *mt_rebind_f;
00294        LDAP_URLLIST_PROC    *mt_urllist_f;
00295        void                 *mt_urllist_p;
00296 
00297        metasubtree_t        *mt_subtree;
00298        /* F: subtree-include; T: subtree-exclude */
00299        int                  mt_subtree_exclude;
00300 
00301        int                  mt_scope;
00302 
00303        struct berval        mt_psuffix;          /* pretty suffix */
00304        struct berval        mt_nsuffix;          /* normalized suffix */
00305 
00306        struct berval        mt_binddn;
00307        struct berval        mt_bindpw;
00308 
00309        /* we only care about the TLS options here */
00310        slap_bindconf        mt_tls;
00311 
00312        slap_idassert_t             mt_idassert;
00313 #define       mt_idassert_mode     mt_idassert.si_mode
00314 #define       mt_idassert_authcID  mt_idassert.si_bc.sb_authcId
00315 #define       mt_idassert_authcDN  mt_idassert.si_bc.sb_binddn
00316 #define       mt_idassert_passwd   mt_idassert.si_bc.sb_cred
00317 #define       mt_idassert_authzID  mt_idassert.si_bc.sb_authzId
00318 #define       mt_idassert_authmethod      mt_idassert.si_bc.sb_method
00319 #define       mt_idassert_sasl_mech       mt_idassert.si_bc.sb_saslmech
00320 #define       mt_idassert_sasl_realm      mt_idassert.si_bc.sb_realm
00321 #define       mt_idassert_secprops mt_idassert.si_bc.sb_secprops
00322 #define       mt_idassert_tls             mt_idassert.si_bc.sb_tls
00323 #define       mt_idassert_flags    mt_idassert.si_flags
00324 #define       mt_idassert_authz    mt_idassert.si_authz
00325 
00326        int                  mt_nretries;
00327 #define META_RETRY_UNDEFINED       (-2)
00328 #define META_RETRY_FOREVER  (-1)
00329 #define META_RETRY_NEVER    (0)
00330 #define META_RETRY_DEFAULT  (10)
00331 
00332        struct ldaprwmap     mt_rwmap;
00333 
00334        sig_atomic_t         mt_isquarantined;
00335        slap_retry_info_t    mt_quarantine;
00336        ldap_pvt_thread_mutex_t     mt_quarantine_mutex;
00337 
00338        unsigned             mt_flags;
00339 #define       META_BACK_TGT_ISSET(mt,f)          ( ( (mt)->mt_flags & (f) ) == (f) )
00340 #define       META_BACK_TGT_ISMASK(mt,m,f)              ( ( (mt)->mt_flags & (m) ) == (f) )
00341 
00342 #define META_BACK_TGT_SAVECRED(mt)        META_BACK_TGT_ISSET( (mt), LDAP_BACK_F_SAVECRED )
00343 
00344 #define META_BACK_TGT_USE_TLS(mt)         META_BACK_TGT_ISSET( (mt), LDAP_BACK_F_USE_TLS )
00345 #define META_BACK_TGT_PROPAGATE_TLS(mt)          META_BACK_TGT_ISSET( (mt), LDAP_BACK_F_PROPAGATE_TLS )
00346 #define META_BACK_TGT_TLS_CRITICAL(mt)           META_BACK_TGT_ISSET( (mt), LDAP_BACK_F_TLS_CRITICAL )
00347 
00348 #define META_BACK_TGT_CHASE_REFERRALS(mt) META_BACK_TGT_ISSET( (mt), LDAP_BACK_F_CHASE_REFERRALS )
00349 
00350 #define       META_BACK_TGT_T_F(mt)                     META_BACK_TGT_ISMASK( (mt), LDAP_BACK_F_T_F_MASK, LDAP_BACK_F_T_F )
00351 #define       META_BACK_TGT_T_F_DISCOVER(mt)            META_BACK_TGT_ISMASK( (mt), LDAP_BACK_F_T_F_MASK2, LDAP_BACK_F_T_F_DISCOVER )
00352 
00353 #define       META_BACK_TGT_ABANDON(mt)          META_BACK_TGT_ISMASK( (mt), LDAP_BACK_F_CANCEL_MASK, LDAP_BACK_F_CANCEL_ABANDON )
00354 #define       META_BACK_TGT_IGNORE(mt)           META_BACK_TGT_ISMASK( (mt), LDAP_BACK_F_CANCEL_MASK, LDAP_BACK_F_CANCEL_IGNORE )
00355 #define       META_BACK_TGT_CANCEL(mt)           META_BACK_TGT_ISMASK( (mt), LDAP_BACK_F_CANCEL_MASK, LDAP_BACK_F_CANCEL_EXOP )
00356 #define       META_BACK_TGT_CANCEL_DISCOVER(mt)  META_BACK_TGT_ISMASK( (mt), LDAP_BACK_F_CANCEL_MASK2, LDAP_BACK_F_CANCEL_EXOP_DISCOVER )
00357 #define       META_BACK_TGT_QUARANTINE(mt)              META_BACK_TGT_ISSET( (mt), LDAP_BACK_F_QUARANTINE )
00358 
00359 #ifdef SLAP_CONTROL_X_SESSION_TRACKING
00360 #define       META_BACK_TGT_ST_REQUEST(mt)              META_BACK_TGT_ISSET( (mt), LDAP_BACK_F_ST_REQUEST )
00361 #define       META_BACK_TGT_ST_RESPONSE(mt)             META_BACK_TGT_ISSET( (mt), LDAP_BACK_F_ST_RESPONSE )
00362 #endif /* SLAP_CONTROL_X_SESSION_TRACKING */
00363 
00364 #define       META_BACK_TGT_NOREFS(mt)           META_BACK_TGT_ISSET( (mt), LDAP_BACK_F_NOREFS )
00365 #define       META_BACK_TGT_NOUNDEFFILTER(mt)           META_BACK_TGT_ISSET( (mt), LDAP_BACK_F_NOUNDEFFILTER )
00366 
00367        slap_mask_t          mt_rep_flags;
00368 
00369        int                  mt_version;
00370 
00371 #ifdef SLAPD_META_CLIENT_PR
00372        /*
00373         * client-side paged results:
00374         * -1: accept unsolicited paged results responses
00375         *  0: off
00376         * >0: always request paged results with size == mt_ps
00377         */
00378 #define META_CLIENT_PR_DISABLE                   (0)
00379 #define META_CLIENT_PR_ACCEPT_UNSOLICITED (-1)
00380        ber_int_t            mt_ps;
00381 #endif /* SLAPD_META_CLIENT_PR */
00382 
00383        time_t               mt_network_timeout;
00384        struct timeval              mt_bind_timeout;
00385 #define META_BIND_TIMEOUT   LDAP_BACK_RESULT_UTIMEOUT
00386        time_t               mt_timeout[ SLAP_OP_LAST ];
00387 } metatarget_t;
00388 
00389 typedef struct metadncache_t {
00390        ldap_pvt_thread_mutex_t mutex;
00391        Avlnode                     *tree;
00392 
00393 #define META_DNCACHE_DISABLED   (0)
00394 #define META_DNCACHE_FOREVER    ((time_t)(-1))
00395        time_t               ttl;  /* seconds; 0: no cache, -1: no expiry */
00396 } metadncache_t;
00397 
00398 typedef struct metacandidates_t {
00399        int                  mc_ntargets;
00400        SlapReply            *mc_candidates;
00401 } metacandidates_t;
00402 
00403 /*
00404  * Hook to allow mucking with metainfo_t/metatarget_t when quarantine is over
00405  */
00406 typedef int (*meta_back_quarantine_f)( struct metainfo_t *, int target, void * );
00407 
00408 typedef struct metainfo_t {
00409        int                  mi_ntargets;
00410        int                  mi_defaulttarget;
00411 #define META_DEFAULT_TARGET_NONE   (-1)
00412        int                  mi_nretries;
00413 
00414        metatarget_t         **mi_targets;
00415        metacandidates_t     *mi_candidates;
00416 
00417        LDAP_REBIND_PROC     *mi_rebind_f;
00418        LDAP_URLLIST_PROC    *mi_urllist_f;
00419 
00420        metadncache_t        mi_cache;
00421        
00422        /* cached connections; 
00423         * special conns are in tailq rather than in tree */
00424        ldap_avl_info_t             mi_conninfo;
00425        struct {
00426               int                                       mic_num;
00427               LDAP_TAILQ_HEAD(mc_conn_priv_q, metaconn_t)      mic_priv;
00428        }                    mi_conn_priv[ LDAP_BACK_PCONN_LAST ];
00429        int                  mi_conn_priv_max;
00430 
00431        /* NOTE: quarantine uses the connection mutex */
00432        slap_retry_info_t    mi_quarantine;
00433        meta_back_quarantine_f      mi_quarantine_f;
00434        void                 *mi_quarantine_p;
00435 
00436        unsigned             mi_flags;
00437 #define       li_flags             mi_flags
00438 /* uses flags as defined in <back-ldap/back-ldap.h> */
00439 #define       META_BACK_F_ONERR_STOP             (0x01000000U)
00440 #define       META_BACK_F_ONERR_REPORT    (0x02000000U)
00441 #define       META_BACK_F_ONERR_MASK             (META_BACK_F_ONERR_STOP|META_BACK_F_ONERR_REPORT)
00442 #define       META_BACK_F_DEFER_ROOTDN_BIND      (0x04000000U)
00443 #define       META_BACK_F_PROXYAUTHZ_ALWAYS      (0x08000000U) /* users always proxyauthz */
00444 #define       META_BACK_F_PROXYAUTHZ_ANON (0x10000000U) /* anonymous always proxyauthz */
00445 #define       META_BACK_F_PROXYAUTHZ_NOANON      (0x20000000U) /* anonymous remains anonymous */
00446 
00447 #define       META_BACK_ONERR_STOP(mi)    LDAP_BACK_ISSET( (mi), META_BACK_F_ONERR_STOP )
00448 #define       META_BACK_ONERR_REPORT(mi)  LDAP_BACK_ISSET( (mi), META_BACK_F_ONERR_REPORT )
00449 #define       META_BACK_ONERR_CONTINUE(mi)       ( !LDAP_BACK_ISSET( (mi), META_BACK_F_ONERR_MASK ) )
00450 
00451 #define META_BACK_DEFER_ROOTDN_BIND(mi)   LDAP_BACK_ISSET( (mi), META_BACK_F_DEFER_ROOTDN_BIND )
00452 #define META_BACK_PROXYAUTHZ_ALWAYS(mi)   LDAP_BACK_ISSET( (mi), META_BACK_F_PROXYAUTHZ_ALWAYS )
00453 #define META_BACK_PROXYAUTHZ_ANON(mi)     LDAP_BACK_ISSET( (mi), META_BACK_F_PROXYAUTHZ_ANON )
00454 #define META_BACK_PROXYAUTHZ_NOANON(mi)   LDAP_BACK_ISSET( (mi), META_BACK_F_PROXYAUTHZ_NOANON )
00455 
00456 #define META_BACK_QUARANTINE(mi)   LDAP_BACK_ISSET( (mi), LDAP_BACK_F_QUARANTINE )
00457 
00458        int                  mi_version;
00459 
00460 #ifdef SLAPD_META_CLIENT_PR
00461        ber_int_t            mi_ps;
00462 #endif /* SLAPD_META_CLIENT_PR */
00463 
00464 
00465        time_t               mi_network_timeout;
00466        time_t               mi_conn_ttl;
00467        time_t               mi_idle_timeout;
00468        struct timeval              mi_bind_timeout;
00469        time_t               mi_timeout[ SLAP_OP_LAST ];
00470 
00471        ldap_extra_t  *mi_ldap_extra;
00472 
00473 } metainfo_t;
00474 
00475 typedef enum meta_op_type {
00476        META_OP_ALLOW_MULTIPLE = 0,
00477        META_OP_REQUIRE_SINGLE,
00478        META_OP_REQUIRE_ALL
00479 } meta_op_type;
00480 
00481 SlapReply *
00482 meta_back_candidates_get( Operation *op );
00483 
00484 extern metaconn_t *
00485 meta_back_getconn(
00486        Operation            *op,
00487        SlapReply            *rs,
00488        int                  *candidate,
00489        ldap_back_send_t     sendok );
00490 
00491 extern void
00492 meta_back_release_conn_lock(
00493               metainfo_t           *mi,
00494        metaconn_t           *mc,
00495        int                  dolock );
00496 #define meta_back_release_conn(mi, mc)    meta_back_release_conn_lock( (mi), (mc), 1 )
00497 
00498 extern int
00499 meta_back_retry(
00500        Operation            *op,
00501        SlapReply            *rs,
00502        metaconn_t           **mcp,
00503        int                  candidate,
00504        ldap_back_send_t     sendok );
00505 
00506 extern void
00507 meta_back_conn_free(
00508        void                 *v_mc );
00509 
00510 #if META_BACK_PRINT_CONNTREE > 0
00511 extern void
00512 meta_back_print_conntree(
00513        metainfo_t           *mi,
00514        char                 *msg );
00515 #endif
00516 
00517 extern int
00518 meta_back_init_one_conn(
00519        Operation            *op,
00520        SlapReply            *rs,
00521        metaconn_t           *mc,
00522        int                  candidate,
00523        int                  ispriv,
00524        ldap_back_send_t     sendok,
00525        int                  dolock );
00526 
00527 extern void
00528 meta_back_quarantine(
00529        Operation            *op,
00530        SlapReply            *rs,
00531        int                  candidate );
00532 
00533 extern int
00534 meta_back_dobind(
00535        Operation            *op,
00536        SlapReply            *rs,
00537        metaconn_t           *mc,
00538        ldap_back_send_t     sendok );
00539 
00540 extern int
00541 meta_back_single_dobind(
00542        Operation            *op,
00543        SlapReply            *rs,
00544        metaconn_t           **mcp,
00545        int                  candidate,
00546        ldap_back_send_t     sendok,
00547        int                  retries,
00548        int                  dolock );
00549 
00550 extern int
00551 meta_back_proxy_authz_cred(
00552        metaconn_t           *mc,
00553        int                  candidate,
00554        Operation            *op,
00555        SlapReply            *rs,
00556        ldap_back_send_t     sendok,
00557        struct berval        *binddn,
00558        struct berval        *bindcred,
00559        int                  *method );
00560 
00561 extern int
00562 meta_back_cancel(
00563        metaconn_t           *mc,
00564        Operation            *op,
00565        SlapReply            *rs,
00566        ber_int_t            msgid,
00567        int                  candidate,
00568        ldap_back_send_t     sendok );
00569 
00570 extern int
00571 meta_back_op_result(
00572        metaconn_t           *mc,
00573        Operation            *op,
00574        SlapReply            *rs,
00575        int                  candidate,
00576        ber_int_t            msgid,
00577        time_t               timeout,
00578        ldap_back_send_t     sendok );
00579 
00580 extern int
00581 meta_back_controls_add(
00582        Operation     *op,
00583        SlapReply     *rs,
00584        metaconn_t    *mc,
00585        int           candidate,
00586        LDAPControl   ***pctrls );
00587 
00588 extern int
00589 back_meta_LTX_init_module(
00590        int                  argc,
00591        char                 *argv[] );
00592 
00593 extern int
00594 meta_back_conn_cmp(
00595        const void           *c1,
00596        const void           *c2 );
00597 
00598 extern int
00599 meta_back_conndn_cmp(
00600        const void           *c1,
00601        const void           *c2 );
00602 
00603 extern int
00604 meta_back_conndn_dup(
00605        void                 *c1,
00606        void                 *c2 );
00607 
00608 /*
00609  * Candidate stuff
00610  */
00611 extern int
00612 meta_back_is_candidate(
00613        metatarget_t         *mt,
00614        struct berval        *ndn,
00615        int                  scope );
00616 
00617 extern int
00618 meta_back_select_unique_candidate(
00619        metainfo_t           *mi,
00620        struct berval        *ndn );
00621 
00622 extern int
00623 meta_clear_unused_candidates(
00624        Operation            *op,
00625        int                  candidate );
00626 
00627 extern int
00628 meta_clear_one_candidate(
00629        Operation            *op,
00630        metaconn_t           *mc,
00631        int                  candidate );
00632 
00633 /*
00634  * Dn cache stuff (experimental)
00635  */
00636 extern int
00637 meta_dncache_cmp(
00638        const void           *c1,
00639        const void           *c2 );
00640 
00641 extern int
00642 meta_dncache_dup(
00643        void                 *c1,
00644        void                 *c2 );
00645 
00646 #define META_TARGET_NONE    (-1)
00647 #define META_TARGET_MULTIPLE       (-2)
00648 extern int
00649 meta_dncache_get_target(
00650        metadncache_t        *cache,
00651        struct berval        *ndn );
00652 
00653 extern int
00654 meta_dncache_update_entry(
00655        metadncache_t        *cache,
00656        struct berval        *ndn,
00657        int                  target );
00658 
00659 extern int
00660 meta_dncache_delete_entry(
00661        metadncache_t        *cache,
00662        struct berval        *ndn );
00663 
00664 extern void
00665 meta_dncache_free( void *entry );
00666 
00667 extern int
00668 meta_subtree_destroy( metasubtree_t *ms );
00669 
00670 extern LDAP_REBIND_PROC            meta_back_default_rebind;
00671 extern LDAP_URLLIST_PROC    meta_back_default_urllist;
00672 
00673 LDAP_END_DECL
00674 
00675 #endif /* SLAPD_META_H */
00676