+ LDAP_SLIST_ENTRY(slap_control) sc_next;
+};
+
+static LDAP_SLIST_HEAD(ControlsList, slap_control) controls_list
+ = LDAP_SLIST_HEAD_INITIALIZER(&controls_list);
+
+/*
+ * all known request control OIDs should be added to this list
+ */
+/*
+ * NOTE: initialize num_known_controls to 1 so that cid = 0 always
+ * addresses an undefined control; this allows to safely test for
+ * well known controls even if they are not registered, e.g. if
+ * they get moved to modules. An example is sc_LDAPsync, which
+ * is implemented in the syncprov overlay and thus, if configured
+ * as dynamic module, may not be registered. One side effect is that
+ * slap_known_controls[0] == NULL, so it should always be used
+ * starting from 1.
+ * FIXME: should we define the "undefined control" oid?
+ */
+char *slap_known_controls[SLAP_MAX_CIDS+1];
+static int num_known_controls = 1;
+
+static char *proxy_authz_extops[] = {
+ LDAP_EXOP_MODIFY_PASSWD,
+ LDAP_EXOP_X_WHO_AM_I,
+ NULL
+};
+
+static struct slap_control control_defs[] = {
+ { LDAP_CONTROL_ASSERT,
+ (int)offsetof(struct slap_control_ids, sc_assert),
+ SLAP_CTRL_HIDE|SLAP_CTRL_ACCESS, NULL,
+ parseAssert, LDAP_SLIST_ENTRY_INITIALIZER(next) },
+ { LDAP_CONTROL_PRE_READ,
+ (int)offsetof(struct slap_control_ids, sc_preRead),
+ SLAP_CTRL_HIDE|SLAP_CTRL_DELETE|SLAP_CTRL_MODIFY|SLAP_CTRL_RENAME, NULL,
+ parsePreRead, LDAP_SLIST_ENTRY_INITIALIZER(next) },
+ { LDAP_CONTROL_POST_READ,
+ (int)offsetof(struct slap_control_ids, sc_postRead),
+ SLAP_CTRL_HIDE|SLAP_CTRL_ADD|SLAP_CTRL_MODIFY|SLAP_CTRL_RENAME, NULL,
+ parsePostRead, LDAP_SLIST_ENTRY_INITIALIZER(next) },
+ { LDAP_CONTROL_VALUESRETURNFILTER,
+ (int)offsetof(struct slap_control_ids, sc_valuesReturnFilter),
+ SLAP_CTRL_GLOBAL|SLAP_CTRL_SEARCH, NULL,
+ parseValuesReturnFilter, LDAP_SLIST_ENTRY_INITIALIZER(next) },
+ { LDAP_CONTROL_PAGEDRESULTS,
+ (int)offsetof(struct slap_control_ids, sc_pagedResults),
+ SLAP_CTRL_SEARCH, NULL,
+ parsePagedResults, LDAP_SLIST_ENTRY_INITIALIZER(next) },
+#ifdef LDAP_DEVEL
+ { LDAP_CONTROL_SORTREQUEST,
+ (int)offsetof(struct slap_control_ids, sc_sortedResults),
+ SLAP_CTRL_GLOBAL|SLAP_CTRL_SEARCH|SLAP_CTRL_HIDE, NULL,
+ parseSortedResults, LDAP_SLIST_ENTRY_INITIALIZER(next) },
+#endif
+#ifdef LDAP_CONTROL_X_DOMAIN_SCOPE
+ { LDAP_CONTROL_X_DOMAIN_SCOPE,
+ (int)offsetof(struct slap_control_ids, sc_domainScope),
+ SLAP_CTRL_GLOBAL|SLAP_CTRL_SEARCH, NULL,
+ parseDomainScope, LDAP_SLIST_ENTRY_INITIALIZER(next) },
+#endif
+#ifdef LDAP_CONTROL_X_PERMISSIVE_MODIFY
+ { LDAP_CONTROL_X_PERMISSIVE_MODIFY,
+ (int)offsetof(struct slap_control_ids, sc_permissiveModify),
+ SLAP_CTRL_MODIFY, NULL,
+ parsePermissiveModify, LDAP_SLIST_ENTRY_INITIALIZER(next) },
+#endif
+#ifdef SLAP_CONTROL_X_TREE_DELETE
+ { LDAP_CONTROL_X_TREE_DELETE,
+ (int)offsetof(struct slap_control_ids, sc_treeDelete),
+ SLAP_CTRL_HIDE|SLAP_CTRL_DELETE, NULL,
+ parseTreeDelete, LDAP_SLIST_ENTRY_INITIALIZER(next) },
+#endif
+#ifdef LDAP_CONTROL_X_SEARCH_OPTIONS
+ { LDAP_CONTROL_X_SEARCH_OPTIONS,
+ (int)offsetof(struct slap_control_ids, sc_searchOptions),
+ SLAP_CTRL_GLOBAL|SLAP_CTRL_SEARCH, NULL,
+ parseSearchOptions, LDAP_SLIST_ENTRY_INITIALIZER(next) },
+#endif