diff options
Diffstat (limited to 'fs/cifs/cifsacl.c')
| -rw-r--r-- | fs/cifs/cifsacl.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index 15bac390dff9..b98436f5c7c7 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c | |||
| @@ -1135,20 +1135,19 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr, | |||
| 1135 | u32 acllen = 0; | 1135 | u32 acllen = 0; |
| 1136 | int rc = 0; | 1136 | int rc = 0; |
| 1137 | struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); | 1137 | struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); |
| 1138 | struct cifs_tcon *tcon; | 1138 | struct smb_version_operations *ops; |
| 1139 | 1139 | ||
| 1140 | cifs_dbg(NOISY, "converting ACL to mode for %s\n", path); | 1140 | cifs_dbg(NOISY, "converting ACL to mode for %s\n", path); |
| 1141 | 1141 | ||
| 1142 | if (IS_ERR(tlink)) | 1142 | if (IS_ERR(tlink)) |
| 1143 | return PTR_ERR(tlink); | 1143 | return PTR_ERR(tlink); |
| 1144 | tcon = tlink_tcon(tlink); | ||
| 1145 | 1144 | ||
| 1146 | if (pfid && (tcon->ses->server->ops->get_acl_by_fid)) | 1145 | ops = tlink_tcon(tlink)->ses->server->ops; |
| 1147 | pntsd = tcon->ses->server->ops->get_acl_by_fid(cifs_sb, pfid, | 1146 | |
| 1148 | &acllen); | 1147 | if (pfid && (ops->get_acl_by_fid)) |
| 1149 | else if (tcon->ses->server->ops->get_acl) | 1148 | pntsd = ops->get_acl_by_fid(cifs_sb, pfid, &acllen); |
| 1150 | pntsd = tcon->ses->server->ops->get_acl(cifs_sb, inode, path, | 1149 | else if (ops->get_acl) |
| 1151 | &acllen); | 1150 | pntsd = ops->get_acl(cifs_sb, inode, path, &acllen); |
| 1152 | else { | 1151 | else { |
| 1153 | cifs_put_tlink(tlink); | 1152 | cifs_put_tlink(tlink); |
| 1154 | return -EOPNOTSUPP; | 1153 | return -EOPNOTSUPP; |
| @@ -1181,23 +1180,23 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode, | |||
| 1181 | struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */ | 1180 | struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */ |
| 1182 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 1181 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
| 1183 | struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); | 1182 | struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); |
| 1184 | struct cifs_tcon *tcon; | 1183 | struct smb_version_operations *ops; |
| 1185 | 1184 | ||
| 1186 | if (IS_ERR(tlink)) | 1185 | if (IS_ERR(tlink)) |
| 1187 | return PTR_ERR(tlink); | 1186 | return PTR_ERR(tlink); |
| 1188 | tcon = tlink_tcon(tlink); | 1187 | |
| 1188 | ops = tlink_tcon(tlink)->ses->server->ops; | ||
| 1189 | 1189 | ||
| 1190 | cifs_dbg(NOISY, "set ACL from mode for %s\n", path); | 1190 | cifs_dbg(NOISY, "set ACL from mode for %s\n", path); |
| 1191 | 1191 | ||
| 1192 | /* Get the security descriptor */ | 1192 | /* Get the security descriptor */ |
| 1193 | 1193 | ||
| 1194 | if (tcon->ses->server->ops->get_acl == NULL) { | 1194 | if (ops->get_acl == NULL) { |
| 1195 | cifs_put_tlink(tlink); | 1195 | cifs_put_tlink(tlink); |
| 1196 | return -EOPNOTSUPP; | 1196 | return -EOPNOTSUPP; |
| 1197 | } | 1197 | } |
| 1198 | 1198 | ||
| 1199 | pntsd = tcon->ses->server->ops->get_acl(cifs_sb, inode, path, | 1199 | pntsd = ops->get_acl(cifs_sb, inode, path, &secdesclen); |
| 1200 | &secdesclen); | ||
| 1201 | if (IS_ERR(pntsd)) { | 1200 | if (IS_ERR(pntsd)) { |
| 1202 | rc = PTR_ERR(pntsd); | 1201 | rc = PTR_ERR(pntsd); |
| 1203 | cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc); | 1202 | cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc); |
| @@ -1224,13 +1223,12 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode, | |||
| 1224 | 1223 | ||
| 1225 | cifs_dbg(NOISY, "build_sec_desc rc: %d\n", rc); | 1224 | cifs_dbg(NOISY, "build_sec_desc rc: %d\n", rc); |
| 1226 | 1225 | ||
| 1227 | if (tcon->ses->server->ops->set_acl == NULL) | 1226 | if (ops->set_acl == NULL) |
| 1228 | rc = -EOPNOTSUPP; | 1227 | rc = -EOPNOTSUPP; |
| 1229 | 1228 | ||
| 1230 | if (!rc) { | 1229 | if (!rc) { |
| 1231 | /* Set the security descriptor */ | 1230 | /* Set the security descriptor */ |
| 1232 | rc = tcon->ses->server->ops->set_acl(pnntsd, secdesclen, inode, | 1231 | rc = ops->set_acl(pnntsd, secdesclen, inode, path, aclflag); |
| 1233 | path, aclflag); | ||
| 1234 | cifs_dbg(NOISY, "set_cifs_acl rc: %d\n", rc); | 1232 | cifs_dbg(NOISY, "set_cifs_acl rc: %d\n", rc); |
| 1235 | } | 1233 | } |
| 1236 | cifs_put_tlink(tlink); | 1234 | cifs_put_tlink(tlink); |
