Use Authz to fetch correct user permissions.

* sec_acl.cc (getacl): Use Authz to fetch correct user permissions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2015-08-31 11:34:38 +02:00
parent 42fad6ffa5
commit 7972e63402
2 changed files with 28 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2015-11-18 Corinna Vinschen <corinna@vinschen.de>
* sec_acl.cc (getacl): Use Authz to fetch correct user permissions.
2015-11-18 Corinna Vinschen <corinna@vinschen.de> 2015-11-18 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (AuthzAccessCheck): Import. * autoload.cc (AuthzAccessCheck): Import.

View File

@ -642,6 +642,15 @@ get_posix_access (PSECURITY_DESCRIPTOR psd,
goto out; goto out;
} }
/* If we use the Windows user DB, use Authz to make sure the owner
permissions are correctly reflecting the Windows permissions. */
if (cygheap->pg.nss_pwd_db ())
{
mode_t attr = 0;
authz_get_user_attribute (&attr, psd, owner_sid);
lacl[0].a_perm = attr >> 6;
}
/* Files and dirs are created with a NULL descriptor, so inheritence /* Files and dirs are created with a NULL descriptor, so inheritence
rules kick in. If no inheritable entries exist in the parent object, rules kick in. If no inheritable entries exist in the parent object,
Windows will create entries according to the user token's default DACL. Windows will create entries according to the user token's default DACL.
@ -787,8 +796,21 @@ get_posix_access (PSECURITY_DESCRIPTOR psd,
} }
if ((pos = searchace (lacl, MAX_ACL_ENTRIES, type, id)) >= 0) if ((pos = searchace (lacl, MAX_ACL_ENTRIES, type, id)) >= 0)
{ {
getace (lacl[pos], type, id, ace->Mask, ace->Header.AceType, /* If we use the Windows user DB, use Authz to check for user
new_style && type & (USER | GROUP_OBJ | GROUP)); permissions. */
if (cygheap->pg.nss_pwd_db () && (type & (USER_OBJ | USER)))
{
/* We already handle the USER_OBJ entry above. */
if (type == USER)
{
mode_t attr = 0;
authz_get_user_attribute (&attr, psd, ace_sid);
lacl[pos].a_perm = attr >> 6;
}
}
else
getace (lacl[pos], type, id, ace->Mask, ace->Header.AceType,
new_style && type & (USER | GROUP_OBJ | GROUP));
if (!new_style) if (!new_style)
{ {
/* Fix up CLASS_OBJ value. */ /* Fix up CLASS_OBJ value. */