s4:dsdb/schema: add "dsdb:schema update allowed" option to enable schema updates
[samba.git] / source4 / dsdb / schema / schema.h
index 9762a2ba988665702a46d3a8c2dc0b52b39bcaf4..b1ae76882ab035733c62da1bae7b90ae31a9876a 100644 (file)
 
 #include "prefixmap.h"
 
+enum dsdb_dn_format {
+       DSDB_NORMAL_DN,
+       DSDB_BINARY_DN,
+       DSDB_STRING_DN,
+       DSDB_INVALID_DN
+};
+
+
 struct dsdb_attribute;
 struct dsdb_class;
 struct dsdb_schema;
+struct dsdb_dn;
+
+struct dsdb_syntax_ctx {
+       struct ldb_context *ldb;
+       const struct dsdb_schema *schema;
+
+       /* set when converting objects under Schema NC */
+       bool is_schema_nc;
+
+       /* remote prefixMap to be used for drsuapi_to_ldb conversions */
+       const struct dsdb_schema_prefixmap *pfm_remote;
+};
+
 
 struct dsdb_syntax {
        const char *name;
@@ -39,22 +60,20 @@ struct dsdb_syntax {
        const char *comment;
        const char *ldb_syntax;
 
-       WERROR (*drsuapi_to_ldb)(struct ldb_context *ldb, 
-                                const struct dsdb_schema *schema,
+       WERROR (*drsuapi_to_ldb)(const struct dsdb_syntax_ctx *ctx,
                                 const struct dsdb_attribute *attr,
                                 const struct drsuapi_DsReplicaAttribute *in,
                                 TALLOC_CTX *mem_ctx,
                                 struct ldb_message_element *out);
-       WERROR (*ldb_to_drsuapi)(struct ldb_context *ldb, 
-                                const struct dsdb_schema *schema,
+       WERROR (*ldb_to_drsuapi)(const struct dsdb_syntax_ctx *ctx,
                                 const struct dsdb_attribute *attr,
                                 const struct ldb_message_element *in,
                                 TALLOC_CTX *mem_ctx,
                                 struct drsuapi_DsReplicaAttribute *out);
-       WERROR (*validate_ldb)(struct ldb_context *ldb,
-                              const struct dsdb_schema *schema,
+       WERROR (*validate_ldb)(const struct dsdb_syntax_ctx *ctx,
                               const struct dsdb_attribute *attr,
                               const struct ldb_message_element *in);
+       bool auto_normalise;
 };
 
 struct dsdb_attribute {
@@ -97,6 +116,9 @@ struct dsdb_attribute {
        bool isDefunct;
        bool systemOnly;
 
+       bool one_way_link;
+       enum dsdb_dn_format dn_format;
+
        /* internal stuff */
        const struct dsdb_syntax *syntax;
        const struct ldb_schema_attribute *ldb_schema_attribute;
@@ -133,6 +155,7 @@ struct dsdb_class {
        const char *defaultSecurityDescriptor;
 
        uint32_t schemaFlagsEx;
+       uint32_t systemFlags;
        struct ldb_val msDs_Schema_Extensions;
 
        bool showInAdvancedViewOnly;
@@ -209,9 +232,12 @@ struct dsdb_schema {
        struct dsdb_attribute **attributes_by_attributeID_id;
        struct dsdb_attribute **attributes_by_attributeID_oid;
        struct dsdb_attribute **attributes_by_linkID;
+       uint32_t num_int_id_attr;
+       struct dsdb_attribute **attributes_by_msDS_IntId;
 
        struct {
                bool we_are_master;
+               bool update_allowed;
                struct ldb_dn *master_dn;
        } fsmo;
 
@@ -221,6 +247,9 @@ struct dsdb_schema {
        bool refresh_in_progress;
        /* an 'opaque' sequence number that the reload function may also wish to use */
        uint64_t reload_seq_number;
+
+       /* Should the syntax handlers in this case handle all incoming OIDs automatically, assigning them as an OID if no text name is known? */
+       bool relax_OID_conversions;
 };
 
 enum dsdb_attr_list_query {