s3: smbd: cleanup. Change 'int referral_count' -> 'size_t referral_count' in struct...
authorJeremy Allison <jra@samba.org>
Fri, 13 Dec 2019 17:52:31 +0000 (09:52 -0800)
committerRalph Boehme <slow@samba.org>
Mon, 16 Dec 2019 14:05:33 +0000 (14:05 +0000)
This is a non-negative count. Fix remaing code to not mix int and size_t.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/include/msdfs.h
source3/modules/vfs_default.c
source3/rpc_server/dfs/srv_dfs_nt.c
source3/smbd/msdfs.c

index 333a84082d69519b10af5ff6ab79be0f276b5556..6a851cb3330dc28f2512dc073ac561642b3e6ace 100644 (file)
@@ -53,7 +53,7 @@ struct junction_map {
        char *service_name;
        char *volume_name;
        const char *comment;
-       int referral_count;
+       size_t referral_count;
        struct referral* referral_list;
 };
 
index 5666e09f60b5a1392b3f5a05e8dd111f22fb060a..82238e4b96c38e36260db459afea783d743e121b 100644 (file)
@@ -192,7 +192,7 @@ static NTSTATUS vfswrap_get_dfs_referrals(struct vfs_handle_struct *handle,
        char *pathnamep = NULL;
        char *local_dfs_path = NULL;
        NTSTATUS status;
-       int i;
+       size_t i;
        uint16_t max_referral_level = r->in.req.max_referral_level;
 
        if (DEBUGLVL(10)) {
index 0a4d6d31b7c372ba99668020d546c6f2ec790ed0..55cd045abd0fa8da00aa5f8cbd51b926b7407c22 100644 (file)
@@ -162,9 +162,11 @@ WERROR _dfs_Remove(struct pipes_struct *p, struct dfs_Remove *r)
                        return WERR_NERR_DFSNOSUCHVOLUME;
                }
        } else {
-               int i=0;
+               size_t i = 0;
                /* compare each referral in the list with the one to remove */
-               DEBUG(10,("altpath: .%s. refcnt: %d\n", altpath, jn->referral_count));
+               DBG_DEBUG("altpath: .%s. refcnt: %zu\n",
+                               altpath,
+                               jn->referral_count);
                for(i=0;i<jn->referral_count;i++) {
                        char *refpath = talloc_strdup(ctx,
                                        jn->referral_list[i].alternate_path);
@@ -226,7 +228,7 @@ static bool init_reply_dfs_info_2(TALLOC_CTX *mem_ctx, struct junction_map* j, s
 
 static bool init_reply_dfs_info_3(TALLOC_CTX *mem_ctx, struct junction_map* j, struct dfs_Info3* dfs3)
 {
-       int ii;
+       size_t ii;
        if (j->volume_name[0] == '\0')
                dfs3->path = talloc_asprintf(mem_ctx, "\\\\%s\\%s",
                        lp_netbios_name(), j->service_name);
@@ -268,7 +270,7 @@ static bool init_reply_dfs_info_3(TALLOC_CTX *mem_ctx, struct junction_map* j, s
                        continue;
                }
                *p = '\0';
-               DEBUG(5,("storage %d: %s.%s\n",ii,path,p+1));
+               DBG_INFO("storage %zu: %s.%s\n",ii,path,p+1);
                stor->state = 2; /* set all stores as ONLINE */
                stor->server = talloc_strdup(mem_ctx, path);
                stor->share = talloc_strdup(mem_ctx, p+1);
index 67e736a84f08369912a27d917b568678dc0e18b9..da9b847b96d315ff82643376e46fd42319dae301 100644 (file)
@@ -535,12 +535,12 @@ static bool parse_msdfs_symlink(TALLOC_CTX *ctx,
                                int snum,
                                const char *target,
                                struct referral **preflist,
-                               int *refcount)
+                               size_t *refcount)
 {
        char *temp = NULL;
        char *prot;
        char **alt_path = NULL;
-       int count = 0, i;
+       size_t count = 0, i;
        struct referral *reflist;
        char *saveptr;
 
@@ -570,7 +570,7 @@ static bool parse_msdfs_symlink(TALLOC_CTX *ctx,
                shuffle_strlist(alt_path, count);
        }
 
-       DEBUG(10,("parse_msdfs_symlink: count=%d\n", count));
+       DBG_DEBUG("count=%zu\n", count);
 
        if (count) {
                reflist = *preflist = talloc_zero_array(ctx,
@@ -1083,7 +1083,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
        if (pdp->reqpath[0] == '\0') {
                char *tmp;
                struct referral *ref;
-               int refcount;
+               size_t refcount;
 
                if (*lp_msdfs_proxy(talloc_tos(), lp_sub, snum) == '\0') {
                        TALLOC_FREE(frame);
@@ -1363,7 +1363,7 @@ bool create_msdfs_link(const struct junction_map *jucn)
        char *path = NULL;
        char *msdfs_link = NULL;
        connection_struct *conn;
-       int i=0;
+       size_t i = 0;
        bool insert_comma = False;
        bool ret = False;
        struct smb_filename *smb_fname = NULL;