Author: rjung Date: Sun Jan 28 05:15:50 2007 New Revision: 500787 URL: http://svn.apache.org/viewvc?view=rev&rev=500787 Log: Adding a configuration attribute to the status worker, to make user comparison case insensitive (BZ 41318).
Modified: tomcat/connectors/trunk/jk/native/common/jk_status.c tomcat/connectors/trunk/jk/native/common/jk_util.c tomcat/connectors/trunk/jk/native/common/jk_util.h tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml tomcat/connectors/trunk/jk/xdocs/reference/status.xml tomcat/connectors/trunk/jk/xdocs/reference/workers.xml Modified: tomcat/connectors/trunk/jk/native/common/jk_status.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_status.c?view=diff&rev=500787&r1=500786&r2=500787 ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_status.c (original) +++ tomcat/connectors/trunk/jk/native/common/jk_status.c Sun Jan 28 05:15:50 2007 @@ -260,6 +260,7 @@ int read_only; char **user_names; unsigned int num_of_users; + int user_case_insensitive; jk_uint32_t good_mask; jk_uint32_t bad_mask; jk_worker_t worker; @@ -2987,9 +2988,17 @@ unsigned int i; denied = 1; for (i = 0; i < w->num_of_users; i++) { - if (!strcmp(s->remote_user, w->user_names[i])) { - denied = 0; - break; + if (w->user_case_insensitive) { + if (!strcasecmp(s->remote_user, w->user_names[i])) { + denied = 0; + break; + } + } + else { + if (!strcmp(s->remote_user, w->user_names[i])) { + denied = 0; + break; + } } } } @@ -3502,20 +3511,26 @@ p->xmlns = jk_get_worker_xmlns(props, p->name, JK_STATUS_XMLNS_DEF); p->doctype = jk_get_worker_xml_doctype(props, p->name, NULL); p->read_only = jk_get_is_read_only(props, p->name); + p->user_case_insensitive = jk_get_worker_user_case_insensitive(props, p->name); if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "Status worker '%s' has css '%s' and read_only '%s'", + "Status worker '%s' is %s and has css '%s', prefix '%s', name space '%s', xml name space '%s', document type '%s'", p->name, + p->read_only ? "read-only" : "read/write", p->css ? p->css : "(null)", - p->read_only ? "true" : "false"); + p->prefix ? p->prefix : "(null)", + p->ns ? p->ns : "(null)", + p->xmlns ? p->xmlns : "(null)", + p->doctype ? p->doctype : "(null)"); if (jk_get_worker_user_list(props, p->name, &(p->user_names), &(p->num_of_users)) && p->num_of_users) { for (i = 0; i < p->num_of_users; i++) { if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "restricting access for status worker '%s' to user '%s'", - p->name, p->user_names[i]); + "Status worker '%s' restricting access to user '%s' case %s", + p->name, p->user_names[i], + p->user_case_insensitive ? "insensitive" : "sensitive"); } } if (jk_get_worker_good_rating(props, p->name, 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=500787&r1=500786&r2=500787 ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_util.c (original) +++ tomcat/connectors/trunk/jk/native/common/jk_util.c Sun Jan 28 05:15:50 2007 @@ -85,6 +85,7 @@ #define READ_ONLY_OF_WORKER ("read_only") #define USER_OF_WORKER ("user") +#define USER_CASE_OF_WORKER ("user_case_insensitive") #define GOOD_RATING_OF_WORKER ("good") #define BAD_RATING_OF_WORKER ("bad") @@ -182,6 +183,7 @@ XML_DOCTYPE_OF_WORKER, PROP_PREFIX_OF_WORKER, STATUS_FAIL_OF_WORKER, + USER_CASE_OF_WORKER, NULL }; @@ -1027,6 +1029,20 @@ } +int jk_get_worker_user_case_insensitive(jk_map_t *m, const char *wname) +{ + int rc = JK_FALSE; + char buf[1024]; + if (m && wname) { + int value; + MAKE_WORKER_PARAM(USER_CASE_OF_WORKER); + value = jk_map_get_bool(m, buf, 0); + if (value) + rc = JK_TRUE; + } + return rc; + +} const char *jk_get_worker_style_sheet(jk_map_t *m, const char *wname, const char *def) { Modified: tomcat/connectors/trunk/jk/native/common/jk_util.h URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.h?view=diff&rev=500787&r1=500786&r2=500787 ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_util.h (original) +++ tomcat/connectors/trunk/jk/native/common/jk_util.h Sun Jan 28 05:15:50 2007 @@ -199,6 +199,8 @@ int jk_get_worker_fail_on_status(jk_map_t *m, const char *wname); +int jk_get_worker_user_case_insensitive(jk_map_t *m, const char *wname); + #define TC32_BRIDGE_TYPE 32 #define TC33_BRIDGE_TYPE 33 #define TC40_BRIDGE_TYPE 40 Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?view=diff&rev=500787&r1=500786&r2=500787 ============================================================================== --- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original) +++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Sun Jan 28 05:15:50 2007 @@ -27,6 +27,10 @@ <subsection name="Native"> <changelog> <add> + <bug>41318</bug>: Add configuration to make status worker user + name checks case insensitive. (rjung) + </add> + <add> JkStatus: Add estimated time until next global maintenance to other mime types and adopt jkstatus ant task. (rjung) </add> Modified: tomcat/connectors/trunk/jk/xdocs/reference/status.xml URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/reference/status.xml?view=diff&rev=500787&r1=500786&r2=500787 ============================================================================== --- tomcat/connectors/trunk/jk/xdocs/reference/status.xml (original) +++ tomcat/connectors/trunk/jk/xdocs/reference/status.xml Sun Jan 28 05:15:50 2007 @@ -256,13 +256,23 @@ worker.jk-manage.type=status worker.jk-manage.mount=/admin/status/jk </source> +Starting with version 1.2.21, a read/write status worker can also be switched temporarily +into read-only mode by the user via a link in the HTML GUI. The user can always switch it +back to read/write. Only a status worker configured as read-only via the "read_only" attribute +is completely safe from applying any changes. +</p> +<p> The other attribute you can use is <b>user</b>. By default this list is empty, which means no limit on the users. You can set "user" to a comma separated list of user names. If your -web server is confiugured such that it sends the user names with the request, the status worker +web server is configured such that it sends the user names with the request, the status worker will check, if the name attached with the request is contained in it's "user" list. </p> <p> The user list can be split over multiple occurences of the "user" attribute. +</p> +<p> +By default, the user names are matched case sensitively. Starting with version 1.2.21 you can set +the attribute <b>user_case_insensitive</b> to "True". Then the comparison will be made case insensitive. </p> </subsection> Modified: tomcat/connectors/trunk/jk/xdocs/reference/workers.xml URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/reference/workers.xml?view=diff&rev=500787&r1=500786&r2=500787 ============================================================================== --- tomcat/connectors/trunk/jk/xdocs/reference/workers.xml (original) +++ tomcat/connectors/trunk/jk/xdocs/reference/workers.xml Sun Jan 28 05:15:50 2007 @@ -392,6 +392,14 @@ This feature has been added in <b>jk 1.2.20</b>. </p> </directive> +<directive name="user_case_insensitive" default="False" required="false"> +By default, the user names are matched case sensitively. You can set +user_case_insensitive=True to make the comparison case insensitive. +This may be especially useful on the Windows platform. +<p> +This feature has been added in <b>jk 1.2.21</b>. +</p> +</directive> <directive name="good" default="a.o,a.n,a.b,a.r" required="false"> For every load balancer worker, the status worker shows a summary of the state of its members. There are three such states, --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]