VirtualBox

Changeset 70876 in vbox


Ignore:
Timestamp:
Feb 5, 2018 7:41:53 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
120702
Message:

VBoxGuest: Solaris root and wheel (equivalent) detection. bugref:9105

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c

    r70873 r70876  
    3939#include <sys/open.h>
    4040#include <sys/sunldi.h>
     41#include <sys/policy.h>
    4142#include <sys/file.h>
    4243#undef u /* /usr/include/sys/user.h:249:1 is where this is defined to (curproc->p_user). very cool. */
     
    525526    /*
    526527     * Create a new session.
     528     *
     529     * Note! The devfs inode with the gid isn't readily available here, so we cannot easily
     530     *       to the vbox group detection like on linux.  Read config instead?
    527531     */
    528532    if (!(fFlags & FKLYR))
    529         rc = VGDrvCommonCreateUserSession(&g_DevExt, VMMDEV_REQUESTOR_USERMODE, &pSession);
     533    {
     534        uint32_t fRequestor = VMMDEV_REQUESTOR_USERMODE | VMMDEV_REQUESTOR_TRUST_NOT_GIVEN;
     535        if (crgetruid(pCred) == 0)
     536            fRequestor |= VMMDEV_REQUESTOR_USR_ROOT;
     537        else
     538            fRequestor |= VMMDEV_REQUESTOR_USR_USER;
     539        if (secpolicy_coreadm(pCred) == 0)
     540            fRequestor |= VMMDEV_REQUESTOR_GRP_WHEEL;
     541        /** @todo is there any way of detecting that the process belongs to someone on the physical console?
     542         * secpolicy_console() [== PRIV_SYS_DEVICES] doesn't look quite right, or does it? */
     543        fRequestor |= VMMDEV_REQUESTOR_CON_DONT_KNOW;
     544
     545        rc = VGDrvCommonCreateUserSession(&g_DevExt, fRequestor, &pSession);
     546    }
    530547    else
    531548        rc = VGDrvCommonCreateKernelSession(&g_DevExt, &pSession);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette