summaryrefslogtreecommitdiff
path: root/source4/dsdb/schema
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2010-08-18 03:06:53 +0300
committerKamen Mazdrashki <kamenim@samba.org>2010-08-19 03:34:03 +0300
commit35d886db176123b3ef3a0436463f59edcaed1322 (patch)
treebfd869d304f2373b291da8016f13919e6d0d0ea1 /source4/dsdb/schema
parentfffc98f33e333b8711da053e5cd5ddcc601cd275 (diff)
downloadsamba-35d886db176123b3ef3a0436463f59edcaed1322.tar.gz
samba-35d886db176123b3ef3a0436463f59edcaed1322.tar.bz2
samba-35d886db176123b3ef3a0436463f59edcaed1322.zip
s4-dsdb-syntax: ATTID should be msDs-IntId value for the attributeSchema object
in case object replicated is not in Schema NC and attributeSchema object has msDs-IntId attribute value set
Diffstat (limited to 'source4/dsdb/schema')
-rw-r--r--source4/dsdb/schema/schema.h3
-rw-r--r--source4/dsdb/schema/schema_syntax.c66
2 files changed, 55 insertions, 14 deletions
diff --git a/source4/dsdb/schema/schema.h b/source4/dsdb/schema/schema.h
index fc28fbf776..8c73fd56d4 100644
--- a/source4/dsdb/schema/schema.h
+++ b/source4/dsdb/schema/schema.h
@@ -31,6 +31,9 @@ struct dsdb_schema;
struct dsdb_syntax_ctx {
struct ldb_context *ldb;
const struct dsdb_schema *schema;
+
+ /* set when converting objects under Schema NC */
+ bool is_schema_nc;
};
diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c
index 59f9ff33ae..e7a3724d52 100644
--- a/source4/dsdb/schema/schema_syntax.c
+++ b/source4/dsdb/schema/schema_syntax.c
@@ -41,6 +41,30 @@ void dsdb_syntax_ctx_init(struct dsdb_syntax_ctx *ctx,
{
ctx->ldb = ldb;
ctx->schema = schema;
+
+ /*
+ * 'true' will keep current behavior,
+ * i.e. attributeID_id will be returned by default
+ */
+ ctx->is_schema_nc = true;
+}
+
+
+/**
+ * Returns ATTID for DRS attribute.
+ *
+ * ATTID depends on whether we are replicating
+ * Schema NC or msDs-IntId is set for schemaAttribute
+ * for the attribute.
+ */
+static uint32_t dsdb_attribute_get_attid(const struct dsdb_attribute *attr,
+ bool for_schema_nc)
+{
+ if (!for_schema_nc && attr->msDS_IntId) {
+ return attr->msDS_IntId;
+ }
+
+ return attr->attributeID_id;
}
@@ -150,7 +174,8 @@ static WERROR dsdb_syntax_BOOL_ldb_to_drsuapi(const struct dsdb_syntax_ctx *ctx,
return WERR_FOOBAR;
}
- out->attid = attr->attributeID_id;
+ out->attid = dsdb_attribute_get_attid(attr,
+ ctx->is_schema_nc);
out->value_ctr.num_values = in->num_values;
out->value_ctr.values = talloc_array(mem_ctx,
struct drsuapi_DsAttributeValue,
@@ -258,7 +283,8 @@ static WERROR dsdb_syntax_INT32_ldb_to_drsuapi(const struct dsdb_syntax_ctx *ctx
return WERR_FOOBAR;
}
- out->attid = attr->attributeID_id;
+ out->attid = dsdb_attribute_get_attid(attr,
+ ctx->is_schema_nc);
out->value_ctr.num_values = in->num_values;
out->value_ctr.values = talloc_array(mem_ctx,
struct drsuapi_DsAttributeValue,
@@ -384,7 +410,8 @@ static WERROR dsdb_syntax_INT64_ldb_to_drsuapi(const struct dsdb_syntax_ctx *ctx
return WERR_FOOBAR;
}
- out->attid = attr->attributeID_id;
+ out->attid = dsdb_attribute_get_attid(attr,
+ ctx->is_schema_nc);
out->value_ctr.num_values = in->num_values;
out->value_ctr.values = talloc_array(mem_ctx,
struct drsuapi_DsAttributeValue,
@@ -518,7 +545,8 @@ static WERROR dsdb_syntax_NTTIME_UTC_ldb_to_drsuapi(const struct dsdb_syntax_ctx
return WERR_FOOBAR;
}
- out->attid = attr->attributeID_id;
+ out->attid = dsdb_attribute_get_attid(attr,
+ ctx->is_schema_nc);
out->value_ctr.num_values = in->num_values;
out->value_ctr.values = talloc_array(mem_ctx,
struct drsuapi_DsAttributeValue,
@@ -649,7 +677,8 @@ static WERROR dsdb_syntax_NTTIME_ldb_to_drsuapi(const struct dsdb_syntax_ctx *ct
return WERR_FOOBAR;
}
- out->attid = attr->attributeID_id;
+ out->attid = dsdb_attribute_get_attid(attr,
+ ctx->is_schema_nc);
out->value_ctr.num_values = in->num_values;
out->value_ctr.values = talloc_array(mem_ctx,
struct drsuapi_DsAttributeValue,
@@ -763,7 +792,8 @@ static WERROR dsdb_syntax_DATA_BLOB_ldb_to_drsuapi(const struct dsdb_syntax_ctx
return WERR_FOOBAR;
}
- out->attid = attr->attributeID_id;
+ out->attid = dsdb_attribute_get_attid(attr,
+ ctx->is_schema_nc);
out->value_ctr.num_values = in->num_values;
out->value_ctr.values = talloc_array(mem_ctx,
struct drsuapi_DsAttributeValue,
@@ -1024,7 +1054,8 @@ static WERROR _dsdb_syntax_auto_OID_ldb_to_drsuapi(const struct dsdb_syntax_ctx
unsigned int i;
DATA_BLOB *blobs;
- out->attid= attr->attributeID_id;
+ out->attid= dsdb_attribute_get_attid(attr,
+ ctx->is_schema_nc);
out->value_ctr.num_values= in->num_values;
out->value_ctr.values= talloc_array(mem_ctx,
struct drsuapi_DsAttributeValue,
@@ -1077,7 +1108,8 @@ static WERROR _dsdb_syntax_OID_obj_ldb_to_drsuapi(const struct dsdb_syntax_ctx *
unsigned int i;
DATA_BLOB *blobs;
- out->attid= attr->attributeID_id;
+ out->attid= dsdb_attribute_get_attid(attr,
+ ctx->is_schema_nc);
out->value_ctr.num_values= in->num_values;
out->value_ctr.values= talloc_array(mem_ctx,
struct drsuapi_DsAttributeValue,
@@ -1118,7 +1150,8 @@ static WERROR _dsdb_syntax_OID_attr_ldb_to_drsuapi(const struct dsdb_syntax_ctx
unsigned int i;
DATA_BLOB *blobs;
- out->attid= attr->attributeID_id;
+ out->attid= dsdb_attribute_get_attid(attr,
+ ctx->is_schema_nc);
out->value_ctr.num_values= in->num_values;
out->value_ctr.values= talloc_array(mem_ctx,
struct drsuapi_DsAttributeValue,
@@ -1156,7 +1189,8 @@ static WERROR _dsdb_syntax_OID_oid_ldb_to_drsuapi(const struct dsdb_syntax_ctx *
unsigned int i;
DATA_BLOB *blobs;
- out->attid= attr->attributeID_id;
+ out->attid= dsdb_attribute_get_attid(attr,
+ ctx->is_schema_nc);
out->value_ctr.num_values= in->num_values;
out->value_ctr.values= talloc_array(mem_ctx,
struct drsuapi_DsAttributeValue,
@@ -1369,7 +1403,8 @@ static WERROR dsdb_syntax_UNICODE_ldb_to_drsuapi(const struct dsdb_syntax_ctx *c
return WERR_FOOBAR;
}
- out->attid = attr->attributeID_id;
+ out->attid = dsdb_attribute_get_attid(attr,
+ ctx->is_schema_nc);
out->value_ctr.num_values = in->num_values;
out->value_ctr.values = talloc_array(mem_ctx,
struct drsuapi_DsAttributeValue,
@@ -1581,7 +1616,8 @@ static WERROR dsdb_syntax_DN_ldb_to_drsuapi(const struct dsdb_syntax_ctx *ctx,
return WERR_FOOBAR;
}
- out->attid = attr->attributeID_id;
+ out->attid = dsdb_attribute_get_attid(attr,
+ ctx->is_schema_nc);
out->value_ctr.num_values = in->num_values;
out->value_ctr.values = talloc_array(mem_ctx,
struct drsuapi_DsAttributeValue,
@@ -1886,7 +1922,8 @@ static WERROR dsdb_syntax_DN_BINARY_ldb_to_drsuapi(const struct dsdb_syntax_ctx
return WERR_FOOBAR;
}
- out->attid = attr->attributeID_id;
+ out->attid = dsdb_attribute_get_attid(attr,
+ ctx->is_schema_nc);
out->value_ctr.num_values = in->num_values;
out->value_ctr.values = talloc_array(mem_ctx,
struct drsuapi_DsAttributeValue,
@@ -2128,7 +2165,8 @@ static WERROR dsdb_syntax_PRESENTATION_ADDRESS_ldb_to_drsuapi(const struct dsdb_
return WERR_FOOBAR;
}
- out->attid = attr->attributeID_id;
+ out->attid = dsdb_attribute_get_attid(attr,
+ ctx->is_schema_nc);
out->value_ctr.num_values = in->num_values;
out->value_ctr.values = talloc_array(mem_ctx,
struct drsuapi_DsAttributeValue,