s4-ldb: added an environment varibale LDB_WARN_UNINDEXED
[kai/samba.git] / source4 / lib / ldb / include / ldb.h
index 53ae0e4c1887aab3272d229802e4f08cc19281b5..1deed84550c8818f98bac75a143dd98e44812f5b 100644 (file)
@@ -109,6 +109,11 @@ struct ldb_dn;
 */
 #define LDB_FLAG_MOD_MASK  0x3
 
+/**
+  use this to extract the mod type from the operation
+ */
+#define LDB_FLAG_MOD_TYPE(flags) ((flags) & LDB_FLAG_MOD_MASK)
+
 /**
    Flag value used in ldap_modify() to indicate that attributes are
    being added.
@@ -133,6 +138,11 @@ struct ldb_dn;
 */
 #define LDB_FLAG_MOD_DELETE  3
 
+/**
+    flag bits on an element usable only by the internal implementation
+*/
+#define LDB_FLAG_INTERNAL_MASK 0xFFFFFFF0
+
 /**
   OID for logic AND comaprison.
 
@@ -304,7 +314,7 @@ struct ldb_parse_tree {
 };
 
 struct ldb_parse_tree *ldb_parse_tree(TALLOC_CTX *mem_ctx, const char *s);
-char *ldb_filter_from_tree(TALLOC_CTX *mem_ctx, struct ldb_parse_tree *tree);
+char *ldb_filter_from_tree(TALLOC_CTX *mem_ctx, const struct ldb_parse_tree *tree);
 
 /**
    Encode a binary blob
@@ -343,6 +353,10 @@ char *ldb_binary_encode_string(TALLOC_CTX *mem_ctx, const char *string);
 */
 typedef int (*ldb_attr_handler_t)(struct ldb_context *, TALLOC_CTX *mem_ctx, const struct ldb_val *, struct ldb_val *);
 typedef int (*ldb_attr_comparison_t)(struct ldb_context *, TALLOC_CTX *mem_ctx, const struct ldb_val *, const struct ldb_val *);
+struct ldb_schema_attribute;
+typedef int (*ldb_attr_operator_t)(struct ldb_context *, enum ldb_parse_op operation,
+                                  const struct ldb_schema_attribute *a,
+                                  const struct ldb_val *, const struct ldb_val *, bool *matched);
 
 /*
   attribute handler structure
@@ -360,6 +374,7 @@ struct ldb_schema_syntax {
        ldb_attr_handler_t ldif_write_fn;
        ldb_attr_handler_t canonicalise_fn;
        ldb_attr_comparison_t comparison_fn;
+       ldb_attr_operator_t operator_fn;
 };
 
 struct ldb_schema_attribute {
@@ -472,7 +487,7 @@ typedef int (*ldb_qsort_cmp_fn_t) (void *v1, void *v2, void *opaque);
   It can be used to access attribute that used to be stored in the sam 
   and that are now calculated.
 */
-#define LDB_CONTROL_BYPASSOPERATIONAL_OID "1.3.6.1.4.1.7165.4.3.13"
+#define LDB_CONTROL_BYPASS_OPERATIONAL_OID "1.3.6.1.4.1.7165.4.3.13"
 
 /**
   OID for recalculate SD control. This control force the
@@ -495,6 +510,12 @@ typedef int (*ldb_qsort_cmp_fn_t) (void *v1, void *v2, void *opaque);
 */
 #define LDB_CONTROL_AS_SYSTEM_OID "1.3.6.1.4.1.7165.4.3.7"
 
+/**
+   LDB_CONTROL_PROVISION_OID is used to skip some constraint checks. It's is
+   mainly thought to be used for the provisioning.
+*/
+#define LDB_CONTROL_PROVISION_OID "1.3.6.1.4.1.7165.4.3.16"
+
 /* AD controls */
 
 /**
@@ -639,11 +660,47 @@ typedef int (*ldb_qsort_cmp_fn_t) (void *v1, void *v2, void *opaque);
 /** 
     OID to allow the server to be more 'fast and loose' with the data being added.  
 
-    \sa 
-
+    \sa <a href="http://msdn.microsoft.com/en-us/library/aa366982(v=VS.85).aspx">Microsoft documentation of this OID</a>
 */
 #define LDB_CONTROL_SERVER_LAZY_COMMIT   "1.2.840.113556.1.4.619"
 
