From: Jeremy Allison Date: Fri, 13 Dec 2019 17:52:31 +0000 (-0800) Subject: s3: smbd: cleanup. Change 'int referral_count' -> 'size_t referral_count' in struct... X-Git-Tag: ldb-2.1.0~254 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc1ec0a9f135ec32c05ae04d0b3bd47fdef5d47d;p=thirdparty%2Fsamba.git s3: smbd: cleanup. Change 'int referral_count' -> 'size_t referral_count' in struct junction_map. This is a non-negative count. Fix remaing code to not mix int and size_t. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/include/msdfs.h b/source3/include/msdfs.h index 333a84082d6..6a851cb3330 100644 --- a/source3/include/msdfs.h +++ b/source3/include/msdfs.h @@ -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; }; diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 5666e09f60b..82238e4b96c 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -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)) { diff --git a/source3/rpc_server/dfs/srv_dfs_nt.c b/source3/rpc_server/dfs/srv_dfs_nt.c index 0a4d6d31b7c..55cd045abd0 100644 --- a/source3/rpc_server/dfs/srv_dfs_nt.c +++ b/source3/rpc_server/dfs/srv_dfs_nt.c @@ -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;ireferral_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); diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 67e736a84f0..da9b847b96d 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -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;