diff options
author | Daniel Stone <daniel@fooishbar.org> | 2012-07-10 02:03:09 +0100 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-07-09 23:28:37 -0700 |
commit | 6fb481d1251626456914d0012d6ca5a342bfdf71 (patch) | |
tree | b9dbf24b20b0f94e7ddc3d6e989d27bad8d4cdad | |
parent | 5d92ee4081a23a6b4d1f9ba2a98985f539f99312 (diff) |
Move SELinux from extmod to built-in
Instead of letting it languish in extmod just because we want to
configure bits of it from xf86, move XSELinux to the builtin part of
Xext, and do its configuration from xf86ExtensionInit.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | Xext/Makefile.am | 8 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Extensions.c | 22 | ||||
-rw-r--r-- | hw/xfree86/dixmods/extmod/modinit.c | 35 | ||||
-rw-r--r-- | include/extinit.h | 2 | ||||
-rw-r--r-- | mi/miinitext.c | 3 |
5 files changed, 33 insertions, 37 deletions
diff --git a/Xext/Makefile.am b/Xext/Makefile.am index 98e9917d9..957fa671a 100644 --- a/Xext/Makefile.am +++ b/Xext/Makefile.am @@ -30,6 +30,7 @@ BUILTIN_SRCS = \ syncsrv.h \ xcmisc.c \ xtest.c +BUILTIN_LIBS = # Sources always included in libXextmodule.la & libXext.la. That's right, zero. MODULE_SRCS = @@ -84,8 +85,8 @@ endif # 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) +BUILTIN_SRCS += $(XSELINUX_SRCS) +BUILTIN_LIBS += $(SELINUX_LIBS) endif # Security extension: multi-level security to protect clients from each other @@ -109,10 +110,11 @@ 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_LIBADD = $(BUILTIN_LIBS) $(MODULE_LIBS) if XORG libXextbuiltin_la_SOURCES = $(BUILTIN_SRCS) +libXextbuiltin_la_LIBADD = $(BUILTIN_LIBS) libXextmodule_la_SOURCES = $(MODULE_SRCS) libXextmodule_la_LIBADD = $(MODULE_LIBS) diff --git a/hw/xfree86/common/xf86Extensions.c b/hw/xfree86/common/xf86Extensions.c index 15c96b444..aed0635a2 100644 --- a/hw/xfree86/common/xf86Extensions.c +++ b/hw/xfree86/common/xf86Extensions.c @@ -37,6 +37,10 @@ #include "xf86Opt.h" #include "optionstr.h" +#ifdef XSELINUX +#include "xselinux.h" +#endif + /* * DDX-specific extensions. */ @@ -67,6 +71,24 @@ load_extension_config(void) if (EnableDisableExtension(key + 4, FALSE)) xf86MarkOptionUsed(opt); } + +#ifdef XSELINUX + if ((opt = xf86FindOption(modp->load_opt, + "SELinux mode disabled"))) { + xf86MarkOptionUsed(opt); + selinuxEnforcingState = SELINUX_MODE_DISABLED; + } + if ((opt = xf86FindOption(modp->load_opt, + "SELinux mode permissive"))) { + xf86MarkOptionUsed(opt); + selinuxEnforcingState = SELINUX_MODE_PERMISSIVE; + } + if ((opt = xf86FindOption(modp->load_opt, + "SELinux mode enforcing"))) { + xf86MarkOptionUsed(opt); + selinuxEnforcingState = SELINUX_MODE_ENFORCING; + } +#endif } } diff --git a/hw/xfree86/dixmods/extmod/modinit.c b/hw/xfree86/dixmods/extmod/modinit.c index f8832fd1c..e64d41aca 100644 --- a/hw/xfree86/dixmods/extmod/modinit.c +++ b/hw/xfree86/dixmods/extmod/modinit.c @@ -39,14 +39,6 @@ static MODULESETUPPROTO(extmodSetup); * Array describing extensions to be initialized */ static ExtensionModule extensionModules[] = { -#ifdef XSELINUX - { - SELinuxExtensionInit, - SELINUX_EXTENSION_NAME, - &noSELinuxExtension, - NULL, - NULL}, -#endif #ifdef XF86VIDMODE { XFree86VidModeExtensionInit, @@ -88,32 +80,9 @@ 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; i < ARRAY_SIZE(extensionModules); i++) { -#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 + for (i = 0; i < ARRAY_SIZE(extensionModules); i++) + LoadExtension(&extensionModules[i], FALSE); - LoadExtension(&extensionModules[i], FALSE); - } /* Need a non-NULL return */ return (pointer) 1; } diff --git a/include/extinit.h b/include/extinit.h index ea41eba14..0a24db068 100644 --- a/include/extinit.h +++ b/include/extinit.h @@ -158,7 +158,7 @@ extern _X_EXPORT void AssignTypeAndName(DeviceIntPtr dev, #include <X11/extensions/XKB.h> extern void XkbExtensionInit(void); -#if defined(XSELINUX) && !defined(XorgLoader) +#if defined(XSELINUX) #include "xselinux.h" extern Bool noSELinuxExtension; extern void SELinuxExtensionInit(void); diff --git a/mi/miinitext.c b/mi/miinitext.c index 74fb223fb..a8644db6b 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -416,6 +416,9 @@ static ExtensionModule staticExtensions[] = { {XvExtensionInit, XvName, &noXvExtension, NULL}, {XvMCExtensionInit, XvMCName, &noXvExtension, NULL}, #endif +#ifdef XSELINUX + {SELinuxExtensionInit, SELINUX_EXTENSION_NAME, &noSELinuxExtension, NULL}, +#endif }; /*ARGSUSED*/ void |