The branch, master has been updated via f8dba77... s4:ldb_ldap.c - fix indentation via 2d03011... LDB:TDB backend - change counter variables to "unsigned" where appropriate via 4a2b78a... LDB:SQLITE3 backend - change counter variables to "unsigned" where appropriate via 95d726f... LDB:LDAP backend - change a counter variable to "unsigned" via b33a340... LDB:map - make LDB "signed-safe" on counter variables where appropriate via 7a7cb5e... s4:ldif_handlers - Change "unsigned int" to "uint32_t" which fits better here from 818d518... s4-gensec: Fixed wrong usage of error_string.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit f8dba773a5174055e3c206d006317b5275481636 Author: Matthias Dieter Wallnöfer <mwallnoe...@yahoo.de> Date: Mon Mar 8 09:58:28 2010 +0100 s4:ldb_ldap.c - fix indentation commit 2d03011858ca33ee56b4c36ac6a901850ff69864 Author: Matthias Dieter Wallnöfer <mwallnoe...@yahoo.de> Date: Fri Nov 6 18:35:17 2009 +0100 LDB:TDB backend - change counter variables to "unsigned" where appropriate commit 4a2b78a6f36d4eb2a8763464f33720936921650c Author: Matthias Dieter Wallnöfer <mwallnoe...@yahoo.de> Date: Fri Nov 6 18:35:17 2009 +0100 LDB:SQLITE3 backend - change counter variables to "unsigned" where appropriate commit 95d726f3018ef5d249f89d56bde24b7ee0c24ecf Author: Matthias Dieter Wallnöfer <mwallnoe...@yahoo.de> Date: Fri Nov 6 18:35:17 2009 +0100 LDB:LDAP backend - change a counter variable to "unsigned" commit b33a340e0a2dcf972f0e53d3ff28a17eb42e4582 Author: Matthias Dieter Wallnöfer <mwallnoe...@yahoo.de> Date: Fri Nov 6 18:35:17 2009 +0100 LDB:map - make LDB "signed-safe" on counter variables where appropriate commit 7a7cb5e9c25131e6eadc24f2e5a5a020e015731d Author: Matthias Dieter Wallnöfer <mwallnoe...@yahoo.de> Date: Mon Mar 8 08:02:32 2010 +0100 s4:ldif_handlers - Change "unsigned int" to "uint32_t" which fits better here ----------------------------------------------------------------------- Summary of changes: source4/lib/ldb-samba/ldif_handlers.c | 2 +- source4/lib/ldb/ldb_ldap/ldb_ldap.c | 4 ++-- source4/lib/ldb/ldb_map/ldb_map.c | 16 ++++++++-------- source4/lib/ldb/ldb_map/ldb_map_inbound.c | 7 ++++--- source4/lib/ldb/ldb_map/ldb_map_outbound.c | 26 ++++++++++++++++---------- source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c | 18 ++++++++++-------- source4/lib/ldb/ldb_tdb/ldb_cache.c | 11 ++++++----- source4/lib/ldb/ldb_tdb/ldb_index.c | 12 ++++++------ source4/lib/ldb/ldb_tdb/ldb_search.c | 5 +++-- source4/lib/ldb/ldb_tdb/ldb_tdb.c | 5 +++-- source4/lib/ldb/ldb_tdb/ldb_tdb.h | 2 +- 11 files changed, 60 insertions(+), 48 deletions(-) Changeset truncated at 500 lines: diff --git a/source4/lib/ldb-samba/ldif_handlers.c b/source4/lib/ldb-samba/ldif_handlers.c index b5a6630..4d7d5db 100644 --- a/source4/lib/ldb-samba/ldif_handlers.c +++ b/source4/lib/ldb-samba/ldif_handlers.c @@ -594,7 +594,7 @@ static int ldif_write_prefixMap(struct ldb_context *ldb, void *mem_ctx, struct prefixMapBlob *blob; enum ndr_err_code ndr_err; char *string; - unsigned int i; + uint32_t i; if (ldb_get_flags(ldb) & LDB_FLG_SHOW_BINARY) { int err; diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index 4e88cc4..11edd34 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -387,7 +387,7 @@ static int lldb_rename(struct lldb_context *lldb_ac) struct ldb_module *module = lldb_ac->module; struct ldb_request *req = lldb_ac->req; char *old_dn; - char *newrdn; + char *newrdn; char *parentdn; int ret; @@ -483,8 +483,8 @@ static bool lldb_parse_result(struct lldb_context *ac, LDAPMessage *result) bool callback_failed; bool request_done; bool lret; + unsigned int i; int ret; - int i; ldb = ldb_module_get_ctx(ac->module); diff --git a/source4/lib/ldb/ldb_map/ldb_map.c b/source4/lib/ldb/ldb_map/ldb_map.c index ab9578b..483222e 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 5a948cf..cdc88af 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 922d139..836aec9 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); diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c index c899646..7dcb1f9 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); @@ -667,7 +667,8 @@ static int lsqlite3_search_callback(void *result, int col_num, char **cols, char struct lsql_context *ac; struct ldb_message *msg; long long eid; - int i, ret; + unsigned int i; + int ret; ac = talloc_get_type(result, struct lsql_context); ldb = ldb_module_get_ctx(ac->module); @@ -986,7 +987,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 +1044,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); @@ -1110,9 +1111,9 @@ static int lsql_modify(struct lsql_context *ctx) struct lsqlite3_private *lsqlite3; struct ldb_context *ldb; struct ldb_message *msg = req->op.mod.message; - long long eid; + long long eid; char *errmsg; - int i; + unsigned int i; int ret; ldb = ldb_module_get_ctx(module); @@ -1136,7 +1137,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 +1895,8 @@ static int lsqlite3_connect(struct ldb_context *ldb, { struct ldb_module *module; struct lsqlite3_private *lsqlite3; - int i, ret; + unsigned int i; + int ret; module = ldb_module_new(ldb, ldb, "ldb_sqlite3 backend", &lsqlite3_ops); if (!module) return LDB_ERR_OPERATIONS_ERROR; diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c index aa19f75..2f0ba22 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,10 +83,10 @@ 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;i<el->num_values;i++) { - int j; + unsigned int j; for (j=0;ltdb_valid_attr_flags[j].name;j++) { if (strcmp(ltdb_valid_attr_flags[j].name, (char *)el->values[i].data) == 0) { @@ -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 bb4617d..c9c3e0c 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; i<list->count; 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; @@ -1279,12 +1279,13 @@ int ltdb_index_add_new(struct ldb_module *module, const struct ldb_message *msg) delete an index entry for one message element */ int ltdb_index_del_value(struct ldb_module *module, struct ldb_dn *dn, - struct ldb_message_element *el, int v_idx) + struct ldb_message_element *el, unsigned int v_idx) { struct ldb_context *ldb; struct ldb_dn *dn_key; const char *dn_str; int ret, i; + unsigned int j; struct dn_list *list; ldb = ldb_module_get_ctx(module); @@ -1329,9 +1330,8 @@ int ltdb_index_del_value(struct ldb_module *module, struct ldb_dn *dn, return LDB_SUCCESS; } - if (i != list->count-1) { - memmove(&list->dn[i], &list->dn[i+1], sizeof(list->dn[0])*(list->count - (i+1))); - } + j = (unsigned int) i; + memmove(&list->dn[j], &list->dn[j+1], sizeof(list->dn[0])*(list->count - (i+1))); list->count--; list->dn = talloc_realloc(list, list->dn, struct ldb_val, list->count); diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c index 268c2f3..efd6968 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_search.c +++ b/source4/lib/ldb/ldb_tdb/ldb_search.c @@ -145,7 +145,7 @@ static struct ldb_message *ltdb_pull_attrs(struct ldb_module *module, const char * const *attrs) { struct ldb_message *ret; - int i; + unsigned int i; ret = talloc(mem_ctx, struct ldb_message); if (!ret) { @@ -325,7 +325,8 @@ int ltdb_add_attr_results(struct ldb_module *module, */ int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs) { - int i, keep_all = 0; + unsigned int i; + int keep_all = 0; if (attrs) { /* check for special attrs */ diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index fc9a949..cf62538 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/ldb_tdb/ldb_tdb.h b/source4/lib/ldb/ldb_tdb/ldb_tdb.h index 70b99c3..8faefc3 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.h +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.h @@ -93,7 +93,7 @@ int ltdb_index_del_element(struct ldb_module *module, struct ldb_dn *dn, int ltdb_index_add_element(struct ldb_module *module, struct ldb_dn *dn, struct ldb_message_element *el); int ltdb_index_del_value(struct ldb_module *module, struct ldb_dn *dn, - struct ldb_message_element *el, int v_idx); + struct ldb_message_element *el, unsigned int v_idx); int ltdb_reindex(struct ldb_module *module); int ltdb_index_transaction_start(struct ldb_module *module); int ltdb_index_transaction_commit(struct ldb_module *module); -- Samba Shared Repository