From 428ef08930e06de31919b75ff12b9147aada8a10 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 10 Jan 2006 14:21:24 +0000 Subject: 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) --- source4/lib/ldb/common/attrib_handlers.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source4/lib/ldb/common/attrib_handlers.c') 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)); } -- cgit