1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

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.
This commit is contained in:
Matthias Dieter Wallnöfer 2010-10-16 14:47:42 +02:00
parent bc0294814a
commit 19e94349b3

View File

@ -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;