Author: jfclere
Date: Sat Feb 24 11:02:40 2007
New Revision: 511326
URL: http://svn.apache.org/viewvc?view=rev&rev=511326
Log:
Check the worker parameters.
Modified:
tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
tomcat/connectors/trunk/jk/native/common/jk_map.c
tomcat/connectors/trunk/jk/native/common/jk_util.c
Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c?view=diff&rev=511326&r1=511325&r2=511326
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c Sat Feb 24 11:02:40
2007
@@ -1744,9 +1744,9 @@
jk_server_conf_t *conf =
(jk_server_conf_t *) ap_get_module_config(s->module_config,
&jk_module);
-
+
if (jk_map_read_property(conf->worker_properties, line, 1, conf->log) ==
JK_FALSE)
- return ap_pstrcat(cmd->temp_pool, "Invalid JkWorkerProperty ", line);
+ return ap_pstrcat(cmd->temp_pool, "Invalid JkWorkerProperty ", line,
NULL);
return NULL;
}
@@ -2543,8 +2543,9 @@
ap_log_error(APLOG_MARK, APLOG_EMERG, s,
"No worker file and no worker options in httpd.conf "
"use JkWorkerFile to set workers");
- return;
}
+ ap_log_error(APLOG_MARK, APLOG_EMERG | APLOG_NOERRNO, 0, NULL, "Error
in reading worker properties");
+ return !OK;
}
#if MODULE_MAGIC_NUMBER >= 19980527
Modified: tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c?view=diff&rev=511326&r1=511325&r2=511326
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c Sat Feb 24 11:02:40
2007
@@ -250,7 +250,7 @@
static int JK_METHOD ws_read(jk_ws_service_t *s,
void *b, unsigned len, unsigned *actually_read);
-static void init_jk(apr_pool_t * pconf, jk_server_conf_t * conf,
+static int init_jk(apr_pool_t * pconf, jk_server_conf_t * conf,
server_rec * s);
static int JK_METHOD ws_write(jk_ws_service_t *s, const void *b, unsigned l);
@@ -1788,7 +1788,7 @@
}
if (jk_map_read_property(conf->worker_properties, line, 1, conf->log) ==
JK_FALSE)
- return apr_pstrcat(cmd->temp_pool, "Invalid JkWorkerProperty ", line);
+ return apr_pstrcat(cmd->temp_pool, "Invalid JkWorkerProperty ", line,
NULL);
return NULL;
}
@@ -2608,7 +2608,7 @@
SetHandler and normal apache directives ( but minimal jk-specific
stuff )
*/
-static void init_jk(apr_pool_t * pconf, jk_server_conf_t * conf,
+static int init_jk(apr_pool_t * pconf, jk_server_conf_t * conf,
server_rec * s)
{
int rc;
@@ -2664,12 +2664,14 @@
0, NULL,
"No worker file and no worker options in httpd.conf"
"use JkWorkerFile to set workers");
- return;
}
+ ap_log_error(APLOG_MARK, APLOG_EMERG | APLOG_NOERRNO, 0, NULL, "Error
in reading worker properties");
+ return !OK;
}
if (jk_map_resolve_references(init_map, "worker.", 1, 1, conf->log) ==
JK_FALSE) {
- jk_error_exit(APLOG_MARK, APLOG_EMERG, s, pconf, "Error in resolving
configuration references");
+ ap_log_error(APLOG_MARK, APLOG_EMERG | APLOG_NOERRNO, 0, NULL, "Error
in resolving configuration references");
+ return !OK;
}
/* we add the URI->WORKER MAP since workers using AJP14
@@ -2684,6 +2686,7 @@
if (wc_open(init_map, &worker_env, conf->log)) {
ap_add_version_component(pconf, JK_EXPOSED_VERSION);
}
+ return OK;
}
static int jk_post_config(apr_pool_t * pconf,
@@ -2701,7 +2704,7 @@
pconf)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
"mod_jk: could not create jk_log_lock");
- return HTTP_INTERNAL_SERVER_ERROR;
+ return !OK;
}
#if JK_NEED_SET_MUTEX_PERMS
@@ -2710,7 +2713,7 @@
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
"mod_jk: Could not set permissions on "
"jk_log_lock; check User and Group directives");
- return HTTP_INTERNAL_SERVER_ERROR;
+ return !OK;
}
#endif
@@ -2728,7 +2731,7 @@
jk_server_conf_t *sconf = (jk_server_conf_t
*)ap_get_module_config(srv->module_config,
&jk_module);
if (open_jklog(srv, pconf))
- return HTTP_INTERNAL_SERVER_ERROR;
+ return !OK;
if (sconf) {
if (!uri_worker_map_alloc(&(sconf->uw_map),
sconf->uri_to_context,
sconf->log))
@@ -2776,7 +2779,8 @@
}
}
}
- init_jk(pconf, conf, s);
+ if (init_jk(pconf, conf, s))
+ return !OK;
}
}
Modified: tomcat/connectors/trunk/jk/native/common/jk_map.c
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_map.c?view=diff&rev=511326&r1=511325&r2=511326
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_map.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_map.c Sat Feb 24 11:02:40 2007
@@ -365,6 +365,14 @@
trim(v);
if (strlen(v) && strlen(prp)) {
const char *oldv = jk_map_get_string(m, prp, NULL);
+ /* check the worker properties */
+ if (!jk_is_valid_property(prp)) {
+ jk_log(l, JK_LOG_ERROR,
+ "The attribute '%s' is not supported - please check"
+ " the documentation for the supported attributes.",
+ prp);
+ return JK_FALSE;
+ }
if (jk_is_deprecated_property(prp)) {
jk_log(l, JK_LOG_WARNING,
"The attribute '%s' is deprecated - please check"
Modified: tomcat/connectors/trunk/jk/native/common/jk_util.c
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.c?view=diff&rev=511326&r1=511325&r2=511326
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.c Sat Feb 24 11:02:40 2007
@@ -96,7 +96,9 @@
#define DEFAULT_WORKER JK_AJP13_WORKER_NAME
#define WORKER_LIST_PROPERTY_NAME ("worker.list")
+#define LIST_PROPERTY_NAME ("list")
#define WORKER_MAINTAIN_PROPERTY_NAME ("worker.maintain")
+#define MAINTAIN_PROPERTY_NAME ("maintain")
#define DEFAULT_MAINTAIN_TIME (60)
#define DEFAULT_LB_FACTOR (1)
#define DEFAULT_DISTANCE (0)
@@ -209,6 +211,70 @@
NULL
};
+static const char *supported_properties[] = {
+ SYSPROPS_OF_WORKER,
+ STDERR_OF_WORKER,
+ STDOUT_OF_WORKER,
+ SECRET_OF_WORKER,
+ MX_OF_WORKER,
+ MS_OF_WORKER,
+ CP_OF_WORKER,
+ BRIDGE_OF_WORKER,
+ JVM_OF_WORKER,
+ LIBPATH_OF_WORKER,
+ CMD_LINE_OF_WORKER,
+ NATIVE_LIB_OF_WORKER,
+ HOST_OF_WORKER,
+ PORT_OF_WORKER,
+ TYPE_OF_WORKER,
+ CACHE_OF_WORKER_DEPRECATED,
+ CACHE_OF_WORKER,
+ CACHE_OF_WORKER_MIN,
+ CACHE_TIMEOUT_DEPRECATED,
+ CACHE_TIMEOUT_OF_WORKER,
+ RECOVERY_OPTS_OF_WORKER,
+ CONNECT_TIMEOUT_OF_WORKER,
+ PREPOST_TIMEOUT_OF_WORKER,
+ REPLY_TIMEOUT_OF_WORKER,
+ SOCKET_TIMEOUT_OF_WORKER,
+ SOCKET_BUFFER_OF_WORKER,
+ SOCKET_KEEPALIVE_OF_WORKER,
+ RECYCLE_TIMEOUT_DEPRECATED,
+ LOAD_FACTOR_OF_WORKER,
+ DISTANCE_OF_WORKER,
+ BALANCED_WORKERS_DEPRECATED,
+ BALANCE_WORKERS,
+ STICKY_SESSION,
+ STICKY_SESSION_FORCE,
+ JVM_ROUTE_OF_WORKER_DEPRECATED,
+ ROUTE_OF_WORKER,
+ DOMAIN_OF_WORKER,
+ REDIRECT_OF_WORKER,
+ MOUNT_OF_WORKER,
+ METHOD_OF_WORKER,
+ LOCK_OF_WORKER,
+ IS_WORKER_DISABLED_DEPRECATED,
+ IS_WORKER_STOPPED_DEPRECATED,
+ ACTIVATION_OF_WORKER,
+ WORKER_RECOVER_TIME,
+ WORKER_MAX_PACKET_SIZE,
+ STYLE_SHEET_OF_WORKER,
+ NAMESPACE_OF_WORKER,
+ XML_NAMESPACE_OF_WORKER,
+ XML_DOCTYPE_OF_WORKER,
+ PROP_PREFIX_OF_WORKER,
+ READ_ONLY_OF_WORKER,
+ USER_OF_WORKER,
+ USER_CASE_OF_WORKER,
+ GOOD_RATING_OF_WORKER,
+ BAD_RATING_OF_WORKER,
+ SECRET_KEY_OF_WORKER,
+ RETRIES_OF_WORKER,
+ STATUS_FAIL_OF_WORKER,
+ LIST_PROPERTY_NAME,
+ MAINTAIN_PROPERTY_NAME
+};
+
/* All entries need to have fixed length 8 chars! */
static const char *jk_level_verbs[] = {
"[" JK_LOG_TRACE_VERB "] ",
@@ -1447,6 +1513,24 @@
int jk_is_deprecated_property(const char *prp_name)
{
const char **props = &deprecated_properties[0];
+ while (*props) {
+ if (jk_is_some_property(prp_name, *props, "."))
+ return JK_TRUE;
+ props++;
+ }
+ return JK_FALSE;
+}
+/*
+ * Check that property is a valid one (to prevent user typos).
+ * Only property starting with worker.
+ */
+int jk_is_valid_property(const char *prp_name)
+{
+ const char **props;
+ if (memcmp(prp_name, "worker.", 7))
+ return JK_TRUE;
+
+ props = &supported_properties[0];
while (*props) {
if (jk_is_some_property(prp_name, *props, "."))
return JK_TRUE;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]