diff options
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r-- | source4/lib/ldb/common/ldb_ldif.c | 8 | ||||
-rw-r--r-- | source4/lib/ldb/common/ldb_msg.c | 6 | ||||
-rw-r--r-- | source4/lib/ldb/common/ldb_parse.c | 2 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_ldap/ldb_ldap.c | 5 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_index.c | 38 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_match.c | 9 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_pack.c | 6 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_search.c | 8 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.c | 18 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbedit.c | 2 |
10 files changed, 56 insertions, 46 deletions
diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c index b08c616a05..8c912f76d4 100644 --- a/source4/lib/ldb/common/ldb_ldif.c +++ b/source4/lib/ldb/common/ldb_ldif.c @@ -122,7 +122,7 @@ char *ldb_base64_encode(struct ldb_context *ldb, const char *buf, int len) */ int ldb_should_b64_encode(const struct ldb_val *val) { - int i; + unsigned int i; uint8_t *p = val->data; if (val->length == 0 || p[0] == ' ' || p[0] == ':') { @@ -146,7 +146,7 @@ int ldb_should_b64_encode(const struct ldb_val *val) static int fold_string(int (*fprintf_fn)(void *, const char *, ...), void *private_data, const char *buf, size_t length, int start_pos) { - int i; + unsigned int i; int total=0, ret; for (i=0;i<length;i++) { @@ -201,7 +201,7 @@ int ldb_ldif_write(struct ldb_context *ldb, void *private_data, const struct ldb_ldif *ldif) { - int i, j; + unsigned int i, j; int total=0, ret; const struct ldb_message *msg; @@ -410,7 +410,7 @@ static int next_attr(char **s, const char **attr, struct ldb_val *value) void ldb_ldif_read_free(struct ldb_context *ldb, struct ldb_ldif *ldif) { struct ldb_message *msg = &ldif->msg; - int i; + unsigned int i; for (i=0;i<msg->num_elements;i++) { if (msg->elements[i].name) ldb_free(ldb, msg->elements[i].name); if (msg->elements[i].values) ldb_free(ldb, msg->elements[i].values); diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c index 0d5b47f920..170a7ae5e4 100644 --- a/source4/lib/ldb/common/ldb_msg.c +++ b/source4/lib/ldb/common/ldb_msg.c @@ -41,7 +41,7 @@ struct ldb_message_element *ldb_msg_find_element(const struct ldb_message *msg, const char *attr_name) { - int i; + unsigned int i; for (i=0;i<msg->num_elements;i++) { if (ldb_attr_cmp(msg->elements[i].name, attr_name) == 0) { return &msg->elements[i]; @@ -74,7 +74,7 @@ int ldb_val_equal_exact(const struct ldb_val *v1, const struct ldb_val *v2) struct ldb_val *ldb_msg_find_val(const struct ldb_message_element *el, struct ldb_val *val) { - int i; + unsigned int i; for (i=0;i<el->num_values;i++) { if (ldb_val_equal_exact(val, &el->values[i])) { return &el->values[i]; @@ -185,7 +185,7 @@ int ldb_msg_add_string(struct ldb_context *ldb, struct ldb_message *msg, int ldb_msg_element_compare(struct ldb_message_element *el1, struct ldb_message_element *el2) { - int i; + unsigned int i; if (el1->num_values != el2->num_values) { return el1->num_values - el2->num_values; diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c index d61d65548c..b037284a24 100644 --- a/source4/lib/ldb/common/ldb_parse.c +++ b/source4/lib/ldb/common/ldb_parse.c @@ -344,7 +344,7 @@ struct ldb_parse_tree *ldb_parse_tree(struct ldb_context *ldb, const char *s) */ void ldb_parse_tree_free(struct ldb_context *ldb, struct ldb_parse_tree *tree) { - int i; + unsigned int i; switch (tree->operation) { case LDB_OP_SIMPLE: diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index d96bfd62d3..06d3884c16 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -117,7 +117,7 @@ static int lldb_delete(struct ldb_context *ldb, const char *dn) */ static int lldb_msg_free(struct ldb_context *ldb, struct ldb_message *msg) { - int i, j; + unsigned int i, j; ldb_free(ldb, msg->dn); for (i=0;i<msg->num_elements;i++) { ldb_free(ldb, msg->elements[i].name); @@ -333,7 +333,8 @@ static LDAPMod **lldb_msg_to_mods(struct ldb_context *ldb, const struct ldb_message *msg, int use_flags) { LDAPMod **mods; - int i, j, num_mods = 0; + unsigned int i, j; + int num_mods = 0; /* allocate maximum number of elements needed */ mods = ldb_malloc_array_p(ldb, LDAPMod *, msg->num_elements+1); diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c index b4ca666287..8a26e2d197 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_index.c +++ b/source4/lib/ldb/ldb_tdb/ldb_index.c @@ -46,7 +46,7 @@ struct dn_list { */ static void dn_list_free(struct ldb_context *ldb, struct dn_list *list) { - int i; + unsigned int i; for (i=0;i<list->count;i++) { ldb_free(ldb, list->dn[i]); } @@ -80,7 +80,7 @@ static char *ldb_dn_key(struct ldb_context *ldb, static int ldb_msg_find_idx(const struct ldb_message *msg, const char *attr, int *v_idx, const char *key) { - int i, j; + unsigned int i, j; for (i=0;i<msg->num_elements;i++) { if (ldb_attr_cmp(msg->elements[i].name, key) == 0) { const struct ldb_message_element *el = @@ -113,7 +113,8 @@ static int ltdb_index_dn_simple(struct ldb_context *ldb, struct dn_list *list) { char *dn = NULL; - int ret, i, j; + int ret; + unsigned int i, j; struct ldb_message msg; list->count = 0; @@ -186,7 +187,7 @@ static int ltdb_index_dn_objectclass(struct ldb_context *ldb, struct dn_list *list) { struct ltdb_private *ltdb = ldb->private_data; - int i; + unsigned int i; int ret; const char *target = tree->u.simple.value.data; static int list_union(struct ldb_context *, @@ -200,7 +201,7 @@ static int ltdb_index_dn_objectclass(struct ldb_context *ldb, for (i=0;i<ltdb->cache.subclasses.num_elements;i++) { struct ldb_message_element *el = <db->cache.subclasses.elements[i]; if (ldb_attr_cmp(el->name, target) == 0) { - int j; + unsigned int j; for (j=0;j<el->num_values;j++) { struct ldb_parse_tree tree2; struct dn_list list2; @@ -252,7 +253,7 @@ static int list_intersect(struct ldb_context *ldb, struct dn_list *list, const struct dn_list *list2) { struct dn_list list3; - int i; + unsigned int i; if (list->count == 0 || list2->count == 0) { /* 0 & X == 0 */ @@ -293,7 +294,7 @@ static int list_intersect(struct ldb_context *ldb, static int list_union(struct ldb_context *ldb, struct dn_list *list, const struct dn_list *list2) { - int i; + unsigned int i; char **d; unsigned int count = list->count; @@ -343,7 +344,8 @@ static int ltdb_index_dn_or(struct ldb_context *ldb, const struct ldb_message *index_list, struct dn_list *list) { - int ret, i; + unsigned int i; + int ret; ret = -1; list->dn = NULL; @@ -416,7 +418,8 @@ static int ltdb_index_dn_and(struct ldb_context *ldb, const struct ldb_message *index_list, struct dn_list *list) { - int ret, i; + unsigned int i; + int ret; ret = -1; list->dn = NULL; @@ -499,8 +502,7 @@ static int ldb_index_filter(struct ldb_context *ldb, struct ldb_parse_tree *tree const struct dn_list *dn_list, const char * const attrs[], struct ldb_message ***res) { - int i; - unsigned int count = 0; + unsigned int count = 0, i; for (i=0;i<dn_list->count;i++) { struct ldb_message msg; @@ -608,7 +610,7 @@ static int ltdb_index_add1_add(struct ldb_context *ldb, char *dn) { struct ldb_val *v2; - int i; + unsigned int i; /* for multi-valued attributes we can end up with repeats */ for (i=0;i<msg->elements[idx].num_values;i++) { @@ -640,7 +642,8 @@ static int ltdb_index_add1(struct ldb_context *ldb, char *dn, { struct ldb_message msg; char *dn_key; - int ret, i, added=0, added_dn=0; + int ret, added=0, added_dn=0; + unsigned int i; dn_key = ldb_dn_key(ldb, el->name, &el->values[v_idx]); if (!dn_key) { @@ -704,7 +707,8 @@ static int ltdb_index_add1(struct ldb_context *ldb, char *dn, int ltdb_index_add(struct ldb_context *ldb, const struct ldb_message *msg) { struct ltdb_private *ltdb = ldb->private_data; - int ret, i, j; + int ret; + unsigned int i, j; if (ltdb->cache.indexlist.num_elements == 0) { /* no indexed fields */ @@ -737,7 +741,8 @@ static int ltdb_index_del1(struct ldb_context *ldb, const char *dn, { struct ldb_message msg; char *dn_key; - int ret, i, j; + int ret, i; + unsigned int j; dn_key = ldb_dn_key(ldb, el->name, &el->values[v_idx]); if (!dn_key) { @@ -794,7 +799,8 @@ static int ltdb_index_del1(struct ldb_context *ldb, const char *dn, int ltdb_index_del(struct ldb_context *ldb, const struct ldb_message *msg) { struct ltdb_private *ltdb = ldb->private_data; - int ret, i, j; + int ret; + unsigned int i, j; /* find the list of indexed fields */ if (ltdb->cache.indexlist.num_elements == 0) { diff --git a/source4/lib/ldb/ldb_tdb/ldb_match.c b/source4/lib/ldb/ldb_tdb/ldb_match.c index 05a2826d4d..963048915a 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_match.c +++ b/source4/lib/ldb/ldb_tdb/ldb_match.c @@ -140,7 +140,7 @@ static int ldb_val_equal_objectclass(struct ldb_context *ldb, const struct ldb_val *v1, const struct ldb_val *v2) { struct ltdb_private *ltdb = ldb->private_data; - int i; + unsigned int i; if (ldb_val_equal_case_insensitive(v1, v2) == 1) { return 1; @@ -149,7 +149,7 @@ static int ldb_val_equal_objectclass(struct ldb_context *ldb, for (i=0;i<ltdb->cache.subclasses.num_elements;i++) { struct ldb_message_element *el = <db->cache.subclasses.elements[i]; if (ldb_attr_cmp(el->name, v2->data) == 0) { - int j; + unsigned int j; for (j=0;j<el->num_values;j++) { if (ldb_val_equal_objectclass(ldb, v1, &el->values[j])) { return 1; @@ -259,7 +259,7 @@ static int match_leaf(struct ldb_context *ldb, const char *base, enum ldb_scope scope) { - int i, j; + unsigned int i, j; if (!scope_match(msg->dn, base, scope)) { return 0; @@ -304,7 +304,8 @@ int ldb_message_match(struct ldb_context *ldb, const char *base, enum ldb_scope scope) { - int v, i; + unsigned int i; + int v; switch (tree->operation) { case LDB_OP_SIMPLE: diff --git a/source4/lib/ldb/ldb_tdb/ldb_pack.c b/source4/lib/ldb/ldb_tdb/ldb_pack.c index fcbc9bd56d..ad856d2faf 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_pack.c +++ b/source4/lib/ldb/ldb_tdb/ldb_pack.c @@ -69,7 +69,7 @@ int ltdb_pack_data(struct ldb_context *ldb, const struct ldb_message *message, struct TDB_DATA *data) { - int i, j, real_elements=0; + unsigned int i, j, real_elements=0; size_t size; char *p; size_t len; @@ -141,7 +141,7 @@ int ltdb_pack_data(struct ldb_context *ldb, void ltdb_unpack_data_free(struct ldb_context *ldb, struct ldb_message *message) { - int i; + unsigned int i; for (i=0;i<message->num_elements;i++) { if (message->elements[i].values) ldb_free(ldb, message->elements[i].values); @@ -166,7 +166,7 @@ int ltdb_unpack_data(struct ldb_context *ldb, { char *p; unsigned int remaining; - int i, j; + unsigned int i, j; unsigned format; size_t len; diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c index 7e8cd8b289..18d51d1aa4 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_search.c +++ b/source4/lib/ldb/ldb_tdb/ldb_search.c @@ -41,7 +41,7 @@ */ static void msg_free_all_parts(struct ldb_context *ldb, struct ldb_message *msg) { - int i, j; + unsigned int i, j; ldb_free(ldb, msg->dn); for (i=0;i<msg->num_elements;i++) { ldb_free(ldb, msg->elements[i].name); @@ -89,7 +89,7 @@ struct ldb_val ldb_val_dup(struct ldb_context *ldb, static int msg_add_element(struct ldb_context *ldb, struct ldb_message *ret, const struct ldb_message_element *el) { - int i; + unsigned int i; struct ldb_message_element *e2, *elnew; e2 = ldb_realloc_p(ldb, ret->elements, struct ldb_message_element, ret->num_elements+1); @@ -134,7 +134,7 @@ static int msg_add_element(struct ldb_context *ldb, static int msg_add_all_elements(struct ldb_context *ldb, struct ldb_message *ret, const struct ldb_message *msg) { - int i; + unsigned int i; for (i=0;i<msg->num_elements;i++) { int flags = ltdb_attribute_flags(ldb, msg->elements[i].name); if ((msg->dn[0] != '@') && (flags & LTDB_FLAG_HIDDEN)) { @@ -265,7 +265,7 @@ int ltdb_has_wildcard(struct ldb_context *ldb, const char *attr_name, */ void ltdb_search_dn1_free(struct ldb_context *ldb, struct ldb_message *msg) { - int i; + unsigned int i; ldb_free(ldb, msg->private_data); for (i=0;i<msg->num_elements;i++) { ldb_free(ldb, msg->elements[i].values); diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index d60504ff17..b36c53e100 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -324,7 +324,7 @@ failed: */ static int find_element(const struct ldb_message *msg, const char *name) { - int i; + unsigned int i; for (i=0;i<msg->num_elements;i++) { if (ldb_attr_cmp(msg->elements[i].name, name) == 0) { return i; @@ -345,7 +345,7 @@ static int msg_add_element(struct ldb_context *ldb, struct ldb_message *msg, struct ldb_message_element *el) { struct ldb_message_element *e2; - int i; + unsigned int i; e2 = ldb_realloc_p(ldb, msg->elements, struct ldb_message_element, msg->num_elements+1); @@ -385,7 +385,7 @@ static int msg_add_element(struct ldb_context *ldb, static int msg_delete_attribute(struct ldb_context *ldb, struct ldb_message *msg, const char *name) { - int i, count=0; + unsigned int i, count=0; struct ldb_message_element *el2; el2 = ldb_malloc_array_p(ldb, struct ldb_message_element, msg->num_elements); @@ -419,15 +419,16 @@ static int msg_delete_element(struct ldb_context *ldb, const char *name, const struct ldb_val *val) { - int i; + unsigned int i; + int found; struct ldb_message_element *el; - i = find_element(msg, name); - if (i == -1) { + found = find_element(msg, name); + if (found == -1) { return -1; } - el = &msg->elements[i]; + el = &msg->elements[found]; for (i=0;i<el->num_values;i++) { if (ldb_val_equal(ldb, msg->elements[i].name, &el->values[i], val)) { @@ -459,7 +460,8 @@ int ltdb_modify_internal(struct ldb_context *ldb, const struct ldb_message *msg) struct ltdb_private *ltdb = ldb->private_data; TDB_DATA tdb_key, tdb_data; struct ldb_message msg2; - int ret, i, j; + unsigned i, j; + int ret; tdb_key = ltdb_key(ldb, msg->dn); if (!tdb_key.dptr) { diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c index f8e0fbb68a..90a6f94750 100644 --- a/source4/lib/ldb/tools/ldbedit.c +++ b/source4/lib/ldb/tools/ldbedit.c @@ -44,7 +44,7 @@ static int modify_record(struct ldb_context *ldb, { struct ldb_message mod; struct ldb_message_element *el; - int i; + unsigned int i; int count = 0; mod.dn = msg1->dn; |