summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-09-21 17:24:43 -0700
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-10-02 12:44:58 +0200
commit642dd95d817521f75f193a1e594b4dacf04d7b26 (patch)
treeca7efa325c257233bf7e213b0e58ba9b705b22fc /source4/dsdb/samdb
parent61598258450589db4b42e3ef38453c37080c5265 (diff)
downloadsamba-642dd95d817521f75f193a1e594b4dacf04d7b26.tar.gz
samba-642dd95d817521f75f193a1e594b4dacf04d7b26.tar.bz2
samba-642dd95d817521f75f193a1e594b4dacf04d7b26.zip
s4:Ensure the selected RDN is the right one per the schema
The relative DN must be the one that the most specific structural objectclass specifies. Andrew Bartlett
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/objectclass.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c
index 3cf252c71a..ad14acbcf8 100644
--- a/source4/dsdb/samdb/ldb_modules/objectclass.c
+++ b/source4/dsdb/samdb/ldb_modules/objectclass.c
@@ -547,7 +547,13 @@ static int objectclass_do_add(struct oc_context *ac)
if (!current->next) {
struct ldb_message_element *el;
int32_t systemFlags = 0;
- DATA_BLOB *sd;
+ const char *rdn_name = ldb_dn_get_rdn_name(msg->dn);
+ if (ldb_attr_cmp(rdn_name, current->objectclass->rDNAttID) != 0) {
+ ldb_asprintf_errstring(ldb, "RDN %s is not correct for most specific structural objectclass %s, should be %s",
+ rdn_name, current->objectclass->lDAPDisplayName, current->objectclass->rDNAttID);
+ return LDB_ERR_NAMING_VIOLATION;
+ }
+
if (!ldb_msg_find_element(msg, "objectCategory")) {
value = talloc_strdup(msg, current->objectclass->defaultObjectCategory);
if (value == NULL) {