[PATCH] Improve Samba4's LDB consistancy

simo idra at samba.org
Mon Oct 29 21:42:39 GMT 2007


On Tue, 2007-10-30 at 08:01 +1100, Andrew Bartlett wrote:
> On Mon, 2007-10-29 at 09:15 -0400, simo wrote:
> > On Mon, 2007-10-29 at 22:21 +1100, Andrew Bartlett wrote:
> > > +static int fix_dn(TALLOC_CTX *mem_ctx, 
> > > +                 struct ldb_dn *newdn, struct ldb_dn *parent_dn, 
> > > +                 struct ldb_dn **fixed_dn) 
> > > +{
> > > +       /* We need the attribute name in upper case */
> > > +       char *upper_rdn_attr = strupper_talloc(*fixed_dn, 
> > > +
> > > ldb_dn_get_rdn_name(newdn));
> > > +       if (!upper_rdn_attr) {
> > > +               return LDB_ERR_OPERATIONS_ERROR;
> > > +       }
> > > +                                              
> > > +       /* Fix up the DN to be in the standard form, taking particular
> > > care to match the parent DN */
> > > +       *fixed_dn = ldb_dn_copy(mem_ctx, parent_dn);
> > > +
> > > +       /* Create a new child */
> > > +       if (ldb_dn_add_child_fmt(*fixed_dn, "X=X") == false) {
> > > +               return LDB_ERR_OPERATIONS_ERROR;
> > > +       }
> > > +
> > > +       /* And replace it with CN=foo (we need the attribute in upper
> > > case */
> > > +       return ldb_dn_set_component(*fixed_dn, 0, upper_rdn_attr,
> > > +                                   *ldb_dn_get_rdn_val(newdn));
> > > +}
> > 
> > Why are you changing the Attribute name case here?
> 
> This matches AD behaviour, all attribute names in the DN are in UPPER
> CASE.  Previously we used the case as supplied by the client which added
> the DN.

even something like displayName becomes -> DISPLAYNAME ?

ugly ...

Simo.


-- 
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Senior Software Engineer at Red Hat Inc. <ssorce at redhat.com>



More information about the samba-technical mailing list