aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/smb2ops.c')
-rw-r--r--fs/cifs/smb2ops.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 0e33ca32abf9..1266137406fa 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -157,6 +157,30 @@ smb2_negotiate(const unsigned int xid, struct cifs_ses *ses)
157 return rc; 157 return rc;
158} 158}
159 159
160static int
161smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon,
162 struct cifs_sb_info *cifs_sb, const char *full_path)
163{
164 int rc;
165 __u64 persistent_fid, volatile_fid;
166 __le16 *utf16_path;
167
168 utf16_path = cifs_convert_path_to_utf16(full_path, cifs_sb);
169 if (!utf16_path)
170 return -ENOMEM;
171
172 rc = SMB2_open(xid, tcon, utf16_path, &persistent_fid, &volatile_fid,
173 FILE_READ_ATTRIBUTES, FILE_OPEN, 0, 0);
174 if (rc) {
175 kfree(utf16_path);
176 return rc;
177 }
178
179 rc = SMB2_close(xid, tcon, persistent_fid, volatile_fid);
180 kfree(utf16_path);
181 return rc;
182}
183
160struct smb_version_operations smb21_operations = { 184struct smb_version_operations smb21_operations = {
161 .setup_request = smb2_setup_request, 185 .setup_request = smb2_setup_request,
162 .check_receive = smb2_check_receive, 186 .check_receive = smb2_check_receive,
@@ -174,6 +198,7 @@ struct smb_version_operations smb21_operations = {
174 .logoff = SMB2_logoff, 198 .logoff = SMB2_logoff,
175 .tree_connect = SMB2_tcon, 199 .tree_connect = SMB2_tcon,
176 .tree_disconnect = SMB2_tdis, 200 .tree_disconnect = SMB2_tdis,
201 .is_path_accessible = smb2_is_path_accessible,
177}; 202};
178 203
179struct smb_version_values smb21_values = { 204struct smb_version_values smb21_values = {