]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slap.h
Build without HAVE_TLS
[openldap] / servers / slapd / slap.h
index 168cf296db3b755dffb540cadf95966b410634bb..38f0a4ca6b97745be11056d4b13b73f5fab85fc5 100644 (file)
@@ -36,8 +36,6 @@
 #include "ldap_queue.h"
 
 #ifdef LDAP_DEVEL
-#define SLAP_NVALUES 1
-#define SLAP_NVALUES_ON_DISK 1
 #define SLAP_EXTENDED_SCHEMA 1
 #define LDAP_CACHING
 #endif
@@ -79,6 +77,10 @@ LDAP_BEGIN_DECL
 
 #define SLAP_MAX_WORKER_THREADS                (16)
 
+#ifdef LDAP_SYNCREPL
+#define SLAP_MAX_SYNCREPL_THREADS      (8)
+#endif
+
 #define SLAP_SB_MAX_INCOMING_DEFAULT ((1<<18) - 1)
 #define SLAP_SB_MAX_INCOMING_AUTH ((1<<24) - 1)
 
@@ -294,7 +296,8 @@ typedef int slap_syntax_validate_func LDAP_P((
 typedef int slap_syntax_transform_func LDAP_P((
        struct slap_syntax *syntax,
        struct berval * in,
-       struct berval * out));
+       struct berval * out,
+       void *memctx));
 
 typedef struct slap_syntax {
        LDAPSyntax                      ssyn_syn;
@@ -321,9 +324,6 @@ typedef struct slap_syntax {
 #define SLAP_SYNTAX_HIDE       0x8000U /* hide (do not publish) */
 
        slap_syntax_validate_func       *ssyn_validate;
-#ifndef SLAP_NVALUES
-       slap_syntax_transform_func      *ssyn_normalize;
-#endif
        slap_syntax_transform_func      *ssyn_pretty;
 
 #ifdef SLAPD_BINARY_CONVERSION
@@ -345,11 +345,6 @@ typedef struct slap_syntax_defs_rec {
        char *sd_desc;
        int sd_flags;
        slap_syntax_validate_func *sd_validate;
-#ifdef SLAP_NVALUES
-       slap_syntax_transform_func *sd_normalizeXXX; /* to be deleted */
-#else
-       slap_syntax_transform_func *sd_normalize;
-#endif
        slap_syntax_transform_func *sd_pretty;
 #ifdef SLAPD_BINARY_CONVERSION
        slap_syntax_transform_func *sd_ber2str;
@@ -360,7 +355,8 @@ typedef struct slap_syntax_defs_rec {
 /* X -> Y Converter */
 typedef int slap_mr_convert_func LDAP_P((
        struct berval * in,
-       struct berval * out ));
+       struct berval * out,
+       void *memctx ));
 
 /* Normalizer */
 typedef int slap_mr_normalize_func LDAP_P((
@@ -368,7 +364,8 @@ typedef int slap_mr_normalize_func LDAP_P((
        struct slap_syntax *syntax, /* NULL if in is asserted value */
        struct slap_matching_rule *mr,
        struct berval * in,
-       struct berval * out ));
+       struct berval * out,
+       void *memctx ));
 
 /* Match (compare) function */
 typedef int slap_mr_match_func LDAP_P((
@@ -387,7 +384,8 @@ typedef int slap_mr_indexer_func LDAP_P((
        struct slap_matching_rule *mr,
        struct berval *prefix,
        BerVarray values,
-       BerVarray *keys ));
+       BerVarray *keys,
+       void *memctx ));
 
 /* Filter index function */
 typedef int slap_mr_filter_func LDAP_P((
@@ -397,7 +395,8 @@ typedef int slap_mr_filter_func LDAP_P((
        struct slap_matching_rule *mr,
        struct berval *prefix,
        void * assertValue,
-       BerVarray *keys ));
+       BerVarray *keys,
+       void *memctx ));
 
 typedef struct slap_matching_rule_use MatchingRuleUse;
 
@@ -437,29 +436,7 @@ typedef struct slap_matching_rule {
 #define SLAP_MR_SUBSTR_ANY             ( SLAP_MR_SUBSTR | 0x0200U )
 #define SLAP_MR_SUBSTR_FINAL   ( SLAP_MR_SUBSTR | 0x0400U )
 
-#ifndef SLAP_NVALUES
-#define SLAP_MR_DN_FOLD                        0x0080U
-#endif
 
-#ifndef SLAP_NVALUES
-/*
- * normally the asserted value is expected to conform to
- * assertion syntax specified in the matching rule, however
- * at times (such as during individual value modification),
- * the asserted value is expected to conform to the
- * attribute's value syntax.
- */
-#define SLAP_MR_ASSERTION_SYNTAX_MATCH         0x0000U
-#define SLAP_MR_ATTRIBUTE_SYNTAX_MATCH         0x0001U
-
-/* For SLAP_MR_ATTRIBUTE_SYNTAX_MATCHes, this flag indicates
- * that the asserted value of the attribute syntax has been
- * converted to the assertion syntax.  (Not sure why we just
- * don't clear the SLAP_MR_ATTRIBUTE_SYNTAX_MATCH flag instead.)
- */
-#define SLAP_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH       0x0002U
-
-#else
 /*
  * The asserted value, depending on the particular usage,
  * is expected to conform to either the assertion syntax
@@ -478,7 +455,6 @@ typedef struct slap_matching_rule {
        ((usage) & SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX )
 #define SLAP_MR_IS_VALUE_OF_ASSERTION_SYNTAX( usage ) \
        ((usage) & SLAP_MR_VALUE_OF_ASSERTION_SYNTAX )
-#endif
 
 /* either or both the asserted value or attribute value
  * may be provided in normalized form
@@ -517,7 +493,15 @@ typedef struct slap_matching_rule {
         */
        Syntax                                  **smr_compat_syntaxes;
 
+       /*
+        * For equality rules, refers to an associated approximate rule.
+        * For non-equality rules, refers to an associated equality rule.
+        */
        struct slap_matching_rule       *smr_associated;
+
+#define SLAP_MR_ASSOCIATED(mr,amr)     (((mr) == (amr)) || \
+       ((mr)->smr_associated == (amr)))
+
        LDAP_SLIST_ENTRY(slap_matching_rule)smr_next;
 
 #define smr_oid                                smr_mrule.mr_oid
@@ -555,7 +539,8 @@ typedef struct slap_mrule_defs_rec {
        slap_mr_indexer_func *          mrd_indexer;
        slap_mr_filter_func *           mrd_filter;
 
-       /* For equality rule, this may refer to an appropriate approximate rule */
+       /* For equality rule, this may refer to an associated approximate rule */
+       /* For non-equality rule, this may refer to an associated equality rule */
        char *                                          mrd_associated;
 } slap_mrule_defs_rec;
 
@@ -714,10 +699,15 @@ struct slap_internal_schema {
        ObjectClass *si_oc_rootdse;
        ObjectClass *si_oc_subentry;
        ObjectClass *si_oc_subschema;
-       ObjectClass *si_oc_monitor;
        ObjectClass *si_oc_collectiveAttributeSubentry;
        ObjectClass *si_oc_dynamicObject;
 
+#ifdef LDAP_SYNCREPL
+        ObjectClass *si_oc_glue;
+        ObjectClass *si_oc_syncConsumerSubentry;
+        ObjectClass *si_oc_syncProviderSubentry;
+#endif
+
        /* objectClass attribute descriptions */
        AttributeDescription *si_ad_objectClass;
 
@@ -741,6 +731,11 @@ struct slap_internal_schema {
        AttributeDescription *si_ad_queryid;
 #endif /* LDAP_CACHING */
 
+#ifdef LDAP_SYNCREPL
+        AttributeDescription *si_ad_dseType;
+        AttributeDescription *si_ad_syncreplCookie;
+#endif
+
        /* root DSE attribute descriptions */
        AttributeDescription *si_ad_altServer;
        AttributeDescription *si_ad_namingContexts;
@@ -795,7 +790,7 @@ struct slap_internal_schema {
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
        AttributeDescription *si_ad_krbName;
 #endif
-
+        
        /* Undefined Attribute Type */
        AttributeType   *si_at_undefined;
 
@@ -806,6 +801,7 @@ struct slap_internal_schema {
        MatchingRule    *si_mr_caseExactIA5Match;
        MatchingRule    *si_mr_integerMatch;
        MatchingRule    *si_mr_integerFirstComponentMatch;
+       MatchingRule    *si_mr_objectIdentifierFirstComponentMatch;
 
        /* Syntaxes */
        Syntax          *si_syn_directoryString;
@@ -948,9 +944,7 @@ typedef struct slap_valuesreturnfilter {
 typedef struct slap_attr {
        AttributeDescription *a_desc;
        BerVarray       a_vals;         /* preserved values */
-#ifdef SLAP_NVALUES
        BerVarray       a_nvals;        /* normalized values */
-#endif
        struct slap_attr *a_next;
        unsigned a_flags;
 #define SLAP_ATTR_IXADD                0x1U
@@ -1001,9 +995,7 @@ typedef struct slap_mod {
        struct berval sm_type;
        BerVarray sm_values;
 #define sm_bvalues sm_values
-#ifdef SLAP_NVALUES
        BerVarray sm_nvalues;
-#endif
 } Modification;
 
 typedef struct slap_mod_list {
@@ -1227,6 +1219,8 @@ LDAP_SLAPD_V (int) slapMode;
 #define SLAP_MODE                      0x0003
 
 #define SLAP_TRUNCATE_MODE     0x0100
+#define        SLAP_TOOL_READMAIN      0x0200
+#define        SLAP_TOOL_READONLY      0x0400
 
 struct slap_replica_info {
        char *ri_host;                          /* supersedes be_replica */
@@ -1276,6 +1270,99 @@ typedef BackendDB Backend;
 #define nbackends nBackendDB
 #define backends backendDB
 
+#ifdef LDAP_SYNCREPL
+
+struct nonpresent_entry {
+       struct berval *dn;
+       struct berval *ndn;
+       LDAP_LIST_ENTRY(nonpresent_entry) np_link;
+};
+
+ /*
+  * syncinfo structure for syncrepl
+  */
+typedef struct syncinfo_s {
+        struct slap_conn *conn;
+        struct slap_backend_db *be;
+        struct slap_entry *e;
+        void            *ctx;
+        int             id;
+        char            *masteruri;
+               struct berval   *master_bv;
+        char            *mastername;
+        int             masterport;
+        int             type;
+               struct berval   updatedn;       
+        char            *binddn;
+        int             bindmethod;
+        char            *passwd;
+        char            *secprops;
+        char            *realm;
+        char            *authcId;
+        char            *authzId;
+        char            *srvtab;
+        char            *saslmech;
+        time_t                 interval;
+        char            *base;
+        int             scope;
+        int             deref;
+        int             slimit;
+        int             tlimit;
+        Filter          *filter;
+        char            *filterstr;
+        char            **attrs;
+        int             attrsonly;
+#define LASTMOD_REQ            0
+#define LASTMOD_GEN            1
+#define LASTMOD_NO             2
+       int             lastmod;
+        /* TLS flags */
+#define TLS_OFF                 0
+#define TLS_ON                  1
+#define TLS_CRITICAL            2
+        int             tls;
+        int             found;
+        struct berval   *syncUUID;
+               struct berval   *syncUUID_ndn;
+        struct berval   *syncCookie;
+        Avlnode         *presentlist;
+               LDAP_LIST_HEAD(np, nonpresent_entry) nonpresentlist;
+} syncinfo_t;
+
+#define IDSTR           "id"
+#define MASTERSTR       "master"
+#define SUFFIXSTR       "suffix"
+#define UPDATEDNSTR            "updatedn"
+#define BINDDNSTR       "binddn"
+#define BINDMETHSTR     "bindmethod"
+#define SIMPLESTR       "simple"
+#define SASLSTR         "sasl"
+#define CREDSTR         "credentials"
+#define OLDAUTHCSTR     "bindprincipal"
+#define AUTHCSTR        "authcID"
+#define AUTHZSTR        "authzID"
+#define SRVTABSTR       "srvtab"
+#define SASLMECHSTR     "saslmech"
+#define REALMSTR        "realm"
+#define SECPROPSSTR     "secprops"
+#define TLSSTR          "tls"
+#define TLSCRITICALSTR  "critical"
+
+#define FILTERSTR       "filter"
+#define SEARCHBASESTR   "searchbase"
+#define SCOPESTR        "scope"
+#define ATTRSSTR        "attrs"
+#define ATTRSONLYSTR    "attrsonly"
+#define TYPESTR         "type"
+#define INTERVALSTR     "interval"
+#define COOKIESTR       "cookie"
+#define LASTMODSTR     "lastmod"
+#define LMREQSTR       "req"
+#define LMGENSTR       "gen"
+#define LMNOSTR                "no"
+
+#endif /* LDAP_SYNCREPL */
+
 struct slap_backend_db {
        BackendInfo     *bd_info;       /* pointer to shared backend info */
 
@@ -1416,6 +1503,9 @@ struct slap_backend_db {
        void    *be_private;    /* anything the backend database needs     */
 
        void    *be_pb;         /* Netscape plugin */
+#ifdef LDAP_SYNCREPL
+       syncinfo_t      *syncinfo;      /* For syncrepl */
+#endif
 };
 
 struct slap_conn;
@@ -1876,6 +1966,12 @@ typedef struct slap_op {
        LDAPControl     **o_ctrls;       /* controls */
 
        void    *o_threadctx;           /* thread pool thread context */
+       void    *o_tmpmemctx;           /* slab malloc context */
+       BerMemoryFunctions *o_tmpmfuncs;
+#define        o_tmpalloc      o_tmpmfuncs->bmf_malloc
+#define o_tmpcalloc    o_tmpmfuncs->bmf_calloc
+#define        o_tmprealloc    o_tmpmfuncs->bmf_realloc
+#define        o_tmpfree       o_tmpmfuncs->bmf_free
        void    *o_private;     /* anything the backend needs */
 
        LDAP_STAILQ_ENTRY(slap_op)      o_next; /* next operation in list         */
@@ -1978,7 +2074,9 @@ typedef struct slap_conn {
        int     c_needs_tls_accept;     /* true if SSL_accept should be called */
 #endif
        int             c_sasl_layers;   /* true if we need to install SASL i/o handlers */
-       void    *c_sasl_context;        /* SASL session context */
+       int     c_sasl_done;            /* SASL completed once */
+       void    *c_sasl_authctx;        /* SASL authentication context */
+       void    *c_sasl_sockctx;        /* SASL security layer context */
        void    *c_sasl_extra;          /* SASL session extra stuff */
        struct slap_op  *c_sasl_bindop; /* set to current op if it's a bind */
 
@@ -2045,6 +2143,7 @@ struct slap_listener {
 #ifdef LDAP_CONNECTIONLESS
        int     sl_is_udp;              /* UDP listener is also data port */
 #endif
+       int     sl_is_mute;     /* Listening is temporarily disabled */
        ber_socket_t sl_sd;
        Sockaddr sl_sa;
 #define sl_addr        sl_sa.sa_in_addr