aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsacl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/cifsacl.c')
-rw-r--r--fs/cifs/cifsacl.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 0e9fc2ba90ee..57ecdc83c26f 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -56,7 +56,7 @@ int match_sid(struct cifs_sid *ctsid)
56 struct cifs_sid *cwsid; 56 struct cifs_sid *cwsid;
57 57
58 if (!ctsid) 58 if (!ctsid)
59 return (-1); 59 return -1;
60 60
61 for (i = 0; i < NUM_WK_SIDS; ++i) { 61 for (i = 0; i < NUM_WK_SIDS; ++i) {
62 cwsid = &(wksidarr[i].cifssid); 62 cwsid = &(wksidarr[i].cifssid);
@@ -87,11 +87,11 @@ int match_sid(struct cifs_sid *ctsid)
87 } 87 }
88 88
89 cFYI(1, ("matching sid: %s\n", wksidarr[i].sidname)); 89 cFYI(1, ("matching sid: %s\n", wksidarr[i].sidname));
90 return (0); /* sids compare/match */ 90 return 0; /* sids compare/match */
91 } 91 }
92 92
93 cFYI(1, ("No matching sid")); 93 cFYI(1, ("No matching sid"));
94 return (-1); 94 return -1;
95} 95}
96 96
97/* if the two SIDs (roughly equivalent to a UUID for a user or group) are 97/* if the two SIDs (roughly equivalent to a UUID for a user or group) are
@@ -102,16 +102,16 @@ int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid)
102 int num_subauth, num_sat, num_saw; 102 int num_subauth, num_sat, num_saw;
103 103
104 if ((!ctsid) || (!cwsid)) 104 if ((!ctsid) || (!cwsid))
105 return (0); 105 return 0;
106 106
107 /* compare the revision */ 107 /* compare the revision */
108 if (ctsid->revision != cwsid->revision) 108 if (ctsid->revision != cwsid->revision)
109 return (0); 109 return 0;
110 110
111 /* compare all of the six auth values */ 111 /* compare all of the six auth values */
112 for (i = 0; i < 6; ++i) { 112 for (i = 0; i < 6; ++i) {
113 if (ctsid->authority[i] != cwsid->authority[i]) 113 if (ctsid->authority[i] != cwsid->authority[i])
114 return (0); 114 return 0;
115 } 115 }
116 116
117 /* compare all of the subauth values if any */ 117 /* compare all of the subauth values if any */
@@ -121,11 +121,11 @@ int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid)
121 if (num_subauth) { 121 if (num_subauth) {
122 for (i = 0; i < num_subauth; ++i) { 122 for (i = 0; i < num_subauth; ++i) {
123 if (ctsid->sub_auth[i] != cwsid->sub_auth[i]) 123 if (ctsid->sub_auth[i] != cwsid->sub_auth[i])
124 return (0); 124 return 0;
125 } 125 }
126 } 126 }
127 127
128 return (1); /* sids compare/match */ 128 return 1; /* sids compare/match */
129} 129}
130 130
131 131
@@ -169,8 +169,7 @@ static void copy_sec_desc(const struct cifs_ntsd *pntsd,
169 for (i = 0; i < 6; i++) 169 for (i = 0; i < 6; i++)
170 ngroup_sid_ptr->authority[i] = group_sid_ptr->authority[i]; 170 ngroup_sid_ptr->authority[i] = group_sid_ptr->authority[i];
171 for (i = 0; i < 5; i++) 171 for (i = 0; i < 5; i++)
172 ngroup_sid_ptr->sub_auth[i] = 172 ngroup_sid_ptr->sub_auth[i] = group_sid_ptr->sub_auth[i];
173 cpu_to_le32(group_sid_ptr->sub_auth[i]);
174 173
175 return; 174 return;
176} 175}
@@ -285,7 +284,7 @@ static __u16 fill_ace_for_sid(struct cifs_ace *pntace,
285 size = 1 + 1 + 2 + 4 + 1 + 1 + 6 + (psid->num_subauth * 4); 284 size = 1 + 1 + 2 + 4 + 1 + 1 + 6 + (psid->num_subauth * 4);
286 pntace->size = cpu_to_le16(size); 285 pntace->size = cpu_to_le16(size);
287 286
288 return (size); 287 return size;
289} 288}
290 289
291 290
@@ -426,7 +425,7 @@ static int set_chmod_dacl(struct cifs_acl *pndacl, struct cifs_sid *pownersid,
426 pndacl->size = cpu_to_le16(size + sizeof(struct cifs_acl)); 425 pndacl->size = cpu_to_le16(size + sizeof(struct cifs_acl));
427 pndacl->num_aces = cpu_to_le32(3); 426 pndacl->num_aces = cpu_to_le32(3);
428 427
429 return (0); 428 return 0;
430} 429}
431 430
432 431
@@ -510,7 +509,7 @@ static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len,
510 sizeof(struct cifs_sid)); */ 509 sizeof(struct cifs_sid)); */
511 510
512 511
513 return (0); 512 return 0;
514} 513}
515 514
516 515
@@ -527,7 +526,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
527 struct cifs_acl *ndacl_ptr = NULL; /* no need for SACL ptr */ 526 struct cifs_acl *ndacl_ptr = NULL; /* no need for SACL ptr */
528 527
529 if ((inode == NULL) || (pntsd == NULL) || (pnntsd == NULL)) 528 if ((inode == NULL) || (pntsd == NULL) || (pnntsd == NULL))
530 return (-EIO); 529 return -EIO;
531 530
532 owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + 531 owner_sid_ptr = (struct cifs_sid *)((char *)pntsd +
533 le32_to_cpu(pntsd->osidoffset)); 532 le32_to_cpu(pntsd->osidoffset));
@@ -550,7 +549,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
550 /* copy security descriptor control portion and owner and group sid */ 549 /* copy security descriptor control portion and owner and group sid */
551 copy_sec_desc(pntsd, pnntsd, sidsoffset); 550 copy_sec_desc(pntsd, pnntsd, sidsoffset);
552 551
553 return (rc); 552 return rc;
554} 553}
555 554
556 555
@@ -629,11 +628,11 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
629 cFYI(DBG2, ("set ACL for %s from mode 0x%x", path, inode->i_mode)); 628 cFYI(DBG2, ("set ACL for %s from mode 0x%x", path, inode->i_mode));
630 629
631 if (!inode) 630 if (!inode)
632 return (rc); 631 return rc;
633 632
634 sb = inode->i_sb; 633 sb = inode->i_sb;
635 if (sb == NULL) 634 if (sb == NULL)
636 return (rc); 635 return rc;
637 636
638 cifs_sb = CIFS_SB(sb); 637 cifs_sb = CIFS_SB(sb);
639 xid = GetXid(); 638 xid = GetXid();
@@ -652,7 +651,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
652 if (rc != 0) { 651 if (rc != 0) {
653 cERROR(1, ("Unable to open file to set ACL")); 652 cERROR(1, ("Unable to open file to set ACL"));
654 FreeXid(xid); 653 FreeXid(xid);
655 return (rc); 654 return rc;
656 } 655 }
657 } 656 }
658 657
@@ -665,7 +664,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
665 664
666 FreeXid(xid); 665 FreeXid(xid);
667 666
668 return (rc); 667 return rc;
669} 668}
670 669
671/* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */ 670/* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */
@@ -715,7 +714,7 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
715 if (!pnntsd) { 714 if (!pnntsd) {
716 cERROR(1, ("Unable to allocate security descriptor")); 715 cERROR(1, ("Unable to allocate security descriptor"));
717 kfree(pntsd); 716 kfree(pntsd);
718 return (-ENOMEM); 717 return -ENOMEM;
719 } 718 }
720 719
721 rc = build_sec_desc(pntsd, pnntsd, inode, nmode); 720 rc = build_sec_desc(pntsd, pnntsd, inode, nmode);
@@ -732,6 +731,6 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
732 kfree(pntsd); 731 kfree(pntsd);
733 } 732 }
734 733
735 return (rc); 734 return rc;
736} 735}
737#endif /* CONFIG_CIFS_EXPERIMENTAL */ 736#endif /* CONFIG_CIFS_EXPERIMENTAL */