aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2008-05-16 14:48:38 -0400
committerSteve French <sfrench@us.ibm.com>2008-05-16 14:48:38 -0400
commita1fe78f16eac7d03d3c391dd5d54559826574982 (patch)
tree636561017d12be1a5d6e88541fa6ae206c74c8d6 /fs/cifs
parentfec4585fd71cc5ec35d134e8c3854f6e8c4503f0 (diff)
[CIFS] Add missing defines for DFS
Also has minor cleanup of previous patch CC: Igor Mammedov <niallain@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifspdu.h9
-rw-r--r--fs/cifs/cifssmb.c17
2 files changed, 18 insertions, 8 deletions
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index 93d5ee02a25b..65d58b4e6a61 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -1904,6 +1904,15 @@ typedef struct smb_com_transaction2_get_dfs_refer_req {
1904 char RequestFileName[1]; 1904 char RequestFileName[1];
1905} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ; 1905} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ;
1906 1906
1907#define DFS_VERSION cpu_to_le16(0x0003)
1908
1909/* DFS server target type */
1910#define DFS_TYPE_LINK 0x0000 /* also for sysvol targets */
1911#define DFS_TYPE_ROOT 0x0001
1912
1913/* Referral Entry Flags */
1914#define DFS_NAME_LIST_REF 0x0200
1915
1907typedef struct dfs_referral_level_3 { 1916typedef struct dfs_referral_level_3 {
1908 __le16 VersionNumber; 1917 __le16 VersionNumber;
1909 __le16 Size; 1918 __le16 Size;
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 6f8ed93a4ae8..7b9938445b07 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -107,6 +107,7 @@ cifs_strncpy_to_host(char **dst, const char *src, const int maxlen,
107 strncpy(*dst, src, plen); 107 strncpy(*dst, src, plen);
108 } 108 }
109 (*dst)[plen] = 0; 109 (*dst)[plen] = 0;
110 (*dst)[plen+1] = 0; /* harmless for ASCII case, needed for Unicode */
110 return 0; 111 return 0;
111 112
112cifs_strncpy_to_host_ErrExit: 113cifs_strncpy_to_host_ErrExit:
@@ -3907,7 +3908,7 @@ GetInodeNumOut:
3907 * on failure - errno 3908 * on failure - errno
3908 */ 3909 */
3909static int 3910static int
3910parse_DFS_REFERRALS(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr, 3911parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
3911 unsigned int *num_of_nodes, 3912 unsigned int *num_of_nodes,
3912 struct dfs_info3_param **target_nodes, 3913 struct dfs_info3_param **target_nodes,
3913 const struct nls_table *nls_codepage) 3914 const struct nls_table *nls_codepage)
@@ -3924,7 +3925,7 @@ parse_DFS_REFERRALS(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
3924 cERROR(1, ("num_referrals: must be at least > 0," 3925 cERROR(1, ("num_referrals: must be at least > 0,"
3925 "but we get num_referrals = %d\n", *num_of_nodes)); 3926 "but we get num_referrals = %d\n", *num_of_nodes));
3926 rc = -EINVAL; 3927 rc = -EINVAL;
3927 goto parse_DFS_REFERRALS_exit; 3928 goto parse_DFS_referrals_exit;
3928 } 3929 }
3929 3930
3930 ref = (struct dfs_referral_level_3 *) &(pSMBr->referrals); 3931 ref = (struct dfs_referral_level_3 *) &(pSMBr->referrals);
@@ -3932,7 +3933,7 @@ parse_DFS_REFERRALS(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
3932 cERROR(1, ("Referrals of V%d version are not supported," 3933 cERROR(1, ("Referrals of V%d version are not supported,"
3933 "should be V3", ref->VersionNumber)); 3934 "should be V3", ref->VersionNumber));
3934 rc = -EINVAL; 3935 rc = -EINVAL;
3935 goto parse_DFS_REFERRALS_exit; 3936 goto parse_DFS_referrals_exit;
3936 } 3937 }
3937 3938
3938 /* get the upper boundary of the resp buffer */ 3939 /* get the upper boundary of the resp buffer */
@@ -3948,7 +3949,7 @@ parse_DFS_REFERRALS(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
3948 if (*target_nodes == NULL) { 3949 if (*target_nodes == NULL) {
3949 cERROR(1, ("Failed to allocate buffer for target_nodes\n")); 3950 cERROR(1, ("Failed to allocate buffer for target_nodes\n"));
3950 rc = -ENOMEM; 3951 rc = -ENOMEM;
3951 goto parse_DFS_REFERRALS_exit; 3952 goto parse_DFS_referrals_exit;
3952 } 3953 }
3953 3954
3954 /* collect neccessary data from referrals */ 3955 /* collect neccessary data from referrals */
@@ -3968,7 +3969,7 @@ parse_DFS_REFERRALS(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
3968 rc = cifs_strncpy_to_host(&(node->path_name), temp, 3969 rc = cifs_strncpy_to_host(&(node->path_name), temp,
3969 max_len, is_unicode, nls_codepage); 3970 max_len, is_unicode, nls_codepage);
3970 if (rc) 3971 if (rc)
3971 goto parse_DFS_REFERRALS_exit; 3972 goto parse_DFS_referrals_exit;
3972 3973
3973 /* copy link target UNC */ 3974 /* copy link target UNC */
3974 temp = (char *)ref + le16_to_cpu(ref->NetworkAddressOffset); 3975 temp = (char *)ref + le16_to_cpu(ref->NetworkAddressOffset);
@@ -3976,12 +3977,12 @@ parse_DFS_REFERRALS(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
3976 rc = cifs_strncpy_to_host(&(node->node_name), temp, 3977 rc = cifs_strncpy_to_host(&(node->node_name), temp,
3977 max_len, is_unicode, nls_codepage); 3978 max_len, is_unicode, nls_codepage);
3978 if (rc) 3979 if (rc)
3979 goto parse_DFS_REFERRALS_exit; 3980 goto parse_DFS_referrals_exit;
3980 3981
3981 ref += ref->Size; 3982 ref += ref->Size;
3982 } 3983 }
3983 3984
3984parse_DFS_REFERRALS_exit: 3985parse_DFS_referrals_exit:
3985 if (rc) { 3986 if (rc) {
3986 free_dfs_info_array(*target_nodes, *num_of_nodes); 3987 free_dfs_info_array(*target_nodes, *num_of_nodes);
3987 *target_nodes = NULL; 3988 *target_nodes = NULL;
@@ -4090,7 +4091,7 @@ getDFSRetry:
4090 le16_to_cpu(pSMBr->t2.DataOffset))); 4091 le16_to_cpu(pSMBr->t2.DataOffset)));
4091 4092
4092 /* parse returned result into more usable form */ 4093 /* parse returned result into more usable form */
4093 rc = parse_DFS_REFERRALS(pSMBr, num_of_nodes, 4094 rc = parse_DFS_referrals(pSMBr, num_of_nodes,
4094 target_nodes, nls_codepage); 4095 target_nodes, nls_codepage);
4095 4096
4096GetDFSRefExit: 4097GetDFSRefExit: