CIFS: Move getting dfs referalls to ops struct
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org> Signed-off-by: Steve French <smfrench@gmail.com>
This commit is contained in:
parent
aa24d1e969
commit
b669f33ca6
@ -162,6 +162,7 @@ struct TCP_Server_Info;
|
|||||||
struct cifsFileInfo;
|
struct cifsFileInfo;
|
||||||
struct cifs_ses;
|
struct cifs_ses;
|
||||||
struct cifs_tcon;
|
struct cifs_tcon;
|
||||||
|
struct dfs_info3_param;
|
||||||
|
|
||||||
struct smb_version_operations {
|
struct smb_version_operations {
|
||||||
int (*send_cancel)(struct TCP_Server_Info *, void *,
|
int (*send_cancel)(struct TCP_Server_Info *, void *,
|
||||||
@ -208,6 +209,10 @@ struct smb_version_operations {
|
|||||||
struct cifs_tcon *, const struct nls_table *);
|
struct cifs_tcon *, const struct nls_table *);
|
||||||
/* close tree connecion */
|
/* close tree connecion */
|
||||||
int (*tree_disconnect)(const unsigned int, struct cifs_tcon *);
|
int (*tree_disconnect)(const unsigned int, struct cifs_tcon *);
|
||||||
|
/* get DFS referrals */
|
||||||
|
int (*get_dfs_refer)(const unsigned int, struct cifs_ses *,
|
||||||
|
const char *, struct dfs_info3_param **,
|
||||||
|
unsigned int *, const struct nls_table *, int);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct smb_version_values {
|
struct smb_version_values {
|
||||||
|
@ -226,17 +226,16 @@ extern int CIFSSMBUnixQPathInfo(const unsigned int xid,
|
|||||||
const struct nls_table *nls_codepage, int remap);
|
const struct nls_table *nls_codepage, int remap);
|
||||||
|
|
||||||
extern int CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses,
|
extern int CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses,
|
||||||
const unsigned char *searchName,
|
const char *search_name,
|
||||||
struct dfs_info3_param **target_nodes,
|
struct dfs_info3_param **target_nodes,
|
||||||
unsigned int *number_of_nodes_in_array,
|
unsigned int *num_of_nodes,
|
||||||
const struct nls_table *nls_codepage, int remap);
|
const struct nls_table *nls_codepage, int remap);
|
||||||
|
|
||||||
extern int get_dfs_path(unsigned int xid, struct cifs_ses *pSesInfo,
|
extern int get_dfs_path(const unsigned int xid, struct cifs_ses *ses,
|
||||||
const char *old_path,
|
const char *old_path,
|
||||||
const struct nls_table *nls_codepage,
|
const struct nls_table *nls_codepage,
|
||||||
unsigned int *pnum_referrals,
|
unsigned int *num_referrals,
|
||||||
struct dfs_info3_param **preferrals,
|
struct dfs_info3_param **referrals, int remap);
|
||||||
int remap);
|
|
||||||
extern void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,
|
extern void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,
|
||||||
struct cifs_sb_info *cifs_sb,
|
struct cifs_sb_info *cifs_sb,
|
||||||
struct smb_vol *vol);
|
struct smb_vol *vol);
|
||||||
|
@ -4766,8 +4766,7 @@ parse_DFS_referrals_exit:
|
|||||||
|
|
||||||
int
|
int
|
||||||
CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses,
|
CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses,
|
||||||
const unsigned char *searchName,
|
const char *search_name, struct dfs_info3_param **target_nodes,
|
||||||
struct dfs_info3_param **target_nodes,
|
|
||||||
unsigned int *num_of_nodes,
|
unsigned int *num_of_nodes,
|
||||||
const struct nls_table *nls_codepage, int remap)
|
const struct nls_table *nls_codepage, int remap)
|
||||||
{
|
{
|
||||||
@ -4781,7 +4780,7 @@ CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses,
|
|||||||
*num_of_nodes = 0;
|
*num_of_nodes = 0;
|
||||||
*target_nodes = NULL;
|
*target_nodes = NULL;
|
||||||
|
|
||||||
cFYI(1, "In GetDFSRefer the path %s", searchName);
|
cFYI(1, "In GetDFSRefer the path %s", search_name);
|
||||||
if (ses == NULL)
|
if (ses == NULL)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
getDFSRetry:
|
getDFSRetry:
|
||||||
@ -4804,14 +4803,14 @@ getDFSRetry:
|
|||||||
pSMB->hdr.Flags2 |= SMBFLG2_UNICODE;
|
pSMB->hdr.Flags2 |= SMBFLG2_UNICODE;
|
||||||
name_len =
|
name_len =
|
||||||
cifsConvertToUTF16((__le16 *) pSMB->RequestFileName,
|
cifsConvertToUTF16((__le16 *) pSMB->RequestFileName,
|
||||||
searchName, PATH_MAX, nls_codepage,
|
search_name, PATH_MAX, nls_codepage,
|
||||||
remap);
|
remap);
|
||||||
name_len++; /* trailing null */
|
name_len++; /* trailing null */
|
||||||
name_len *= 2;
|
name_len *= 2;
|
||||||
} else { /* BB improve the check for buffer overruns BB */
|
} else { /* BB improve the check for buffer overruns BB */
|
||||||
name_len = strnlen(searchName, PATH_MAX);
|
name_len = strnlen(search_name, PATH_MAX);
|
||||||
name_len++; /* trailing null */
|
name_len++; /* trailing null */
|
||||||
strncpy(pSMB->RequestFileName, searchName, name_len);
|
strncpy(pSMB->RequestFileName, search_name, name_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ses->server) {
|
if (ses->server) {
|
||||||
@ -4867,7 +4866,7 @@ getDFSRetry:
|
|||||||
/* parse returned result into more usable form */
|
/* parse returned result into more usable form */
|
||||||
rc = parse_DFS_referrals(pSMBr, num_of_nodes,
|
rc = parse_DFS_referrals(pSMBr, num_of_nodes,
|
||||||
target_nodes, nls_codepage, remap,
|
target_nodes, nls_codepage, remap,
|
||||||
searchName);
|
search_name);
|
||||||
|
|
||||||
GetDFSRefExit:
|
GetDFSRefExit:
|
||||||
cifs_buf_release(pSMB);
|
cifs_buf_release(pSMB);
|
||||||
|
@ -2767,14 +2767,14 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
get_dfs_path(unsigned int xid, struct cifs_ses *ses, const char *old_path,
|
get_dfs_path(const unsigned int xid, struct cifs_ses *ses, const char *old_path,
|
||||||
const struct nls_table *nls_codepage, unsigned int *num_referrals,
|
const struct nls_table *nls_codepage, unsigned int *num_referrals,
|
||||||
struct dfs_info3_param **referrals, int remap)
|
struct dfs_info3_param **referrals, int remap)
|
||||||
{
|
{
|
||||||
char *temp_unc;
|
char *temp_unc;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (!ses->server->ops->tree_connect)
|
if (!ses->server->ops->tree_connect || !ses->server->ops->get_dfs_refer)
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
|
|
||||||
*num_referrals = 0;
|
*num_referrals = 0;
|
||||||
@ -2796,11 +2796,12 @@ get_dfs_path(unsigned int xid, struct cifs_ses *ses, const char *old_path,
|
|||||||
kfree(temp_unc);
|
kfree(temp_unc);
|
||||||
}
|
}
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
rc = CIFSGetDFSRefer(xid, ses, old_path, referrals,
|
rc = ses->server->ops->get_dfs_refer(xid, ses, old_path,
|
||||||
num_referrals, nls_codepage, remap);
|
referrals, num_referrals,
|
||||||
|
nls_codepage, remap);
|
||||||
/*
|
/*
|
||||||
* BB - map targetUNCs to dfs_info3 structures, here or in
|
* BB - map targetUNCs to dfs_info3 structures, here or in
|
||||||
* CIFSGetDFSRefer.
|
* ses->server->ops->get_dfs_refer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@ -3488,7 +3489,7 @@ build_unc_path_to_root(const struct smb_vol *vol,
|
|||||||
* determine whether there were referrals.
|
* determine whether there were referrals.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
expand_dfs_referral(unsigned int xid, struct cifs_ses *pSesInfo,
|
expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses,
|
||||||
struct smb_vol *volume_info, struct cifs_sb_info *cifs_sb,
|
struct smb_vol *volume_info, struct cifs_sb_info *cifs_sb,
|
||||||
int check_prefix)
|
int check_prefix)
|
||||||
{
|
{
|
||||||
@ -3504,7 +3505,7 @@ expand_dfs_referral(unsigned int xid, struct cifs_ses *pSesInfo,
|
|||||||
/* For DFS paths, skip the first '\' of the UNC */
|
/* For DFS paths, skip the first '\' of the UNC */
|
||||||
ref_path = check_prefix ? full_path + 1 : volume_info->UNC + 1;
|
ref_path = check_prefix ? full_path + 1 : volume_info->UNC + 1;
|
||||||
|
|
||||||
rc = get_dfs_path(xid, pSesInfo , ref_path, cifs_sb->local_nls,
|
rc = get_dfs_path(xid, ses, ref_path, cifs_sb->local_nls,
|
||||||
&num_referrals, &referrals,
|
&num_referrals, &referrals,
|
||||||
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
|
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
|
||||||
|
|
||||||
|
@ -434,6 +434,7 @@ struct smb_version_operations smb1_operations = {
|
|||||||
.logoff = CIFSSMBLogoff,
|
.logoff = CIFSSMBLogoff,
|
||||||
.tree_connect = CIFSTCon,
|
.tree_connect = CIFSTCon,
|
||||||
.tree_disconnect = CIFSSMBTDis,
|
.tree_disconnect = CIFSSMBTDis,
|
||||||
|
.get_dfs_refer = CIFSGetDFSRefer,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct smb_version_values smb1_values = {
|
struct smb_version_values smb1_values = {
|
||||||
|
Loading…
Reference in New Issue
Block a user