9d36ace
9d36ace
If SElinux is enabled, log the context on startup.
9d36ace
9d36ace
--- httpd-2.0.54/server/core.c.selinux
9d36ace
+++ httpd-2.0.54/server/core.c
9d36ace
@@ -50,6 +50,8 @@
9d36ace
 #include "mod_proxy.h"
9d36ace
 #include "ap_listen.h"
9d36ace
 
9d36ace
+#include <selinux/selinux.h>
9d36ace
+
9d36ace
 /* LimitRequestBody handling */
9d36ace
 #define AP_LIMIT_REQ_BODY_UNSET         ((apr_off_t) -1)
9d36ace
 #define AP_DEFAULT_LIMIT_REQ_BODY       ((apr_off_t) 0)
9d36ace
@@ -4337,6 +4339,26 @@
9d36ace
     }
9d36ace
 #endif
9d36ace
 
9d36ace
+    {
9d36ace
+        static int already_warned = 0;
9d36ace
+        int is_enabled = is_selinux_enabled() > 0;
9d36ace
+        
9d36ace
+        if (is_enabled) {
9d36ace
+            security_context_t con;
9d36ace
+            
9d36ace
+            if (getcon(&con) == 0) {
9d36ace
+                
9d36ace
+                ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
9d36ace
+                             "SELinux policy enabled; "
9d36ace
+                             "httpd running as context %s", con);
9d36ace
+                
9d36ace
+                already_warned = 1;
9d36ace
+                
9d36ace
+                freecon(con);
9d36ace
+            }
9d36ace
+        }
9d36ace
+    }
9d36ace
+
9d36ace
     return OK;
9d36ace
 }
9d36ace
 
9d36ace
--- httpd-2.0.54/configure.in.selinux
9d36ace
+++ httpd-2.0.54/configure.in
9d36ace
@@ -294,6 +294,8 @@
9d36ace
 timegm \
9d36ace
 )
9d36ace
 
9d36ace
+AC_SEARCH_LIBS(is_selinux_enabled, selinux)
9d36ace
+
9d36ace
 dnl ## Check for the tm_gmtoff field in struct tm to get the timezone diffs
9d36ace
 AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
9d36ace
 [AC_TRY_COMPILE([#include <sys/types.h>