summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tools
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2005-07-16 18:16:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:29:33 -0500
commitcb2c43f7b032c26adf82f3ba7d6e3dc855f89fa4 (patch)
tree653e4ff22e4f0a424381675f9acc242c5bea9a2d /source4/lib/ldb/tools
parentb86111fe83f531629c0d76584ea7217ac6fbffef (diff)
downloadsamba-cb2c43f7b032c26adf82f3ba7d6e3dc855f89fa4.tar.gz
samba-cb2c43f7b032c26adf82f3ba7d6e3dc855f89fa4.tar.bz2
samba-cb2c43f7b032c26adf82f3ba7d6e3dc855f89fa4.zip
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)
Diffstat (limited to 'source4/lib/ldb/tools')
-rw-r--r--source4/lib/ldb/tools/ldbedit.c10
-rw-r--r--source4/lib/ldb/tools/ldbsearch.c7
2 files changed, 11 insertions, 6 deletions
diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c
index 12bf12bfff..1613f4ddc5 100644
--- a/source4/lib/ldb/tools/ldbedit.c
+++ b/source4/lib/ldb/tools/ldbedit.c
@@ -93,12 +93,14 @@ static int modify_record(struct ldb_context *ldb,
/*
find dn in msgs[]
*/
-static struct ldb_message *msg_find(struct ldb_message **msgs, int count,
+static struct ldb_message *msg_find(struct ldb_context *ldb,
+ struct ldb_message **msgs,
+ int count,
const char *dn)
{
int i;
for (i=0;i<count;i++) {
- if (ldb_dn_cmp(dn, msgs[i]->dn) == 0) {
+ if (ldb_dn_cmp(ldb, dn, msgs[i]->dn) == 0) {
return msgs[i];
}
}
@@ -119,7 +121,7 @@ static int merge_edits(struct ldb_context *ldb,
/* do the adds and modifies */
for (i=0;i<count2;i++) {
- msg = msg_find(msgs1, count1, msgs2[i]->dn);
+ msg = msg_find(ldb, msgs1, count1, msgs2[i]->dn);
if (!msg) {
if (options->verbose > 0) {
ldif_write_msg(ldb, stdout, LDB_CHANGETYPE_ADD, msgs2[i]);
@@ -139,7 +141,7 @@ static int merge_edits(struct ldb_context *ldb,
/* do the deletes */
for (i=0;i<count1;i++) {
- msg = msg_find(msgs2, count2, msgs1[i]->dn);
+ msg = msg_find(ldb, msgs2, count2, msgs1[i]->dn);
if (!msg) {
if (options->verbose > 0) {
ldif_write_msg(ldb, stdout, LDB_CHANGETYPE_DELETE, msgs1[i]);
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c
index 396bb7797a..5604436980 100644
--- a/source4/lib/ldb/tools/ldbsearch.c
+++ b/source4/lib/ldb/tools/ldbsearch.c
@@ -55,10 +55,12 @@ static void usage(void)
exit(1);
}
+struct ldb_context *ldbsearch_ldb;
+
static int do_compare_msg(struct ldb_message **el1,
- struct ldb_message **el2)
+ struct ldb_message **el2)
{
- return ldb_dn_cmp((*el1)->dn, (*el2)->dn);
+ return ldb_dn_cmp(ldbsearch_ldb, (*el1)->dn, (*el2)->dn);
}
static int do_search(struct ldb_context *ldb,
@@ -79,6 +81,7 @@ static int do_search(struct ldb_context *ldb,
printf("# returned %d records\n", ret);
+ ldbsearch_ldb = ldb;
if (sort_attribs) {
qsort(msgs, ret, sizeof(struct ldb_message *),
(comparison_fn_t)do_compare_msg);