VirtualBox

Changeset 84593 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
May 28, 2020 2:33:35 PM (5 years ago)
Author:
vboxsync
Message:

bugref:9637. dont lose effective user id

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/display-drm.cpp

    r84584 r84593  
    106106static void drmConnect(struct DRMCONTEXT *pContext)
    107107{
     108    uid_t guid = getuid();
     109    if (setreuid(0, 0) == -1)
     110    {
     111        perror("setuid failed drm device open.");
     112    }
    108113    unsigned i;
    109114    RTFILE hDevice;
     
    145150    }
    146151    pContext->hDevice = hDevice;
     152    setreuid(guid, 0);
    147153}
    148154
     
    163169{
    164170    uid_t guid = getuid();
    165     if (setuid(0) == -1)
    166     {
    167         perror("setuid failed during drm ioctl.");
     171    if (setreuid(0, 0) == -1)
     172    {
     173        perror("setuid failed drm device open.");
    168174    }
    169175
     
    179185    if (RT_FAILURE(rc) && rc != VERR_INVALID_PARAMETER)
    180186        VBClLogFatalError("Failure updating layout, rc=%Rrc\n", rc);
    181     setuid(guid);
     187    setreuid(guid, 0);
    182188}
    183189
    184190int main(int argc, char *argv[])
    185191{
    186     uid_t guid = getuid();
    187     if (setuid(0) == -1)
    188     {
    189         perror("setuid failed during init.");
    190     }
    191 
    192192    int rc = RTR3InitExe(argc, &argv, 0);
    193193    if (RT_FAILURE(rc))
     
    223223        return VERR_INVALID_HANDLE;
    224224    }
    225     setuid(guid);
     225
    226226    for (;;)
    227227    {
Note: See TracChangeset for help on using the changeset viewer.

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