[Initng-svn] r3807 - initng/trunk/plugins/bash_launcher
svn at initng.thinktux.net
svn at initng.thinktux.net
Sun Apr 16 09:57:32 CEST 2006
Author: dragoran
Date: Sun Apr 16 09:57:29 2006
New Revision: 3807
Modified:
initng/trunk/plugins/bash_launcher/initng_bash_launcher.c
Log:
Fixed SELINUX context switching
Modified: initng/trunk/plugins/bash_launcher/initng_bash_launcher.c
==============================================================================
--- initng/trunk/plugins/bash_launcher/initng_bash_launcher.c (original)
+++ initng/trunk/plugins/bash_launcher/initng_bash_launcher.c Sun Apr 16 09:57:29 2006
@@ -115,16 +115,32 @@
argtmp[4] = NULL;
#ifdef SELINUX
+ /*
const char *selinux_context = get_string(&SELINUX_CONTEXT, s);
if(selinux_context)
setexeccon(selinux_context);
else
- setexeccon("initrc_exec_t");
+ setexeccon("initrc_exec_t"); */
+ char *sestr = NULL;
+ context_t seref = NULL;
+ rc = getcon(&sestr);
+ if (rc < 0) goto fail;
+ seref = context_new(sestr);
+ if (!seref) goto fail;
+ if (context_type_set(seref, "initrc_t")) goto fail;
+ freecon(sestr);
+ sestr = context_str(seref);
+ if (!sestr) goto fail;
+ rc = setexeccon(sestr);
+ if (rc < 0) goto fail;
#endif
/* execute */
execve("/bin/sh", argtmp, new_environ(s));
-
+#ifdef SELINUX
+fail:
+ F_("bash_this(): could not change selinux context!\n ERROR!\n");
+#endif
/* free them all */
{
int i = 0;
@@ -139,6 +155,7 @@
free(argtmp);
/* put an error message up */
+
F_("bash_this(): child died!\n ERROR!\n");
/* system free */
More information about the Initng-svn
mailing list