From cb2c43f7b032c26adf82f3ba7d6e3dc855f89fa4 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 16 Jul 2005 18:16:32 +0000 Subject: r8515: ldb_dn_cmp now uses ldb_dn_compare so that the DNs are compared on a content level not ona form level, his means that the 2 DNs: a) cn= user, dc=this, dc = is,dc=test b) cn=user,dc=this,dc=is,dc=test are now identical even if the string form differ (spaces) (This used to be commit 76d496c30867ae80434483a34b0d842523aed762) --- source4/lib/ldb/common/ldb_dn.c | 23 +++++++++++++++++++++++ source4/lib/ldb/common/ldb_utf8.c | 9 --------- 2 files changed, 23 insertions(+), 9 deletions(-) (limited to 'source4/lib/ldb/common') diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c index 32b575dd36..3cdc7ba85f 100644 --- a/source4/lib/ldb/common/ldb_dn.c +++ b/source4/lib/ldb/common/ldb_dn.c @@ -450,6 +450,29 @@ int ldb_dn_compare(struct ldb_context *ldb, return ldb_dn_compare_base(ldb, edn0, edn1); } +int ldb_dn_cmp(struct ldb_context *ldb, const char *dn0, const char *dn1) +{ + struct ldb_dn *edn0; + struct ldb_dn *edn1; + int ret; + + edn0 = ldb_dn_explode_casefold(ldb, dn0); + if (edn0 == NULL) return 0; + + edn1 = ldb_dn_explode_casefold(ldb, dn1); + if (edn1 == NULL) { + talloc_free(edn0); + return 0; + } + + ret = ldb_dn_compare(ldb, edn0, edn1); + + talloc_free(edn0); + talloc_free(edn1); + + return ret; +} + /* casefold a dn. We need to casefold the attribute names, and canonicalize attribute values of case insensitive attributes. diff --git a/source4/lib/ldb/common/ldb_utf8.c b/source4/lib/ldb/common/ldb_utf8.c index 5df5a6bba7..cd68180f77 100644 --- a/source4/lib/ldb/common/ldb_utf8.c +++ b/source4/lib/ldb/common/ldb_utf8.c @@ -72,15 +72,6 @@ int ldb_caseless_cmp(const char *s1, const char *s2) return s2[i]; } -/* - compare two basedn fields - return 0 for match -*/ -int ldb_dn_cmp(const char *dn1, const char *dn2) -{ - return ldb_caseless_cmp(dn1, dn2); -} - /* compare two attributes return 0 for match -- cgit