]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slap.h
limit checking in syncrepl
[openldap] / servers / slapd / slap.h
index e01c80dbec2e1cfa6dedd7b34cf71eff97e13ae0..f1853ee04f3456ee0c7735e208c19b34e355fa71 100644 (file)
@@ -133,7 +133,10 @@ LDAP_BEGIN_DECL
        || (c) == '(' || (c) == ')' || !ASCII_PRINTABLE(c) )
 
 #define DN_ESCAPE(c)   ((c) == SLAP_ESCAPE_CHAR)
-#define DN_SEPARATOR(c)        ((c) == ',' || (c) == ';')
+/* NOTE: for consistency, this macro must only operate
+ * on normalized/pretty DN, such that ';' is never used
+ * as RDN separator, and all occurrences of ';' must be escaped */
+#define DN_SEPARATOR(c)        ((c) == ',')
 #define RDN_ATTRTYPEANDVALUE_SEPARATOR(c) ((c) == '+') /* RFC 2253 */
 #define RDN_SEPARATOR(c) (DN_SEPARATOR(c) || RDN_ATTRTYPEANDVALUE_SEPARATOR(c))
 #define RDN_NEEDSESCAPE(c)     ((c) == '\\' || (c) == '"')
@@ -225,9 +228,21 @@ typedef struct slap_ssf_set {
        | SLAP_INDEX_SUBSTR_ANY \
        | SLAP_INDEX_SUBSTR_FINAL )
 
-#define SLAP_INDEX_SUBSTR_MINLEN       2
-#define SLAP_INDEX_SUBSTR_MAXLEN       4
-#define SLAP_INDEX_SUBSTR_STEP 2
+/* constants for initial/final substrings indices */
+#ifndef SLAP_INDEX_SUBSTR_IF_MINLEN
+# define SLAP_INDEX_SUBSTR_IF_MINLEN   2
+#endif
+#ifndef SLAP_INDEX_SUBSTR_IF_MAXLEN
+# define SLAP_INDEX_SUBSTR_IF_MAXLEN   4
+#endif
+
+/* constants for any substrings indices */
+#ifndef SLAP_INDEX_SUBSTR_ANY_LEN
+# define SLAP_INDEX_SUBSTR_ANY_LEN     4
+#endif
+#ifndef SLAP_INDEX_SUBSTR_ANY_STEP
+# define SLAP_INDEX_SUBSTR_ANY_STEP    2
+#endif
 
 #define SLAP_INDEX_FLAGS         0xF000UL
 #define SLAP_INDEX_NOSUBTYPES    0x1000UL /* don't use index w/ subtypes */
@@ -1297,6 +1312,10 @@ struct slap_limits_set {
        int     lms_s_pr_total;
 };
 
+/* Note: this is different from LDAP_NO_LIMIT (0); slapd internal use only */
+#define SLAP_NO_LIMIT                  -1
+#define SLAP_MAX_LIMIT                 2147483647
+
 struct slap_limits {
        unsigned                lm_flags;       /* type of pattern */
 #define SLAP_LIMITS_UNDEFINED          0x0000U
@@ -1389,6 +1408,9 @@ typedef struct syncinfo_s {
         char                           **si_attrs;
         int                                    si_type;
         time_t                         si_interval;
+               time_t                          *si_retryinterval;
+               int                                     *si_retrynum_init;
+               int                                     *si_retrynum;
                struct sync_cookie      si_syncCookie;
         int                                    si_manageDSAit;
         int                                    si_slimit;
@@ -1400,6 +1422,8 @@ typedef struct syncinfo_s {
                LDAP_STAILQ_ENTRY( syncinfo_s ) si_next;
 } syncinfo_t;
 
+LDAP_TAILQ_HEAD( be_pcl, slap_csn_entry );
+
 struct slap_backend_db {
        BackendInfo     *bd_info;       /* pointer to shared backend info */
 
@@ -1490,6 +1514,15 @@ struct slap_backend_db {
 #define SLAP_RESTRICT_OP_MODIFY                0x0020U
 #define SLAP_RESTRICT_OP_RENAME                0x0040U
 #define SLAP_RESTRICT_OP_SEARCH                0x0080U
+#define SLAP_RESTRICT_OP_MASK          0x00FFU
+
+#define        SLAP_RESTRICT_READONLY          0x80000000U
+
+#define SLAP_RESTRICT_EXOP_START_TLS           0x0100U
+#define        SLAP_RESTRICT_EXOP_MODIFY_PASSWD        0x0200U
+#define SLAP_RESTRICT_EXOP_WHOAMI              0x0400U
+#define SLAP_RESTRICT_EXOP_CANCEL              0x0800U
+#define SLAP_RESTRICT_EXOP_MASK                        0xFF00U
 
 #define SLAP_RESTRICT_OP_READS \
        ( SLAP_RESTRICT_OP_COMPARE      \
@@ -1545,7 +1578,7 @@ struct slap_backend_db {
        char    *be_replogfile; /* replication log file (in master)        */
        struct berval be_update_ndn;    /* allowed to make changes (in replicas) */
        BerVarray       be_update_refs; /* where to refer modifying clients to */
-       LDAP_TAILQ_HEAD( be_pcl, slap_csn_entry )       be_pending_csn_list;
+       struct          be_pcl  *be_pending_csn_list;
        ldap_pvt_thread_mutex_t                                 be_pcl_mutex;
        struct berval                                                   be_context_csn;
        ldap_pvt_thread_mutex_t                                 be_context_csn_mutex;
@@ -1831,6 +1864,7 @@ struct slap_backend_info {
 
        slap_mask_t     bi_flags; /* backend flags */
 #define SLAP_BFLAG_MONITOR                     0x0001U /* a monitor backend */
+#define SLAP_BFLAG_NOLASTMODCMD                0x0010U
 #define SLAP_BFLAG_INCREMENT           0x0100U
 #define SLAP_BFLAG_ALIASES                     0x1000U
 #define SLAP_BFLAG_REFERRALS           0x2000U
@@ -1844,6 +1878,8 @@ struct slap_backend_info {
 #define SLAP_REFERRALS(be)     (SLAP_BFLAGS(be) & SLAP_BFLAG_REFERRALS)
 #define SLAP_SUBENTRIES(be)    (SLAP_BFLAGS(be) & SLAP_BFLAG_SUBENTRIES)
 #define SLAP_DYNAMIC(be)       (SLAP_BFLAGS(be) & SLAP_BFLAG_DYNAMIC)
+#define SLAP_NOLASTMODCMD(be)  (SLAP_BFLAGS(be) & SLAP_BFLAG_NOLASTMODCMD)
+#define SLAP_LASTMODCMD(be)    (!SLAP_NOLASTMODCMD(be))
 
        char **bi_controls;             /* supported controls */
 
@@ -2040,6 +2076,7 @@ typedef struct slap_op {
        char o_do_not_cache;    /* don't cache groups from this op */
        char o_is_auth_check;   /* authorization in progress */
 
+#define SLAP_IGNORED_CONTROL -1
 #define SLAP_NO_CONTROL 0
 #define SLAP_NONCRITICAL_CONTROL 1
 #define SLAP_CRITICAL_CONTROL 2