From 19e94349b3bf3ba605cb5fde3fca9fe12bfe74d9 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sat, 16 Oct 2010 14:47:42 +0200 Subject: ldb:"ldb_dn_canonical" - use an "unsigned int" counter Convert it to use an "unsigned int" counter which represents the exact length of the DN components. --- source4/lib/ldb/common/ldb_dn.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/lib/ldb/common/ldb_dn.c') diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c index 9bbefddb8e..2b640687b1 100644 --- a/source4/lib/ldb/common/ldb_dn.c +++ b/source4/lib/ldb/common/ldb_dn.c @@ -1711,7 +1711,7 @@ struct ldb_dn *ldb_dn_get_parent(TALLOC_CTX *mem_ctx, struct ldb_dn *dn) */ static char *ldb_dn_canonical(TALLOC_CTX *mem_ctx, struct ldb_dn *dn, int ex_format) { - long long int i; + unsigned int i; TALLOC_CTX *tmpctx; char *cracked = NULL; const char *format = (ex_format ? "\n" : "/" ); @@ -1723,7 +1723,7 @@ static char *ldb_dn_canonical(TALLOC_CTX *mem_ctx, struct ldb_dn *dn, int ex_for tmpctx = talloc_new(mem_ctx); /* Walk backwards down the DN, grabbing 'dc' components at first */ - for (i = dn->comp_num - 1; i >= 0; i--) { + for (i = dn->comp_num - 1; i != (unsigned int) -1; i--) { if (ldb_attr_cmp(dn->components[i].name, "dc") != 0) { break; } @@ -1742,7 +1742,7 @@ static char *ldb_dn_canonical(TALLOC_CTX *mem_ctx, struct ldb_dn *dn, int ex_for } /* Only domain components? Finish here */ - if (i < 0) { + if (i == (unsigned int) -1) { cracked = talloc_strdup_append_buffer(cracked, format); talloc_steal(mem_ctx, cracked); goto done; -- cgit