VirtualBox

Ignore:
Timestamp:
Jul 12, 2016 2:14:55 PM (8 years ago)
Author:
vboxsync
Message:

bugref:8087: Additions/x11: support non-root X server: improve preventing loading of OpenGL libraries by the X server. We support client-side OpenGL, but not server-side. Now we intercept functions that the X server will call and check for it rather than trying to overwrite the libraries in memory with the Mesa OpenGL ones. Also fix locating the Mesa libraries. Hopefully this can be removed altogether, but not just before the release.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/crOpenGL/egl.c

    r62074 r62201  
    2929#include <GL/glx.h>
    3030#include <X11/Xlib.h>
     31
     32#include <stdlib.h>
    3133
    3234/*******************************************************************************
     
    133135    Display *pDisplay;
    134136    int rc, cError, cEvent, cMajor, cMinor;
    135 
     137    /* Prevent working from inside the X server by requiring a valid DISPLAY. */
     138    char *pszDisplay = getenv("DISPLAY");
     139   
     140    if (!pszDisplay || !*pszDisplay)
     141        return EGL_NO_DISPLAY;
    136142    rc = RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE);
    137143    if (RT_FAILURE(rc))
     
    164170DECLEXPORT(EGLBoolean) eglInitialize (EGLDisplay hDisplay, EGLint *pcMajor, EGLint *pcMinor)
    165171{
     172    /* Prevent working from inside the X server by requiring a valid DISPLAY. */
     173    char *pszDisplay = getenv("DISPLAY");
     174   
     175    if (!pszDisplay || !*pszDisplay)
     176        return EGL_FALSE;
    166177    if (!VALID_PTR(hDisplay))
    167178        return setEGLError(EGL_BAD_DISPLAY);
     
    730741DECLEXPORT(EGLBoolean) eglBindAPI(EGLenum enmApi)
    731742{
     743    /* Prevent working from inside the X server by requiring a valid DISPLAY. */
     744    char *pszDisplay = getenv("DISPLAY");
     745   
     746    if (!pszDisplay || !*pszDisplay)
     747        return EGL_FALSE;
    732748    return enmApi == EGL_OPENGL_API ? clearEGLError() : setEGLError(EGL_BAD_PARAMETER);
    733749}
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