diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-11-06 18:35:17 +0100 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2010-03-08 10:29:25 +0100 |
commit | b33a340e0a2dcf972f0e53d3ff28a17eb42e4582 (patch) | |
tree | 88efd0d4566c1952340640d81d1c9ca056de0a15 /source4/lib/ldb/ldb_map | |
parent | 7a7cb5e9c25131e6eadc24f2e5a5a020e015731d (diff) | |
download | samba-b33a340e0a2dcf972f0e53d3ff28a17eb42e4582.tar.gz samba-b33a340e0a2dcf972f0e53d3ff28a17eb42e4582.tar.bz2 samba-b33a340e0a2dcf972f0e53d3ff28a17eb42e4582.zip |
LDB:map - make LDB "signed-safe" on counter variables where appropriate
Diffstat (limited to 'source4/lib/ldb/ldb_map')
-rw-r--r-- | source4/lib/ldb/ldb_map/ldb_map.c | 16 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_map/ldb_map_inbound.c | 7 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_map/ldb_map_outbound.c | 26 |
3 files changed, 28 insertions, 21 deletions
diff --git a/source4/lib/ldb/ldb_map/ldb_map.c b/source4/lib/ldb/ldb_map/ldb_map.c index ab9578bd88..483222ec20 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 5a948cff69..cdc88afbc5 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 922d13991b..836aec9b1b 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)); @@ -1051,7 +1057,7 @@ int map_return_entry(struct map_context *ac, struct ldb_reply *ares) struct ldb_message_element *el; const char * const *attrs; struct ldb_context *ldb; - int i; + unsigned int i; ldb = ldb_module_get_ctx(ac->module); |