diff options
author | Simo Sorce <idra@samba.org> | 2006-01-10 14:21:24 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:50:03 -0500 |
commit | 428ef08930e06de31919b75ff12b9147aada8a10 (patch) | |
tree | 98eae4a0f00beddf28f49d92b2d3c1740deff221 /source4/lib | |
parent | a6a007d0c421f31f2cdb7f27f1db342f1573db50 (diff) | |
download | samba-428ef08930e06de31919b75ff12b9147aada8a10.tar.gz samba-428ef08930e06de31919b75ff12b9147aada8a10.tar.bz2 samba-428ef08930e06de31919b75ff12b9147aada8a10.zip |
r12827: This was a very well concealed bug.
Thank to Andrew Bartlet for finding out a test case that showed it up.
Simo.
(This used to be commit 72a86d74a95c2b38d25159027f612075c50a1f3c)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/ldb/common/attrib_handlers.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source4/lib/ldb/common/attrib_handlers.c b/source4/lib/ldb/common/attrib_handlers.c index 4b9d349672..4826ead946 100644 --- a/source4/lib/ldb/common/attrib_handlers.c +++ b/source4/lib/ldb/common/attrib_handlers.c @@ -136,8 +136,15 @@ static int ldb_comparison_fold(struct ldb_context *ldb, void *mem_ctx, } s1++; s2++; } - while (*s1 == ' ') s1++; - while (*s2 == ' ') s2++; + if (! (*s1 && *s2)) { + /* remove trailing spaces only if one of the pointers + * has reached the end of the strings otherwise we + * can mistakenly match. + * ex. "domain users" <-> "domainUpdates" + */ + while (*s1 == ' ') s1++; + while (*s2 == ' ') s2++; + } return (int)(toupper(*s1)) - (int)(toupper(*s2)); } |