aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsacl.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-11-25 08:00:37 -0500
committerSteve French <smfrench@gmail.com>2012-12-05 14:13:11 -0500
commit36f87ee70f754d04e55518853e6fb30ed4732dda (patch)
tree59169a8e5ce4a3ff23a7d5e9dbaa88a3515259cb /fs/cifs/cifsacl.c
parent436bb435fcbe2d52678ec7e2abc45fd1938601ce (diff)
cifs: make cifs_copy_sid handle a source sid with variable size subauth arrays
...and lift the restriction in id_to_sid upcall that the size must be at least as big as a full cifs_sid. Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/cifsacl.c')
-rw-r--r--fs/cifs/cifsacl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 5a312eb45a92..141a944c9dfd 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -277,8 +277,14 @@ compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid)
277static void 277static void
278cifs_copy_sid(struct cifs_sid *dst, const struct cifs_sid *src) 278cifs_copy_sid(struct cifs_sid *dst, const struct cifs_sid *src)
279{ 279{
280 memcpy(dst, src, sizeof(*dst)); 280 int i;
281
282 dst->revision = src->revision;
281 dst->num_subauth = min_t(u8, src->num_subauth, NUM_SUBAUTHS); 283 dst->num_subauth = min_t(u8, src->num_subauth, NUM_SUBAUTHS);
284 for (i = 0; i < NUM_AUTHS; ++i)
285 dst->authority[i] = src->authority[i];
286 for (i = 0; i < dst->num_subauth; ++i)
287 dst->sub_auth[i] = src->sub_auth[i];
282} 288}
283 289
284static void 290static void
@@ -427,7 +433,7 @@ id_to_sid(unsigned long cid, uint sidtype, struct cifs_sid *ssid)
427 if (IS_ERR(sidkey)) { 433 if (IS_ERR(sidkey)) {
428 rc = -EINVAL; 434 rc = -EINVAL;
429 cFYI(1, "%s: Can't map and id to a SID", __func__); 435 cFYI(1, "%s: Can't map and id to a SID", __func__);
430 } else if (sidkey->datalen < sizeof(struct cifs_sid)) { 436 } else if (sidkey->datalen < CIFS_SID_BASE_SIZE) {
431 rc = -EIO; 437 rc = -EIO;
432 cFYI(1, "%s: Downcall contained malformed key " 438 cFYI(1, "%s: Downcall contained malformed key "
433 "(datalen=%hu)", __func__, sidkey->datalen); 439 "(datalen=%hu)", __func__, sidkey->datalen);