From 8516fad3b49f6ac87e9e17dc2929433116dcb04d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 4 Nov 2010 12:37:29 +0100 Subject: s4:dsdb/objectclass_attrs: not all objects have delete protected attributes as must contain Before we got the following error, while starting samba after a 'samba-tool vampire': Failed to store repsFrom - objectclass_attrs: delete protected attribute 'objectSid' on entry 'DC=ForestDnsZones,DC=alpha,DC=sz,DC=salzgitter-ag,DC=lab' missing! metze Autobuild-User: Stefan Metzmacher Autobuild-Date: Thu Nov 4 17:01:59 UTC 2010 on sn-devel-104 --- source4/dsdb/samdb/ldb_modules/objectclass_attrs.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source4/dsdb/samdb') diff --git a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c index ed193491d1..26eaaeaae5 100644 --- a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c +++ b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c @@ -43,6 +43,8 @@ struct oc_context { struct ldb_request *req; const struct dsdb_schema *schema; + struct ldb_message *msg; + struct ldb_reply *search_res; struct ldb_reply *mod_ares; }; @@ -107,6 +109,7 @@ static int attr_handler(struct oc_context *ac) if (msg == NULL) { return ldb_oom(ldb); } + ac->msg = msg; /* initialize syntax checking context */ dsdb_syntax_ctx_init(&syntax_ctx, ldb, ac->schema); @@ -275,6 +278,17 @@ static int attr_handler2(struct oc_context *ac) /* Check the delete-protected attributes list */ msg = ac->search_res->message; for (l = del_prot_attributes; *l != NULL; l++) { + struct ldb_message_element *el; + + el = ldb_msg_find_element(ac->msg, *l); + if (el == NULL) { + /* + * It was not specified in the add or modify, + * so it doesn't need to be in the stored record + */ + continue; + } + found = str_list_check_ci(must_contain, *l); if (!found) { found = str_list_check_ci(may_contain, *l); -- cgit