+/**
+   Control for RODC join -see [MS-ADTS] section 3.1.1.3.4.1.23
+
+   \sa <a href="">Microsoft documentation of this OID</a>
+*/
+#define LDB_CONTROL_RODC_DCPROMO_OID "1.2.840.113556.1.4.1341"
+
+/* Other standardised controls */
+
+/**
+   OID for the allowing client to request temporary relaxed
+   enforcement of constraints of the x.500 model.
+
+   Mainly used for the OpenLDAP backend.
+
+   \sa <a href="http://opends.dev.java.net/public/standards/draft-zeilenga-ldap-managedit.txt">draft managedit</a>.
+*/
+#define LDB_CONTROL_RELAX_OID "1.3.6.1.4.1.4203.666.5.12"
+
+/* Extended operations */
+
+/**
+   OID for LDAP Extended Operation SEQUENCE_NUMBER
+
+   This extended operation is used to retrieve the extended sequence number.
+*/
+#define LDB_EXTENDED_SEQUENCE_NUMBER   "1.3.6.1.4.1.7165.4.4.3"
+
+/**
+   OID for LDAP Extended Operation PASSWORD_CHANGE.
+
+   This Extended operation is used to allow user password changes by the user
+   itself.
+*/
+#define LDB_EXTENDED_PASSWORD_CHANGE_OID       "1.3.6.1.4.1.4203.1.11.1"
+
+
 /**
    OID for LDAP Extended Operation FAST_BIND
 
@@ -669,25 +726,6 @@ typedef int (*ldb_qsort_cmp_fn_t) (void *v1, void *v2, void *opaque);
 */
 #define LDB_EXTENDED_DYNAMIC_OID       "1.3.6.1.4.1.1466.101.119.1"
 
-/* Other standardised controls */
-
-/**
-   OID for the allowing client to request temporary relaxed
-   enforcement of constraints of the x.500 model.
-
-   \sa <a href="http://opends.dev.java.net/public/standards/draft-zeilenga-ldap-managedit.txt">draft managedit</a>.
-*/
-#define LDB_CONTROL_RELAX_OID "1.3.6.1.4.1.4203.666.5.12"
-
-/*
-   OID for LDAP Extended Operation PASSWORD_CHANGE.
-
-   This Extended operation is used to allow user password changes by the user
-   itself.
-*/
-#define LDB_EXTENDED_PASSWORD_CHANGE_OID       "1.3.6.1.4.1.4203.1.11.1"
-
-
 struct ldb_sd_flags_control {
        /*
         * request the owner    0x00000001
@@ -819,8 +857,6 @@ struct ldb_extended {
        void *data; /* NULL or a valid talloc pointer! talloc_get_type() will be used on it */
 };
 
-#define LDB_EXTENDED_SEQUENCE_NUMBER   "1.3.6.1.4.1.7165.4.4.3"
-
 enum ldb_sequence_type {
        LDB_SEQ_HIGHEST_SEQ,
        LDB_SEQ_HIGHEST_TIMESTAMP,
@@ -1201,6 +1237,18 @@ int ldb_build_rename_req(struct ldb_request **ret_req,
 */
 int ldb_request_add_control(struct ldb_request *req, const char *oid, bool critical, void *data);
 
+/**
+  replace a ldb_control in a ldb_request
+
+  \param req the request struct where to add the control
+  \param oid the object identifier of the control as string
+  \param critical whether the control should be critical or not
+  \param data a talloc pointer to the control specific data
+
+  \return result code (LDB_SUCCESS on success, or a failure code)
+*/
+int ldb_request_replace_control(struct ldb_request *req, const char *oid, bool critical, void *data);
+
 /**
    check if a control with the specified "oid" exist and return it 
   \param req the request struct where to add the control
@@ -2116,4 +2164,11 @@ struct ldb_dn *ldb_dn_binary_from_ldb_val(TALLOC_CTX *mem_ctx,
 int ldb_dn_get_binary(struct ldb_dn *dn, struct ldb_val *val);
 int ldb_dn_set_binary(struct ldb_dn *dn, struct ldb_val *val);
 
+/* debugging functions for ldb requests */
+void ldb_req_set_location(struct ldb_request *req, const char *location);
+const char *ldb_req_location(struct ldb_request *req);
+
+/* set the location marker on a request handle - used for debugging */
+#define LDB_REQ_SET_LOCATION(req) ldb_req_set_location(req, __location__)
+
 #endif