?? back-ldap.h
字號:
/* back-ldap.h - ldap backend header file *//* $OpenLDAP: pkg/ldap/servers/slapd/back-ldap/back-ldap.h,v 1.63.2.23 2007/01/27 23:56:43 ando Exp $ *//* This work is part of OpenLDAP Software <http://www.openldap.org/>. * * Copyright 1999-2007 The OpenLDAP Foundation. * Portions Copyright 2000-2003 Pierangelo Masarati. * Portions Copyright 1999-2003 Howard Chu. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted only as authorized by the OpenLDAP * Public License. * * A copy of this license is available in the file LICENSE in the * top-level directory of the distribution or, alternatively, at * <http://www.OpenLDAP.org/license.html>. *//* ACKNOWLEDGEMENTS: * This work was initially developed by the Howard Chu for inclusion * in OpenLDAP Software and subsequently enhanced by Pierangelo * Masarati. */#ifndef SLAPD_LDAP_H#define SLAPD_LDAP_HLDAP_BEGIN_DECLstruct ldapinfo_t;enum { /* even numbers are connection types */ LDAP_BACK_PCONN_FIRST = 0, LDAP_BACK_PCONN_ROOTDN = LDAP_BACK_PCONN_FIRST, LDAP_BACK_PCONN_ANON = 2, LDAP_BACK_PCONN_BIND = 4, /* add the TLS bit */ LDAP_BACK_PCONN_TLS = 0x1U, LDAP_BACK_PCONN_ROOTDN_TLS = (LDAP_BACK_PCONN_ROOTDN|LDAP_BACK_PCONN_TLS), LDAP_BACK_PCONN_ANON_TLS = (LDAP_BACK_PCONN_ANON|LDAP_BACK_PCONN_TLS), LDAP_BACK_PCONN_BIND_TLS = (LDAP_BACK_PCONN_BIND|LDAP_BACK_PCONN_TLS), LDAP_BACK_PCONN_LAST};typedef struct ldapconn_t { Connection *lc_conn;#define LDAP_BACK_CONN2PRIV(lc) ((unsigned long)(lc)->lc_conn)#define LDAP_BACK_PCONN_ISPRIV(lc) ((void *)(lc)->lc_conn >= (void *)LDAP_BACK_PCONN_FIRST \ && (void *)(lc)->lc_conn < (void *)LDAP_BACK_PCONN_LAST)#define LDAP_BACK_PCONN_ISROOTDN(lc) (LDAP_BACK_PCONN_ISPRIV((lc)) \ && (LDAP_BACK_CONN2PRIV((lc)) < LDAP_BACK_PCONN_ANON))#define LDAP_BACK_PCONN_ISANON(lc) (LDAP_BACK_PCONN_ISPRIV((lc)) \ && (LDAP_BACK_CONN2PRIV((lc)) < LDAP_BACK_PCONN_BIND) \ && (LDAP_BACK_CONN2PRIV((lc)) >= LDAP_BACK_PCONN_ANON))#define LDAP_BACK_PCONN_ISBIND(lc) (LDAP_BACK_PCONN_ISPRIV((lc)) \ && (LDAP_BACK_CONN2PRIV((lc)) >= LDAP_BACK_PCONN_BIND))#define LDAP_BACK_PCONN_ISTLS(lc) (LDAP_BACK_PCONN_ISPRIV((lc)) \ && (LDAP_BACK_CONN2PRIV((lc)) & LDAP_BACK_PCONN_TLS))#define LDAP_BACK_PCONN_ID(lc) (LDAP_BACK_PCONN_ISPRIV((lc)) ? \ ( -1 - (long)(lc)->lc_conn ) : (lc)->lc_conn->c_connid )#ifdef HAVE_TLS#define LDAP_BACK_PCONN_ROOTDN_SET(lc, op) \ ((lc)->lc_conn = (void *)((op)->o_conn->c_is_tls ? (void *) LDAP_BACK_PCONN_ROOTDN_TLS : (void *) LDAP_BACK_PCONN_ROOTDN))#define LDAP_BACK_PCONN_ANON_SET(lc, op) \ ((lc)->lc_conn = (void *)((op)->o_conn->c_is_tls ? (void *) LDAP_BACK_PCONN_ANON_TLS : (void *) LDAP_BACK_PCONN_ANON))#define LDAP_BACK_PCONN_BIND_SET(lc, op) \ ((lc)->lc_conn = (void *)((op)->o_conn->c_is_tls ? (void *) LDAP_BACK_PCONN_BIND_TLS : (void *) LDAP_BACK_PCONN_BIND))#else /* ! HAVE_TLS */#define LDAP_BACK_PCONN_ROOTDN_SET(lc, op) \ ((lc)->lc_conn = (void *)LDAP_BACK_PCONN_ROOTDN)#define LDAP_BACK_PCONN_ANON_SET(lc, op) \ ((lc)->lc_conn = (void *)LDAP_BACK_PCONN_ANON)#define LDAP_BACK_PCONN_BIND_SET(lc, op) \ ((lc)->lc_conn = (void *)LDAP_BACK_PCONN_BIND)#endif /* ! HAVE_TLS */#define LDAP_BACK_PCONN_SET(lc, op) \ (BER_BVISEMPTY(&(op)->o_ndn) ? \ LDAP_BACK_PCONN_ANON_SET((lc), (op)) : LDAP_BACK_PCONN_ROOTDN_SET((lc), (op))) LDAP *lc_ld; struct berval lc_cred; struct berval lc_bound_ndn; struct berval lc_local_ndn; unsigned lc_lcflags;#define LDAP_BACK_CONN_ISSET_F(fp,f) (*(fp) & (f))#define LDAP_BACK_CONN_SET_F(fp,f) (*(fp) |= (f))#define LDAP_BACK_CONN_CLEAR_F(fp,f) (*(fp) &= ~(f))#define LDAP_BACK_CONN_CPY_F(fp,f,mfp) \ do { \ if ( ((f) & *(mfp)) == (f) ) { \ *(fp) |= (f); \ } else { \ *(fp) &= ~(f); \ } \ } while ( 0 )#define LDAP_BACK_CONN_ISSET(lc,f) LDAP_BACK_CONN_ISSET_F(&(lc)->lc_lcflags, (f))#define LDAP_BACK_CONN_SET(lc,f) LDAP_BACK_CONN_SET_F(&(lc)->lc_lcflags, (f))#define LDAP_BACK_CONN_CLEAR(lc,f) LDAP_BACK_CONN_CLEAR_F(&(lc)->lc_lcflags, (f))#define LDAP_BACK_CONN_CPY(lc,f,mlc) LDAP_BACK_CONN_CPY_F(&(lc)->lc_lcflags, (f), &(mlc)->lc_lcflags)/* 0xFFF00000U are reserved for back-meta */#define LDAP_BACK_FCONN_ISBOUND (0x00000001U)#define LDAP_BACK_FCONN_ISANON (0x00000002U)#define LDAP_BACK_FCONN_ISBMASK (LDAP_BACK_FCONN_ISBOUND|LDAP_BACK_FCONN_ISANON)#define LDAP_BACK_FCONN_ISPRIV (0x00000004U)#define LDAP_BACK_FCONN_ISTLS (0x00000008U)#define LDAP_BACK_FCONN_BINDING (0x00000010U)#define LDAP_BACK_FCONN_TAINTED (0x00000020U)#define LDAP_BACK_FCONN_ABANDON (0x00000040U)#define LDAP_BACK_FCONN_ISIDASR (0x00000080U)#define LDAP_BACK_FCONN_CACHED (0x00000100U)#define LDAP_BACK_CONN_ISBOUND(lc) LDAP_BACK_CONN_ISSET((lc), LDAP_BACK_FCONN_ISBOUND)#define LDAP_BACK_CONN_ISBOUND_SET(lc) LDAP_BACK_CONN_SET((lc), LDAP_BACK_FCONN_ISBOUND)#define LDAP_BACK_CONN_ISBOUND_CLEAR(lc) LDAP_BACK_CONN_CLEAR((lc), LDAP_BACK_FCONN_ISBMASK)#define LDAP_BACK_CONN_ISBOUND_CPY(lc, mlc) LDAP_BACK_CONN_CPY((lc), LDAP_BACK_FCONN_ISBOUND, (mlc))#define LDAP_BACK_CONN_ISANON(lc) LDAP_BACK_CONN_ISSET((lc), LDAP_BACK_FCONN_ISANON)#define LDAP_BACK_CONN_ISANON_SET(lc) LDAP_BACK_CONN_SET((lc), LDAP_BACK_FCONN_ISANON)#define LDAP_BACK_CONN_ISANON_CLEAR(lc) LDAP_BACK_CONN_ISBOUND_CLEAR((lc))#define LDAP_BACK_CONN_ISANON_CPY(lc, mlc) LDAP_BACK_CONN_CPY((lc), LDAP_BACK_FCONN_ISANON, (mlc))#define LDAP_BACK_CONN_ISPRIV(lc) LDAP_BACK_CONN_ISSET((lc), LDAP_BACK_FCONN_ISPRIV)#define LDAP_BACK_CONN_ISPRIV_SET(lc) LDAP_BACK_CONN_SET((lc), LDAP_BACK_FCONN_ISPRIV)#define LDAP_BACK_CONN_ISPRIV_CLEAR(lc) LDAP_BACK_CONN_CLEAR((lc), LDAP_BACK_FCONN_ISPRIV)#define LDAP_BACK_CONN_ISPRIV_CPY(lc, mlc) LDAP_BACK_CONN_CPY((lc), LDAP_BACK_FCONN_ISPRIV, (mlc))#define LDAP_BACK_CONN_ISTLS(lc) LDAP_BACK_CONN_ISSET((lc), LDAP_BACK_FCONN_ISTLS)#define LDAP_BACK_CONN_ISTLS_SET(lc) LDAP_BACK_CONN_SET((lc), LDAP_BACK_FCONN_ISTLS)#define LDAP_BACK_CONN_ISTLS_CLEAR(lc) LDAP_BACK_CONN_CLEAR((lc), LDAP_BACK_FCONN_ISTLS)#define LDAP_BACK_CONN_ISTLS_CPY(lc, mlc) LDAP_BACK_CONN_CPY((lc), LDAP_BACK_FCONN_ISTLS, (mlc))#define LDAP_BACK_CONN_BINDING(lc) LDAP_BACK_CONN_ISSET((lc), LDAP_BACK_FCONN_BINDING)#define LDAP_BACK_CONN_BINDING_SET(lc) LDAP_BACK_CONN_SET((lc), LDAP_BACK_FCONN_BINDING)#define LDAP_BACK_CONN_BINDING_CLEAR(lc) LDAP_BACK_CONN_CLEAR((lc), LDAP_BACK_FCONN_BINDING)#define LDAP_BACK_CONN_TAINTED(lc) LDAP_BACK_CONN_ISSET((lc), LDAP_BACK_FCONN_TAINTED)#define LDAP_BACK_CONN_TAINTED_SET(lc) LDAP_BACK_CONN_SET((lc), LDAP_BACK_FCONN_TAINTED)#define LDAP_BACK_CONN_TAINTED_CLEAR(lc) LDAP_BACK_CONN_CLEAR((lc), LDAP_BACK_FCONN_TAINTED)#define LDAP_BACK_CONN_ABANDON(lc) LDAP_BACK_CONN_ISSET((lc), LDAP_BACK_FCONN_ABANDON)#define LDAP_BACK_CONN_ABANDON_SET(lc) LDAP_BACK_CONN_SET((lc), LDAP_BACK_FCONN_ABANDON)#define LDAP_BACK_CONN_ABANDON_CLEAR(lc) LDAP_BACK_CONN_CLEAR((lc), LDAP_BACK_FCONN_ABANDON)#define LDAP_BACK_CONN_ISIDASSERT(lc) LDAP_BACK_CONN_ISSET((lc), LDAP_BACK_FCONN_ISIDASR)#define LDAP_BACK_CONN_ISIDASSERT_SET(lc) LDAP_BACK_CONN_SET((lc), LDAP_BACK_FCONN_ISIDASR)#define LDAP_BACK_CONN_ISIDASSERT_CLEAR(lc) LDAP_BACK_CONN_CLEAR((lc), LDAP_BACK_FCONN_ISIDASR)#define LDAP_BACK_CONN_ISIDASSERT_CPY(lc, mlc) LDAP_BACK_CONN_CPY((lc), LDAP_BACK_FCONN_ISIDASR, (mlc))#define LDAP_BACK_CONN_CACHED(lc) LDAP_BACK_CONN_ISSET((lc), LDAP_BACK_FCONN_CACHED)#define LDAP_BACK_CONN_CACHED_SET(lc) LDAP_BACK_CONN_SET((lc), LDAP_BACK_FCONN_CACHED)#define LDAP_BACK_CONN_CACHED_CLEAR(lc) LDAP_BACK_CONN_CLEAR((lc), LDAP_BACK_FCONN_CACHED) unsigned lc_refcnt; unsigned lc_flags; time_t lc_create_time; time_t lc_time; LDAP_TAILQ_ENTRY(ldapconn_t) lc_q;} ldapconn_t;typedef struct ldap_avl_info_t { ldap_pvt_thread_mutex_t lai_mutex; Avlnode *lai_tree;} ldap_avl_info_t;typedef struct slap_retry_info_t { time_t *ri_interval; int *ri_num; int ri_idx; int ri_count; time_t ri_last;#define SLAP_RETRYNUM_FOREVER (-1) /* retry forever */#define SLAP_RETRYNUM_TAIL (-2) /* end of retrynum array */#define SLAP_RETRYNUM_VALID(n) ((n) >= SLAP_RETRYNUM_FOREVER) /* valid retrynum */#define SLAP_RETRYNUM_FINITE(n) ((n) > SLAP_RETRYNUM_FOREVER) /* not forever */} slap_retry_info_t;/* * identity assertion modes */typedef enum { LDAP_BACK_IDASSERT_LEGACY = 1, LDAP_BACK_IDASSERT_NOASSERT, LDAP_BACK_IDASSERT_ANONYMOUS, LDAP_BACK_IDASSERT_SELF, LDAP_BACK_IDASSERT_OTHERDN, LDAP_BACK_IDASSERT_OTHERID} slap_idassert_mode_t;/* ID assert stuff */typedef struct slap_idassert_t { slap_idassert_mode_t si_mode;#define li_idassert_mode li_idassert.si_mode slap_bindconf si_bc;#define li_idassert_authcID li_idassert.si_bc.sb_authcId#define li_idassert_authcDN li_idassert.si_bc.sb_binddn#define li_idassert_passwd li_idassert.si_bc.sb_cred#define li_idassert_authzID li_idassert.si_bc.sb_authzId#define li_idassert_authmethod li_idassert.si_bc.sb_method#define li_idassert_sasl_mech li_idassert.si_bc.sb_saslmech
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -