Loading fs/cifs/cifsacl.c +14 −14 Original line number Original line Diff line number Diff line Loading @@ -31,7 +31,7 @@ #ifdef CONFIG_CIFS_EXPERIMENTAL #ifdef CONFIG_CIFS_EXPERIMENTAL struct cifs_wksid wksidarr[NUM_WK_SIDS] = { static struct cifs_wksid wksidarr[NUM_WK_SIDS] = { {{1, 0, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }, "null user"}, {{1, 0, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }, "null user"}, {{1, 1, {0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0} }, "nobody"}, {{1, 1, {0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0} }, "nobody"}, {{1, 1, {0, 0, 0, 0, 0, 5}, {11, 0, 0, 0, 0} }, "net-users"}, {{1, 1, {0, 0, 0, 0, 0, 5}, {11, 0, 0, 0, 0} }, "net-users"}, Loading Loading @@ -192,14 +192,15 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl) /* BB need to add parm so we can store the SID BB */ /* BB need to add parm so we can store the SID BB */ /* validate that we do not go past end of acl */ /* validate that we do not go past end of acl */ if (end_of_acl < (char *)pdacl + pdacl->size) { if (end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size)) { cERROR(1, ("ACL too small to parse DACL")); cERROR(1, ("ACL too small to parse DACL")); return; return; } } #ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2 cFYI(1, ("DACL revision %d size %d num aces %d", cFYI(1, ("DACL revision %d size %d num aces %d", pdacl->revision, pdacl->size, pdacl->num_aces)); le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size), le32_to_cpu(pdacl->num_aces))); #endif #endif acl_base = (char *)pdacl; acl_base = (char *)pdacl; Loading Loading @@ -255,7 +256,6 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl) static int parse_sid(struct cifs_sid *psid, char *end_of_acl) static int parse_sid(struct cifs_sid *psid, char *end_of_acl) { { int num_subauth; /* BB need to add parm so we can store the SID BB */ /* BB need to add parm so we can store the SID BB */ Loading @@ -265,14 +265,13 @@ static int parse_sid(struct cifs_sid *psid, char *end_of_acl) return -EINVAL; return -EINVAL; } } num_subauth = cpu_to_le32(psid->num_subauth); if (psid->num_subauth) { if (num_subauth) { #ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2 int i; int i; cFYI(1, ("SID revision %d num_auth %d First subauth 0x%x", cFYI(1, ("SID revision %d num_auth %d First subauth 0x%x", psid->revision, psid->num_subauth, psid->sub_auth[0])); psid->revision, psid->num_subauth, psid->sub_auth[0])); for (i = 0; i < num_subauth; ++i) { for (i = 0; i < psid->num_subauth; i++) { cFYI(1, ("SID sub_auth[%d]: 0x%x ", i, cFYI(1, ("SID sub_auth[%d]: 0x%x ", i, le32_to_cpu(psid->sub_auth[i]))); le32_to_cpu(psid->sub_auth[i]))); } } Loading @@ -280,7 +279,7 @@ static int parse_sid(struct cifs_sid *psid, char *end_of_acl) /* BB add length check to make sure that we do not have huge /* BB add length check to make sure that we do not have huge num auths and therefore go off the end */ num auths and therefore go off the end */ cFYI(1, ("RID 0x%x", cFYI(1, ("RID 0x%x", le32_to_cpu(psid->sub_auth[num_subauth-1]))); le32_to_cpu(psid->sub_auth[psid->num_subauth-1]))); #endif #endif } } Loading @@ -297,17 +296,18 @@ int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len) char *end_of_acl = ((char *)pntsd) + acl_len; char *end_of_acl = ((char *)pntsd) + acl_len; owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + cpu_to_le32(pntsd->osidoffset)); le32_to_cpu(pntsd->osidoffset)); group_sid_ptr = (struct cifs_sid *)((char *)pntsd + group_sid_ptr = (struct cifs_sid *)((char *)pntsd + cpu_to_le32(pntsd->gsidoffset)); le32_to_cpu(pntsd->gsidoffset)); dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacl_ptr = (struct cifs_acl *)((char *)pntsd + cpu_to_le32(pntsd->dacloffset)); le32_to_cpu(pntsd->dacloffset)); #ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2 cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x " cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x " "sacloffset 0x%x dacloffset 0x%x", "sacloffset 0x%x dacloffset 0x%x", pntsd->revision, pntsd->type, pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset), pntsd->osidoffset, pntsd->gsidoffset, pntsd->sacloffset, le32_to_cpu(pntsd->gsidoffset), pntsd->dacloffset)); le32_to_cpu(pntsd->sacloffset), le32_to_cpu(pntsd->dacloffset)); #endif #endif rc = parse_sid(owner_sid_ptr, end_of_acl); rc = parse_sid(owner_sid_ptr, end_of_acl); if (rc) if (rc) Loading fs/cifs/cifsacl.h +11 −12 Original line number Original line Diff line number Diff line Loading @@ -27,25 +27,25 @@ #define SIDNAMELENGTH 20 /* long enough for the ones we care about */ #define SIDNAMELENGTH 20 /* long enough for the ones we care about */ struct cifs_ntsd { struct cifs_ntsd { __u16 revision; /* revision level */ __le16 revision; /* revision level */ __u16 type; __le16 type; __u32 osidoffset; __le32 osidoffset; __u32 gsidoffset; __le32 gsidoffset; __u32 sacloffset; __le32 sacloffset; __u32 dacloffset; __le32 dacloffset; } __attribute__((packed)); } __attribute__((packed)); struct cifs_sid { struct cifs_sid { __u8 revision; /* revision level */ __u8 revision; /* revision level */ __u8 num_subauth; __u8 num_subauth; __u8 authority[6]; __u8 authority[6]; __u32 sub_auth[5]; /* sub_auth[num_subauth] */ __le32 sub_auth[5]; /* sub_auth[num_subauth] */ /* BB FIXME endianness BB */ } __attribute__((packed)); } __attribute__((packed)); struct cifs_acl { struct cifs_acl { __u16 revision; /* revision level */ __le16 revision; /* revision level */ __u16 size; __le16 size; __u32 num_aces; __le32 num_aces; } __attribute__((packed)); } __attribute__((packed)); struct cifs_ntace { /* first part of ACE which contains perms */ struct cifs_ntace { /* first part of ACE which contains perms */ Loading @@ -59,7 +59,7 @@ struct cifs_ace { /* last part of ACE which includes user info */ __u8 revision; /* revision level */ __u8 revision; /* revision level */ __u8 num_subauth; __u8 num_subauth; __u8 authority[6]; __u8 authority[6]; __u32 sub_auth[5]; __le32 sub_auth[5]; } __attribute__((packed)); } __attribute__((packed)); struct cifs_wksid { struct cifs_wksid { Loading @@ -69,7 +69,6 @@ struct cifs_wksid { #ifdef CONFIG_CIFS_EXPERIMENTAL #ifdef CONFIG_CIFS_EXPERIMENTAL extern struct cifs_wksid wksidarr[NUM_WK_SIDS]; extern int match_sid(struct cifs_sid *); extern int match_sid(struct cifs_sid *); extern int compare_sids(struct cifs_sid *, struct cifs_sid *); extern int compare_sids(struct cifs_sid *, struct cifs_sid *); Loading fs/cifs/cifssmb.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -3121,7 +3121,7 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, /* BB check that data area is minimum length and as big as acl_len */ /* BB check that data area is minimum length and as big as acl_len */ acl_len = le32_to_cpu(*(__le32 *)parm); acl_len = le32_to_cpu(*parm); /* BB check if (acl_len > bufsize) */ /* BB check if (acl_len > bufsize) */ parse_sec_desc(psec_desc, acl_len); parse_sec_desc(psec_desc, acl_len); Loading Loading
fs/cifs/cifsacl.c +14 −14 Original line number Original line Diff line number Diff line Loading @@ -31,7 +31,7 @@ #ifdef CONFIG_CIFS_EXPERIMENTAL #ifdef CONFIG_CIFS_EXPERIMENTAL struct cifs_wksid wksidarr[NUM_WK_SIDS] = { static struct cifs_wksid wksidarr[NUM_WK_SIDS] = { {{1, 0, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }, "null user"}, {{1, 0, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }, "null user"}, {{1, 1, {0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0} }, "nobody"}, {{1, 1, {0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0} }, "nobody"}, {{1, 1, {0, 0, 0, 0, 0, 5}, {11, 0, 0, 0, 0} }, "net-users"}, {{1, 1, {0, 0, 0, 0, 0, 5}, {11, 0, 0, 0, 0} }, "net-users"}, Loading Loading @@ -192,14 +192,15 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl) /* BB need to add parm so we can store the SID BB */ /* BB need to add parm so we can store the SID BB */ /* validate that we do not go past end of acl */ /* validate that we do not go past end of acl */ if (end_of_acl < (char *)pdacl + pdacl->size) { if (end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size)) { cERROR(1, ("ACL too small to parse DACL")); cERROR(1, ("ACL too small to parse DACL")); return; return; } } #ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2 cFYI(1, ("DACL revision %d size %d num aces %d", cFYI(1, ("DACL revision %d size %d num aces %d", pdacl->revision, pdacl->size, pdacl->num_aces)); le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size), le32_to_cpu(pdacl->num_aces))); #endif #endif acl_base = (char *)pdacl; acl_base = (char *)pdacl; Loading Loading @@ -255,7 +256,6 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl) static int parse_sid(struct cifs_sid *psid, char *end_of_acl) static int parse_sid(struct cifs_sid *psid, char *end_of_acl) { { int num_subauth; /* BB need to add parm so we can store the SID BB */ /* BB need to add parm so we can store the SID BB */ Loading @@ -265,14 +265,13 @@ static int parse_sid(struct cifs_sid *psid, char *end_of_acl) return -EINVAL; return -EINVAL; } } num_subauth = cpu_to_le32(psid->num_subauth); if (psid->num_subauth) { if (num_subauth) { #ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2 int i; int i; cFYI(1, ("SID revision %d num_auth %d First subauth 0x%x", cFYI(1, ("SID revision %d num_auth %d First subauth 0x%x", psid->revision, psid->num_subauth, psid->sub_auth[0])); psid->revision, psid->num_subauth, psid->sub_auth[0])); for (i = 0; i < num_subauth; ++i) { for (i = 0; i < psid->num_subauth; i++) { cFYI(1, ("SID sub_auth[%d]: 0x%x ", i, cFYI(1, ("SID sub_auth[%d]: 0x%x ", i, le32_to_cpu(psid->sub_auth[i]))); le32_to_cpu(psid->sub_auth[i]))); } } Loading @@ -280,7 +279,7 @@ static int parse_sid(struct cifs_sid *psid, char *end_of_acl) /* BB add length check to make sure that we do not have huge /* BB add length check to make sure that we do not have huge num auths and therefore go off the end */ num auths and therefore go off the end */ cFYI(1, ("RID 0x%x", cFYI(1, ("RID 0x%x", le32_to_cpu(psid->sub_auth[num_subauth-1]))); le32_to_cpu(psid->sub_auth[psid->num_subauth-1]))); #endif #endif } } Loading @@ -297,17 +296,18 @@ int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len) char *end_of_acl = ((char *)pntsd) + acl_len; char *end_of_acl = ((char *)pntsd) + acl_len; owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + cpu_to_le32(pntsd->osidoffset)); le32_to_cpu(pntsd->osidoffset)); group_sid_ptr = (struct cifs_sid *)((char *)pntsd + group_sid_ptr = (struct cifs_sid *)((char *)pntsd + cpu_to_le32(pntsd->gsidoffset)); le32_to_cpu(pntsd->gsidoffset)); dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacl_ptr = (struct cifs_acl *)((char *)pntsd + cpu_to_le32(pntsd->dacloffset)); le32_to_cpu(pntsd->dacloffset)); #ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2 cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x " cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x " "sacloffset 0x%x dacloffset 0x%x", "sacloffset 0x%x dacloffset 0x%x", pntsd->revision, pntsd->type, pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset), pntsd->osidoffset, pntsd->gsidoffset, pntsd->sacloffset, le32_to_cpu(pntsd->gsidoffset), pntsd->dacloffset)); le32_to_cpu(pntsd->sacloffset), le32_to_cpu(pntsd->dacloffset)); #endif #endif rc = parse_sid(owner_sid_ptr, end_of_acl); rc = parse_sid(owner_sid_ptr, end_of_acl); if (rc) if (rc) Loading
fs/cifs/cifsacl.h +11 −12 Original line number Original line Diff line number Diff line Loading @@ -27,25 +27,25 @@ #define SIDNAMELENGTH 20 /* long enough for the ones we care about */ #define SIDNAMELENGTH 20 /* long enough for the ones we care about */ struct cifs_ntsd { struct cifs_ntsd { __u16 revision; /* revision level */ __le16 revision; /* revision level */ __u16 type; __le16 type; __u32 osidoffset; __le32 osidoffset; __u32 gsidoffset; __le32 gsidoffset; __u32 sacloffset; __le32 sacloffset; __u32 dacloffset; __le32 dacloffset; } __attribute__((packed)); } __attribute__((packed)); struct cifs_sid { struct cifs_sid { __u8 revision; /* revision level */ __u8 revision; /* revision level */ __u8 num_subauth; __u8 num_subauth; __u8 authority[6]; __u8 authority[6]; __u32 sub_auth[5]; /* sub_auth[num_subauth] */ __le32 sub_auth[5]; /* sub_auth[num_subauth] */ /* BB FIXME endianness BB */ } __attribute__((packed)); } __attribute__((packed)); struct cifs_acl { struct cifs_acl { __u16 revision; /* revision level */ __le16 revision; /* revision level */ __u16 size; __le16 size; __u32 num_aces; __le32 num_aces; } __attribute__((packed)); } __attribute__((packed)); struct cifs_ntace { /* first part of ACE which contains perms */ struct cifs_ntace { /* first part of ACE which contains perms */ Loading @@ -59,7 +59,7 @@ struct cifs_ace { /* last part of ACE which includes user info */ __u8 revision; /* revision level */ __u8 revision; /* revision level */ __u8 num_subauth; __u8 num_subauth; __u8 authority[6]; __u8 authority[6]; __u32 sub_auth[5]; __le32 sub_auth[5]; } __attribute__((packed)); } __attribute__((packed)); struct cifs_wksid { struct cifs_wksid { Loading @@ -69,7 +69,6 @@ struct cifs_wksid { #ifdef CONFIG_CIFS_EXPERIMENTAL #ifdef CONFIG_CIFS_EXPERIMENTAL extern struct cifs_wksid wksidarr[NUM_WK_SIDS]; extern int match_sid(struct cifs_sid *); extern int match_sid(struct cifs_sid *); extern int compare_sids(struct cifs_sid *, struct cifs_sid *); extern int compare_sids(struct cifs_sid *, struct cifs_sid *); Loading
fs/cifs/cifssmb.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -3121,7 +3121,7 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, /* BB check that data area is minimum length and as big as acl_len */ /* BB check that data area is minimum length and as big as acl_len */ acl_len = le32_to_cpu(*(__le32 *)parm); acl_len = le32_to_cpu(*parm); /* BB check if (acl_len > bufsize) */ /* BB check if (acl_len > bufsize) */ parse_sec_desc(psec_desc, acl_len); parse_sec_desc(psec_desc, acl_len); Loading