1
1
/* slap.h - stand alone ldap server include file */
2
/* $OpenLDAP: pkg/ldap/servers/slapd/slap.h,v 1.764.2.54 2009/08/25 22:44:25 quanah Exp $ */
2
/* $OpenLDAP: pkg/ldap/servers/slapd/slap.h,v 1.764.2.59 2009/12/12 06:18:53 hyc Exp $ */
3
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5
5
* Copyright 1998-2009 The OpenLDAP Foundation.
1527
1527
struct AccessControl *acl_next;
1528
1528
} AccessControl;
1531
ACL_STATE_NOT_RECORDED = 0x0,
1532
ACL_STATE_RECORDED_VD = 0x1,
1533
ACL_STATE_RECORDED_NV = 0x2,
1534
ACL_STATE_RECORDED = ( ACL_STATE_RECORDED_VD | ACL_STATE_RECORDED_NV )
1537
1530
typedef struct AccessControlState {
1538
1531
/* Access state */
1539
AccessControl *as_vi_acl;
1540
AccessControl *as_vd_acl;
1541
AttributeDescription *as_vd_ad;
1544
slap_acl_state_t as_recorded;
1533
/* The stored state is valid when requesting as_access access
1534
* to the as_desc attributes. */
1535
AttributeDescription *as_desc;
1536
slap_access_t as_access;
1538
/* Value dependent acl where processing can restart */
1539
AccessControl *as_vd_acl;
1545
1540
int as_vd_acl_count;
1541
slap_mask_t as_vd_mask;
1543
/* The cached result after evaluating a value independent attr.
1544
* Only valid when != -1 and as_vd_acl == NULL */
1547
/* True if started to process frontend ACLs */
1547
1548
int as_fe_done;
1548
1549
} AccessControlState;
1549
#define ACL_STATE_INIT { NULL, NULL, NULL, \
1550
ACL_STATE_NOT_RECORDED, 0, 0, 0 }
1550
#define ACL_STATE_INIT { NULL, ACL_NONE, NULL, 0, ACL_PRIV_NONE, -1, 0 }
1552
1552
typedef struct AclRegexMatches {
1704
1712
#define SLAP_SYNC_RID_MAX 999
1705
1713
#define SLAP_SYNC_SID_MAX 4095 /* based on liblutil/csn.c field width */
1715
/* fake conn connid constructed as rid; real connids start
1716
* at SLAPD_SYNC_CONN_OFFSET */
1717
#define SLAPD_SYNC_SYNCCONN_OFFSET (SLAP_SYNC_RID_MAX + 1)
1718
#define SLAPD_SYNC_IS_SYNCCONN(connid) ((connid) < SLAPD_SYNC_SYNCCONN_OFFSET)
1719
#define SLAPD_SYNC_RID2SYNCCONN(rid) (rid)
1706
1721
#define SLAP_SYNCUUID_SET_SIZE 256
1708
1723
struct sync_cookie {
1804
1819
#define SLAP_DBFLAG_SHADOW_MASK (SLAP_DBFLAG_SHADOW|SLAP_DBFLAG_SINGLE_SHADOW|SLAP_DBFLAG_SYNC_SHADOW|SLAP_DBFLAG_SLURP_SHADOW)
1805
1820
#define SLAP_DBFLAG_CLEAN 0x10000U /* was cleanly shutdown */
1806
1821
#define SLAP_DBFLAG_ACL_ADD 0x20000U /* check attr ACLs on adds */
1822
#define SLAP_DBFLAG_SYNC_SUBENTRY 0x40000U /* use subentry for context */
1807
1823
slap_mask_t be_flags;
1808
1824
#define SLAP_DBFLAGS(be) ((be)->be_flags)
1809
1825
#define SLAP_NOLASTMOD(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_NOLASTMOD)
1830
1846
#define SLAP_MULTIMASTER(be) (!SLAP_SINGLE_SHADOW(be))
1831
1847
#define SLAP_DBCLEAN(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_CLEAN)
1832
1848
#define SLAP_DBACL_ADD(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_ACL_ADD)
1849
#define SLAP_SYNC_SUBENTRY(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SYNC_SUBENTRY)
1834
1851
slap_mask_t be_restrictops; /* restriction operations */
1835
1852
#define SLAP_RESTRICT_OP_ADD 0x0001U
2761
2778
* represents a connection from an ldap client
2780
/* structure state (protected by connections_mutex) */
2781
enum sc_struct_state {
2782
SLAP_C_UNINITIALIZED = 0, /* MUST BE ZERO (0) */
2788
/* connection state (protected by c_mutex ) */
2789
enum sc_conn_state {
2790
SLAP_C_INVALID = 0, /* MUST BE ZERO (0) */
2791
SLAP_C_INACTIVE, /* zero threads */
2792
SLAP_C_CLOSING, /* closing */
2793
SLAP_C_ACTIVE, /* one or more threads */
2794
SLAP_C_BINDING, /* binding */
2795
SLAP_C_CLIENT /* outbound client conn */
2763
2797
struct Connection {
2764
int c_struct_state; /* structure management state */
2765
int c_conn_state; /* connection state */
2798
enum sc_struct_state c_struct_state; /* structure management state */
2799
enum sc_conn_state c_conn_state; /* connection state */
2766
2800
int c_conn_idx; /* slot in connections array */
2767
2801
ber_socket_t c_sd;
2768
2802
const char *c_close_reason; /* why connection is closing */