mturk 2004/11/30 00:22:47
Modified: jk/native/apache-1.3 mod_jk.c
jk/native/apache-2.0 mod_jk.c
Log:
Allow JkMount and JkUnMount directives to be defined inside
Location and Files sections. This allows security to be implemented
on apache side.
Revision Changes Path
1.54 +45 -13 jakarta-tomcat-connectors/jk/native/apache-1.3/mod_jk.c
Index: mod_jk.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-1.3/mod_jk.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- mod_jk.c 30 Nov 2004 07:30:41 -0000 1.53
+++ mod_jk.c 30 Nov 2004 08:22:47 -0000 1.54
@@ -665,20 +665,37 @@
static const char *jk_mount_context(cmd_parms * cmd,
void *dummy,
char *context,
- char *worker, char *maybe_cookie)
+ char *worker)
{
server_rec *s = cmd->server;
jk_server_conf_t *conf =
(jk_server_conf_t *) ap_get_module_config(s->module_config,
&jk_module);
char *old;
- if (context[0] != '/')
- return "Mount context should start with /";
+ const char *c, *w;
+
+ if (worker != NULL && cmd->path == NULL ) {
+ c = context;
+ w = worker;
+ }
+ else if (worker == NULL && cmd->path != NULL) {
+ c = cmd->path;
+ w = context;
+ }
+ else {
+ if (worker == NULL)
+ return "JkMount needs a path when not defined in a location";
+ else
+ return "JkMount can not have a path when defined in a location";
+ }
+
+ if (c[0] != '/')
+ return "JkMount context should start with /";
/*
* Add the new worker to the alias map.
*/
- jk_map_put(conf->uri_to_context, context, worker, (void **)&old);
+ jk_map_put(conf->uri_to_context, c, w, (void **)&old);
return NULL;
}
@@ -691,21 +708,36 @@
static const char *jk_unmount_context(cmd_parms * cmd,
void *dummy,
const char *context,
- const char *worker,
- const char *maybe_cookie)
+ const char *worker)
{
server_rec *s = cmd->server;
jk_server_conf_t *conf =
(jk_server_conf_t *) ap_get_module_config(s->module_config,
&jk_module);
char *old , *uri;
- if (context[0] != '/')
- return "Unmount context should start with /";
- uri = ap_pstrcat(cmd->temp_pool, "!", context, NULL);
+ const char *c, *w;
+
+ if (worker != NULL && cmd->path == NULL ) {
+ c = context;
+ w = worker;
+ }
+ else if (worker == NULL && cmd->path != NULL) {
+ c = cmd->path;
+ w = context;
+ }
+ else {
+ if (worker == NULL)
+ return "JkUnMount needs a path when not defined in a location";
+ else
+ return "JkUnMount can not have a path when defined in a
location";
+ }
+ if (c[0] != '/')
+ return "JkUnMount context should start with /";
+ uri = ap_pstrcat(cmd->temp_pool, "!", c, NULL);
/*
* Add the new worker to the alias map.
*/
- jk_map_put(conf->uri_to_context, uri, worker, (void **)&old);
+ jk_map_put(conf->uri_to_context, uri, w, (void **)&old);
return NULL;
}
@@ -1453,14 +1485,14 @@
* JkMount mounts a url prefix to a worker (the worker need to be
* defined in the worker properties file.
*/
- {"JkMount", jk_mount_context, NULL, RSRC_CONF, TAKE23,
+ {"JkMount", jk_mount_context, NULL, RSRC_CONF|ACCESS_CONF, TAKE12,
"A mount point from a context to a servlet-engine worker"},
/*
* JkUnMount unmounts a url prefix to a worker (the worker need to be
* defined in the worker properties file.
*/
- {"JkUnMount", jk_unmount_context, NULL, RSRC_CONF, TAKE23,
+ {"JkUnMount", jk_unmount_context, NULL, RSRC_CONF|ACCESS_CONF, TAKE12,
"A no mount point from a context to a servlet-engine worker"},
/*
1.103 +47 -14 jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c
Index: mod_jk.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -r1.102 -r1.103
--- mod_jk.c 30 Nov 2004 07:30:42 -0000 1.102
+++ mod_jk.c 30 Nov 2004 08:22:47 -0000 1.103
@@ -705,21 +705,37 @@
static const char *jk_mount_context(cmd_parms * cmd,
void *dummy,
const char *context,
- const char *worker,
- const char *maybe_cookie)
+ const char *worker)
{
server_rec *s = cmd->server;
jk_server_conf_t *conf =
(jk_server_conf_t *) ap_get_module_config(s->module_config,
&jk_module);
char *old;
- if (context[0] != '/')
- return "Mount xontext should start with /";
+ const char *c, *w;
+
+ if (worker != NULL && cmd->path == NULL ) {
+ c = context;
+ w = worker;
+ }
+ else if (worker == NULL && cmd->path != NULL) {
+ c = cmd->path;
+ w = context;
+ }
+ else {
+ if (worker == NULL)
+ return "JkMount needs a path when not defined in a location";
+ else
+ return "JkMount can not have a path when defined in a location";
+ }
+
+ if (c[0] != '/')
+ return "JkMount context should start with /";
/*
* Add the new worker to the alias map.
*/
- jk_map_put(conf->uri_to_context, context, worker, (void **)&old);
+ jk_map_put(conf->uri_to_context, c, w, (void **)&old);
return NULL;
}
@@ -732,21 +748,38 @@
static const char *jk_unmount_context(cmd_parms * cmd,
void *dummy,
const char *context,
- const char *worker,
- const char *maybe_cookie)
+ const char *worker)
{
server_rec *s = cmd->server;
jk_server_conf_t *conf =
(jk_server_conf_t *) ap_get_module_config(s->module_config,
&jk_module);
char *old , *uri;
- if (context[0] != '/')
- return "Unmount context should start with /";
- uri = apr_pstrcat(cmd->temp_pool, "!", context, NULL);
+ const char *c, *w;
+
+ if (worker != NULL && cmd->path == NULL ) {
+ c = context;
+ w = worker;
+ }
+ else if (worker == NULL && cmd->path != NULL) {
+ c = cmd->path;
+ w = context;
+ }
+ else {
+ if (worker == NULL)
+ return "JkUnMount needs a path when not defined in a location";
+ else
+ return "JkUnMount can not have a path when defined in a
location";
+ }
+
+ if (c[0] != '/')
+ return "JkUnMount context should start with /";
+
+ uri = apr_pstrcat(cmd->temp_pool, "!", c, NULL);
/*
* Add the new worker to the alias map.
*/
- jk_map_put(conf->uri_to_context, uri, worker, (void **)&old);
+ jk_map_put(conf->uri_to_context, uri, w, (void **)&old);
return NULL;
}
@@ -1554,14 +1587,14 @@
* JkMount mounts a url prefix to a worker (the worker need to be
* defined in the worker properties file.
*/
- AP_INIT_TAKE23("JkMount", jk_mount_context, NULL, RSRC_CONF,
+ AP_INIT_TAKE12("JkMount", jk_mount_context, NULL, RSRC_CONF|ACCESS_CONF,
"A mount point from a context to a Tomcat worker"),
/*
* JkUnMount unmounts a url prefix to a worker (the worker need to be
* defined in the worker properties file.
*/
- AP_INIT_TAKE23("JkUnMount", jk_unmount_context, NULL, RSRC_CONF,
+ AP_INIT_TAKE12("JkUnMount", jk_unmount_context, NULL,
RSRC_CONF|ACCESS_CONF,
"A no mount point from a context to a Tomcat worker"),
/*
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]