ldb_compre_base - can you clarify this test?
Andrew Bartlett
abartlet at samba.org
Wed Oct 29 02:46:16 GMT 2008
In this function, from ldb_dn.c, I'm concerned about the use of strlen():
int ldb_dn_compare_base(struct ldb_dn *base, struct ldb_dn *dn)
{
int ret;
int n_base, n_dn;
if ( ! base || base->invalid) return 1;
if ( ! dn || dn->invalid) return -1;
if (( ! base->valid_case) || ( ! dn->valid_case)) {
if (base->linearized && dn->linearized) {
/* try with a normal compare first, if we are lucky
* we will avoid exploding and casfolding */
int dif;
dif = strlen(dn->linearized) - strlen(base->linearized);
if (dif < 0) return dif;
if (strcmp(base->linearized, &dn->linearized[dif]) == 0) return 0;
}
Firstly, it is my understanding that there are some (annoying)
characters are longer when upper cased. Secondly, could dn->liniarized
contain escaped characters?
If either of these are true, is it valid to do the comparisons like this?
Thanks,
Andrew Bartlett
--
Andrew Bartlett
http://samba.org/~abartlet/
Authentication Developer, Samba Team http://samba.org
Samba Developer, Red Hat Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20081029/4149b537/attachment.bin
More information about the samba-technical
mailing list