From: Jean-Pierre A. <jp...@us...> - 2008-12-24 15:30:35
|
Update of /cvsroot/ntfs-3g/ntfs-3g/libntfs-3g In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26992/ntfs-3g/libntfs-3g Modified Files: Tag: PERMISSION_HANDLING_BRANCH acls.c Log Message: Changed the sequencing of operations to compute the size of an ACL Index: acls.c =================================================================== RCS file: /cvsroot/ntfs-3g/ntfs-3g/libntfs-3g/Attic/acls.c,v retrieving revision 1.1.2.17 retrieving revision 1.1.2.18 diff -u -d -r1.1.2.17 -r1.1.2.18 --- acls.c 24 Dec 2008 15:27:34 -0000 1.1.2.17 +++ acls.c 24 Dec 2008 15:30:25 -0000 1.1.2.18 @@ -261,30 +261,15 @@ unsigned int offowner; unsigned int offgroup; unsigned int endsid; - unsigned int endsacl; + unsigned int endacl; unsigned int attrsz; + phead = (const SECURITY_DESCRIPTOR_RELATIVE*)attr; /* - * First check DACL, which is the last field in all descriptors + * First check group, which is the last field in all descriptors * we build, and in most descriptors built by Windows - * however missing for "DR Watson" */ - phead = (const SECURITY_DESCRIPTOR_RELATIVE*)attr; - /* find end of DACL */ - offdacl = le32_to_cpu(phead->dacl); - if (offdacl) { - pdacl = (const ACL*)&attr[offdacl]; - attrsz = offdacl + le16_to_cpu(pdacl->size); - } else - attrsz = 0; - - offowner = le32_to_cpu(phead->owner); - if (offowner >= attrsz) { - /* find end of USID */ - psid = (const SID*)&attr[offowner]; - endsid = offowner + ntfs_sid_size(psid); - attrsz = endsid; - } + attrsz = sizeof(SECURITY_DESCRIPTOR_RELATIVE); offgroup = le32_to_cpu(phead->group); if (offgroup >= attrsz) { /* find end of GSID */ @@ -292,16 +277,31 @@ endsid = offgroup + ntfs_sid_size(psid); if (endsid > attrsz) attrsz = endsid; } + offowner = le32_to_cpu(phead->owner); + if (offowner >= attrsz) { + /* find end of USID */ + psid = (const SID*)&attr[offowner]; + endsid = offowner + ntfs_sid_size(psid); + attrsz = endsid; + } offsacl = le32_to_cpu(phead->sacl); if (offsacl >= attrsz) { /* find end of SACL */ - offsacl = le32_to_cpu(phead->sacl); psacl = (const ACL*)&attr[offsacl]; - endsacl = offsacl + le16_to_cpu(psacl->size); - if (endsacl > attrsz) - attrsz = endsacl; + endacl = offsacl + le16_to_cpu(psacl->size); + if (endacl > attrsz) + attrsz = endacl; } + + /* find end of DACL */ + offdacl = le32_to_cpu(phead->dacl); + if (offdacl >= attrsz) { + pdacl = (const ACL*)&attr[offdacl]; + endacl = offdacl + le16_to_cpu(pdacl->size); + if (endacl > attrsz) + attrsz = endacl; + } return (attrsz); } |