This is the last extension still living in extmod. It expects some configuration options in the config file which it parsed when extmod was loaded. Now parse the config file when SELinuxExtensionInit() is called: Look if there is a Modules section, extmod subsection and see if the options are present.
In the future, we might want to move the options into the ServerFlags or Extensions section. Because XSELinux depends on the xorg.conf config file and methods which parse it, this extension needs to go into libXextbuiltin.la and not libXext.la. This change also makes libXextmodule.la and the whole extmod/ directory obsolete. Signed-off-by: Tomas Carnecky <[email protected]> --- Xext/Makefile.am | 36 ++++------ Xext/bigreq.c | 1 - Xext/dpms.c | 1 - Xext/panoramiX.c | 1 - Xext/saver.c | 2 - Xext/shape.c | 1 - Xext/shm.c | 2 - Xext/sync.c | 2 - Xext/xcmisc.c | 1 - Xext/xres.c | 1 - Xext/xselinux_ext.c | 29 ++++++++ Xext/xtest.c | 2 - configure.ac | 1 - hw/xfree86/dixmods/Makefile.am | 2 - hw/xfree86/dixmods/extmod/Makefile.am | 14 ---- hw/xfree86/dixmods/extmod/modinit.c | 126 --------------------------------- hw/xfree86/dixmods/extmod/modinit.h | 78 -------------------- mi/miinitext.c | 4 +- 18 files changed, 47 insertions(+), 257 deletions(-) delete mode 100644 hw/xfree86/dixmods/extmod/Makefile.am delete mode 100644 hw/xfree86/dixmods/extmod/modinit.c delete mode 100644 hw/xfree86/dixmods/extmod/modinit.h diff --git a/Xext/Makefile.am b/Xext/Makefile.am index a9dd43c..fd4e2d6 100644 --- a/Xext/Makefile.am +++ b/Xext/Makefile.am @@ -2,15 +2,13 @@ # Xnest, Xdmx and Xprt # libXextbuiltin.la: includes those extensions that are built directly into # Xorg by default -# libXextmodule.la: includes those extensions that are built into a module -# that Xorg loads if XORG -noinst_LTLIBRARIES = libXext.la libXextbuiltin.la libXextmodule.la +noinst_LTLIBRARIES = libXext.la libXextbuiltin.la else noinst_LTLIBRARIES = libXext.la endif -INCLUDES = -I$(top_srcdir)/hw/xfree86/dixmods/extmod @XORG_INCS@ +INCLUDES = @XORG_INCS@ AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) @@ -29,10 +27,7 @@ BUILTIN_SRCS = \ syncsrv.h \ xcmisc.c \ xtest.c - -# Sources always included in libXextmodule.la & libXext.la. That's right, zero. -MODULE_SRCS = -MODULE_LIBS = +BUILTIN_LIBS = # Optional sources included if extension enabled by configure.ac rules @@ -79,14 +74,6 @@ sdk_HEADERS += xace.h xacestr.h endif endif -# SELinux extension: provides SELinux policy support for X objects -# requires X-ACE extension -XSELINUX_SRCS = xselinux_ext.c xselinux_hooks.c xselinux_label.c xselinux.h xselinuxint.h -if XSELINUX -MODULE_SRCS += $(XSELINUX_SRCS) -MODULE_LIBS += $(SELINUX_LIBS) -endif - # Security extension: multi-level security to protect clients from each other XCSECURITY_SRCS = security.c securitysrv.h if XCSECURITY @@ -115,6 +102,15 @@ endif # Sources *only* included in libXextbuiltin.la. These are extensions requiring # special support in the DDX, which at this point is only provided by Xorg XEXT_XORG_SRCS = +XEXT_XORG_LIBS = + +# SELinux extension: provides SELinux policy support for X objects +# requires X-ACE extension +XSELINUX_SRCS = xselinux_ext.c xselinux_hooks.c xselinux_label.c xselinux.h xselinuxint.h +if XSELINUX +XEXT_XORG_SRCS += $(XSELINUX_SRCS) +XEXT_XORG_LIBS += $(SELINUX_LIBS) +endif # DGA extension DGA_SRCS = xf86dga2.c dgaproc.h xf86dgaext.h @@ -131,14 +127,12 @@ endif # Now take all of the above, mix well, bake for 10 minutes and get libXext*.la -libXext_la_SOURCES = $(BUILTIN_SRCS) $(MODULE_SRCS) -libXext_la_LIBADD = $(MODULE_LIBS) +libXext_la_SOURCES = $(BUILTIN_SRCS) +libXext_la_LIBADD = $(BUILTIN_LIBS) if XORG libXextbuiltin_la_SOURCES = $(XEXT_XORG_SRCS) $(BUILTIN_SRCS) - -libXextmodule_la_SOURCES = $(MODULE_SRCS) -libXextmodule_la_LIBADD = $(MODULE_LIBS) +libXextbuiltin_la_LIBADD = $(XEXT_XORG_LIBS) $(BUILTIN_LIBS) endif EXTRA_DIST = \ diff --git a/Xext/bigreq.c b/Xext/bigreq.c index cb52787..212ae4d 100644 --- a/Xext/bigreq.c +++ b/Xext/bigreq.c @@ -38,7 +38,6 @@ from The Open Group. #include "extnsionst.h" #include <X11/extensions/bigreqsproto.h> #include "opaque.h" -#include "modinit.h" static DISPATCH_PROC(ProcBigReqDispatch); diff --git a/Xext/dpms.c b/Xext/dpms.c index 32f33b3..c8fdb9e 100644 --- a/Xext/dpms.c +++ b/Xext/dpms.c @@ -39,7 +39,6 @@ Equipment Corporation. #include "opaque.h" #include <X11/extensions/dpmsproto.h> #include "dpmsproc.h" -#include "modinit.h" static int ProcDPMSGetVersion(ClientPtr client) diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index c7a8af3..a10407bb 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -53,7 +53,6 @@ Equipment Corporation. #include "servermd.h" #include "resource.h" #include "picturestr.h" -#include "modinit.h" #include "protocol-versions.h" #ifdef GLXPROXY diff --git a/Xext/saver.c b/Xext/saver.c index 12d5d60..1180a32 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -58,8 +58,6 @@ in this Software without prior written authorization from the X Consortium. #include <stdio.h> -#include "modinit.h" - static int ScreenSaverEventBase = 0; static DISPATCH_PROC(ProcScreenSaverQueryInfo); diff --git a/Xext/shape.c b/Xext/shape.c index ac95328..6f44a56 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -44,7 +44,6 @@ in this Software without prior written authorization from The Open Group. #include <X11/extensions/shapeproto.h> #include "regionstr.h" #include "gcstruct.h" -#include "modinit.h" #include "protocol-versions.h" typedef RegionPtr (*CreateDftPtr)( diff --git a/Xext/shm.c b/Xext/shm.c index 78344e0..d8901d5 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -88,8 +88,6 @@ in this Software without prior written authorization from The Open Group. #include "panoramiXsrv.h" #endif -#include "modinit.h" - typedef struct _ShmDesc { struct _ShmDesc *next; int shmid; diff --git a/Xext/sync.c b/Xext/sync.c index a51262a..12bd206 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -73,8 +73,6 @@ PERFORMANCE OF THIS SOFTWARE. #include <sys/time.h> #endif -#include "modinit.h" - /* * Local Global Variables */ diff --git a/Xext/xcmisc.c b/Xext/xcmisc.c index e095d8f..c522fd3 100644 --- a/Xext/xcmisc.c +++ b/Xext/xcmisc.c @@ -38,7 +38,6 @@ from The Open Group. #include "extnsionst.h" #include "swaprep.h" #include <X11/extensions/xcmiscproto.h> -#include "modinit.h" #if HAVE_STDINT_H #include <stdint.h> diff --git a/Xext/xres.c b/Xext/xres.c index 8d0ef30..113ac18 100644 --- a/Xext/xres.c +++ b/Xext/xres.c @@ -20,7 +20,6 @@ #include "pixmapstr.h" #include "windowstr.h" #include "gcstruct.h" -#include "modinit.h" #include "protocol-versions.h" static int diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c index 28e13aa..bee808a 100644 --- a/Xext/xselinux_ext.c +++ b/Xext/xselinux_ext.c @@ -711,6 +711,35 @@ SELinuxExtensionInit(void) LogMessage(X_INFO, "SELinux: Disabled on system\n"); return; } + + selinuxEnforcingState = SELINUX_MODE_DEFAULT; + + /* Read the enforcing state from the config file. This extension used + * to live in extmod, so look in the Module section, extmod subsection + * to see if the user specified a selinux related option. */ + if (xf86configptr->conf_modules) { + XF86LoadPtr *modp = xf86configptr->conf_modules->mod_load_lst; + while (modp) { + if (!strcmp(modp->load_name, "extmod")) { + pointer o; + if ((o = xf86FindOption(modp->load_opt, "SELinux mode disabled"))) { + xf86MarkOptionUsed(o); + selinuxEnforcingState = SELINUX_MODE_DISABLED; + } + if ((o = xf86FindOption(modp->load_opt, "SELinux mode permissive"))) { + xf86MarkOptionUsed(o); + selinuxEnforcingState = SELINUX_MODE_PERMISSIVE; + } + if ((o = xf86FindOption(modp->load_opt, "SELinux mode enforcing"))) { + xf86MarkOptionUsed(o); + selinuxEnforcingState = SELINUX_MODE_ENFORCING; + } + break; + } + modp = (XF86LoadPtr) modp->list.next; + } + } + if (selinuxEnforcingState == SELINUX_MODE_DISABLED) { LogMessage(X_INFO, "SELinux: Disabled in configuration file\n"); return; diff --git a/Xext/xtest.c b/Xext/xtest.c index 57e9626..607fea1 100644 --- a/Xext/xtest.c +++ b/Xext/xtest.c @@ -53,8 +53,6 @@ #include "xserver-properties.h" #include "exevents.h" -#include "modinit.h" - extern int DeviceValuator; /* XTest events are sent during request processing and may be interruped by diff --git a/configure.ac b/configure.ac index 9884fa7..3606947 100644 --- a/configure.ac +++ b/configure.ac @@ -2208,7 +2208,6 @@ hw/xfree86/common/Makefile hw/xfree86/common/xf86Build.h hw/xfree86/ddc/Makefile hw/xfree86/dixmods/Makefile -hw/xfree86/dixmods/extmod/Makefile hw/xfree86/doc/Makefile hw/xfree86/doc/devel/Makefile hw/xfree86/doc/man/Makefile diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am index 365f006..5718bdf 100644 --- a/hw/xfree86/dixmods/Makefile.am +++ b/hw/xfree86/dixmods/Makefile.am @@ -1,7 +1,5 @@ noinst_LTLIBRARIES = libdixmods.la libxorgxkb.la -SUBDIRS = extmod - if GLX GLXMODS = libglx.la endif diff --git a/hw/xfree86/dixmods/extmod/Makefile.am b/hw/xfree86/dixmods/extmod/Makefile.am deleted file mode 100644 index 21abc07..0000000 --- a/hw/xfree86/dixmods/extmod/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ - -extsmoduledir = $(moduledir)/extensions -extsmodule_LTLIBRARIES = libextmod.la - -AM_CFLAGS = @DIX_CFLAGS@ @XORG_CFLAGS@ -INCLUDES = @XORG_INCS@ \ - -I$(top_srcdir)/dbe \ - -I$(top_srcdir)/hw/xfree86/loader \ - -I$(top_srcdir)/miext/shadow - -libextmod_la_LDFLAGS = -avoid-version -libextmod_la_SOURCES = modinit.c \ - modinit.h -libextmod_la_LIBADD = $(top_builddir)/Xext/libXextmodule.la diff --git a/hw/xfree86/dixmods/extmod/modinit.c b/hw/xfree86/dixmods/extmod/modinit.c deleted file mode 100644 index bba13bd..0000000 --- a/hw/xfree86/dixmods/extmod/modinit.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 1997 Matthieu Herrb - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Matthieu Herrb not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Matthieu Herrb makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * MATTHIEU HERRB DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL MATTHIEU HERRB BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86Module.h" -#include "xf86Opt.h" - -#include <X11/Xproto.h> - -#include "modinit.h" -#include "globals.h" - -static MODULESETUPPROTO(extmodSetup); - -/* - * Array describing extensions to be initialized - */ -static ExtensionModule extensionModules[] = { -#ifdef XSELINUX - { - SELinuxExtensionInit, - SELINUX_EXTENSION_NAME, - &noSELinuxExtension, - NULL, - NULL - }, -#endif - { /* DON'T delete this entry ! */ - NULL, - NULL, - NULL, - NULL, - NULL - } -}; - -static XF86ModuleVersionInfo VersRec = -{ - "extmod", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_EXTENSION, - ABI_EXTENSION_VERSION, - MOD_CLASS_EXTENSION, - {0,0,0,0} -}; - -/* - * Data for the loader - */ -_X_EXPORT XF86ModuleData extmodModuleData = { &VersRec, extmodSetup, NULL }; - -static pointer -extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - int i; - - /* XXX the option stuff here is largely a sample/test case */ - - for (i = 0; extensionModules[i].name != NULL; i++) { - if (opts) { - char *s; - s = (char *)malloc(strlen(extensionModules[i].name) + 5); - if (s) { - pointer o; - strcpy(s, "omit"); - strcat(s, extensionModules[i].name); - o = xf86FindOption(opts, s); - free(s); - if (o) { - xf86MarkOptionUsed(o); - continue; - } - } - } - -#ifdef XSELINUX - if (! strcmp(SELINUX_EXTENSION_NAME, extensionModules[i].name)) { - pointer o; - selinuxEnforcingState = SELINUX_MODE_DEFAULT; - - if ((o = xf86FindOption(opts, "SELinux mode disabled"))) { - xf86MarkOptionUsed(o); - selinuxEnforcingState = SELINUX_MODE_DISABLED; - } - if ((o = xf86FindOption(opts, "SELinux mode permissive"))) { - xf86MarkOptionUsed(o); - selinuxEnforcingState = SELINUX_MODE_PERMISSIVE; - } - if ((o = xf86FindOption(opts, "SELinux mode enforcing"))) { - xf86MarkOptionUsed(o); - selinuxEnforcingState = SELINUX_MODE_ENFORCING; - } - } -#endif - - LoadExtension(&extensionModules[i], FALSE); - } - /* Need a non-NULL return */ - return (pointer)1; -} diff --git a/hw/xfree86/dixmods/extmod/modinit.h b/hw/xfree86/dixmods/extmod/modinit.h deleted file mode 100644 index 05cd8ce..0000000 --- a/hw/xfree86/dixmods/extmod/modinit.h +++ /dev/null @@ -1,78 +0,0 @@ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <X11/extensions/shapeproto.h> - -#ifdef XTEST -extern void XTestExtensionInit(void); -#include <X11/extensions/xtestproto.h> -#endif - -#if 1 -extern void XTestExtension1Init(void); -#endif - -#ifdef SCREENSAVER -extern void ScreenSaverExtensionInit (void); -#include <X11/extensions/saver.h> -#endif - -#ifdef XF86VIDMODE -extern void XFree86VidModeExtensionInit(void); -#include <X11/extensions/xf86vmproto.h> -#endif - -#ifdef XFreeXDGA -extern void XFree86DGAExtensionInit(void); -extern void XFree86DGARegister(void); -#include <X11/extensions/xf86dgaproto.h> -#endif - -#ifdef DPMSExtension -extern void DPMSExtensionInit(void); -#include <X11/extensions/dpmsconst.h> -#endif - -#ifdef XV -extern void XvExtensionInit(void); -extern void XvMCExtensionInit(void); -extern void XvRegister(void); -#include <X11/extensions/Xv.h> -#include <X11/extensions/XvMC.h> -#endif - -#ifdef RES -extern void ResExtensionInit(void); -#include <X11/extensions/XResproto.h> -#endif - -#ifdef SHM -extern void ShmExtensionInit(void); -#include <X11/extensions/shmproto.h> -extern void ShmRegisterFuncs( - ScreenPtr pScreen, - ShmFuncsPtr funcs); -#endif - -#ifdef XSELINUX -extern void SELinuxExtensionInit(void); -#include "xselinux.h" -#endif - -#ifdef XEVIE -extern void XevieExtensionInit(void); -#endif - -#if 1 -extern void SecurityExtensionInit(void); -#endif - -#if 1 -extern void PanoramiXExtensionInit(void); -#endif - -#if 1 -extern void XkbExtensionInit(void); -#endif diff --git a/mi/miinitext.c b/mi/miinitext.c index 336f582..5ad7a39 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -529,7 +529,9 @@ static ExtensionModule staticExtensions[] = { #ifdef XFreeXDGA { XFree86DGAExtensionInit, XF86DGANAME, &noXFree86DGAExtension, NULL, NULL }, #endif - +#ifdef XSELINUX + { SELinuxExtensionInit, SELINUX_EXTENSION_NAME, &noSELinuxExtension, NULL, NULL }, +#endif { NULL, NULL, NULL, NULL, NULL } }; -- 1.7.2.1.g43c6fa _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
