summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/dsdb/samdb/ldb_modules/objectclass.c11
-rw-r--r--source4/setup/provision_templates.ldif5
-rwxr-xr-xtestprogs/ejs/samba3sam.js6
3 files changed, 13 insertions, 9 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c
index ad11442035..259b963ce0 100644
--- a/source4/dsdb/samdb/ldb_modules/objectclass.c
+++ b/source4/dsdb/samdb/ldb_modules/objectclass.c
@@ -161,7 +161,7 @@ static int objectclass_sort(struct ldb_module *module,
/* Save the next pointer, as the DLIST_ macros will change poss_subclass->next */
next = poss_subclass->next;
- if (ldb_attr_cmp(class->subClassOf, current->objectclass) == 0) {
+ if (class && ldb_attr_cmp(class->subClassOf, current->objectclass) == 0) {
DLIST_REMOVE(unsorted, poss_subclass);
DLIST_ADD(subclass, poss_subclass);
@@ -199,6 +199,7 @@ static int objectclass_sort(struct ldb_module *module,
static int objectclass_add(struct ldb_module *module, struct ldb_request *req)
{
struct ldb_message_element *objectclass_element;
+ const struct dsdb_schema *schema = dsdb_get_schema(module->ldb);
struct class_list *sorted, *current;
struct ldb_request *down_req;
struct ldb_message *msg;
@@ -265,6 +266,14 @@ static int objectclass_add(struct ldb_module *module, struct ldb_request *req)
talloc_free(mem_ctx);
return ret;
}
+ /* Last one */
+ if (schema && !current->next && !ldb_msg_find_element(msg, "objectCategory")) {
+ const struct dsdb_class *objectclass
+ = dsdb_class_by_lDAPDisplayName(schema, current->objectclass);
+ if (objectclass) {
+ ldb_msg_add_string(msg, "objectCategory", objectclass->defaultObjectCategory);
+ }
+ }
}
talloc_free(mem_ctx);
diff --git a/source4/setup/provision_templates.ldif b/source4/setup/provision_templates.ldif
index 6e264be9d6..914582eaf0 100644
--- a/source4/setup/provision_templates.ldif
+++ b/source4/setup/provision_templates.ldif
@@ -4,7 +4,6 @@ objectClass: container
description: Container for SAM account templates
showInAdvancedViewOnly: TRUE
systemFlags: 2348810240
-objectCategory: CN=Container,${SCHEMADN}
isCriticalSystemObject: TRUE
###
@@ -30,7 +29,6 @@ primaryGroupID: 513
accountExpires: -1
logonCount: 0
sAMAccountType: 805306368
-objectCategory: CN=Person,${SCHEMADN}
dn: CN=TemplateComputer,CN=Templates
objectClass: top
@@ -50,7 +48,6 @@ primaryGroupID: 513
accountExpires: -1
logonCount: 0
sAMAccountType: 805306369
-objectCategory: CN=Computer,${SCHEMADN}
dn: CN=TemplateTrustingDomain,CN=Templates
objectClass: top
@@ -74,7 +71,6 @@ objectClass: Template
objectClass: groupTemplate
groupType: -2147483646
sAMAccountType: 268435456
-objectCategory: CN=Group,${SCHEMADN}
# Currently this isn't used, we don't have a way to detect it different from an incoming alias
#
@@ -92,7 +88,6 @@ objectClass: top
objectClass: Template
objectClass: foreignSecurityPrincipalTemplate
showInAdvancedViewOnly: TRUE
-objectCategory: CN=Foreign-Security-Principal,${SCHEMADN}
dn: CN=TemplateSecret,CN=Templates
objectClass: top
diff --git a/testprogs/ejs/samba3sam.js b/testprogs/ejs/samba3sam.js
index 5fa527a694..44a1f140b1 100755
--- a/testprogs/ejs/samba3sam.js
+++ b/testprogs/ejs/samba3sam.js
@@ -46,7 +46,7 @@ dn: @MAP=samba3sam
@TO: sambaDomainName=TESTS," + s3.BASEDN + "
dn: @MODULES
-@LIST: rootdse,paged_results,server_sort,extended_dn,asq,samldb,objectclass,password_hash,operational,objectguid,rdn_name,samba3sam,partition
+@LIST: rootdse,paged_results,server_sort,extended_dn,asq,samldb,password_hash,operational,objectguid,rdn_name,samba3sam,partition
dn: @PARTITION
partition: " + s4.BASEDN + ":" + s4.url + "
@@ -482,7 +482,7 @@ description: y
assert(res.msgs[0].dnsHostName == "x");
assert(res.msgs[0].lastLogon == "x");
assert(res.msgs[0].objectClass != undefined);
- assert(res.msgs[0].objectClass[3] == "user");
+ assert(res.msgs[0].objectClass[0] == "user");
assert(res.msgs[1].dn == s4.dn("cn=A"));
assert(res.msgs[1].dnsHostName == undefined);
assert(res.msgs[1].lastLogon == "x");
@@ -504,7 +504,7 @@ description: y
assert(res.msgs[1].dnsHostName == "x");
assert(res.msgs[1].lastLogon == "x");
assert(res.msgs[1].objectClass != undefined);
- assert(res.msgs[1].objectClass[3] == "user");
+ assert(res.msgs[1].objectClass[0] == "user");
assert(res.msgs[2].dn == s4.dn("cn=A"));
assert(res.msgs[2].dnsHostName == undefined);
assert(res.msgs[2].lastLogon == "x");