Improved the ownership definition when inheriting and user mapping fails
When using the Windows permission inheritance mode and the current user has not been mapped, try to derive a reasonable user from the parent directory.edge.strict_endians
parent
c2af343c03
commit
38dcb707ef
|
@ -3787,7 +3787,6 @@ static le32 build_inherited_id(struct SECURITY_CONTEXT *scx,
|
||||||
BIGSID defusid;
|
BIGSID defusid;
|
||||||
BIGSID defgsid;
|
BIGSID defgsid;
|
||||||
int offpacl;
|
int offpacl;
|
||||||
int offowner;
|
|
||||||
int offgroup;
|
int offgroup;
|
||||||
SECURITY_DESCRIPTOR_RELATIVE *pnhead;
|
SECURITY_DESCRIPTOR_RELATIVE *pnhead;
|
||||||
ACL *pnacl;
|
ACL *pnacl;
|
||||||
|
@ -3805,10 +3804,22 @@ static le32 build_inherited_id(struct SECURITY_CONTEXT *scx,
|
||||||
if (scx->mapping[MAPUSERS]) {
|
if (scx->mapping[MAPUSERS]) {
|
||||||
usid = ntfs_find_usid(scx->mapping[MAPUSERS], scx->uid, (SID*)&defusid);
|
usid = ntfs_find_usid(scx->mapping[MAPUSERS], scx->uid, (SID*)&defusid);
|
||||||
gsid = ntfs_find_gsid(scx->mapping[MAPGROUPS], scx->gid, (SID*)&defgsid);
|
gsid = ntfs_find_gsid(scx->mapping[MAPGROUPS], scx->gid, (SID*)&defgsid);
|
||||||
|
#if OWNERFROMACL
|
||||||
|
/* Get approximation of parent owner when cannot map */
|
||||||
|
if (!gsid)
|
||||||
|
gsid = adminsid;
|
||||||
|
if (!usid) {
|
||||||
|
usid = ntfs_acl_owner(parentattr);
|
||||||
|
if (!ntfs_is_user_sid(gsid))
|
||||||
|
gsid = usid;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/* Define owner as root when cannot map */
|
||||||
if (!usid)
|
if (!usid)
|
||||||
usid = adminsid;
|
usid = adminsid;
|
||||||
if (!gsid)
|
if (!gsid)
|
||||||
gsid = adminsid;
|
gsid = adminsid;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* If there is no user mapping, we have to copy owner
|
* If there is no user mapping, we have to copy owner
|
||||||
|
@ -3816,8 +3827,14 @@ static le32 build_inherited_id(struct SECURITY_CONTEXT *scx,
|
||||||
* Windows never has to do that, because it can always
|
* Windows never has to do that, because it can always
|
||||||
* rely on a user mapping
|
* rely on a user mapping
|
||||||
*/
|
*/
|
||||||
|
#if OWNERFROMACL
|
||||||
|
usid = ntfs_acl_owner(parentattr);
|
||||||
|
#else
|
||||||
|
int offowner;
|
||||||
|
|
||||||
offowner = le32_to_cpu(pphead->owner);
|
offowner = le32_to_cpu(pphead->owner);
|
||||||
usid = (const SID*)&parentattr[offowner];
|
usid = (const SID*)&parentattr[offowner];
|
||||||
|
#endif
|
||||||
offgroup = le32_to_cpu(pphead->group);
|
offgroup = le32_to_cpu(pphead->group);
|
||||||
gsid = (const SID*)&parentattr[offgroup];
|
gsid = (const SID*)&parentattr[offgroup];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue