[Date Prev][Date Next]
Re: commit: ldap/libraries/libldap getdn.c
"Kurt D. Zeilenga" wrote:
> The plan is to move to using new functions:
> checks that the input is a valid DN
> dnNormalize (creates a DN for matching)
> outputs a value suitable for dnMatch matching (and indexing)
> outputs a "pretty" DN
> For migration purposes:
> dn_validate needs to be written in terms of dnPretty().
> dn_normalize is already written in terms of dnNormalize().
> The DN pretty form should be designed such that in most cases
> it is shorter than its input. Where not, an error can be returned.
Done. Now another migration problem arises. The normalization
function at present does not uppercase the DN, so all the code
that uses strcmp (a lot!) when comparing normalized DNs is broken.
There are two solutions:
a) tweak the new dn_normalize to make it uppercase the resulting
string (already tried, works fine)
b) add a dn_match wrapper that calls dnMatch (which on turn uses
strcasecmp as a temporary hack), and replace all the strcmp around
the code (I started doing this, but it's kinda a nightmare; if
we're not going to use dnMatch all around the code, relying on
appropriate uniform normalization, I'd prefer solution a).
So I'd rather wait for suggestions before I keep on replacing
strcmp's all around (adding an extra set of strlen's because
dnMatch uses berval's ...)
> >I planned to introduce a layer of functions working with given
> >buffers to allow in-place work with limited overhead (of couse
> >we can do
> > DN = ldap_str2dn(dn_in);
> <schema aware mucking inserted here (eventually)>
> > dn_out = ldap_dn2str(DN);
> > free(DN);
> > strcpy(dn_in, dn_out);
> > free(dn_out);
> That would be dnPretty()
> Yes, eventually we need to pass LDAPDNs...
Dr. Pierangelo Masarati | voice: +39 02 2399 8309
Dip. Ing. Aerospaziale | fax: +39 02 2399 8334
Politecnico di Milano |
via La Masa 34, 20156 Milano, Italy |