|
@@ -865,8 +865,8 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
|
-static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
|
|
|
- __u16 fid, u32 *pacllen)
|
|
|
+struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
|
|
|
+ const struct cifs_fid *cifsfid, u32 *pacllen)
|
|
|
{
|
|
|
struct cifs_ntsd *pntsd = NULL;
|
|
|
unsigned int xid;
|
|
@@ -877,7 +877,8 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
|
|
|
return ERR_CAST(tlink);
|
|
|
|
|
|
xid = get_xid();
|
|
|
- rc = CIFSSMBGetCIFSACL(xid, tlink_tcon(tlink), fid, &pntsd, pacllen);
|
|
|
+ rc = CIFSSMBGetCIFSACL(xid, tlink_tcon(tlink), cifsfid->netfid, &pntsd,
|
|
|
+ pacllen);
|
|
|
free_xid(xid);
|
|
|
|
|
|
cifs_put_tlink(tlink);
|
|
@@ -946,7 +947,7 @@ struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *cifs_sb,
|
|
|
if (!open_file)
|
|
|
return get_cifs_acl_by_path(cifs_sb, path, pacllen);
|
|
|
|
|
|
- pntsd = get_cifs_acl_by_fid(cifs_sb, open_file->fid.netfid, pacllen);
|
|
|
+ pntsd = get_cifs_acl_by_fid(cifs_sb, &open_file->fid, pacllen);
|
|
|
cifsFileInfo_put(open_file);
|
|
|
return pntsd;
|
|
|
}
|
|
@@ -1006,19 +1007,31 @@ out:
|
|
|
/* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */
|
|
|
int
|
|
|
cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
|
|
|
- struct inode *inode, const char *path, const __u16 *pfid)
|
|
|
+ struct inode *inode, const char *path,
|
|
|
+ const struct cifs_fid *pfid)
|
|
|
{
|
|
|
struct cifs_ntsd *pntsd = NULL;
|
|
|
u32 acllen = 0;
|
|
|
int rc = 0;
|
|
|
+ struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
|
|
|
+ struct cifs_tcon *tcon;
|
|
|
|
|
|
cifs_dbg(NOISY, "converting ACL to mode for %s\n", path);
|
|
|
|
|
|
- if (pfid)
|
|
|
- pntsd = get_cifs_acl_by_fid(cifs_sb, *pfid, &acllen);
|
|
|
- else
|
|
|
- pntsd = get_cifs_acl(cifs_sb, inode, path, &acllen);
|
|
|
+ if (IS_ERR(tlink))
|
|
|
+ return PTR_ERR(tlink);
|
|
|
+ tcon = tlink_tcon(tlink);
|
|
|
|
|
|
+ if (pfid && (tcon->ses->server->ops->get_acl_by_fid))
|
|
|
+ pntsd = tcon->ses->server->ops->get_acl_by_fid(cifs_sb, pfid,
|
|
|
+ &acllen);
|
|
|
+ else if (tcon->ses->server->ops->get_acl)
|
|
|
+ pntsd = tcon->ses->server->ops->get_acl(cifs_sb, inode, path,
|
|
|
+ &acllen);
|
|
|
+ else {
|
|
|
+ cifs_put_tlink(tlink);
|
|
|
+ return -EOPNOTSUPP;
|
|
|
+ }
|
|
|
/* if we can retrieve the ACL, now parse Access Control Entries, ACEs */
|
|
|
if (IS_ERR(pntsd)) {
|
|
|
rc = PTR_ERR(pntsd);
|
|
@@ -1030,6 +1043,8 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
|
|
|
cifs_dbg(VFS, "parse sec desc failed rc = %d\n", rc);
|
|
|
}
|
|
|
|
|
|
+ cifs_put_tlink(tlink);
|
|
|
+
|
|
|
return rc;
|
|
|
}
|
|
|
|