I recently created a port of mod_jk-1.2.1 for OpenBSD and needed to make
some minor patches to mod_jk. OpenBSD 3.2 has Apache 1.3.26 configured as
ServerType standalone, to chroot to /var/www and run as user www by default.
This combination requires a few minor patches so that mod_jk will continue
to work after an Apache restart.
Both jk_set_worker_file and jk_set_log_file need to call
ap_server_strip_chroot to account for the path changes while chrooted.
The log file is initially created as user/group = root/daemon, but after a
restart Apache is running as www/www so it doesn't have permission to reopen
the log file. In order to have the log file continue working after a
restart, I patched jk_init. Instead of setting conf->log to NULL when
jk_open_file_logger fails, I set it to main_log. In other words, if the new
log file can't be opened it falls back to the already open one. Other
possible solutions are to change the user and/or group of the log file to
match the Apache User/Group directives, however if the admin changes the log
file name the open will still fail unless the directory has write access for
the Apache User/Group.
I made some Makefile.in patches to allow the object files to be built
outside the source tree. I think these patches will work for other archs/OSs
too.
Please review and consider commiting. Please cc me if replying. Thank You.
-Kurt
$OpenBSD$
--- apache-1.3/mod_jk.c.orig Tue Nov 26 12:26:25 2002
+++ apache-1.3/mod_jk.c Mon Dec 9 01:59:18 2002
@@ -734,6 +734,8 @@ static const char *jk_set_worker_file(cm
/* we need an absolut path */
conf->worker_file = ap_server_root_relative(cmd->pool,worker_file);
+ ap_server_strip_chroot(conf->worker_file,0);
+
if (conf->worker_file == worker_file)
conf->worker_file = ap_pstrdup(cmd->pool,worker_file);
@@ -762,6 +764,8 @@ static const char *jk_set_log_file(cmd_p
/* we need an absolut path */
conf->log_file = ap_server_root_relative(cmd->pool,log_file);
+ ap_server_strip_chroot(conf->log_file,0);
+
if ( conf->log_file == log_file)
conf->log_file = ap_pstrdup(cmd->pool,log_file);
@@ -1742,7 +1746,7 @@ static void jk_init(server_rec *s, ap_po
/* Open up log file */
if(conf->log_file && conf->log_level >= 0) {
if(!jk_open_file_logger(&(conf->log), conf->log_file, conf->log_level)) {
- conf->log = NULL;
+ conf->log = main_log;
} else {
main_log = conf->log;
}
$OpenBSD$
--- apache-1.3/Makefile.in.orig Tue Nov 26 12:26:25 2002
+++ apache-1.3/Makefile.in Fri Dec 6 05:30:44 2002
@@ -1,6 +1,8 @@
## configure should make the Makefile out of this file.
-
+srcdir=@srcdir@
+top_srcdir=@top_srcdir@
+VPATH=@srcdir@
APXS=@APXS@
OS=@OS@
JAVA_HOME=@JAVA_HOME@
@@ -17,14 +19,13 @@ libexecdir=${APACHE_DIR}/libexec
JK_DIR := ..
BUILD_DIR = ${JK_DIR}/../build/jk/apache13
-#VPATH=.:../common
APACHE_FILES = Makefile.tmpl Makefile.libdir libjk.module
JK=../common/
-JK_INCL=-DUSE_APACHE_MD5 -I ${JK}
+JK_INCL=-DUSE_APACHE_MD5 -I ${top_srcdir}/common
JAVA_INCL=-I ${JAVA_HOME}/include -I ${JAVA_HOME}/include/${OS}
JAVA_LIB=-L ${JAVA_HOME}/jre/lib/${ARCH} -L ${JAVA_HOME}/lib/${ARCH}/native_threads
-APACHE_CFLAGS=@apache_include@ @APXSCFLAGS@ @APXSCPPFLAGS@ -I../common
+APACHE_CFLAGS=@apache_include@ @APXSCFLAGS@ @APXSCPPFLAGS@ -I${top_srcdir}/common
# Compile commands
JK_CFLAGS = $(JK_INCL) $(JAVA_INCL) $(APACHE_CFLAGS)
$OpenBSD$
--- common/Makefile.in.orig Thu Dec 5 11:30:30 2002
+++ common/Makefile.in Thu Dec 5 11:32:29 2002
@@ -19,7 +19,7 @@ include list.mk
JAVA_INCL=-I @JAVA_HOME@/include -I @JAVA_HOME@/include/@OS@
CFLAGS=@apache_include@ @CFLAGS@ ${APXSCFLAGS} ${APXSCPPFLAGS} ${JAVA_INCL}
-include ../scripts/build/rules.mk
+include @top_srcdir@/scripts/build/rules.mk
JK=./
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>