X-Git-Url: http://git.samba.org/samba.git/?a=blobdiff_plain;f=source4%2Flib%2Fldb%2Finclude%2Fldb.h;h=d1e29010b1d7ff9f43ead4299158829c0608d4f3;hb=f9a6ff482c8d03e7e46fd6925d58214b7a097e02;hp=065aa31682d42f32456872d7f956710dd7f3284b;hpb=e5a9469a88e039b558e13273ae637f874bbb42b3;p=samba.git
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index 065aa31682d..d1e29010b1d 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -86,6 +86,14 @@ struct ldb_val {
#ifndef PRINTF_ATTRIBUTE
#define PRINTF_ATTRIBUTE(a,b)
#endif
+
+#ifndef _DEPRECATED_
+#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )
+#define _DEPRECATED_ __attribute__ ((deprecated))
+#else
+#define _DEPRECATED_
+#endif
+#endif
/*! \endcond */
/* opaque ldb_dn structures, see ldb_dn.c for internals */
@@ -101,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.
@@ -125,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.
@@ -335,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
@@ -352,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 {
@@ -464,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
@@ -487,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 */
/**
@@ -631,11 +660,37 @@ 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 Microsoft documentation of this OID
*/
#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 Microsoft documentation of this OID
+*/
+#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.
+
+ \sa draft managedit.
+*/
+#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"
+
+/* Extended operations */
+
/**
OID for LDAP Extended Operation FAST_BIND
@@ -661,25 +716,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 draft managedit.
-*/
-#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
@@ -1193,6 +1229,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
@@ -1633,7 +1681,7 @@ char *ldb_dn_alloc_linearized(TALLOC_CTX *mem_ctx, struct ldb_dn *dn);
\param dn The DN to linearize
\param mode Style of extended DN to return (0 is HEX representation of binary form, 1 is a string form)
*/
-char *ldb_dn_get_extended_linearized(void *mem_ctx, struct ldb_dn *dn, int mode);
+char *ldb_dn_get_extended_linearized(TALLOC_CTX *mem_ctx, struct ldb_dn *dn, int mode);
const struct ldb_val *ldb_dn_get_extended_component(struct ldb_dn *dn, const char *name);
int ldb_dn_set_extended_component(struct ldb_dn *dn, const char *name, const struct ldb_val *val);
void ldb_dn_extended_filter(struct ldb_dn *dn, const char * const *accept);
@@ -1673,7 +1721,7 @@ struct ldb_dn *ldb_dn_new_fmt(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, cons
\note The DN will not be parsed at this time. Use ldb_dn_validate to tell if the DN is syntacticly correct
*/
-struct ldb_dn *ldb_dn_from_ldb_val(void *mem_ctx, struct ldb_context *ldb, const struct ldb_val *strdn);
+struct ldb_dn *ldb_dn_from_ldb_val(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, const struct ldb_val *strdn);
/**
Determine if this DN is syntactically valid
@@ -1851,8 +1899,17 @@ struct ldb_message *ldb_msg_copy_shallow(TALLOC_CTX *mem_ctx,
struct ldb_message *ldb_msg_copy(TALLOC_CTX *mem_ctx,
const struct ldb_message *msg);
+/*
+ * ldb_msg_canonicalize() is now depreciated
+ * Please use ldb_msg_normalize() instead
+ *
+ * NOTE: Returned ldb_message object is allocated
+ * into *ldb's context. Callers are recommended
+ * to steal the returned object into a TALLOC_CTX
+ * with short lifetime.
+ */
struct ldb_message *ldb_msg_canonicalize(struct ldb_context *ldb,
- const struct ldb_message *msg);
+ const struct ldb_message *msg) _DEPRECATED_;
int ldb_msg_normalize(struct ldb_context *ldb,
TALLOC_CTX *mem_ctx,
@@ -1860,9 +1917,18 @@ int ldb_msg_normalize(struct ldb_context *ldb,
struct ldb_message **_msg_out);
+/*
+ * ldb_msg_diff() is now depreciated
+ * Please use ldb_msg_difference() instead
+ *
+ * NOTE: Returned ldb_message object is allocated
+ * into *ldb's context. Callers are recommended
+ * to steal the returned object into a TALLOC_CTX
+ * with short lifetime.
+ */
struct ldb_message *ldb_msg_diff(struct ldb_context *ldb,
struct ldb_message *msg1,
- struct ldb_message *msg2);
+ struct ldb_message *msg2) _DEPRECATED_;
/**
* return a ldb_message representing the differences between msg1 and msg2.
@@ -2083,11 +2149,18 @@ unsigned int ldb_get_flags(struct ldb_context *ldb);
void ldb_set_flags(struct ldb_context *ldb, unsigned flags);
-struct ldb_dn *ldb_dn_binary_from_ldb_val(void *mem_ctx,
+struct ldb_dn *ldb_dn_binary_from_ldb_val(TALLOC_CTX *mem_ctx,
struct ldb_context *ldb,
const struct ldb_val *strdn);
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