Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339457
b: refs/heads/master
c: 30c9d6c
h: refs/heads/master
i:
  339455: 05e8cd9
v: v3
  • Loading branch information
Jeff Layton authored and Steve French committed Dec 5, 2012
1 parent 6ede43f commit 82b2acf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 36f87ee70f754d04e55518853e6fb30ed4732dda
refs/heads/master: 30c9d6cca526243abe6c08eb6fa03db9d2b1a630
6 changes: 3 additions & 3 deletions trunk/fs/cifs/cifsacl.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ cifs_copy_sid(struct cifs_sid *dst, const struct cifs_sid *src)
int i;

dst->revision = src->revision;
dst->num_subauth = min_t(u8, src->num_subauth, NUM_SUBAUTHS);
dst->num_subauth = min_t(u8, src->num_subauth, SID_MAX_SUB_AUTHORITIES);
for (i = 0; i < NUM_AUTHS; ++i)
dst->authority[i] = src->authority[i];
for (i = 0; i < dst->num_subauth; ++i)
Expand Down Expand Up @@ -383,7 +383,7 @@ id_to_sid(unsigned long cid, uint sidtype, struct cifs_sid *ssid)
if (!npsidid)
return -ENOMEM;

npsidid->sidstr = kmalloc(SIDLEN, GFP_KERNEL);
npsidid->sidstr = kmalloc(SID_STRING_MAX, GFP_KERNEL);
if (!npsidid->sidstr) {
kfree(npsidid);
return -ENOMEM;
Expand Down Expand Up @@ -500,7 +500,7 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
if (!npsidid)
return -ENOMEM;

npsidid->sidstr = kmalloc(SIDLEN, GFP_KERNEL);
npsidid->sidstr = kmalloc(SID_STRING_MAX, GFP_KERNEL);
if (!npsidid->sidstr) {
kfree(npsidid);
return -ENOMEM;
Expand Down
19 changes: 16 additions & 3 deletions trunk/fs/cifs/cifsacl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


#define NUM_AUTHS 6 /* number of authority fields */
#define NUM_SUBAUTHS 5 /* number of sub authority fields */
#define SID_MAX_SUB_AUTHORITIES (15) /* max number of sub authority fields */
#define NUM_WK_SIDS 7 /* number of well known sids */
#define SIDNAMELENGTH 20 /* long enough for the ones we care about */
#define DEFSECDESCLEN 192 /* sec desc len contaiting a dacl with three aces */
Expand All @@ -41,7 +41,20 @@

#define SIDOWNER 1
#define SIDGROUP 2
#define SIDLEN 150 /* S- 1 revision- 6 authorities- max 5 sub authorities */

/*
* Maximum size of a string representation of a SID:
*
* The fields are unsigned values in decimal. So:
*
* u8: max 3 bytes in decimal
* u32: max 10 bytes in decimal
*
* "S-" + 3 bytes for version field + 4 bytes for each authority field (3 bytes
* per number + 1 for '-') + 11 bytes for each subauthority field (10 bytes
* per number + 1 for '-') + NULL terminator.
*/
#define SID_STRING_MAX (195)

#define SID_ID_MAPPED 0
#define SID_ID_PENDING 1
Expand All @@ -61,7 +74,7 @@ struct cifs_sid {
__u8 revision; /* revision level */
__u8 num_subauth;
__u8 authority[NUM_AUTHS];
__le32 sub_auth[NUM_SUBAUTHS]; /* sub_auth[num_subauth] */
__le32 sub_auth[SID_MAX_SUB_AUTHORITIES]; /* sub_auth[num_subauth] */
} __attribute__((packed));

/* size of a struct cifs_sid, sans sub_auth array */
Expand Down

0 comments on commit 82b2acf

Please sign in to comment.