Imported Upstream version 4.0.0+dfsg1
[abartlet/samba-debian.git] / lib / ldb / include / ldb.h
similarity index 97%
rename from source4/lib/ldb/include/ldb.h
rename to lib/ldb/include/ldb.h
index 49f8222d49c4cac172ee04905783b7ab09214de2..b60fc9b5ebb94096fa823fe8981aa57998a27bea 100644 (file)
@@ -183,7 +183,8 @@ enum ldb_changetype {
        LDB_CHANGETYPE_NONE=0,
        LDB_CHANGETYPE_ADD,
        LDB_CHANGETYPE_DELETE,
-       LDB_CHANGETYPE_MODIFY
+       LDB_CHANGETYPE_MODIFY,
+       LDB_CHANGETYPE_MODRDN
 };
 
 /**
@@ -304,7 +305,7 @@ struct ldb_parse_tree {
                struct {
                        const char *attr;
                        int dnAttributes;
-                       char *rule_id;
+                       const char *rule_id;
                        struct ldb_val value;
                } extended;
                struct {
@@ -474,6 +475,7 @@ const struct ldb_dn_extended_syntax *ldb_dn_extended_syntax_by_name(struct ldb_c
   See <a href="http://www.ietf.org/rfc/rfc2252.txt">RFC 2252</a>, Section 4.3.2 
 */
 #define LDB_SYNTAX_UTC_TIME             "1.3.6.1.4.1.1466.115.121.1.53"
+#define LDB_SYNTAX_GENERALIZED_TIME     "1.3.6.1.4.1.1466.115.121.1.24"
 
 #define LDB_SYNTAX_OBJECTCLASS          "LDB_SYNTAX_OBJECTCLASS"
 
@@ -532,7 +534,7 @@ typedef int (*ldb_qsort_cmp_fn_t) (void *v1, void *v2, void *opaque);
    \sa <a href="http://www.ietf.org/rfc/rfc2696.txt">RFC 2696</a>.
 */
 #define LDB_CONTROL_PAGED_RESULTS_OID  "1.2.840.113556.1.4.319"
-#define LDB_CONTROL_PAGED_RESULTS_NAME "paged_result"
+#define LDB_CONTROL_PAGED_RESULTS_NAME "paged_results"
 
 /**
    OID for specifying the returned elements of the ntSecurityDescriptor
@@ -707,6 +709,15 @@ typedef int (*ldb_qsort_cmp_fn_t) (void *v1, void *v2, void *opaque);
 #define LDB_CONTROL_RELAX_OID "1.3.6.1.4.1.4203.666.5.12"
 #define LDB_CONTROL_RELAX_NAME "relax"
 
+/**
+   OID for the allowing some kind of relax check for attributes with DNs
+
+
+   \sa 3.1.1.3.4.1.16 in [MS-ADTS].pdf
+*/
+#define LDB_CONTROL_VERIFY_NAME_OID "1.2.840.113556.1.4.1338"
+#define LDB_CONTROL_VERIFY_NAME_NAME   "verify_name"
+
 /* Extended operations */
 
 /**
@@ -842,6 +853,12 @@ struct ldb_vlv_resp_control {
        char *contextId;
 };
 
+struct ldb_verify_name_control {
+       int flags;
+       size_t gc_len;
+       char *gc;
+};
+
 struct ldb_control {
        const char *oid;
        int critical;
@@ -1424,8 +1441,6 @@ int ldb_build_extended_req(struct ldb_request **ret_req,
 /**
   call an extended operation
 
-  This function deletes a record from the database.
-
   \param ldb the context associated with the database (from ldb_init())
   \param oid the OID of the extended operation.
   \param data a void pointer a the extended operation specific parameters,
@@ -1620,6 +1635,31 @@ struct ldb_ldif *ldb_ldif_read_file(struct ldb_context *ldb, FILE *f);
 */
 struct ldb_ldif *ldb_ldif_read_string(struct ldb_context *ldb, const char **s);
 
+/**
+   Parse a modrdn LDIF message from a struct ldb_message
+
+   \param ldb the ldb context (from ldb_init())
+   \param ldif the preparsed LDIF chunk (from ldb_ldif_read())
+
+   \param mem_ctx the memory context that's used for return values
+
+   \param olddn the old dn as struct ldb_dn, if not needed pass NULL
+   \param newrdn the new rdn as struct ldb_dn, if not needed pass NULL
+   \param deleteoldrdn the deleteoldrdn value as bool, if not needed pass NULL
+   \param newsuperior the newsuperior dn as struct ldb_dn, if not needed pass NULL
+                      *newsuperior can be NULL as it is optional in the LDIF
+   \param newdn the full constructed new dn as struct ldb_dn, if not needed pass NULL
+
+*/
+int ldb_ldif_parse_modrdn(struct ldb_context *ldb,
+                         const struct ldb_ldif *ldif,
+                         TALLOC_CTX *mem_ctx,
+                         struct ldb_dn **olddn,
+                         struct ldb_dn **newrdn,
+                         bool *deleteoldrdn,
+                         struct ldb_dn **newsuperior,
+                         struct ldb_dn **newdn);
+
 /**
    Write an LDIF message to a file
 
@@ -2225,4 +2265,9 @@ const char *ldb_req_location(struct ldb_request *req);
  */
 bool ldb_dn_minimise(struct ldb_dn *dn);
 
+/*
+  compare a ldb_val to a string
+*/
+int ldb_val_string_cmp(const struct ldb_val *v, const char *str);
+
 #endif