From: Stefan Metzmacher Date: Tue, 2 Feb 2010 17:14:15 +0000 (+0100) Subject: first... X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=25c2288d9829fb5c6a25f11366e9c588fcb7aea4;p=metze%2Fsamba%2Fwip.git first... --- diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 94fd6cde1eba..305140068147 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -665,7 +665,6 @@ int ldb_request_get_status(struct ldb_request *req) static void ldb_trace_request(struct ldb_context *ldb, struct ldb_request *req) { TALLOC_CTX *tmp_ctx = talloc_new(req); - int i; switch (req->operation) { case LDB_SEARCH: @@ -682,6 +681,7 @@ static void ldb_trace_request(struct ldb_context *ldb, struct ldb_request *req) if (req->op.search.attrs == NULL) { ldb_debug_add(ldb, " attr: \n"); } else { + unsigned int i; for (i=0; req->op.search.attrs[i]; i++) { ldb_debug_add(ldb, " attr: %s\n", req->op.search.attrs[i]); } @@ -737,6 +737,7 @@ static void ldb_trace_request(struct ldb_context *ldb, struct ldb_request *req) if (req->controls == NULL) { ldb_debug_add(ldb, " control: \n"); } else { + unsigned int i; for (i=0; req->controls && req->controls[i]; i++) { ldb_debug_add(ldb, " control: %s crit:%u data:%s\n", req->controls[i]->oid, @@ -845,7 +846,7 @@ int ldb_search_default_callback(struct ldb_request *req, struct ldb_reply *ares) { struct ldb_result *res; - int n; + unsigned int n; res = talloc_get_type(req->context, struct ldb_result); diff --git a/source4/lib/ldb/common/ldb_attributes.c b/source4/lib/ldb/common/ldb_attributes.c index 79c5dd69de43..87657a134e5d 100644 --- a/source4/lib/ldb/common/ldb_attributes.c +++ b/source4/lib/ldb/common/ldb_attributes.c @@ -49,7 +49,7 @@ int ldb_schema_attribute_add_with_syntax(struct ldb_context *ldb, unsigned flags, const struct ldb_schema_syntax *syntax) { - int i, n; + unsigned int i, n; struct ldb_schema_attribute *a; if (!syntax) { @@ -179,7 +179,7 @@ const struct ldb_schema_attribute *ldb_schema_attribute_by_name(struct ldb_conte void ldb_schema_attribute_remove(struct ldb_context *ldb, const char *name) { const struct ldb_schema_attribute *a; - int i; + unsigned int i; a = ldb_schema_attribute_by_name_internal(ldb, name); if (a == NULL || a->name == NULL) { @@ -232,7 +232,7 @@ int ldb_setup_wellknown_attributes(struct ldb_context *ldb) { "ou", LDB_SYNTAX_DIRECTORY_STRING }, { "objectClass", LDB_SYNTAX_OBJECTCLASS } }; - int i; + unsigned int i; int ret; for (i=0;ischema.num_dn_extended_syntax; i++) { if (ldb_attr_cmp(ldb->schema.dn_extended_syntax[i].name, name) == 0) { return &ldb->schema.dn_extended_syntax[i]; diff --git a/source4/lib/ldb/common/ldb_match.c b/source4/lib/ldb/common/ldb_match.c index f639effc96b1..5bc4c57cf453 100644 --- a/source4/lib/ldb/common/ldb_match.c +++ b/source4/lib/ldb/common/ldb_match.c @@ -189,7 +189,7 @@ static int ldb_wildcard_compare(struct ldb_context *ldb, struct ldb_val *chunk; char *p, *g; uint8_t *save_p = NULL; - int c = 0; + unsigned int c = 0; a = ldb_schema_attribute_by_name(ldb, tree->u.substring.attr); @@ -304,7 +304,7 @@ static int ldb_match_extended(struct ldb_context *ldb, const struct ldb_parse_tree *tree, enum ldb_scope scope) { - int i; + unsigned int i; const struct { const char *oid; int (*comparator)(const struct ldb_val *, const struct ldb_val *); diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 3b8934702aef..aac5470cf3b3 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -48,7 +48,7 @@ void ldb_set_modules_dir(struct ldb_context *ldb, const char *path) static char *ldb_modules_strdup_no_spaces(TALLOC_CTX *mem_ctx, const char *string) { - int i, len; + unsigned int i, len; char *trimmed; trimmed = talloc_strdup(mem_ctx, string); @@ -79,7 +79,7 @@ const char **ldb_modules_list_from_string(struct ldb_context *ldb, TALLOC_CTX *m char **modules = NULL; const char **m; char *modstr, *p; - int i; + unsigned int i; /* spaces not admitted */ modstr = ldb_modules_strdup_no_spaces(mem_ctx, string); @@ -144,7 +144,7 @@ static const struct ldb_builtins { static ldb_connect_fn ldb_find_backend(const char *url) { struct backends_list_entry *backend; - int i; + unsigned int i; for (i = 0; builtins[i].backend_ops || builtins[i].module_ops; i++) { if (builtins[i].backend_ops == NULL) continue; @@ -333,7 +333,7 @@ static void *ldb_dso_load_symbol(struct ldb_context *ldb, const char *name, int ldb_load_modules_list(struct ldb_context *ldb, const char **module_list, struct ldb_module *backend, struct ldb_module **out) { struct ldb_module *module; - int i; + unsigned int i; module = backend; @@ -399,7 +399,6 @@ int ldb_init_module_chain(struct ldb_context *ldb, struct ldb_module *module) int ldb_load_modules(struct ldb_context *ldb, const char *options[]) { const char **modules = NULL; - int i; int ret; TALLOC_CTX *mem_ctx = talloc_new(ldb); if (!mem_ctx) { @@ -410,6 +409,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[]) /* check if we have a custom module list passd as ldb option */ if (options) { + unsigned int i; for (i = 0; options[i] != NULL; i++) { if (strncmp(options[i], LDB_MODULE_PREFIX, LDB_MODULE_PREFIX_LEN) == 0) { modules = ldb_modules_list_from_string(ldb, mem_ctx, &options[i][LDB_MODULE_PREFIX_LEN]); diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c index 9f90f3340562..04761f8867c2 100644 --- a/source4/lib/ldb/common/ldb_msg.c +++ b/source4/lib/ldb/common/ldb_msg.c @@ -476,7 +476,7 @@ struct ldb_message *ldb_msg_copy_shallow(TALLOC_CTX *mem_ctx, const struct ldb_message *msg) { struct ldb_message *msg2; - int i; + unsigned int i; msg2 = talloc(mem_ctx, struct ldb_message); if (msg2 == NULL) return NULL; @@ -506,7 +506,7 @@ struct ldb_message *ldb_msg_copy(TALLOC_CTX *mem_ctx, const struct ldb_message *msg) { struct ldb_message *msg2; - int i, j; + unsigned int i, j; msg2 = ldb_msg_copy_shallow(mem_ctx, msg); if (msg2 == NULL) return NULL; @@ -542,7 +542,7 @@ failed: struct ldb_message *ldb_msg_canonicalize(struct ldb_context *ldb, const struct ldb_message *msg) { - int i; + unsigned int i; struct ldb_message *msg2; msg2 = ldb_msg_copy(ldb, msg); @@ -640,7 +640,7 @@ struct ldb_message *ldb_msg_diff(struct ldb_context *ldb, int ldb_msg_sanity_check(struct ldb_context *ldb, const struct ldb_message *msg) { - int i, j; + unsigned int i, j; /* basic check on DN */ if (msg->dn == NULL) { @@ -678,7 +678,8 @@ int ldb_msg_sanity_check(struct ldb_context *ldb, const char **ldb_attr_list_copy(TALLOC_CTX *mem_ctx, const char * const *attrs) { const char **ret; - int i; + unsigned int i; + for (i=0;attrs && attrs[i];i++) /* noop */ ; ret = talloc_array(mem_ctx, const char *, i+1); if (ret == NULL) { @@ -699,8 +700,9 @@ const char **ldb_attr_list_copy(TALLOC_CTX *mem_ctx, const char * const *attrs) const char **ldb_attr_list_copy_add(TALLOC_CTX *mem_ctx, const char * const *attrs, const char *new_attr) { const char **ret; - int i; + unsigned int i; bool found = false; + for (i=0;attrs && attrs[i];i++) { if (ldb_attr_cmp(attrs[i], new_attr) == 0) { found = true; @@ -727,7 +729,7 @@ const char **ldb_attr_list_copy_add(TALLOC_CTX *mem_ctx, const char * const *att */ int ldb_attr_in_list(const char * const *attrs, const char *attr) { - int i; + unsigned int i; for (i=0;attrs && attrs[i];i++) { if (ldb_attr_cmp(attrs[i], attr) == 0) { return 1; @@ -936,7 +938,7 @@ time_t ldb_string_utc_to_time(const char *s) */ void ldb_dump_results(struct ldb_context *ldb, struct ldb_result *result, FILE *f) { - int i; + unsigned int i; for (i = 0; i < result->count; i++) { struct ldb_ldif ldif; diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c index ba16b57da3f3..7c63414935af 100644 --- a/source4/lib/ldb/common/ldb_parse.c +++ b/source4/lib/ldb/common/ldb_parse.c @@ -61,9 +61,9 @@ a filter is defined by: */ struct ldb_val ldb_binary_decode(void *mem_ctx, const char *str) { - int i, j; + unsigned int i, j; struct ldb_val ret; - int slen = str?strlen(str):0; + unsigned int slen = str?strlen(str):0; ret.data = (uint8_t *)talloc_size(mem_ctx, slen+1); ret.length = 0; @@ -96,9 +96,9 @@ struct ldb_val ldb_binary_decode(void *mem_ctx, const char *str) */ char *ldb_binary_encode(void *mem_ctx, struct ldb_val val) { - int i; + unsigned int i; char *ret; - int len = val.length; + unsigned int len = val.length; unsigned char *buf = val.data; for (i=0;ioperation) { case LDB_OP_AND: case LDB_OP_OR: @@ -826,7 +826,7 @@ void ldb_parse_tree_attr_replace(struct ldb_parse_tree *tree, struct ldb_parse_tree *ldb_parse_tree_copy_shallow(TALLOC_CTX *mem_ctx, const struct ldb_parse_tree *ot) { - int i; + unsigned int i; struct ldb_parse_tree *nt; nt = talloc(mem_ctx, struct ldb_parse_tree); diff --git a/source4/lib/ldb/common/ldb_utf8.c b/source4/lib/ldb/common/ldb_utf8.c index 0a8a89ac1d14..5587d77dc7e6 100644 --- a/source4/lib/ldb/common/ldb_utf8.c +++ b/source4/lib/ldb/common/ldb_utf8.c @@ -55,7 +55,7 @@ void ldb_set_utf8_fns(struct ldb_context *ldb, */ char *ldb_casefold_default(void *context, void *mem_ctx, const char *s, size_t n) { - int i; + unsigned int i; char *ret = talloc_strndup(mem_ctx, s, n); if (!s) { errno = ENOMEM; @@ -84,7 +84,7 @@ char *ldb_casefold(struct ldb_context *ldb, void *mem_ctx, const char *s, size_t int ldb_valid_attr_name(const char *s) { - int i; + unsigned int i; if (!s || !s[0]) return 0; @@ -111,7 +111,7 @@ int ldb_valid_attr_name(const char *s) char *ldb_attr_casefold(void *mem_ctx, const char *s) { - int i; + unsigned int i; char *ret = talloc_strdup(mem_ctx, s); if (!ret) { errno = ENOMEM; diff --git a/source4/lib/ldb/ldb_map/ldb_map.c b/source4/lib/ldb/ldb_map/ldb_map.c index ab9578bd884e..483222ec2044 100644 --- a/source4/lib/ldb/ldb_map/ldb_map.c +++ b/source4/lib/ldb/ldb_map/ldb_map.c @@ -256,7 +256,7 @@ int ldb_next_remote_request(struct ldb_module *module, struct ldb_request *reque /* Find an objectClass mapping by the local name. */ static const struct ldb_map_objectclass *map_objectclass_find_local(const struct ldb_map_context *data, const char *name) { - int i; + unsigned int i; for (i = 0; data->objectclass_maps && data->objectclass_maps[i].local_name; i++) { if (ldb_attr_cmp(data->objectclass_maps[i].local_name, name) == 0) { @@ -270,7 +270,7 @@ static const struct ldb_map_objectclass *map_objectclass_find_local(const struct /* Find an objectClass mapping by the remote name. */ static const struct ldb_map_objectclass *map_objectclass_find_remote(const struct ldb_map_context *data, const char *name) { - int i; + unsigned int i; for (i = 0; data->objectclass_maps && data->objectclass_maps[i].remote_name; i++) { if (ldb_attr_cmp(data->objectclass_maps[i].remote_name, name) == 0) { @@ -284,7 +284,7 @@ static const struct ldb_map_objectclass *map_objectclass_find_remote(const struc /* Find an attribute mapping by the local name. */ const struct ldb_map_attribute *map_attr_find_local(const struct ldb_map_context *data, const char *name) { - int i; + unsigned int i; for (i = 0; data->attribute_maps[i].local_name; i++) { if (ldb_attr_cmp(data->attribute_maps[i].local_name, name) == 0) { @@ -305,7 +305,7 @@ const struct ldb_map_attribute *map_attr_find_remote(const struct ldb_map_contex { const struct ldb_map_attribute *map; const struct ldb_map_attribute *wildcard = NULL; - int i, j; + unsigned int i, j; for (i = 0; data->attribute_maps[i].local_name; i++) { map = &data->attribute_maps[i]; @@ -402,7 +402,7 @@ const char *map_attr_map_remote(void *mem_ctx, const struct ldb_map_attribute *m int map_attrs_merge(struct ldb_module *module, void *mem_ctx, const char ***attrs, const char * const *more_attrs) { - int i, j, k; + unsigned int i, j, k; for (i = 0; *attrs && (*attrs)[i]; i++) /* noop */ ; for (j = 0; more_attrs && more_attrs[j]; j++) /* noop */ ; @@ -714,7 +714,7 @@ static void map_objectclass_generate_remote(struct ldb_module *module, const cha struct ldb_message_element *el, *oc; struct ldb_val val; bool found_extensibleObject = false; - int i; + unsigned int i; ldb = ldb_module_get_ctx(module); @@ -789,7 +789,7 @@ static struct ldb_message_element *map_objectclass_generate_local(struct ldb_mod struct ldb_context *ldb; struct ldb_message_element *el, *oc; struct ldb_val val; - int i; + unsigned int i; ldb = ldb_module_get_ctx(module); @@ -1043,7 +1043,7 @@ static int map_init_maps(struct ldb_module *module, struct ldb_map_context *data const struct ldb_map_objectclass *ocls, const char * const *wildcard_attributes) { - int i, j, last; + unsigned int i, j, last; last = 0; /* Count specified attribute maps */ diff --git a/source4/lib/ldb/ldb_map/ldb_map_inbound.c b/source4/lib/ldb/ldb_map/ldb_map_inbound.c index 5a948cff69dd..cdc88afbc516 100644 --- a/source4/lib/ldb/ldb_map/ldb_map_inbound.c +++ b/source4/lib/ldb/ldb_map/ldb_map_inbound.c @@ -36,7 +36,7 @@ static struct ldb_message_element *ldb_msg_el_map_local(struct ldb_module *module, void *mem_ctx, const struct ldb_map_attribute *map, const struct ldb_message_element *old) { struct ldb_message_element *el; - int i; + unsigned int i; el = talloc_zero(mem_ctx, struct ldb_message_element); if (el == NULL) { @@ -141,7 +141,7 @@ static bool ldb_msg_check_remote(struct ldb_module *module, const struct ldb_mes { const struct ldb_map_context *data = map_get_context(module); bool ret; - int i; + unsigned int i; for (i = 0; i < msg->num_elements; i++) { ret = map_attr_check_remote(data, msg->elements[i].name); @@ -159,7 +159,8 @@ static int ldb_msg_partition(struct ldb_module *module, struct ldb_message *loca { /* const char * const names[]; */ struct ldb_context *ldb; - int i, ret; + unsigned int i; + int ret; ldb = ldb_module_get_ctx(module); diff --git a/source4/lib/ldb/ldb_map/ldb_map_outbound.c b/source4/lib/ldb/ldb_map/ldb_map_outbound.c index 922d13991bb6..7860a1c8db3c 100644 --- a/source4/lib/ldb/ldb_map/ldb_map_outbound.c +++ b/source4/lib/ldb/ldb_map/ldb_map_outbound.c @@ -38,7 +38,7 @@ static const char **map_attrs_select_local(struct ldb_module *module, void *mem_ { const struct ldb_map_context *data = map_get_context(module); const char **result; - int i, last; + unsigned int i, last; if (attrs == NULL) return NULL; @@ -81,7 +81,7 @@ static const char **map_attrs_collect_remote(struct ldb_module *module, void *me const char **result; const struct ldb_map_attribute *map; const char *name=NULL; - int i, j, last; + unsigned int i, j, last; int ret; last = 0; @@ -220,7 +220,7 @@ static struct ldb_message_element *ldb_msg_el_map_remote(struct ldb_module *modu const struct ldb_message_element *old) { struct ldb_message_element *el; - int i; + unsigned int i; el = talloc_zero(mem_ctx, struct ldb_message_element); if (el == NULL) { @@ -350,7 +350,8 @@ static int ldb_msg_el_merge_wildcard(struct ldb_module *module, struct ldb_messa const struct ldb_map_context *data = map_get_context(module); const struct ldb_map_attribute *map = map_attr_find_local(data, "*"); struct ldb_message_element *el=NULL; - int i, ret; + unsigned int i; + int ret; /* Perhaps we have a mapping for "*" */ if (map && map->type == LDB_MAP_KEEP) { @@ -392,7 +393,8 @@ static int ldb_msg_el_merge_wildcard(struct ldb_module *module, struct ldb_messa /* Merge two local messages into a single one. */ static int ldb_msg_merge_local(struct ldb_module *module, struct ldb_message *msg1, struct ldb_message *msg2) { - int i, ret; + unsigned int i; + int ret; for (i = 0; i < msg2->num_elements; i++) { ret = ldb_msg_replace(msg1, &msg2->elements[i]); @@ -408,7 +410,8 @@ static int ldb_msg_merge_local(struct ldb_module *module, struct ldb_message *ms static int ldb_msg_merge_remote(struct map_context *ac, struct ldb_message *local, struct ldb_message *remote) { - int i, ret; + unsigned int i; + int ret; const char * const *attrs = ac->all_attrs; if (!attrs) { ret = ldb_msg_el_merge_wildcard(ac->module, local, remote); @@ -520,7 +523,8 @@ static bool ldb_parse_tree_check_splittable(const struct ldb_parse_tree *tree) static int ldb_parse_tree_collect_attrs(struct ldb_module *module, void *mem_ctx, const char ***attrs, const struct ldb_parse_tree *tree) { const char **new_attrs; - int i, ret; + unsigned int i; + int ret; if (tree == NULL) { return 0; @@ -588,7 +592,8 @@ static int map_subtree_select_local_not(struct ldb_module *module, void *mem_ctx /* Select a list of subtrees that query attributes in the local partition */ static int map_subtree_select_local_list(struct ldb_module *module, void *mem_ctx, struct ldb_parse_tree **new, const struct ldb_parse_tree *tree) { - int i, j, ret=0; + unsigned int i, j; + int ret=0; /* Prepare new tree */ *new = talloc_memdup(mem_ctx, tree, sizeof(struct ldb_parse_tree)); @@ -711,7 +716,8 @@ static int map_subtree_collect_remote_not(struct ldb_module *module, void *mem_c /* Collect a list of subtrees that query attributes in the remote partition */ static int map_subtree_collect_remote_list(struct ldb_module *module, void *mem_ctx, struct ldb_parse_tree **new, const struct ldb_parse_tree *tree) { - int i, j, ret=0; + unsigned int i, j; + int ret=0; /* Prepare new tree */ *new = talloc_memdup(mem_ctx, tree, sizeof(struct ldb_parse_tree)); diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c index f07b330a8b80..fcf1c117242d 100644 --- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c +++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c @@ -255,7 +255,7 @@ static char *parsetree_to_sql(struct ldb_module *module, char *child, *tmp; char *ret = NULL; char *attr; - int i; + unsigned int i; ldb = ldb_module_get_ctx(module); @@ -986,7 +986,7 @@ static int lsql_add(struct lsql_context *ctx) char *dn, *ndn; char *errmsg; char *query; - int i; + unsigned int i; int ret; ldb = ldb_module_get_ctx(module); @@ -1043,7 +1043,7 @@ static int lsql_add(struct lsql_context *ctx) const struct ldb_message_element *el = &msg->elements[i]; const struct ldb_schema_attribute *a; char *attr; - int j; + unsigned int j; /* Get a case-folded copy of the attribute name */ attr = ldb_attr_casefold(ctx, el->name); @@ -1112,7 +1112,7 @@ static int lsql_modify(struct lsql_context *ctx) struct ldb_message *msg = req->op.mod.message; long long eid; char *errmsg; - int i; + unsigned int i; int ret; ldb = ldb_module_get_ctx(module); @@ -1136,7 +1136,7 @@ static int lsql_modify(struct lsql_context *ctx) int flags = el->flags & LDB_FLAG_MOD_MASK; char *attr; char *mod; - int j; + unsigned int j; if (ldb_attr_cmp(el->name, "distinguishedName") == 0) { ldb_asprintf_errstring(ldb, "it is not permitted to perform a modify on 'distinguishedName' (use rename instead): %s", @@ -1894,7 +1894,7 @@ static int lsqlite3_connect(struct ldb_context *ldb, { struct ldb_module *module; struct lsqlite3_private *lsqlite3; - int i, ret; + int ret; module = ldb_module_new(ldb, ldb, "ldb_sqlite3 backend", &lsqlite3_ops); if (!module) return LDB_ERR_OPERATIONS_ERROR; @@ -1918,6 +1918,7 @@ static int lsqlite3_connect(struct ldb_context *ldb, ldb_module_set_private(module, lsqlite3); if (options) { + unsigned int i; /* * take a copy of the options array, so we don't have to rely * on the caller keeping it around (it might be dynamic) diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c index aa19f75e9c25..0b87ec7a8cb5 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_cache.c +++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c @@ -60,7 +60,7 @@ static void ltdb_attributes_unload(struct ldb_module *module) void *data = ldb_module_get_private(module); struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); struct ldb_message *msg; - int i; + unsigned int i; ldb = ldb_module_get_ctx(module); @@ -83,7 +83,7 @@ static void ltdb_attributes_unload(struct ldb_module *module) */ static int ltdb_attributes_flags(struct ldb_message_element *el, unsigned *v) { - int i; + unsigned int i; unsigned value = 0; for (i=0;inum_values;i++) { int j; @@ -112,7 +112,8 @@ static int ltdb_attributes_load(struct ldb_module *module) struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); struct ldb_message *msg = ltdb->cache->attributes; struct ldb_dn *dn; - int i, r; + unsigned int i; + int r; ldb = ldb_module_get_ctx(module); @@ -480,7 +481,7 @@ int ltdb_increase_sequence_number(struct ldb_module *module) int ltdb_check_at_attributes_values(const struct ldb_val *value) { - int i; + unsigned int i; for (i = 0; ltdb_valid_attr_flags[i].name != NULL; i++) { if ((strcmp(ltdb_valid_attr_flags[i].name, (char *)value->data) == 0)) { diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c index 4b3102100111..33a552961555 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_index.c +++ b/source4/lib/ldb/ldb_tdb/ldb_index.c @@ -76,7 +76,7 @@ static int dn_list_cmp(const struct ldb_val *v1, const struct ldb_val *v2) */ static int ltdb_dn_list_find_val(const struct dn_list *list, const struct ldb_val *v) { - int i; + unsigned int i; for (i=0; icount; i++) { if (dn_list_cmp(&list->dn[i], v) == 0) return i; } @@ -967,7 +967,7 @@ static int ltdb_index_filter(const struct dn_list *dn_list, */ static void ltdb_dn_list_remove_duplicates(struct dn_list *list) { - int i, new_count; + unsigned int i, new_count; if (list->count < 2) { return; diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index bad0928c23dc..c17107ae0777 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -176,7 +176,7 @@ static int ltdb_check_special_dn(struct ldb_module *module, const struct ldb_message *msg) { struct ldb_context *ldb = ldb_module_get_ctx(module); - int i, j; + unsigned int i, j; if (! ldb_dn_is_special(msg->dn) || ! ldb_dn_check_special(msg->dn, LTDB_ATTRIBUTES)) { @@ -278,7 +278,8 @@ static int ltdb_add_internal(struct ldb_module *module, const struct ldb_message *msg) { struct ldb_context *ldb = ldb_module_get_ctx(module); - int ret = LDB_SUCCESS, i; + int ret = LDB_SUCCESS; + unsigned int i; ret = ltdb_check_special_dn(module, msg); if (ret != LDB_SUCCESS) { diff --git a/source4/lib/ldb/modules/asq.c b/source4/lib/ldb/modules/asq.c index 491868301c46..6d1e88b67b8f 100644 --- a/source4/lib/ldb/modules/asq.c +++ b/source4/lib/ldb/modules/asq.c @@ -55,8 +55,8 @@ struct asq_context { struct ldb_reply *base_res; struct ldb_request **reqs; - int num_reqs; - int cur_req; + unsigned int num_reqs; + unsigned int cur_req; struct ldb_control **controls; }; @@ -85,7 +85,7 @@ static int asq_search_continue(struct asq_context *ac); static int asq_search_terminate(struct asq_context *ac) { struct ldb_asq_control *asq; - int i; + unsigned int i; if (ac->controls) { for (i = 0; ac->controls[i]; i++) /* count em */ ; @@ -250,7 +250,8 @@ static int asq_build_multiple_requests(struct asq_context *ac, bool *terminated) struct ldb_control *control; struct ldb_dn *dn; struct ldb_message_element *el; - int ret, i; + unsigned int i; + int ret; if (ac->base_res == NULL) { return LDB_ERR_NO_SUCH_OBJECT; diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c index ff1b92ff97e1..bca38c8eadde 100644 --- a/source4/lib/ldb/modules/paged_results.c +++ b/source4/lib/ldb/modules/paged_results.c @@ -56,7 +56,7 @@ struct results_store { struct message_store *first; struct message_store *last; - int num_entries; + unsigned int num_entries; struct message_store *first_ref; struct message_store *last_ref; @@ -65,8 +65,7 @@ struct results_store { }; struct private_data { - - int next_free_id; + unsigned int next_free_id; struct results_store *store; }; @@ -95,7 +94,7 @@ static int store_destructor(struct results_store *del) static struct results_store *new_store(struct private_data *priv) { struct results_store *newr; - int new_id = priv->next_free_id++; + unsigned int new_id = priv->next_free_id++; /* TODO: we should have a limit on the number of * outstanding paged searches @@ -106,7 +105,7 @@ static struct results_store *new_store(struct private_data *priv) newr->priv = priv; - newr->cookie = talloc_asprintf(newr, "%d", new_id); + newr->cookie = talloc_asprintf(newr, "%u", new_id); if (!newr->cookie) { talloc_free(newr); return NULL; @@ -132,7 +131,7 @@ struct paged_context { struct ldb_request *req; struct results_store *store; - int size; + unsigned int size; struct ldb_control **controls; }; @@ -140,7 +139,8 @@ static int paged_results(struct paged_context *ac) { struct ldb_paged_control *paged; struct message_store *msg; - int i, num_ctrls, ret; + unsigned int i, num_ctrls; + int ret; if (ac->store == NULL) { return LDB_ERR_OPERATIONS_ERROR; diff --git a/source4/lib/ldb/modules/paged_searches.c b/source4/lib/ldb/modules/paged_searches.c index c5430eb9bf1f..fe83f5e96d89 100644 --- a/source4/lib/ldb/modules/paged_searches.c +++ b/source4/lib/ldb/modules/paged_searches.c @@ -52,7 +52,7 @@ struct ps_context { bool pending; char **saved_referrals; - int num_referrals; + unsigned int num_referrals; struct ldb_request *down_req; }; @@ -132,7 +132,7 @@ static int send_referrals(struct ps_context *ac) { struct ldb_reply *ares; int ret; - int i; + unsigned int i; for (i = 0; i < ac->num_referrals; i++) { ares = talloc_zero(ac->req, struct ldb_reply); diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c index 2a3c6fd1dcea..e0e426db6dd0 100644 --- a/source4/lib/ldb/modules/rdn_name.c +++ b/source4/lib/ldb/modules/rdn_name.c @@ -48,7 +48,7 @@ struct rename_context { static struct ldb_message_element *rdn_name_find_attribute(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(name, msg->elements[i].name) == 0) { @@ -94,7 +94,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req) const struct ldb_schema_attribute *a; const char *rdn_name; struct ldb_val rdn_val; - int i, ret; + int ret; ldb = ldb_module_get_ctx(module); @@ -139,6 +139,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_OPERATIONS_ERROR; } } else { + unsigned int i; a = ldb_schema_attribute_by_name(ldb, rdn_name); for (i = 0; i < attribute->num_values; i++) { diff --git a/source4/lib/ldb/modules/sort.c b/source4/lib/ldb/modules/sort.c index 5d1431d7394b..1da5590c2433 100644 --- a/source4/lib/ldb/modules/sort.c +++ b/source4/lib/ldb/modules/sort.c @@ -62,7 +62,7 @@ static int build_response(void *mem_ctx, struct ldb_control ***ctrls, int result { struct ldb_control **controls; struct ldb_sort_resp_control *resp; - int i; + unsigned int i; if (*ctrls) { controls = *ctrls; @@ -137,7 +137,8 @@ static int server_sort_results(struct sort_context *ac) { struct ldb_context *ldb; struct ldb_reply *ares; - int i, ret; + unsigned int i; + int ret; ldb = ldb_module_get_ctx(ac->module); diff --git a/source4/lib/ldb/nssldb/ldb-nss.c b/source4/lib/ldb/nssldb/ldb-nss.c index 8f7321031bed..6111749c7a22 100644 --- a/source4/lib/ldb/nssldb/ldb-nss.c +++ b/source4/lib/ldb/nssldb/ldb-nss.c @@ -191,7 +191,7 @@ NSS_STATUS _ldb_nss_fill_group(struct group *result, size_t len; size_t bufpos; size_t lsize; - int i; + unsigned int i; bufpos = 0; @@ -280,7 +280,7 @@ NSS_STATUS _ldb_nss_fill_initgr(gid_t group, struct ldb_result *grlist) { NSS_STATUS ret; - int i; + unsigned int int i; for (i = 0; i < grlist->count; i++) { diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c index f2becb17af40..869d5ca8c303 100644 --- a/source4/lib/ldb/tools/cmdline.c +++ b/source4/lib/ldb/tools/cmdline.c @@ -347,8 +347,8 @@ failed: */ int handle_controls_reply(struct ldb_control **reply, struct ldb_control **request) { - int i, j; - int ret = 0; + unsigned int i, j; + int ret = 0; if (reply == NULL || request == NULL) return -1; diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c index e618ab52f735..0dd35cc1b3c8 100644 --- a/source4/lib/ldb/tools/ldbadd.c +++ b/source4/lib/ldb/tools/ldbadd.c @@ -35,7 +35,7 @@ #include "tools/cmdline.h" #include "ldbutil.h" -static int failures; +static unsigned int failures; static struct ldb_cmdline *options; static void usage(void) @@ -50,7 +50,7 @@ static void usage(void) /* add records from an opened file */ -static int process_file(struct ldb_context *ldb, FILE *f, int *count) +static int process_file(struct ldb_context *ldb, FILE *f, unsigned int *count) { struct ldb_ldif *ldif; int ret = LDB_SUCCESS; @@ -93,7 +93,8 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count) int main(int argc, const char **argv) { struct ldb_context *ldb; - int i, ret=0, count=0; + unsigned int i, count = 0; + int ret=0; ldb = ldb_init(NULL, NULL); diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c index 6de15ee042a5..056f4bf83fb3 100644 --- a/source4/lib/ldb/tools/ldbdel.c +++ b/source4/lib/ldb/tools/ldbdel.c @@ -45,7 +45,8 @@ static int dn_cmp(const void *p1, const void *p2) static int ldb_delete_recursive(struct ldb_context *ldb, struct ldb_dn *dn,struct ldb_control **req_ctrls) { - int ret, i, total=0; + int ret; + unsigned int i, total=0; const char *attrs[] = { NULL }; struct ldb_result *res; diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c index ecadf0f61c12..4c5683cd835f 100644 --- a/source4/lib/ldb/tools/ldbedit.c +++ b/source4/lib/ldb/tools/ldbedit.c @@ -88,10 +88,10 @@ static int modify_record(struct ldb_context *ldb, */ static struct ldb_message *msg_find(struct ldb_context *ldb, struct ldb_message **msgs, - int count, + unsigned int count, struct ldb_dn *dn) { - int i; + unsigned int i; for (i=0;idn) == 0) { return msgs[i]; @@ -104,10 +104,10 @@ static struct ldb_message *msg_find(struct ldb_context *ldb, merge the changes in msgs2 into the messages from msgs1 */ static int merge_edits(struct ldb_context *ldb, - struct ldb_message **msgs1, int count1, - struct ldb_message **msgs2, int count2) + struct ldb_message **msgs1, unsigned int count1, + struct ldb_message **msgs2, unsigned int count2) { - int i; + unsigned int i; struct ldb_message *msg; int ret = 0; int adds=0, modifies=0, deletes=0; @@ -171,9 +171,9 @@ static int merge_edits(struct ldb_context *ldb, save a set of messages as ldif to a file */ static int save_ldif(struct ldb_context *ldb, - FILE *f, struct ldb_message **msgs, int count) + FILE *f, struct ldb_message **msgs, unsigned int count) { - int i; + unsigned int i; fprintf(f, "# editing %d records\n", count); @@ -194,8 +194,8 @@ static int save_ldif(struct ldb_context *ldb, /* edit the ldb search results in msgs using the user selected editor */ -static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, int count1, - const char *editor) +static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, + unsigned int count1, const char *editor) { int fd, ret; FILE *f; @@ -203,7 +203,7 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, int coun char *cmd; struct ldb_ldif *ldif; struct ldb_message **msgs2 = NULL; - int count2 = 0; + unsigned int count2 = 0; /* write out the original set of messages to a temporary file */ diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c index 8f7ee1ce382f..7e71f5fcbf13 100644 --- a/source4/lib/ldb/tools/ldbsearch.c +++ b/source4/lib/ldb/tools/ldbsearch.c @@ -54,15 +54,15 @@ struct search_context { struct ldb_control **req_ctrls; int sort; - int num_stored; + unsigned int num_stored; struct ldb_message **store; - int refs_stored; + unsigned int refs_stored; char **refs_store; - int entries; - int refs; + unsigned int entries; + unsigned int refs; - int pending; + unsigned int pending; int status; }; @@ -245,7 +245,7 @@ again: goto again; if (sctx->sort && (sctx->num_stored != 0 || sctx->refs != 0)) { - int i; + unsigned int i; if (sctx->num_stored) { ldb_qsort(sctx->store, sctx->num_stored, sizeof(struct ldb_message *), diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c index adc6ec811592..3b53047ed4b7 100644 --- a/source4/lib/ldb/tools/ldbtest.c +++ b/source4/lib/ldb/tools/ldbtest.c @@ -52,10 +52,10 @@ static double _end_timer(void) static void add_records(struct ldb_context *ldb, struct ldb_dn *basedn, - int count) + unsigned int count) { struct ldb_message msg; - int i; + unsigned int i; #if 0 if (ldb_lock(ldb, "transaction") != 0) { @@ -141,10 +141,10 @@ static void add_records(struct ldb_context *ldb, static void modify_records(struct ldb_context *ldb, struct ldb_dn *basedn, - int count) + unsigned int count) { struct ldb_message msg; - int i; + unsigned int i; for (i=0;i