summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-01-14 15:22:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:40:49 -0500
commit9f876c9fae1078b71138f6b5bc8b2152b0c64d7b (patch)
tree2f71f73d9bee1a391c32996cd986e1336e0744e7 /source4/dsdb
parent15f6cf2449898432112140aea9f3f9445ca2ea68 (diff)
downloadsamba-9f876c9fae1078b71138f6b5bc8b2152b0c64d7b.tar.gz
samba-9f876c9fae1078b71138f6b5bc8b2152b0c64d7b.tar.bz2
samba-9f876c9fae1078b71138f6b5bc8b2152b0c64d7b.zip
r20766: when creating dsdb_attribute or dsdb_class structs from ldb, try the oid mapping
if the dsdb_schema has mappings attached metze (This used to be commit 6ecd1342ded63b99b51250714127344a5304c47f)
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/schema/schema_init.c56
1 files changed, 48 insertions, 8 deletions
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index ba2db95ae1..4662f5fe79 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -361,13 +361,28 @@ WERROR dsdb_map_int2oid(const struct dsdb_schema *schema, uint32_t in, TALLOC_CT
}\
} while (0)
-WERROR dsdb_attribute_from_ldb(struct ldb_message *msg, TALLOC_CTX *mem_ctx, struct dsdb_attribute *attr)
+WERROR dsdb_attribute_from_ldb(const struct dsdb_schema *schema,
+ struct ldb_message *msg,
+ TALLOC_CTX *mem_ctx,
+ struct dsdb_attribute *attr)
{
+ WERROR status;
+
GET_STRING_LDB(msg, "cn", mem_ctx, attr, cn, True);
GET_STRING_LDB(msg, "lDAPDisplayName", mem_ctx, attr, lDAPDisplayName, True);
GET_STRING_LDB(msg, "attributeID", mem_ctx, attr, attributeID_oid, True);
- /* set an invalid value */
- attr->attributeID_id = 0xFFFFFFFF;
+ if (schema->num_prefixes == 0) {
+ /* set an invalid value */
+ attr->attributeID_id = 0xFFFFFFFF;
+ } else {
+ status = dsdb_map_oid2int(schema, attr->attributeID_oid, &attr->attributeID_id);
+ if (!W_ERROR_IS_OK(status)) {
+ DEBUG(0,("%s: '%s': unable to map attributeID %s: %s\n",
+ __location__, attr->lDAPDisplayName, attr->attributeID_oid,
+ win_errstr(status)));
+ return status;
+ }
+ }
GET_GUID_LDB(msg, "schemaIDGUID", attr, schemaIDGUID);
GET_UINT32_LDB(msg, "mAPIID", attr, mAPIID);
@@ -379,8 +394,18 @@ WERROR dsdb_attribute_from_ldb(struct ldb_message *msg, TALLOC_CTX *mem_ctx, str
GET_UINT32_LDB(msg, "linkID", attr, linkID);
GET_STRING_LDB(msg, "attributeSyntax", mem_ctx, attr, attributeSyntax_oid, True);
- /* set an invalid value */
- attr->attributeSyntax_id = 0xFFFFFFFF;
+ if (schema->num_prefixes == 0) {
+ /* set an invalid value */
+ attr->attributeSyntax_id = 0xFFFFFFFF;
+ } else {
+ status = dsdb_map_oid2int(schema, attr->attributeSyntax_oid, &attr->attributeSyntax_id);
+ if (!W_ERROR_IS_OK(status)) {
+ DEBUG(0,("%s: '%s': unable to map attributeSyntax_ %s: %s\n",
+ __location__, attr->lDAPDisplayName, attr->attributeSyntax_oid,
+ win_errstr(status)));
+ return status;
+ }
+ }
GET_UINT32_LDB(msg, "oMSyntax", attr, oMSyntax);
GET_BLOB_LDB(msg, "oMObjectClass", mem_ctx, attr, oMObjectClass);
@@ -408,13 +433,28 @@ WERROR dsdb_attribute_from_ldb(struct ldb_message *msg, TALLOC_CTX *mem_ctx, str
return WERR_OK;
}
-WERROR dsdb_class_from_ldb(struct ldb_message *msg, TALLOC_CTX *mem_ctx, struct dsdb_class *obj)
+WERROR dsdb_class_from_ldb(const struct dsdb_schema *schema,
+ struct ldb_message *msg,
+ TALLOC_CTX *mem_ctx,
+ struct dsdb_class *obj)
{
+ WERROR status;
+
GET_STRING_LDB(msg, "cn", mem_ctx, obj, cn, True);
GET_STRING_LDB(msg, "lDAPDisplayName", mem_ctx, obj, lDAPDisplayName, True);
GET_STRING_LDB(msg, "governsID", mem_ctx, obj, governsID_oid, True);
- /* set an invalid value */
- obj->governsID_id = 0xFFFFFFFF;
+ if (schema->num_prefixes == 0) {
+ /* set an invalid value */
+ obj->governsID_id = 0xFFFFFFFF;
+ } else {
+ status = dsdb_map_oid2int(schema, obj->governsID_oid, &obj->governsID_id);
+ if (!W_ERROR_IS_OK(status)) {
+ DEBUG(0,("%s: '%s': unable to map governsID %s: %s\n",
+ __location__, obj->lDAPDisplayName, obj->governsID_oid,
+ win_errstr(status)));
+ return status;
+ }
+ }
GET_GUID_LDB(msg, "schemaIDGUID", obj, schemaIDGUID);
GET_UINT32_LDB(msg, "objectClassCategory", obj, objectClassCategory);