diff options
author | Jeff Layton <jlayton@samba.org> | 2012-10-29 16:04:11 -0400 |
---|---|---|
committer | Jeff Layton <jlayton@samba.org> | 2012-11-07 10:19:14 -0500 |
commit | f0269e2a0efacf5299b123801d9ec49695ed30b6 (patch) | |
tree | 249c4aa0ddb0de55ddcef68d74fb5017d0205a3b /setcifsacl.c | |
parent | c49a6767051979368eea1087c9724a2c2994bd56 (diff) | |
download | cifs-utils-f0269e2a0efacf5299b123801d9ec49695ed30b6.tar.gz cifs-utils-f0269e2a0efacf5299b123801d9ec49695ed30b6.tar.bz2 cifs-utils-f0269e2a0efacf5299b123801d9ec49695ed30b6.zip |
setcifsacl: clean up sizing of cifs_sid
The max number of subauthorities on windows and in winbind is generally
15, not 5. If winbind sends more than 5, then this code may end up
overrunning the buffer. Also, define some preprocessor constants and
use those instead of hardcoding '5' and '6' all over the place.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Diffstat (limited to 'setcifsacl.c')
-rw-r--r-- | setcifsacl.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/setcifsacl.c b/setcifsacl.c index 29b7b93..23ab5b1 100644 --- a/setcifsacl.c +++ b/setcifsacl.c @@ -76,9 +76,9 @@ copy_sec_desc(const struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd, nowner_sid_ptr->revision = owner_sid_ptr->revision; nowner_sid_ptr->num_subauth = owner_sid_ptr->num_subauth; - for (i = 0; i < 6; i++) + for (i = 0; i < NUM_AUTHS; i++) nowner_sid_ptr->authority[i] = owner_sid_ptr->authority[i]; - for (i = 0; i < 5; i++) + for (i = 0; i < SID_MAX_SUB_AUTHORITIES; i++) nowner_sid_ptr->sub_auth[i] = owner_sid_ptr->sub_auth[i]; /* copy group sid */ @@ -87,9 +87,9 @@ copy_sec_desc(const struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd, ngroup_sid_ptr->revision = group_sid_ptr->revision; ngroup_sid_ptr->num_subauth = group_sid_ptr->num_subauth; - for (i = 0; i < 6; i++) + for (i = 0; i < NUM_AUTHS; i++) ngroup_sid_ptr->authority[i] = group_sid_ptr->authority[i]; - for (i = 0; i < 5; i++) + for (i = 0; i < SID_MAX_SUB_AUTHORITIES; i++) ngroup_sid_ptr->sub_auth[i] = group_sid_ptr->sub_auth[i]; return; @@ -106,7 +106,7 @@ copy_ace(struct cifs_ace *dace, struct cifs_ace *sace) dace->sid.revision = sace->sid.revision; dace->sid.num_subauth = sace->sid.num_subauth; - for (i = 0; i < 6; i++) + for (i = 0; i < NUM_AUTHS; i++) dace->sid.authority[i] = sace->sid.authority[i]; for (i = 0; i < sace->sid.num_subauth; i++) dace->sid.sub_auth[i] = sace->sid.sub_auth[i]; @@ -126,7 +126,7 @@ compare_aces(struct cifs_ace *sace, struct cifs_ace *dace, int compflags) return 0; if (dace->sid.num_subauth != sace->sid.num_subauth) return 0; - for (i = 0; i < 6; i++) { + for (i = 0; i < NUM_AUTHS; i++) { if (dace->sid.authority[i] != sace->sid.authority[i]) return 0; } |