[SAMBA4] New objectclass module

simo idra at samba.org
Fri Jun 2 22:10:19 GMT 2006


On Sat, 2006-06-03 at 07:40 +1000, Andrew Bartlett wrote:
> On Fri, 2006-06-02 at 16:20 -0400, simo wrote:
> > On Sat, 2006-06-03 at 01:04 +1000, Andrew Bartlett wrote:
> > > As per my mail about the objectClass sorting being incorrect in current
> > > Samba4, I decided to revive the sorting module.  I did this mostly to
> > > try and gain some skill in the new, more complex, async ldb. 
> > > 
> > > I've tested this with 'make test', which runs a provision and checks the
> > > objectclass list on add.  (I need to extend the patched ldap.js I sent
> > > yesterday to do a modify).
> > > 
> > > Any comments?
> > 
> > Some:
> > 
> > - if the object has not objectclasses on add then you can probably just
> >   return an error, this will be done by the schema module later, but it
> >   make no sense to allow to create objects without objectclasses in
> >   sam.ldb (in an add operation you can't delete btw)
> 
> Yeah, good point.
> 
> > - on add you do not need to do the operation, then search, then modify.
> >   The objectclass module must clearly be the last one that manipulates 
> >   objectclasses, so on add you can just sort the classes and then do the
> >   operation as you already have all the classes from the original
> >   request
> 
> I was doing this to make the codepaths more common, and therefore more
> tested.  This is the same reason I did this in the password_hash module.

All you have to do to have the same code path is to store the
objectclass attribute in the async context, and to put the sorting code
in a separate function which gets the objectclass attribute in input and
returns a new allocated (sorted) one as output.

In the modify case you will go through modify and search and then you
will use the sorting function to fill in the modify request.

In the add case you will just retrieve the objectclass attribute from
the original request, call the sorting function, copy the original
request and replace the original objectclass attribute with the new one.

The relevant code paths will be the same.

It's not a big thing but I'd like to reduce the number of steps of
add/modify operations have to perform to the minimum, to not get a too
big penalty on the speed of these operations (exp, when the backend is
not local and each operation means a new round trip through a network
socket).

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer
email: idra at samba.org
http://samba.org



More information about the samba-technical mailing list