first...
authorStefan Metzmacher <metze@samba.org>
Tue, 2 Feb 2010 17:14:15 +0000 (18:14 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 4 Feb 2010 13:53:40 +0000 (14:53 +0100)
26 files changed:
source4/lib/ldb/common/ldb.c
source4/lib/ldb/common/ldb_attributes.c
source4/lib/ldb/common/ldb_match.c
source4/lib/ldb/common/ldb_modules.c
source4/lib/ldb/common/ldb_msg.c
source4/lib/ldb/common/ldb_parse.c
source4/lib/ldb/common/ldb_utf8.c
source4/lib/ldb/ldb_map/ldb_map.c
source4/lib/ldb/ldb_map/ldb_map_inbound.c
source4/lib/ldb/ldb_map/ldb_map_outbound.c
source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
source4/lib/ldb/ldb_tdb/ldb_cache.c
source4/lib/ldb/ldb_tdb/ldb_index.c
source4/lib/ldb/ldb_tdb/ldb_tdb.c
source4/lib/ldb/modules/asq.c
source4/lib/ldb/modules/paged_results.c
source4/lib/ldb/modules/paged_searches.c
source4/lib/ldb/modules/rdn_name.c
source4/lib/ldb/modules/sort.c
source4/lib/ldb/nssldb/ldb-nss.c
source4/lib/ldb/tools/cmdline.c
source4/lib/ldb/tools/ldbadd.c
source4/lib/ldb/tools/ldbdel.c
source4/lib/ldb/tools/ldbedit.c
source4/lib/ldb/tools/ldbsearch.c
source4/lib/ldb/tools/ldbtest.c

index 94fd6cde1ebac1795fd787b2da333af1aa87b9c0..305140068147dd7121f7cb8d472e355095a62d84 100644 (file)
@@ -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: <ALL>\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: <NONE>\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);
 
index 79c5dd69de43f0485abaf6e9a1633fbcccb3fb4e..87657a134e5def6e5f788ce232d67c5eb6e3930f 100644 (file)
@@ -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;i<ARRAY_SIZE(wellknown);i++) {
@@ -254,7 +254,7 @@ int ldb_dn_extended_add_syntax(struct ldb_context *ldb,
                               unsigned flags,
                               const struct ldb_dn_extended_syntax *syntax)
 {
-       int n;
+       unsigned int n;
        struct ldb_dn_extended_syntax *a;
 
        if (!syntax) {
@@ -284,7 +284,7 @@ int ldb_dn_extended_add_syntax(struct ldb_context *ldb,
 const struct ldb_dn_extended_syntax *ldb_dn_extended_syntax_by_name(struct ldb_context *ldb,
                                                                    const char *name)
 {
-       int i;
+       unsigned int i;
        for (i=0; i < ldb->schema.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];
index f639effc96b17f621fca53360ce84af92e6a015d..5bc4c57cf453eedbfb8793c2d113681c14892086 100644 (file)
@@ -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 *);
index 3b8934702aef017aa36852bf15f67a3110cb737a..aac5470cf3b3bd2e8320502d6ac87f3aa757400a 100644 (file)
@@ -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]);
index 9f90f3340562d8676c77a4403b09bb60a5a0a5b9..04761f8867c2b77d29c3bc132111b9309d7b9263 100644 (file)
@@ -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;
index ba16b57da3f3f94892c28c8e3704ea887a682bfe..7c63414935af3ed10d2d85a5f410af4f571f2cca 100644 (file)
@@ -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;i<val.length;i++) {
@@ -162,7 +162,7 @@ static char *ldb_parse_find_wildcard(char *value)
 static struct ldb_val **ldb_wildcard_decode(void *mem_ctx, const char *string)
 {
        struct ldb_val **ret = NULL;
-       int val = 0;
+       unsigned int val = 0;
        char *wc, *str;
 
        wc = talloc_strdup(mem_ctx, string);
@@ -657,7 +657,7 @@ struct ldb_parse_tree *ldb_parse_tree(void *mem_ctx, const char *s)
 char *ldb_filter_from_tree(void *mem_ctx, struct ldb_parse_tree *tree)
 {
        char *s, *s2, *ret;
-       int i;
+       unsigned int i;
 
        if (tree == NULL) {
                return NULL;
@@ -780,7 +780,7 @@ void ldb_parse_tree_attr_replace(struct ldb_parse_tree *tree,
                                 const char *attr, 
                                 const char *replace)
 {
-       int i;
+       unsigned int i;
        switch (tree->operation) {
        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);
index 0a8a89ac1d14e2d48a1248f613c8a7e1c4f2f20e..5587d77dc7e6757895362595ca913c22bf020928 100644 (file)
@@ -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;
index ab9578bd884e6478de3e437f4c8c4b2c4eaef556..483222ec2044d417720879f3af08d4820fd5b2d1 100644 (file)
@@ -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 */
index 5a948cff69dd0c00399f1db2f1a45dc6968f695a..cdc88afbc51615bc9c41ff24814662cc912f7179 100644 (file)
@@ -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);
 
index 922d13991bb61499c6cbed9b77f30086c7574dc0..7860a1c8db3ca7101ffd1b4761a19a5a93ec00d8 100644 (file)
@@ -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));
index f07b330a8b80d008d9649868127242c80bc8ddcd..fcf1c117242d55a4d1645cd8b0bf735638dd8402 100644 (file)
@@ -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)
index aa19f75e9c250e0389ea0808a9112cf34057f89f..0b87ec7a8cb54c629e17ea240076670c89b56cdf 100644 (file)
@@ -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;i<el->num_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)) {
index 4b31021001115e2f32f3e4518479eb0f8bdb119c..33a5529615556a6860bb905a8bf4d6a5767188b8 100644 (file)
@@ -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;
index bad0928c23dc2ef02bfe0b0c47b7d3937923a0eb..c17107ae0777fff551a85155b85688f1f9a2e3c5 100644 (file)
@@ -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) {
index 491868301c46b945465d88b037b36abbfbd01cea..6d1e88b67b8f1a4d22c4c7a2d723879396dab82c 100644 (file)
@@ -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;
index ff1b92ff97e16cf51e36919cc5e8c44b2c673e99..bca38c8eaddea4cbd748d9531159927f8f04de11 100644 (file)
@@ -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;
index c5430eb9bf1f7965bd6710c7a53b59016d872f3b..fe83f5e96d89c28b780f71fd66980c1abff084ce 100644 (file)
@@ -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);
index 2a3c6fd1dcea0e3177c109fc4bdb3373c3abefa0..e0e426db6dd0dc37956e119e3ae336c6f5888fac 100644 (file)
@@ -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++) {
index 5d1431d7394b09a603a0cc5d087033cfda101c19..1da5590c24333f551c5296cc0924557ff7fd1315 100644 (file)
@@ -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);
 
