VirtualBox

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


Ignore:
Timestamp:
May 28, 2020 12:09:35 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
138314
Message:

bugref:9637. setting suid of the drm client

Location:
trunk/src/VBox/Additions/x11/VBoxClient
Files:
2 edited

Legend:

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

    r84579 r84584  
    4646#include <iprt/err.h>
    4747#include <iprt/string.h>
    48 
     48#include <iprt/initterm.h>
     49#include <iprt/message.h>
     50#include <unistd.h>
    4951#include <stdio.h>
    5052
     
    160162                         unsigned cHeads)
    161163{
     164    uid_t guid = getuid();
     165    if (setuid(0) == -1)
     166    {
     167        perror("setuid failed during drm ioctl.");
     168    }
     169
    162170    int rc;
    163171    struct DRMVMWUPDATELAYOUT ioctlLayout;
     
    171179    if (RT_FAILURE(rc) && rc != VERR_INVALID_PARAMETER)
    172180        VBClLogFatalError("Failure updating layout, rc=%Rrc\n", rc);
     181    setuid(guid);
    173182}
    174183
    175 int main()
    176 {
     184int main(int argc, char *argv[])
     185{
     186    uid_t guid = getuid();
     187    if (setuid(0) == -1)
     188    {
     189        perror("setuid failed during init.");
     190    }
     191
     192    int rc = RTR3InitExe(argc, &argv, 0);
     193    if (RT_FAILURE(rc))
     194        return RTMsgInitFailure(rc);
     195    rc = VbglR3InitUser();
     196    if (RT_FAILURE(rc))
     197        VBClLogFatalError("VbglR3InitUser failed: %Rrc", rc);
     198
    177199    struct DRMCONTEXT drmContext = { NIL_RTFILE };
    178200    static struct VMMDevDisplayDef aMonitors[VMW_MAX_HEADS];
    179     int rc;
     201
    180202    unsigned cEnabledMonitors;
    181203    /* Do not acknowledge the first event we query for to pick up old events,
     
    201223        return VERR_INVALID_HANDLE;
    202224    }
     225    setuid(guid);
    203226    for (;;)
    204227    {
  • trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp

    r84561 r84584  
    685685static bool init()
    686686{
    687     if (isXwayland())
     687    if (1 || isXwayland())
    688688    {
    689689        VBClLogInfo("The parent session seems to be running on Wayland. Starting DRM client\n");
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