adding subClassOf if missing

Michael Adam obnox at samba.org
Wed Apr 4 18:06:48 MDT 2012


Hi Matthieu,

thanks for taking this further and for your patch.
I tried it and I got further with it:

The "setup.com /prepareschema" command from exchange 2010 that I ran
now passed the 75% where it originally failed and then slowed
down at 98 or 99%, proceeding very very slowly, so that I let it
run and went to bed... :) I can hence not tell when it finally
failed again, but the error I am hitting now is this:

The client sends an ldap modify request to "<ROOT>" with
empty object and "schemaUpgradeInProgress" set to "1".
This fails with:
"unwillingToPerform (00002035: rootdse_modify: unknown attribute to change!)"

I can show you the capture.

The same form of request works for schemaUpdateNow, which is
defined in the samba code, while I could not find anything like
schemaUpgradeNow.

Cheers - Michael

Matthieu Patou wrote:
> On 04/03/2012 01:11 AM, Andrew Bartlett wrote:
> >On Tue, 2012-04-03 at 00:47 -0700, Matthieu Patou wrote:
> >>Hello Micheal,
> >>
> >>Find attached a patch for this, I think it's incomplete as I should
> >>check if the objectclass of the object is classSchema but for a quick
> >>test it should be sufficient.
> >>
> >>Although not documented most of the other missing attributes should
> >>already be generated by samba let me know how your installation goes on.
> >This seems the wrong module to add this kind of thing to.  The samldb
> >module already handles some things like this, and this should also be
> >handled there.
> Yeah maybe it's was more for helping Micheal to see if he can install 
> exchange on top of Samba.
> >Also, we need tests for this: ldap.py I think is the right place for
> >them.
> Yep, but before this I wait for dochelp to provide us some hints.
> >Finally, the guru here is Matthias, who has tirelessly worked on so much
> >of this code, and can be of great assistance in handling the
> >auto-defaulted attributes.
> By the way the patch was not working correctly :-), the newly attached 
> seems to work better.
> >Andrew Bartlett
> Matthieu.
> 
> 
> -- 
> Matthieu Patou
> Samba Team
> http://samba.org
> 

> diff --git a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
> index d45c46f..5d1d819 100644
> --- a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
> +++ b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
> @@ -169,6 +169,7 @@ static int attr_handler(struct oc_context *ac)
>  	int ret;
>  	WERROR werr;
>  	struct dsdb_syntax_ctx syntax_ctx;
> +	struct ldb_message_element *oc_element;
>  
>  	ldb = ldb_module_get_ctx(ac->module);
>  
> @@ -258,6 +259,24 @@ static int attr_handler(struct oc_context *ac)
>  		msg->elements[i].name = attr->lDAPDisplayName;
>  	}
>  
> +
> +	oc_element = ldb_msg_find_element(msg, "objectClass");
> +	if (oc_element != NULL) {
> +		for (i = 0; i < oc_element->num_values; i++) {
> +			if (strcmp((char *)oc_element->values[i].data, "classSchema") == 0) {
> +				if (ldb_msg_find_attr_as_string(msg, "subClassOf", NULL) == NULL) {
> +					ret = ldb_msg_add_string(msg, "subClassOf", "top");
> +					if (ret != LDB_SUCCESS) {
> +						DEBUG(0, ("Miaou\n"));
> +						return ldb_operr(ldb);
> +					}
> +				}
> +				break;
> +			}
> +		}
> +	}
> +
> +
>  no_attribute:
>  	if (ac->req->operation == LDB_ADD) {
>  		ret = ldb_build_add_req(&child_req, ldb, ac,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 206 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20120405/36226e9a/attachment.pgp>


More information about the samba-technical mailing list