From: Andrew Bartlett Date: Thu, 26 May 2016 22:28:26 +0000 (+1200) Subject: dsdb: Allow "cn" to be missing on schema import X-Git-Tag: tdb-1.3.10~988 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=de8fb1f1edb7de8fca5bff5a5a2818f15de6fff2;p=thirdparty%2Fsamba.git dsdb: Allow "cn" to be missing on schema import This avoids a segfault when we remove the duplication of this value from dsdb_convert_object_ex() Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam --- diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index d0388079241..2e6177346c7 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -623,6 +623,16 @@ WERROR dsdb_attribute_from_ldb(const struct dsdb_schema *schema, } GET_STRING_LDB(msg, "cn", attr, attr, cn, false); + + /* + * This allows for the fact that the CN attribute is not + * replicated over DRS, it is only replicated under the alias + * 'name'. + */ + if (attr->cn == NULL) { + GET_STRING_LDB(msg, "name", attr, attr, cn, true); + } + GET_STRING_LDB(msg, "lDAPDisplayName", attr, attr, lDAPDisplayName, true); GET_STRING_LDB(msg, "attributeID", attr, attr, attributeID_oid, true); if (!schema->prefixmap || schema->prefixmap->length == 0) { @@ -767,6 +777,16 @@ WERROR dsdb_set_class_from_ldb_dups(struct dsdb_schema *schema, return WERR_NOMEM; } GET_STRING_LDB(msg, "cn", obj, obj, cn, false); + + /* + * This allows for the fact that the CN attribute is not + * replicated over DRS, it is only replicated under the alias + * 'name'. + */ + if (obj->cn == NULL) { + GET_STRING_LDB(msg, "name", obj, obj, cn, true); + } + GET_STRING_LDB(msg, "lDAPDisplayName", obj, obj, lDAPDisplayName, true); GET_STRING_LDB(msg, "governsID", obj, obj, governsID_oid, true); if (!schema->prefixmap || schema->prefixmap->length == 0) {