svn commit: samba r13278 - in branches/SAMBA_4_0/source/lib/ldb/common: .

tridge at samba.org tridge at samba.org
Fri Feb 3 21:37:35 GMT 2006


Simo,

 > Replying myself and reconnecting to the topic of attribute name
 > restrictions. By adopting rfc2251 restriction on attribute names we
 > solve most of this problem, as we can simply use strcasecmp() as the
 > only valid chars in an attribute name are ascii7 limited letters,
 > digitis and hyphens. And the name cannot start with a digit.

ahh, yes, thats excellent. Your last post had me stumped, as I could
see that having to propogate the ldb_context everywhere would be a
real pain. I was trying to think of a way around it, and had come up
with some pretty ugly alternatives, none of them as appealing as your
solution!

So, this leaves us with only the comparison of values that should be
interpreted as caseless UTF8 strings, which is really common. That's
easy though as we already have the ldb_attrib_handler logic, which
allows us to pass in external comparison functions. So we should pass
in replacements for ldb_comparison_fold() and ldb_handler_fold() from
the main Samba code, thus giving us correct multi-language case
handling in ldb.

We can do this in one of two ways:

 1) modify lib/ldb/samba/ldif_handlers.c to register functions for
    those syntaxes that need it

 2) add a ldb_set_caseless_cmp() function like I suggested previously,
    but only use it in common/attrib_handlers.c, and default to
    strcasecmp()

I think (2) is the simplest, and makes it very easy for other users of
ldb to get this right.

Cheers, Tridge


More information about the samba-technical mailing list