#include "ldap_queue.h"
#ifdef LDAP_DEVEL
+/* #define SLAP_NVALUES 1 */
#define SLAP_EXTENDED_SCHEMA 1
#endif
#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
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;
#define SLAP_MR_HIDE 0x8000U
-#define SLAP_MR_TYPE_MASK 0x0F00U
-#define SLAP_MR_SUBTYPE_MASK 0x00F0U
-#define SLAP_MR_USAGE 0x000FU
+#define SLAP_MR_TYPE_MASK 0xF000U
+#define SLAP_MR_SUBTYPE_MASK 0x0F00U
+#define SLAP_MR_USAGE 0x00FFU
#define SLAP_MR_NONE 0x0000U
-#define SLAP_MR_EQUALITY 0x0100U
-#define SLAP_MR_ORDERING 0x0200U
-#define SLAP_MR_SUBSTR 0x0400U
-#define SLAP_MR_EXT 0x0800U /* implicitly extensible */
+#define SLAP_MR_EQUALITY 0x1000U
+#define SLAP_MR_ORDERING 0x2000U
+#define SLAP_MR_SUBSTR 0x4000U
+#define SLAP_MR_EXT 0x8000U /* implicitly extensible */
-#define SLAP_MR_EQUALITY_APPROX ( SLAP_MR_EQUALITY | 0x0010U )
-#define SLAP_MR_DN_FOLD 0x0008U
+#define SLAP_MR_EQUALITY_APPROX ( SLAP_MR_EQUALITY | 0x0100U )
-#define SLAP_MR_SUBSTR_INITIAL ( SLAP_MR_SUBSTR | 0x0010U )
-#define SLAP_MR_SUBSTR_ANY ( SLAP_MR_SUBSTR | 0x0020U )
-#define SLAP_MR_SUBSTR_FINAL ( SLAP_MR_SUBSTR | 0x0040U )
+#define SLAP_MR_SUBSTR_INITIAL ( SLAP_MR_SUBSTR | 0x0100U )
+#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 provided value is expected to conform to
+ * 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 provided value is expected to conform to the
+ * the asserted value is expected to conform to the
* attribute's value syntax.
*/
-#define SLAP_MR_ASSERTION_SYNTAX_MATCH 0x0000U
-#define SLAP_MR_VALUE_SYNTAX_MATCH 0x0001U
-#define SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH 0x0003U
-#define SLAP_MR_VALUE_NORMALIZED_MATCH 0x0004U
+#define SLAP_MR_ASSERTION_SYNTAX_MATCH 0x0000U
+#define SLAP_MR_ATTRIBUTE_SYNTAX_MATCH 0x0001U
-#define SLAP_IS_MR_ASSERTION_SYNTAX_MATCH( usage ) \
- (!((usage) & SLAP_MR_VALUE_SYNTAX_MATCH))
-#define SLAP_IS_MR_VALUE_SYNTAX_MATCH( usage ) \
- ((usage) & SLAP_MR_VALUE_SYNTAX_MATCH)
+/* 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
+ * or the attribute syntax. In some cases, the syntax of
+ * the value is known. If so, these flags indicate which
+ * syntax the value is expected to conform to. If not,
+ * neither of these flags is set (until the syntax of the
+ * provided value is determined). If the value is of the
+ * attribute syntax, the flag is changed once a value of
+ * the assertion syntax is derived from the provided value.
+ */
+#define SLAP_MR_VALUE_OF_ASSERTION_SYNTAX 0x0001U
+#define SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX 0x0002U
-#define SLAP_IS_MR_VALUE_SYNTAX_CONVERTED_MATCH( usage ) \
- (((usage) & SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH) \
- == SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH)
-#define SLAP_IS_MR_VALUE_SYNTAX_NONCONVERTED_MATCH( usage ) \
- (((usage) & SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH) \
- == SLAP_MR_VALUE_SYNTAX_MATCH)
+#define SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX( usage ) \
+ ((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
+ */
+#define SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH 0x0010U
+#define SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH 0x0020U
+
+#define SLAP_IS_MR_ASSERTION_SYNTAX_MATCH( usage ) \
+ (!((usage) & SLAP_MR_ATTRIBUTE_SYNTAX_MATCH))
+#define SLAP_IS_MR_ATTRIBUTE_SYNTAX_MATCH( usage ) \
+ ((usage) & SLAP_MR_ATTRIBUTE_SYNTAX_MATCH)
+
+#define SLAP_IS_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH( usage ) \
+ (((usage) & SLAP_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH) \
+ == SLAP_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH)
+#define SLAP_IS_MR_ATTRIBUTE_SYNTAX_NONCONVERTED_MATCH( usage ) \
+ (((usage) & SLAP_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH) \
+ == SLAP_MR_ATTRIBUTE_SYNTAX_MATCH)
+
+#define SLAP_IS_MR_ASSERTED_VALUE_NORMALIZED_MATCH( usage ) \
+ ((usage) & SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH )
+#define SLAP_IS_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH( usage ) \
+ ((usage) & SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH )
Syntax *smr_syntax;
slap_mr_convert_func *smr_convert;
slap_mr_indexer_func * mrd_indexer;
slap_mr_filter_func * mrd_filter;
+ /* For equality rule, this may refer to an appropriate approximate rule */
char * mrd_associated;
} slap_mrule_defs_rec;
AttributeDescription *si_ad_entryCSN;
AttributeDescription *si_ad_superiorUUID;
+#ifdef LDAP_CACHING
+ /* LDAP cache specific operational attribute */
+ AttributeDescription *si_ad_queryid;
+#endif /* LDAP_CACHING */
+
/* root DSE attribute descriptions */
AttributeDescription *si_ad_altServer;
AttributeDescription *si_ad_namingContexts;
/* Matching Rules */
MatchingRule *si_mr_distinguishedNameMatch;
+ MatchingRule *si_mr_caseExactMatch;
+ MatchingRule *si_mr_caseExactSubstringsMatch;
+ MatchingRule *si_mr_caseExactIA5Match;
MatchingRule *si_mr_integerMatch;
+ MatchingRule *si_mr_integerFirstComponentMatch;
/* Syntaxes */
- Syntax *si_syn_octetString;
+ Syntax *si_syn_directoryString;
Syntax *si_syn_distinguishedName;
Syntax *si_syn_integer;
+ Syntax *si_syn_octetString;
};
typedef struct slap_attr_assertion {
*/
typedef struct slap_attr {
AttributeDescription *a_desc;
- BerVarray a_vals;
- struct slap_attr *a_next;
+ 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
#define SLAP_ATTR_IXDEL 0x2U
int sm_op;
AttributeDescription *sm_desc;
struct berval sm_type;
- BerVarray sm_bvalues;
+ BerVarray sm_values;
+#define sm_bvalues sm_values
+#ifdef SLAP_NVALUES
+ BerVarray sm_nvalues;
+#endif
} Modification;
typedef struct slap_mod_list {
#define sml_op sml_mod.sm_op
#define sml_desc sml_mod.sm_desc
#define sml_type sml_mod.sm_type
-#define sml_bvalues sml_mod.sm_bvalues
+#define sml_bvalues sml_mod.sm_values
+#define sml_values sml_mod.sm_values
+#define sml_nvalues sml_mod.sm_nvalues
struct slap_mod_list *sml_next;
} Modifications;
#define ml_op ml_mod.mod_op
#define ml_type ml_mod.mod_type
#define ml_values ml_mod.mod_values
-#define ml_bvalues ml_mod.mod_bvalues
+#define ml_bvalues ml_mod.mod_values
} LDAPModList;
/*
#define SLAP_BFLAG_DYNAMIC 0x2000U
slap_mask_t be_flags;
#define SLAP_LASTMOD(be) (!((be)->be_flags & SLAP_BFLAG_NOLASTMOD))
+#define SLAP_GLUE_INSTANCE(be) ((be)->be_flags & SLAP_BFLAG_GLUE_INSTANCE)
+#define SLAP_GLUE_SUBORDINATE(be) \
+ ((be)->be_flags & SLAP_BFLAG_GLUE_SUBORDINATE)
+#define SLAP_GLUE_LINKED(be) ((be)->be_flags & SLAP_BFLAG_GLUE_LINKED)
#define SLAP_ALIASES(be) ((be)->be_flags & SLAP_BFLAG_ALIASES)
#define SLAP_REFERRALS(be) ((be)->be_flags & SLAP_BFLAG_REFERRALS)
#define SLAP_SUBENTRIES(be) ((be)->be_flags & SLAP_BFLAG_SUBENTRIES)
typedef int (BI_db_close) LDAP_P((Backend *bd));
typedef int (BI_db_destroy) LDAP_P((Backend *bd));
+#ifdef SLAP_OP_BLOCKS
+typedef struct req_bind_s {
+ int rb_method;
+ struct berval rb_cred;
+ struct berval rb_edn;
+} req_bind_s;
+
+typedef struct req_search_s {
+ int rs_scope;
+ int rs_deref;
+ int rs_slimit;
+ int rs_tlimit;
+ int rs_attrsonly;
+ AttributeName *rs_attrs;
+ Filter *rs_f;
+ struct berval rs_filterstr;
+} req_search_s;
+
+typedef struct req_compare_s {
+ AttributeAssertion *rs_ava;
+} req_compare_s;
+
+typedef struct req_modrdn_s {
+ struct berval rs_newrdn;
+ struct berval rs_nnewrdn;
+ struct berval rs_newSup;
+ struct berval rs_nnewSup;
+ int rs_deleteoldrdn;
+} req_modrdn_s;
+
+typedef struct req_add_s {
+ Entry *rs_e;
+} req_add_s;
+
+typedef struct req_abandon_s {
+ ber_int_t rs_msgid;
+} req_abandon_s;
+
+typedef struct req_extended_s {
+ struct berval rs_reqoid;
+ char *rs_rspoid;
+ struct berval *rs_rspdata;
+ LDAPControl **rs_rspctrls;
+ const char *rs_text;
+ BerVarray rs_refs;
+} req_extended_s;
+#endif /* SLAP_OP_BLOCKS */
+
typedef int (BI_op_bind) LDAP_P(( BackendDB *bd,
struct slap_conn *c, struct slap_op *o,
struct berval *dn, struct berval *ndn, int method,
unsigned long o_opid; /* id of this operation */
unsigned long o_connid; /* id of conn initiating this op */
struct slap_conn *o_conn; /* connection spawning this op */
+#ifdef SLAP_OP_BLOCKS
+ BackendDB *o_bd; /* backend DB processing this op */
+#endif
ber_int_t o_msgid; /* msgid of the request */
ber_int_t o_protocol; /* version of the LDAP protocol used by client */
ber_tag_t o_tag; /* tag of the request */
time_t o_time; /* time op was initiated */
+#ifdef SLAP_OP_BLOCKS
+ struct berval o_req_dn; /* DN of target of request */
+ struct berval o_req_ndn;
+
+ union o_req_u {
+ req_bind_s or_bind;
+ req_search_s or_search;
+ req_compare_s or_compare;
+ req_modrdn_s or_modrdn;
+ req_add_s or_add;
+ req_abandon_s or_abandon;
+ req_abandon_s or_cancel;
+ req_extended_s or_extended;
+ } o_request;
+
+/* short hands for union members */
+#define o_bind o_request.or_bind
+/* ... */
+
+/* short hands for inner request members */
+#define o_bind_edn o_bind.rb_edn
+/* ... */
+
+#else
char * o_extendedop; /* extended operation OID */
+#endif
ldap_pvt_thread_t o_tid; /* thread handling this op */
#define SLAP_CANCEL_DONE 0x03
char o_do_not_cache; /* don't cache from this op */
+ char o_is_auth_check; /* authorization in progress */
#define SLAP_NO_CONTROL 0
#define SLAP_NONCRITICAL_CONTROL 1
LDAP_LIST_ENTRY(slap_op) link;
#endif
-#ifdef LDAP_CONNECTIONLESS
- Sockaddr o_peeraddr; /* UDP peer address */
-#endif
AuthorizationInformation o_authz;
BerElement *o_ber; /* ber of the request */
LDAP_STAILQ_ENTRY(slap_op) o_next; /* next operation in list */
ValuesReturnFilter *vrFilter; /* Structure represents ValuesReturnFilter */
+#ifdef LDAP_CACHING
+ char o_caching_on;
+#endif /*LDAP_CACHING */
+
#ifdef LDAP_SLAPI
void *o_pb; /* NS-SLAPI plugin */
#endif
fprintf( stderr, (fmt), (connid), (opid), (arg1), (arg2), (arg3) );\
} while (0)
#define StatslogTest( level ) (ldap_debug & (level))
-#elif defined(LDAP_SYSLOG)
-#define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) \
- do { \
- if ( ldap_syslog & (level) ) \
- syslog( ldap_syslog_level, (fmt), (connid), (opid), (arg1), \
- (arg2), (arg3) ); \
- } while (0)
-#define StatslogTest( level ) (ldap_syslog & (level))
#else
#define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 )
#define StatslogTest( level ) (0)
#define SLAP_SEARCH_MAX_CTRLS 10
#endif
+#define SLAP_CTRL_FRONTEND 0x80000000U
+#define SLAP_CTRL_FRONTEND_SEARCH 0x01000000U /* for NOOP */
+
+#define SLAP_CTRL_OPFLAGS 0x0000FFFFU
+#define SLAP_CTRL_ABANDON 0x00000001U
+#define SLAP_CTRL_ADD 0x00002002U
+#define SLAP_CTRL_BIND 0x00000004U
+#define SLAP_CTRL_COMPARE 0x00001008U
+#define SLAP_CTRL_DELETE 0x00002010U
+#define SLAP_CTRL_MODIFY 0x00002020U
+#define SLAP_CTRL_RENAME 0x00002040U
+#define SLAP_CTRL_SEARCH 0x00001080U
+#define SLAP_CTRL_UNBIND 0x00000100U
+
+#define SLAP_CTRL_INTROGATE (SLAP_CTRL_COMPARE|SLAP_CTRL_SEARCH)
+#define SLAP_CTRL_UPDATE \
+ (SLAP_CTRL_ADD|SLAP_CTRL_DELETE|SLAP_CTRL_MODIFY|SLAP_CTRL_RENAME)
+#define SLAP_CTRL_ACCESS (SLAP_CTRL_INTROGATE|SLAP_CTRL_UPDATE)
+
+typedef int (SLAP_CTRL_PARSE_FN) LDAP_P((
+ Connection *conn,
+ Operation *op,
+ LDAPControl *ctrl,
+ const char **text ));
+
LDAP_END_DECL
#include "proto-slap.h"