[Pkg-sysvinit-commits] r708 - sysvinit/trunk/debian/patches

Thomas Hood jdthood-guest at costa.debian.org
Fri Jan 27 15:59:08 UTC 2006


Author: jdthood-guest
Date: 2006-01-27 15:59:08 +0000 (Fri, 27 Jan 2006)
New Revision: 708

Added:
   sysvinit/trunk/debian/patches/41_selinux_console.dpatch
Modified:
   sysvinit/trunk/debian/patches/00list
Log:
Implement #349149

Modified: sysvinit/trunk/debian/patches/00list
===================================================================
--- sysvinit/trunk/debian/patches/00list	2006-01-27 10:54:57 UTC (rev 707)
+++ sysvinit/trunk/debian/patches/00list	2006-01-27 15:59:08 UTC (rev 708)
@@ -11,6 +11,7 @@
 30_strip
 31_build_warnings
 40_selinux
+41_selinux_console
 45_pidof_symlink
 50_bootlogd_exitcode
 51_bootlogd_syncalot

Added: sysvinit/trunk/debian/patches/41_selinux_console.dpatch
===================================================================
--- sysvinit/trunk/debian/patches/41_selinux_console.dpatch	2006-01-27 10:54:57 UTC (rev 707)
+++ sysvinit/trunk/debian/patches/41_selinux_console.dpatch	2006-01-27 15:59:08 UTC (rev 708)
@@ -0,0 +1,74 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 41_selinux_console.dpatch by  <jdthood at yahoo.co.uk>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad --exclude=CVS --exclude=.svn ./src/init.c /tmp/dpep-work.tcSHzc/trunk/src/init.c
+--- ./src/init.c	2006-01-27 16:52:38.000000000 +0100
++++ /tmp/dpep-work.tcSHzc/trunk/src/init.c	2006-01-27 16:55:20.000000000 +0100
+@@ -89,6 +89,7 @@
+ 
+ /* Mount point for selinuxfs. */
+ #define SELINUXMNT "/selinux/"
++#define BUF_CHARS   (size_t)4096
+ int enforcing = -1;		/* SELinux enforcing mode */
+ 
+ static int load_policy(int *enforce)
+@@ -101,16 +102,20 @@
+   int policy_version=0;
+   extern char *selinux_mnt;
+   FILE *cfg;
+-  char buf[4096];
++  char *buf;
+   int seconfig = -2;
+ 
++  buf = malloc(BUF_CHARS * sizeof(char));
++  if (!buf)
++	  return -1;
++
+   selinux_getenforcemode(&seconfig);
+ 
+   mount("none", "/proc", "proc", 0, 0);
+   cfg = fopen("/proc/cmdline","r");
+   if (cfg) {
+     char *tmp;
+-    if (fgets(buf,4096,cfg) && (tmp = strstr(buf,"enforcing="))) {
++    if (fgets(buf, BUF_CHARS, cfg) && (tmp = strstr(buf, "enforcing="))) {
+       if (tmp == buf || isspace(*(tmp-1))) {
+         enforcing=atoi(tmp+10);
+       }
+@@ -127,14 +132,21 @@
+ 
+   if (mount("none", SELINUXMNT, "selinuxfs", 0, 0) < 0) {
+     if (errno == ENODEV) {
+-      printf("SELinux not supported by kernel: %s\n",strerror(errno));
+       *enforce = 0;
++      snprintf(buf, BUF_CHARS, "Warning: SELinux not supported by kernel: %s\n",strerror(errno));
++      print(buf);
++      free(buf);
++      return ret;
+     } else {
+-      printf("Failed to mount %s: %s\n",SELINUXMNT,strerror(errno));
++      snprintf(buf, BUF_CHARS, "Failed to mount %s: %s\n",SELINUXMNT,strerror(errno));
++      print(buf);
++      free(buf);
++      return -1;
+     }
+-    return ret;
+   }
+ 
++  free(buf);
++
+   selinux_mnt = SELINUXMNT; /* set manually since we mounted it */
+ 
+   policy_version=security_policyvers();
+@@ -228,6 +240,7 @@
+   }
+   return(ret);
+ }
++#undef BUF_CHARS
+ #endif
+ 
+ 


Property changes on: sysvinit/trunk/debian/patches/41_selinux_console.dpatch
___________________________________________________________________
Name: svn:executable
   + *




More information about the Pkg-sysvinit-commits mailing list