index 8f7321031bede901cf8fd44eb7724df193726e15..6111749c7a22b111cbaeefe1190ac1730a7ce0b0 100644 (file)
@@ -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++) {
 
index f2becb17af403079a905f5482b683181cb963d16..869d5ca8c30309b38e4602dc911e4fab128c688e 100644 (file)
@@ -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;
        
index e618ab52f735443b078817c56a88879158954f3a..0dd35cc1b3c815d052262cdb9f140e1ce33b950f 100644 (file)
@@ -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);
 
index 6de15ee042a50f63efc30613c9052bd774d35562..056f4bf83fb3d16e2ecc36c3f29a587f34ddbe57 100644 (file)
@@ -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;
        
index ecadf0f61c1266c70b413910ea566dc2c468f679..4c5683cd835f9c8c615ec3acb7faa3c5f05e7de0 100644 (file)
@@ -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;i<count;i++) {
                if (ldb_dn_compare(dn, msgs[i]->dn) == 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 */
index 8f7ee1ce382fdf52d2980fb88afcb66b667eccf0..7e71f5fcbf1366f73d6b37601faa0f30478c86d1 100644 (file)
@@ -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 *),
index adc6ec8115920e4226271b299fce02252420cbaa..3b53047ed4b7e50a979c223731d2111703794c88 100644 (file)
@@ -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<count;i++) {
                struct ldb_message_element el[3];
@@ -194,9 +194,9 @@ static void modify_records(struct ldb_context *ldb,
 
 static void delete_records(struct ldb_context *ldb,
                           struct ldb_dn *basedn,
-                          int count)
+                          unsigned int count)
 {
-       int i;
+       unsigned int i;
 
        for (i=0;i<count;i++) {
                struct ldb_dn *dn;
@@ -217,9 +217,10 @@ static void delete_records(struct ldb_context *ldb,
        printf("\n");
 }
 
-static void search_uid(struct ldb_context *ldb, struct ldb_dn *basedn, int nrecords, int nsearches)
+static void search_uid(struct ldb_context *ldb, struct ldb_dn *basedn,
+                      unsigned int nrecords, unsigned int nsearches)
 {
-       int i;
+       unsigned int i;
 
        for (i=0;i<nsearches;i++) {
                int uid = (i * 700 + 17) % (nrecords * 2);
@@ -250,7 +251,8 @@ static void search_uid(struct ldb_context *ldb, struct ldb_dn *basedn, int nreco
        printf("\n");
 }
 
-static void start_test(struct ldb_context *ldb, int nrecords, int nsearches)
+static void start_test(struct ldb_context *ldb, unsigned int nrecords,
+                      unsigned int nsearches)
 {
        struct ldb_dn *basedn;