[PATCH] Improve Samba4's LDB consistancy

simo idra at samba.org
Mon Oct 29 13:15:26 GMT 2007


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?

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