diff options
author | pgollucci <pgollucci@FreeBSD.org> | 2008-12-28 16:08:59 +0800 |
---|---|---|
committer | pgollucci <pgollucci@FreeBSD.org> | 2008-12-28 16:08:59 +0800 |
commit | 5e08c341c88479c4a263dbd4c419806ec182518f (patch) | |
tree | fc36867063383d37b65fd913cbb657ad7fc09d0a /www | |
parent | 3c9ba80aa429748e68f854a0f9f5550280db285f (diff) | |
download | freebsd-ports-gnome-5e08c341c88479c4a263dbd4c419806ec182518f.tar.gz freebsd-ports-gnome-5e08c341c88479c4a263dbd4c419806ec182518f.tar.zst freebsd-ports-gnome-5e08c341c88479c4a263dbd4c419806ec182518f.zip |
- fix build with www/apache22
- fix build with www/apache20
PR: ports/127032
Submitted by: Tsurutani Naoki <turutani@scphys.kyoto-u.ac.jp>
Diffstat (limited to 'www')
-rw-r--r-- | www/mod_encoding/Makefile | 41 | ||||
-rw-r--r-- | www/mod_encoding/files/apache20_patch | 535 | ||||
-rw-r--r-- | www/mod_encoding/files/apache22_patch | 538 | ||||
-rw-r--r-- | www/mod_encoding/files/iconv_hook-20040430.patch | 47 | ||||
-rw-r--r-- | www/mod_encoding/files/queryfix-patch13 | 30 | ||||
-rw-r--r-- | www/mod_encoding/files/queryfix-patch22 | 30 |
6 files changed, 1211 insertions, 10 deletions
diff --git a/www/mod_encoding/Makefile b/www/mod_encoding/Makefile index 9efacc3af43c..9452184a8de1 100644 --- a/www/mod_encoding/Makefile +++ b/www/mod_encoding/Makefile @@ -7,7 +7,7 @@ PORTNAME= mod_encoding PORTVERSION= 20021209 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= www MASTER_SITES= http://webdav.todo.gr.jp/download/ @@ -16,24 +16,45 @@ COMMENT= Apache module for non-ascii filename interoperability # This port will work with the following version of Apache and anything newer. # Mostly because of the dependency of mod_dav. -APACHE_VERSION= 1.3.6 +#APACHE_VERSION= 1.3.6 -PLIST_FILES= libexec/apache/mod_encoding.so -USE_APACHE= yes +USE_APACHE= 1.3+ USE_ICONV= yes HAS_CONFIGURE= yes USE_GMAKE= yes + +.include <bsd.port.pre.mk> + CONFIGURE_ARGS= --prefix=${PREFIX} \ --bindir=${PREFIX}/bin \ --sbindir=${PREFIX}/sbin \ - --libexecdir=${PREFIX}/libexec/apache \ - --sysconfdir=${PREFIX}/etc/apache \ - --datadir=${PREFIX}/share/apache \ - --includedir=${PREFIX}/include/apache \ + --libexecdir=${APACHEMODDIR} \ + --sysconfdir=${APACHEETCDIR} \ + --includedir=${APACHEINCLUDEDIR} \ --with-apxs=${APXS} -CONFIGURE_ENV= CPPFLAGS='-I${LOCALBASE}/include/apache -I${LOCALBASE}/include' \ +CONFIGURE_ENV= CPPFLAGS='-I${APACHEINCLUDEDIR} -I${LOCALBASE}/include' \ LIBS='-L${LOCALBASE}/lib' \ PATH="${PREFIX}/bin:${PREFIX}/sbin:${PATH}" -.include <bsd.port.mk> +PLIST_FILES= ${APACHEMODDIR}/mod_encoding.so + +.if ${APACHE_VERSION} == 20 +EXTRA_PATCHES= ${PATCHDIR}/apache20_patch +.elif ${APACHE_VERSION} >= 21 +EXTRA_PATCHES= ${PATCHDIR}/apache22_patch +.endif + +.if !defined(WITHOUT_ICONV_FIX) +EXTRA_PATCHES+= ${PATCHDIR}/iconv_hook-20040430.patch +.endif + +.if defined(WITH_QUERYSTRING_FIX) +.if ${APACHE_VERSION} <= 20 +EXTRA_PATCHES+= ${PATCHDIR}/queryfix-patch13 +.elif ${APACHE_VERSION} >= 21 +EXTRA_PATCHES+= ${PATCHDIR}/queryfix-patch22 +.endif +.endif + +.include <bsd.port.post.mk> diff --git a/www/mod_encoding/files/apache20_patch b/www/mod_encoding/files/apache20_patch new file mode 100644 index 000000000000..2533fba20c88 --- /dev/null +++ b/www/mod_encoding/files/apache20_patch @@ -0,0 +1,535 @@ +--- mod_encoding.c.orig 2002-06-11 18:07:14.000000000 +0900 ++++ mod_encoding.c 2005-11-04 17:40:37.000000000 +0900 +@@ -1,8 +1,72 @@ + /* -*- mode: c -*- + * +- * $Id: mod_encoding.c,v 1.10 2002/06/11 09:07:14 tai Exp $ ++ * $Id: mod_encoding.c,v 1.6 2001/12/11 12:55:38 tai Exp $ + * + */ ++/* ++ * mod_encoding core module test implementation for Apache2. ++ * by Kunio Miyamoto (wakatono@todo.gr.jp) ++ * Original security fix port 2002/06/06 ++ * by Kunio Miyamoto (wakatono@todo.gr.jp) ++ * Port new function of 20020611a ++ * by Kunio Miyamoto (wakatono@todo.gr.jp) ++ * Port new function of 20020611a ++ * by Kunio Miyamoto (wakatono@todo.gr.jp) ++ * Add COPYING statement for redistribute only this code. ++ * by Kunio Miyamoto (wakatono@todo.gr.jp) ++ */ ++/* ++ ++ ++Copyright (c) 2000-2004 ++Internet Initiative Japan Inc. and Kunio Miyamoto All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions ++are met: ++ ++1. Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ ++2. Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in ++ the documentation and/or other materials provided with the ++ distribution. ++ ++3. All advertising materials mentioning features or use of this ++ software must display the following acknowledgment: ++ ++ This product includes software developed by Internet ++ Initiative Japan Inc. and Kunio Miyamoto for use in the ++ mod_encoding module for Apache2. ++ ++4. Products derived from this software may not be called "mod_encoding" ++ nor may "mod_encoding" appear in their names without prior written ++ permission of Internet Initiative Japan Inc. For written permission, ++ please contact tai@iij.ad.jp (Taisuke Yamada). ++ ++5. Redistributions of any form whatsoever must retain the following ++ acknowledgment: ++ ++ This product includes software developed by Internet ++ Initiative Japan Inc. and Kunio Miyamoto for use in the ++ mod_encoding module for Apache2 (http://www.apache.org/). ++ ++THIS SOFTWARE IS PROVIDED BY INTERNET INITIATIVE JAPAN INC. AND KUNIO ++MIYAMOTO ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, ++BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND ++FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ++INTERNET INITIATIVE JAPAN INC., KUNIO MIYAMOTO OR ITS CONTRIBUTORS ++BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, ++OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT ++OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ++BUSINESS INTERRUPTION) ++HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ++STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ++OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++*/ + + #include <httpd.h> + #include <http_config.h> +@@ -10,6 +74,7 @@ + #include <http_log.h> + #include <http_protocol.h> + #include <http_request.h> ++#include <ap_compat.h> + + #include <iconv.h> + +@@ -33,13 +98,7 @@ + + #define DBG(expr) if (MOD_ENCODING_DEBUG) { expr; } + +-#ifdef __GNUC__ +-#define LOG(level, server, args...) \ +- ap_log_error(APLOG_MARK, APLOG_NOERRNO|level, server, ##args) +-#else +-#define LOG(level, server, ...) \ +- ap_log_error(APLOG_MARK, APLOG_NOERRNO|level, server, __VA_ARGS__) +-#endif ++/* FIXME: remove gcc-dependency */ + + #define ENABLE_FLAG_UNSET 0 + #define ENABLE_FLAG_OFF 1 +@@ -55,13 +114,13 @@ + typedef struct { + int enable_function; /* flag to enable this module */ + char *server_encoding; /* server-side filesystem encoding */ +- array_header *client_encoding; /* useragent-to-encoding-list sets */ +- array_header *default_encoding; /* useragent-to-encoding-list sets */ ++ apr_array_header_t *client_encoding; /* useragent-to-encoding-list sets */ ++ apr_array_header_t *default_encoding; /* useragent-to-encoding-list sets */ + +- int strip_msaccount; /* normalize wierd WinXP username */ ++ int strip_msaccount; /* normalize wierd WinXP username */ + } encoding_config; + +-module MODULE_VAR_EXPORT encoding_module; ++module AP_MODULE_DECLARE_DATA encoding_module; + + /*************************************************************************** + * utility methods +@@ -83,22 +142,19 @@ + size_t outlen; + + if (srclen == 0) { +- LOG(APLOG_DEBUG, r->server, "iconv_string: skipping zero-length input"); + return srcbuf; + } + + /* Allocate space for conversion. Note max bloat factor is 4 of UCS-4 */ +- marker = outbuf = (char *)ap_palloc(r->pool, outlen = srclen * 4 + 1); ++ marker = outbuf = (char *)apr_palloc(r->pool, outlen = srclen * 4 + 1); + + if (outbuf == NULL) { +- LOG(APLOG_WARNING, r->server, "iconv_string: no more memory"); + return NULL; + } + + /* Convert every character within input string. */ + while (srclen > 0) { + if (iconv(cd, &srcbuf, &srclen, &outbuf, &outlen) == (size_t)(-1)) { +- LOG(APLOG_DEBUG, r->server, "iconv_string: conversion error"); + return NULL; + } + } +@@ -140,11 +196,11 @@ + + /* Normalize encoding in HTTP request header(s) */ + for (i = 0 ; keys[i] ; i++) { +- if ((buff = (char *)ap_table_get(r->headers_in, keys[i])) != NULL) { ++ if ((buff = (char *)apr_table_get(r->headers_in, keys[i])) != NULL) { + ap_unescape_url(buff); + if ((buff = iconv_string(r, cd, buff, strlen(buff))) == NULL) + return -1; +- ap_table_set(r->headers_in, keys[i], buff); ++ apr_table_set(r->headers_in, keys[i], buff); + } + } + +@@ -159,33 +215,29 @@ + * @param encmap Table of UA-to-encoding(s) + * @param lookup Name of the useragent to look for + */ +-static array_header * ++static apr_array_header_t * + get_client_encoding(request_rec *r, +- array_header *encmap, const char *lookup) { ++ apr_array_header_t *encmap, const char *lookup) { + void **list = (void **)encmap->elts; +- array_header *encs = ap_make_array(r->pool, 1, sizeof(char *)); ++ apr_array_header_t *encs = apr_array_make(r->pool, 1, sizeof(char *)); + + int i; + +- LOG(APLOG_DEBUG, r->server, "get_client_encoding: entered"); + + /* push UTF-8 as the first candidate of expected encoding */ +- *((char **)ap_push_array(encs)) = ap_pstrdup(r->pool, "UTF-8"); ++ *((char **)apr_array_push(encs)) = apr_pstrdup(r->pool, "UTF-8"); + + if (! lookup) + return encs; + +- LOG(APLOG_DEBUG, r->server, "get_client_encoding: lookup == %s", lookup); + + for (i = 0 ; i < encmap->nelts ; i += 2) { + if (ap_regexec((regex_t *)list[i], lookup, 0, NULL, 0) == 0) { +- LOG(APLOG_DEBUG, r->server, "get_client_encoding: entry found"); +- ap_array_cat(encs, (array_header *)list[i + 1]); ++ apr_array_cat(encs, (apr_array_header_t *)list[i + 1]); + return encs; + } + } + +- LOG(APLOG_DEBUG, r->server, "get_client_encoding: entry not found"); + return encs; + } + +@@ -194,8 +246,6 @@ + */ + static const char * + set_encoding_engine(cmd_parms *cmd, encoding_config *conf, int flag) { +- LOG(APLOG_DEBUG, cmd->server, "set_encoding_engine: entered"); +- LOG(APLOG_DEBUG, cmd->server, "set_encoding_engine: flag == %d", flag); + + if (! cmd->path) { + conf = ap_get_module_config(cmd->server->module_config, &encoding_module); +@@ -210,13 +260,11 @@ + */ + static const char * + set_server_encoding(cmd_parms *cmd, encoding_config *conf, char *arg) { +- LOG(APLOG_DEBUG, cmd->server, "set_server_encoding: entered"); +- LOG(APLOG_DEBUG, cmd->server, "set_server_encoding: arg == %s", arg); + + if (! cmd->path) { + conf = ap_get_module_config(cmd->server->module_config, &encoding_module); + } +- conf->server_encoding = ap_pstrdup(cmd->pool, arg); ++ conf->server_encoding = apr_pstrdup(cmd->pool, arg); + + return NULL; + } +@@ -229,31 +277,27 @@ + */ + static const char * + add_client_encoding(cmd_parms *cmd, encoding_config *conf, char *args) { +- array_header *encs; ++ apr_array_header_t *encs; + char *arg; + +- LOG(APLOG_DEBUG, cmd->server, "add_client_encoding: entered"); +- LOG(APLOG_DEBUG, cmd->server, "add_client_encoding: args == %s", args); + + if (! cmd->path) { + conf = ap_get_module_config(cmd->server->module_config, &encoding_module); + } + +- encs = ap_make_array(cmd->pool, 1, sizeof(void *)); ++ encs = apr_array_make(cmd->pool, 1, sizeof(void *)); + + /* register useragent with UserAgent: pattern */ + if (*args && (arg = ap_getword_conf_nc(cmd->pool, &args))) { +- LOG(APLOG_DEBUG, cmd->server, "add_client_encoding: agent: %s", arg); +- *(void **)ap_push_array(conf->client_encoding) = ++ *(void **)apr_array_push(conf->client_encoding) = + ap_pregcomp(cmd->pool, arg, REG_EXTENDED|REG_ICASE|REG_NOSUB); + } + + /* register list of possible encodings from above useragent */ + while (*args && (arg = ap_getword_conf_nc(cmd->pool, &args))) { +- LOG(APLOG_DEBUG, cmd->server, "add_client_encoding: encname: %s", arg); +- *(void **)ap_push_array(encs) = ap_pstrdup(cmd->pool, arg); ++ *(void **)apr_array_push(encs) = apr_pstrdup(cmd->pool, arg); + } +- *(void **)ap_push_array(conf->client_encoding) = encs; ++ *(void **)apr_array_push(conf->client_encoding) = encs; + + return NULL; + } +@@ -267,20 +311,17 @@ + default_client_encoding(cmd_parms *cmd, encoding_config *conf, char *args) { + char *arg; + +- LOG(APLOG_DEBUG, cmd->server, "default_client_encoding: entered"); +- LOG(APLOG_DEBUG, cmd->server, "default_client_encoding: args == %s", args); + + if (! cmd->path) { + conf = ap_get_module_config(cmd->server->module_config, &encoding_module); + } + +- conf->default_encoding = ap_make_array(cmd->pool, 1, sizeof(char *)); ++ conf->default_encoding = apr_array_make(cmd->pool, 1, sizeof(char *)); + + /* register list of possible encodings as a default */ + while (*args && (arg = ap_getword_conf_nc(cmd->pool, &args))) { +- LOG(APLOG_DEBUG, cmd->server, "default_client_encoding: encname: %s", arg); +- *(void **)ap_push_array(conf->default_encoding) +- = ap_pstrdup(cmd->pool, arg); ++ *(void **)apr_array_push(conf->default_encoding) ++ = apr_pstrdup(cmd->pool, arg); + } + + return NULL; +@@ -294,8 +335,6 @@ + */ + static const char * + set_normalize_username(cmd_parms *cmd, encoding_config *conf, int flag) { +- LOG(APLOG_DEBUG, cmd->server, "set_normalize_username: entered"); +- LOG(APLOG_DEBUG, cmd->server, "set_normalize_username: flag == %d", flag); + + if (! cmd->path) { + conf = ap_get_module_config(cmd->server->module_config, &encoding_module); +@@ -343,15 +382,15 @@ + * Setup server-level module internal data strcuture. + */ + static void * +-server_setup(pool *p, server_rec *s) { ++server_setup(apr_pool_t *p, server_rec *s) { + encoding_config *conf; + + DBG(fprintf(stderr, "server_setup: entered\n")); + +- conf = (encoding_config *)ap_pcalloc(p, sizeof(encoding_config)); ++ conf = (encoding_config *)apr_pcalloc(p, sizeof(encoding_config)); + conf->enable_function = ENABLE_FLAG_UNSET; + conf->server_encoding = NULL; +- conf->client_encoding = ap_make_array(p, 2, sizeof(void *)); ++ conf->client_encoding = apr_array_make(p, 2, sizeof(void *)); + conf->default_encoding = NULL; + conf->strip_msaccount = STRIP_FLAG_UNSET; + +@@ -362,7 +401,7 @@ + * Setup folder-level module internal data strcuture. + */ + static void * +-folder_setup(pool *p, char *dir) { ++folder_setup(apr_pool_t *p, char *dir) { + DBG(fprintf(stderr, "folder_setup: entered\n")); + return server_setup(p, NULL); + } +@@ -371,14 +410,14 @@ + * Merge configuration. + */ + static void * +-config_merge(pool *p, void *base, void *override) { ++config_merge(apr_pool_t *p, void *base, void *override) { + encoding_config *parent = base; + encoding_config *child = override; + encoding_config *merge; + + DBG(fprintf(stderr, "config_merge: entered\n")); + +- merge = (encoding_config *)ap_pcalloc(p, sizeof(encoding_config)); ++ merge = (encoding_config *)apr_pcalloc(p, sizeof(encoding_config)); + + if (child->enable_function != ENABLE_FLAG_UNSET) + merge->enable_function = child->enable_function; +@@ -388,13 +427,14 @@ + DBG(fprintf(stderr, + "merged: enable_function == %d\n", merge->enable_function)); + ++ + if (child->strip_msaccount != STRIP_FLAG_UNSET) + merge->strip_msaccount = child->strip_msaccount; + else + merge->strip_msaccount = parent->strip_msaccount; + + DBG(fprintf(stderr, +- "merged: strip_msaccount == %d\n", merge->strip_msaccount)); ++ "merged: strip_msaccount == %d\n", merge->strip_msaccount)); + + if (child->server_encoding) + merge->server_encoding = child->server_encoding; +@@ -410,7 +450,7 @@ + merge->default_encoding = parent->default_encoding; + + merge->client_encoding = +- ap_append_arrays(p, child->client_encoding, parent->client_encoding); ++ apr_array_append(p, child->client_encoding, parent->client_encoding); + + return merge; + } +@@ -424,17 +464,16 @@ + */ + static int + mod_enc_convert(request_rec *r) { +- encoding_config *conf, *dconf, *sconf; ++ encoding_config *conf, *dconf, *sconf; + + const char *oenc; /* server-side encoding */ +- array_header *ienc; /* list of possible encodings */ ++ apr_array_header_t *ienc; /* list of possible encodings */ + void **list; /* same as above (for iteration) */ + + iconv_t cd; /* conversion descriptor */ + + int i; + +- LOG(APLOG_DEBUG, r->server, "mod_enc_convert: entered"); + + sconf = ap_get_module_config(r->server->module_config, &encoding_module); + dconf = ap_get_module_config(r->per_dir_config, &encoding_module); +@@ -446,19 +485,16 @@ + + oenc = conf->server_encoding ? conf->server_encoding : "UTF-8"; + ienc = get_client_encoding(r, conf->client_encoding, +- ap_table_get(r->headers_in, "User-Agent")); ++ apr_table_get(r->headers_in, "User-Agent")); + + if (conf->default_encoding) +- ap_array_cat(ienc, conf->default_encoding); ++ apr_array_cat(ienc, conf->default_encoding); + + list = (void **)ienc->elts; + +- LOG(APLOG_DEBUG, r->server, "mod_enc_convert: oenc == %s", oenc); + + /* try specified encodings in order */ + for (i = 0 ; i < ienc->nelts ; i++) { +- LOG(APLOG_DEBUG, +- r->server, "mod_enc_convert: ienc <> %s", (char *)list[i]); + + /* pick appropriate converter module */ + if ((cd = iconv_open(oenc, list[i])) == (iconv_t)(-1)) +@@ -466,8 +502,6 @@ + + /* conversion tryout */ + if (iconv_header(r, cd) == 0) { +- LOG(APLOG_DEBUG, +- r->server, "mod_enc_convert: ienc == %s", (char *)list[i]); + iconv_close(cd); + return DECLINED; + } +@@ -476,7 +510,6 @@ + iconv_close(cd); + } + +- LOG(APLOG_WARNING, r->server, "mod_enc_convert: no conversion done"); + + return DECLINED; + } +@@ -495,8 +528,6 @@ + char *user; + char *buff; + +- LOG(APLOG_DEBUG, r->server, "mod_enc_parse: entered"); +- + sconf = ap_get_module_config(r->server->module_config, &encoding_module); + dconf = ap_get_module_config(r->per_dir_config, &encoding_module); + conf = config_merge(r->pool, sconf, dconf); +@@ -513,15 +544,15 @@ + return DECLINED; + + /* Is this username broken? */ +- if ((user = index(r->connection->user, '\\')) == NULL) ++ if ((user = index(r->user, '\\')) == NULL) + return DECLINED; + + /* Re-generate authorization header */ + if (*(user + 1)) { + buff = ap_pbase64encode(r->pool, +- ap_psprintf(r->pool, "%s:%s", user + 1, pass)); +- ap_table_set(r->headers_in, "Authorization", +- ap_pstrcat(r->pool, "Basic ", buff, NULL)); ++ apr_psprintf(r->pool, "%s:%s", user + 1, pass)); ++ apr_table_set(r->headers_in, "Authorization", ++ apr_pstrcat(r->pool, "Basic ", buff, NULL)); + + ap_get_basic_auth_pw(r, &pass); /* update */ + } +@@ -530,28 +561,25 @@ + return DECLINED; + } + ++static void register_hooks(apr_pool_t *p) ++{ ++ /* filename-to-URI translation */ ++/* ap_hook_translate_name(mod_enc_convert,NULL,NULL,APR_HOOK_FIRST); */ ++ ap_hook_post_read_request(mod_enc_convert,NULL,NULL,APR_HOOK_FIRST); ++ ap_hook_header_parser(mod_enc_parse,NULL,NULL,APR_HOOK_FIRST); ++} ++ + /*************************************************************************** + * exported module structure + ***************************************************************************/ + +-module MODULE_VAR_EXPORT encoding_module = { +- STANDARD_MODULE_STUFF, +- NULL, /* initializer */ +- folder_setup, /* dir config */ +- config_merge, /* dir config merger */ +- server_setup, /* server config */ +- config_merge, /* server config merger */ +- mod_enc_commands, /* command table */ +- NULL, /* handlers */ +- NULL, /* filename translation */ +- NULL, /* check_user_id */ +- NULL, /* check auth */ +- NULL, /* check access */ +- NULL, /* type_checker */ +- NULL, /* fixups */ +- NULL, /* logger */ +- mod_enc_parse, /* header parser */ +- NULL, /* child_init */ +- NULL, /* child_exit */ +- mod_enc_convert, /* post read-request */ ++module AP_MODULE_DECLARE_DATA encoding_module = { ++ STANDARD20_MODULE_STUFF, ++ folder_setup, /* create per-directory config structure */ ++ config_merge, /* merge per-directory(?) config str */ ++ server_setup, /* create per-server config structure */ ++ config_merge, /* merge per-server config ...*/ ++ mod_enc_commands, /* command handlers */ ++ register_hooks + }; ++ +--- Makefile.in.orig 2002-06-11 17:46:39.000000000 +0900 ++++ Makefile.in 2008-08-30 16:18:36.000000000 +0900 +@@ -250,16 +250,16 @@ + maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +-all-local: mod_encoding.so ++all-local: mod_encoding.la + +-mod_encoding.so: mod_encoding.c ++mod_encoding.la: mod_encoding.c + $(APXS) -c $(CPPFLAGS) $(APXSFLAGS) $(LIBS) $< + + install-exec-local: +- $(APXS) -i mod_encoding.so ++ $(APXS) -i -n mod_encoding mod_encoding.la + + clean-local: +- rm -f *~ *.o *.so ++ rm -f *~ *.o *.so *.la + + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. +--- Makefile.am.orig 2002-06-11 17:46:39.000000000 +0900 ++++ Makefile.am 2008-08-30 16:19:25.000000000 +0900 +@@ -4,13 +4,13 @@ + + EXTRA_DIST = mod_encoding.c Makefile.simple + +-all-local: mod_encoding.so ++all-local: mod_encoding.la + +-mod_encoding.so: mod_encoding.c ++mod_encoding.la: mod_encoding.c + $(APXS) -c $(CPPFLAGS) $(APXSFLAGS) $(LIBS) $< + + install-exec-local: +- $(APXS) -i mod_encoding.so ++ $(APXS) -i -n mod_encoding mod_encoding.la + + clean-local: +- rm -f *~ *.o *.so ++ rm -f *~ *.o *.so *.la diff --git a/www/mod_encoding/files/apache22_patch b/www/mod_encoding/files/apache22_patch new file mode 100644 index 000000000000..f268ca19f0f6 --- /dev/null +++ b/www/mod_encoding/files/apache22_patch @@ -0,0 +1,538 @@ +--- mod_encoding.c.orig 2002-06-11 18:07:14.000000000 +0900 ++++ mod_encoding.c 2008-09-03 10:23:18.000000000 +0900 +@@ -1,8 +1,72 @@ + /* -*- mode: c -*- + * +- * $Id: mod_encoding.c,v 1.10 2002/06/11 09:07:14 tai Exp $ ++ * $Id: mod_encoding.c,v 1.6 2001/12/11 12:55:38 tai Exp $ + * + */ ++/* ++ * mod_encoding core module test implementation for Apache2. ++ * by Kunio Miyamoto (wakatono@todo.gr.jp) ++ * Original security fix port 2002/06/06 ++ * by Kunio Miyamoto (wakatono@todo.gr.jp) ++ * Port new function of 20020611a ++ * by Kunio Miyamoto (wakatono@todo.gr.jp) ++ * Port new function of 20020611a ++ * by Kunio Miyamoto (wakatono@todo.gr.jp) ++ * Add COPYING statement for redistribute only this code. ++ * by Kunio Miyamoto (wakatono@todo.gr.jp) ++ */ ++/* ++ ++ ++Copyright (c) 2000-2004 ++Internet Initiative Japan Inc. and Kunio Miyamoto All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions ++are met: ++ ++1. Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ ++2. Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in ++ the documentation and/or other materials provided with the ++ distribution. ++ ++3. All advertising materials mentioning features or use of this ++ software must display the following acknowledgment: ++ ++ This product includes software developed by Internet ++ Initiative Japan Inc. and Kunio Miyamoto for use in the ++ mod_encoding module for Apache2. ++ ++4. Products derived from this software may not be called "mod_encoding" ++ nor may "mod_encoding" appear in their names without prior written ++ permission of Internet Initiative Japan Inc. For written permission, ++ please contact tai@iij.ad.jp (Taisuke Yamada). ++ ++5. Redistributions of any form whatsoever must retain the following ++ acknowledgment: ++ ++ This product includes software developed by Internet ++ Initiative Japan Inc. and Kunio Miyamoto for use in the ++ mod_encoding module for Apache2 (http://www.apache.org/). ++ ++THIS SOFTWARE IS PROVIDED BY INTERNET INITIATIVE JAPAN INC. AND KUNIO ++MIYAMOTO ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, ++BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND ++FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ++INTERNET INITIATIVE JAPAN INC., KUNIO MIYAMOTO OR ITS CONTRIBUTORS ++BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, ++OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT ++OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ++BUSINESS INTERRUPTION) ++HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ++STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ++OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++*/ + + #include <httpd.h> + #include <http_config.h> +@@ -10,7 +74,10 @@ + #include <http_log.h> + #include <http_protocol.h> + #include <http_request.h> ++/* #include <ap_compat.h> */ + ++/* #include <iconv_hook/iconv.h> */ ++#include <regex.h> + #include <iconv.h> + + /** +@@ -33,13 +100,7 @@ + + #define DBG(expr) if (MOD_ENCODING_DEBUG) { expr; } + +-#ifdef __GNUC__ +-#define LOG(level, server, args...) \ +- ap_log_error(APLOG_MARK, APLOG_NOERRNO|level, server, ##args) +-#else +-#define LOG(level, server, ...) \ +- ap_log_error(APLOG_MARK, APLOG_NOERRNO|level, server, __VA_ARGS__) +-#endif ++/* FIXME: remove gcc-dependency */ + + #define ENABLE_FLAG_UNSET 0 + #define ENABLE_FLAG_OFF 1 +@@ -55,13 +116,13 @@ + typedef struct { + int enable_function; /* flag to enable this module */ + char *server_encoding; /* server-side filesystem encoding */ +- array_header *client_encoding; /* useragent-to-encoding-list sets */ +- array_header *default_encoding; /* useragent-to-encoding-list sets */ ++ apr_array_header_t *client_encoding; /* useragent-to-encoding-list sets */ ++ apr_array_header_t *default_encoding; /* useragent-to-encoding-list sets */ + +- int strip_msaccount; /* normalize wierd WinXP username */ ++ int strip_msaccount; /* normalize wierd WinXP username */ + } encoding_config; + +-module MODULE_VAR_EXPORT encoding_module; ++module AP_MODULE_DECLARE_DATA encoding_module; + + /*************************************************************************** + * utility methods +@@ -83,22 +144,19 @@ + size_t outlen; + + if (srclen == 0) { +- LOG(APLOG_DEBUG, r->server, "iconv_string: skipping zero-length input"); + return srcbuf; + } + + /* Allocate space for conversion. Note max bloat factor is 4 of UCS-4 */ +- marker = outbuf = (char *)ap_palloc(r->pool, outlen = srclen * 4 + 1); ++ marker = outbuf = (char *)apr_palloc(r->pool, outlen = srclen * 4 + 1); + + if (outbuf == NULL) { +- LOG(APLOG_WARNING, r->server, "iconv_string: no more memory"); + return NULL; + } + + /* Convert every character within input string. */ + while (srclen > 0) { + if (iconv(cd, &srcbuf, &srclen, &outbuf, &outlen) == (size_t)(-1)) { +- LOG(APLOG_DEBUG, r->server, "iconv_string: conversion error"); + return NULL; + } + } +@@ -140,11 +198,11 @@ + + /* Normalize encoding in HTTP request header(s) */ + for (i = 0 ; keys[i] ; i++) { +- if ((buff = (char *)ap_table_get(r->headers_in, keys[i])) != NULL) { ++ if ((buff = (char *)apr_table_get(r->headers_in, keys[i])) != NULL) { + ap_unescape_url(buff); + if ((buff = iconv_string(r, cd, buff, strlen(buff))) == NULL) + return -1; +- ap_table_set(r->headers_in, keys[i], buff); ++ apr_table_set(r->headers_in, keys[i], buff); + } + } + +@@ -159,33 +217,29 @@ + * @param encmap Table of UA-to-encoding(s) + * @param lookup Name of the useragent to look for + */ +-static array_header * ++static apr_array_header_t * + get_client_encoding(request_rec *r, +- array_header *encmap, const char *lookup) { ++ apr_array_header_t *encmap, const char *lookup) { + void **list = (void **)encmap->elts; +- array_header *encs = ap_make_array(r->pool, 1, sizeof(char *)); ++ apr_array_header_t *encs = apr_array_make(r->pool, 1, sizeof(char *)); + + int i; + +- LOG(APLOG_DEBUG, r->server, "get_client_encoding: entered"); + + /* push UTF-8 as the first candidate of expected encoding */ +- *((char **)ap_push_array(encs)) = ap_pstrdup(r->pool, "UTF-8"); ++ *((char **)apr_array_push(encs)) = apr_pstrdup(r->pool, "UTF-8"); + + if (! lookup) + return encs; + +- LOG(APLOG_DEBUG, r->server, "get_client_encoding: lookup == %s", lookup); + + for (i = 0 ; i < encmap->nelts ; i += 2) { + if (ap_regexec((regex_t *)list[i], lookup, 0, NULL, 0) == 0) { +- LOG(APLOG_DEBUG, r->server, "get_client_encoding: entry found"); +- ap_array_cat(encs, (array_header *)list[i + 1]); ++ apr_array_cat(encs, (apr_array_header_t *)list[i + 1]); + return encs; + } + } + +- LOG(APLOG_DEBUG, r->server, "get_client_encoding: entry not found"); + return encs; + } + +@@ -194,8 +248,6 @@ + */ + static const char * + set_encoding_engine(cmd_parms *cmd, encoding_config *conf, int flag) { +- LOG(APLOG_DEBUG, cmd->server, "set_encoding_engine: entered"); +- LOG(APLOG_DEBUG, cmd->server, "set_encoding_engine: flag == %d", flag); + + if (! cmd->path) { + conf = ap_get_module_config(cmd->server->module_config, &encoding_module); +@@ -210,13 +262,11 @@ + */ + static const char * + set_server_encoding(cmd_parms *cmd, encoding_config *conf, char *arg) { +- LOG(APLOG_DEBUG, cmd->server, "set_server_encoding: entered"); +- LOG(APLOG_DEBUG, cmd->server, "set_server_encoding: arg == %s", arg); + + if (! cmd->path) { + conf = ap_get_module_config(cmd->server->module_config, &encoding_module); + } +- conf->server_encoding = ap_pstrdup(cmd->pool, arg); ++ conf->server_encoding = apr_pstrdup(cmd->pool, arg); + + return NULL; + } +@@ -229,31 +279,27 @@ + */ + static const char * + add_client_encoding(cmd_parms *cmd, encoding_config *conf, char *args) { +- array_header *encs; ++ apr_array_header_t *encs; + char *arg; + +- LOG(APLOG_DEBUG, cmd->server, "add_client_encoding: entered"); +- LOG(APLOG_DEBUG, cmd->server, "add_client_encoding: args == %s", args); + + if (! cmd->path) { + conf = ap_get_module_config(cmd->server->module_config, &encoding_module); + } + +- encs = ap_make_array(cmd->pool, 1, sizeof(void *)); ++ encs = apr_array_make(cmd->pool, 1, sizeof(void *)); + + /* register useragent with UserAgent: pattern */ + if (*args && (arg = ap_getword_conf_nc(cmd->pool, &args))) { +- LOG(APLOG_DEBUG, cmd->server, "add_client_encoding: agent: %s", arg); +- *(void **)ap_push_array(conf->client_encoding) = ++ *(void **)apr_array_push(conf->client_encoding) = + ap_pregcomp(cmd->pool, arg, REG_EXTENDED|REG_ICASE|REG_NOSUB); + } + + /* register list of possible encodings from above useragent */ + while (*args && (arg = ap_getword_conf_nc(cmd->pool, &args))) { +- LOG(APLOG_DEBUG, cmd->server, "add_client_encoding: encname: %s", arg); +- *(void **)ap_push_array(encs) = ap_pstrdup(cmd->pool, arg); ++ *(void **)apr_array_push(encs) = apr_pstrdup(cmd->pool, arg); + } +- *(void **)ap_push_array(conf->client_encoding) = encs; ++ *(void **)apr_array_push(conf->client_encoding) = encs; + + return NULL; + } +@@ -267,20 +313,17 @@ + default_client_encoding(cmd_parms *cmd, encoding_config *conf, char *args) { + char *arg; + +- LOG(APLOG_DEBUG, cmd->server, "default_client_encoding: entered"); +- LOG(APLOG_DEBUG, cmd->server, "default_client_encoding: args == %s", args); + + if (! cmd->path) { + conf = ap_get_module_config(cmd->server->module_config, &encoding_module); + } + +- conf->default_encoding = ap_make_array(cmd->pool, 1, sizeof(char *)); ++ conf->default_encoding = apr_array_make(cmd->pool, 1, sizeof(char *)); + + /* register list of possible encodings as a default */ + while (*args && (arg = ap_getword_conf_nc(cmd->pool, &args))) { +- LOG(APLOG_DEBUG, cmd->server, "default_client_encoding: encname: %s", arg); +- *(void **)ap_push_array(conf->default_encoding) +- = ap_pstrdup(cmd->pool, arg); ++ *(void **)apr_array_push(conf->default_encoding) ++ = apr_pstrdup(cmd->pool, arg); + } + + return NULL; +@@ -294,8 +337,6 @@ + */ + static const char * + set_normalize_username(cmd_parms *cmd, encoding_config *conf, int flag) { +- LOG(APLOG_DEBUG, cmd->server, "set_normalize_username: entered"); +- LOG(APLOG_DEBUG, cmd->server, "set_normalize_username: flag == %d", flag); + + if (! cmd->path) { + conf = ap_get_module_config(cmd->server->module_config, &encoding_module); +@@ -343,15 +384,15 @@ + * Setup server-level module internal data strcuture. + */ + static void * +-server_setup(pool *p, server_rec *s) { ++server_setup(apr_pool_t *p, server_rec *s) { + encoding_config *conf; + + DBG(fprintf(stderr, "server_setup: entered\n")); + +- conf = (encoding_config *)ap_pcalloc(p, sizeof(encoding_config)); ++ conf = (encoding_config *)apr_pcalloc(p, sizeof(encoding_config)); + conf->enable_function = ENABLE_FLAG_UNSET; + conf->server_encoding = NULL; +- conf->client_encoding = ap_make_array(p, 2, sizeof(void *)); ++ conf->client_encoding = apr_array_make(p, 2, sizeof(void *)); + conf->default_encoding = NULL; + conf->strip_msaccount = STRIP_FLAG_UNSET; + +@@ -362,7 +403,7 @@ + * Setup folder-level module internal data strcuture. + */ + static void * +-folder_setup(pool *p, char *dir) { ++folder_setup(apr_pool_t *p, char *dir) { + DBG(fprintf(stderr, "folder_setup: entered\n")); + return server_setup(p, NULL); + } +@@ -371,14 +412,14 @@ + * Merge configuration. + */ + static void * +-config_merge(pool *p, void *base, void *override) { ++config_merge(apr_pool_t *p, void *base, void *override) { + encoding_config *parent = base; + encoding_config *child = override; + encoding_config *merge; + + DBG(fprintf(stderr, "config_merge: entered\n")); + +- merge = (encoding_config *)ap_pcalloc(p, sizeof(encoding_config)); ++ merge = (encoding_config *)apr_pcalloc(p, sizeof(encoding_config)); + + if (child->enable_function != ENABLE_FLAG_UNSET) + merge->enable_function = child->enable_function; +@@ -388,13 +429,14 @@ + DBG(fprintf(stderr, + "merged: enable_function == %d\n", merge->enable_function)); + ++ + if (child->strip_msaccount != STRIP_FLAG_UNSET) + merge->strip_msaccount = child->strip_msaccount; + else + merge->strip_msaccount = parent->strip_msaccount; + + DBG(fprintf(stderr, +- "merged: strip_msaccount == %d\n", merge->strip_msaccount)); ++ "merged: strip_msaccount == %d\n", merge->strip_msaccount)); + + if (child->server_encoding) + merge->server_encoding = child->server_encoding; +@@ -410,7 +452,7 @@ + merge->default_encoding = parent->default_encoding; + + merge->client_encoding = +- ap_append_arrays(p, child->client_encoding, parent->client_encoding); ++ apr_array_append(p, child->client_encoding, parent->client_encoding); + + return merge; + } +@@ -424,17 +466,16 @@ + */ + static int + mod_enc_convert(request_rec *r) { +- encoding_config *conf, *dconf, *sconf; ++ encoding_config *conf, *dconf, *sconf; + + const char *oenc; /* server-side encoding */ +- array_header *ienc; /* list of possible encodings */ ++ apr_array_header_t *ienc; /* list of possible encodings */ + void **list; /* same as above (for iteration) */ + + iconv_t cd; /* conversion descriptor */ + + int i; + +- LOG(APLOG_DEBUG, r->server, "mod_enc_convert: entered"); + + sconf = ap_get_module_config(r->server->module_config, &encoding_module); + dconf = ap_get_module_config(r->per_dir_config, &encoding_module); +@@ -446,19 +487,16 @@ + + oenc = conf->server_encoding ? conf->server_encoding : "UTF-8"; + ienc = get_client_encoding(r, conf->client_encoding, +- ap_table_get(r->headers_in, "User-Agent")); ++ apr_table_get(r->headers_in, "User-Agent")); + + if (conf->default_encoding) +- ap_array_cat(ienc, conf->default_encoding); ++ apr_array_cat(ienc, conf->default_encoding); + + list = (void **)ienc->elts; + +- LOG(APLOG_DEBUG, r->server, "mod_enc_convert: oenc == %s", oenc); + + /* try specified encodings in order */ + for (i = 0 ; i < ienc->nelts ; i++) { +- LOG(APLOG_DEBUG, +- r->server, "mod_enc_convert: ienc <> %s", (char *)list[i]); + + /* pick appropriate converter module */ + if ((cd = iconv_open(oenc, list[i])) == (iconv_t)(-1)) +@@ -466,8 +504,6 @@ + + /* conversion tryout */ + if (iconv_header(r, cd) == 0) { +- LOG(APLOG_DEBUG, +- r->server, "mod_enc_convert: ienc == %s", (char *)list[i]); + iconv_close(cd); + return DECLINED; + } +@@ -476,7 +512,6 @@ + iconv_close(cd); + } + +- LOG(APLOG_WARNING, r->server, "mod_enc_convert: no conversion done"); + + return DECLINED; + } +@@ -495,8 +530,6 @@ + char *user; + char *buff; + +- LOG(APLOG_DEBUG, r->server, "mod_enc_parse: entered"); +- + sconf = ap_get_module_config(r->server->module_config, &encoding_module); + dconf = ap_get_module_config(r->per_dir_config, &encoding_module); + conf = config_merge(r->pool, sconf, dconf); +@@ -513,15 +546,15 @@ + return DECLINED; + + /* Is this username broken? */ +- if ((user = index(r->connection->user, '\\')) == NULL) ++ if ((user = index(r->user, '\\')) == NULL) + return DECLINED; + + /* Re-generate authorization header */ + if (*(user + 1)) { + buff = ap_pbase64encode(r->pool, +- ap_psprintf(r->pool, "%s:%s", user + 1, pass)); +- ap_table_set(r->headers_in, "Authorization", +- ap_pstrcat(r->pool, "Basic ", buff, NULL)); ++ apr_psprintf(r->pool, "%s:%s", user + 1, pass)); ++ apr_table_set(r->headers_in, "Authorization", ++ apr_pstrcat(r->pool, "Basic ", buff, NULL)); + + ap_get_basic_auth_pw(r, &pass); /* update */ + } +@@ -530,28 +563,25 @@ + return DECLINED; + } + ++static void register_hooks(apr_pool_t *p) ++{ ++ /* filename-to-URI translation */ ++/* ap_hook_translate_name(mod_enc_convert,NULL,NULL,APR_HOOK_FIRST); */ ++ ap_hook_post_read_request(mod_enc_convert,NULL,NULL,APR_HOOK_FIRST); ++ ap_hook_header_parser(mod_enc_parse,NULL,NULL,APR_HOOK_FIRST); ++} ++ + /*************************************************************************** + * exported module structure + ***************************************************************************/ + +-module MODULE_VAR_EXPORT encoding_module = { +- STANDARD_MODULE_STUFF, +- NULL, /* initializer */ +- folder_setup, /* dir config */ +- config_merge, /* dir config merger */ +- server_setup, /* server config */ +- config_merge, /* server config merger */ +- mod_enc_commands, /* command table */ +- NULL, /* handlers */ +- NULL, /* filename translation */ +- NULL, /* check_user_id */ +- NULL, /* check auth */ +- NULL, /* check access */ +- NULL, /* type_checker */ +- NULL, /* fixups */ +- NULL, /* logger */ +- mod_enc_parse, /* header parser */ +- NULL, /* child_init */ +- NULL, /* child_exit */ +- mod_enc_convert, /* post read-request */ ++module AP_MODULE_DECLARE_DATA encoding_module = { ++ STANDARD20_MODULE_STUFF, ++ folder_setup, /* create per-directory config structure */ ++ config_merge, /* merge per-directory(?) config str */ ++ server_setup, /* create per-server config structure */ ++ config_merge, /* merge per-server config ...*/ ++ mod_enc_commands, /* command handlers */ ++ register_hooks + }; ++ +--- Makefile.in.orig 2002-06-11 17:46:39.000000000 +0900 ++++ Makefile.in 2008-08-30 16:18:36.000000000 +0900 +@@ -250,16 +250,16 @@ + maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +-all-local: mod_encoding.so ++all-local: mod_encoding.la + +-mod_encoding.so: mod_encoding.c ++mod_encoding.la: mod_encoding.c + $(APXS) -c $(CPPFLAGS) $(APXSFLAGS) $(LIBS) $< + + install-exec-local: +- $(APXS) -i mod_encoding.so ++ $(APXS) -i -n mod_encoding mod_encoding.la + + clean-local: +- rm -f *~ *.o *.so ++ rm -f *~ *.o *.so *.la + + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. +--- Makefile.am.orig 2002-06-11 17:46:39.000000000 +0900 ++++ Makefile.am 2008-08-30 16:19:25.000000000 +0900 +@@ -4,13 +4,13 @@ + + EXTRA_DIST = mod_encoding.c Makefile.simple + +-all-local: mod_encoding.so ++all-local: mod_encoding.la + +-mod_encoding.so: mod_encoding.c ++mod_encoding.la: mod_encoding.c + $(APXS) -c $(CPPFLAGS) $(APXSFLAGS) $(LIBS) $< + + install-exec-local: +- $(APXS) -i mod_encoding.so ++ $(APXS) -i -n mod_encoding mod_encoding.la + + clean-local: +- rm -f *~ *.o *.so ++ rm -f *~ *.o *.so *.la diff --git a/www/mod_encoding/files/iconv_hook-20040430.patch b/www/mod_encoding/files/iconv_hook-20040430.patch new file mode 100644 index 000000000000..97f86bb92e20 --- /dev/null +++ b/www/mod_encoding/files/iconv_hook-20040430.patch @@ -0,0 +1,47 @@ +diff -urN lib/iconv_hook.c lib.20040430/iconv_hook.c +--- lib/iconv_hook.c 2002-06-08 18:19:01.000000000 +0900 ++++ lib.20040430/iconv_hook.c 2004-04-30 21:40:14.000000000 +0900 +@@ -32,8 +32,9 @@ + } + + int +-iconv_hook_close(iconv_t cd) { +- free((iconv_hook_t *)cd); ++iconv_hook_close(iconv_hook_t *cd) { ++ (*(cd->cm->iconv_close))(cd->cd); ++ free(cd); + return 0; + } + +diff -urN lib/iconv_hook_eucjp.c lib.20040430/iconv_hook_eucjp.c +--- lib/iconv_hook_eucjp.c 2002-06-10 22:57:52.000000000 +0900 ++++ lib.20040430/iconv_hook_eucjp.c 2004-04-30 21:40:14.000000000 +0900 +@@ -111,6 +111,7 @@ + if (cl < 0xA0 || cl > 0xDF) { + *srcbuf=(char *)(src-2); + errno=EILSEQ; ++ free(tmpbuf); + return -1; + } + *tmp++ = cl; +@@ -118,6 +119,7 @@ + /* We don't support JIS X 0212 */ + *srcbuf=(char *)(src-2); + errno=EILSEQ; ++ free(tmpbuf); + return -1; + } + } +diff -urN lib/iconv_hook_ja_auto.c lib.20040430/iconv_hook_ja_auto.c +--- lib/iconv_hook_ja_auto.c 2002-06-08 18:32:41.000000000 +0900 ++++ lib.20040430/iconv_hook_ja_auto.c 2004-04-30 21:40:14.000000000 +0900 +@@ -37,6 +37,9 @@ + cd->ienc = strdup(ienc); + + if (cd->oenc == NULL || cd->ienc == NULL){ ++ if (cd->oenc == NULL) free (cd->oenc); ++ if (cd->ienc == NULL) free (cd->ienc); ++ free(cd); + return (iconv_t)(-1); + } else { + return (iconv_t)cd; diff --git a/www/mod_encoding/files/queryfix-patch13 b/www/mod_encoding/files/queryfix-patch13 new file mode 100644 index 000000000000..09d86f5aca6a --- /dev/null +++ b/www/mod_encoding/files/queryfix-patch13 @@ -0,0 +1,30 @@ +diff -urN mod_encoding.c.orig mod_encoding.c +--- mod_encoding.c.orig Tue Jun 11 18:07:14 2002 ++++ mod_encoding.c Fri Dec 13 11:43:46 2002 +@@ -129,13 +129,21 @@ + char *buff; + char *keys[] = { "Destination", NULL }; + int i; ++ char *unparsed_uri; ++ char *query_string; + + /* Normalize encoding in HTTP request line */ +- ap_unescape_url(r->unparsed_uri); +- if ((buff = iconv_string(r, cd, r->unparsed_uri, +- strlen(r->unparsed_uri))) == NULL) ++ query_string = ap_pstrdup(r->pool, r->unparsed_uri); ++ unparsed_uri = ap_getword(r->pool, &query_string, '?'); ++ ap_unescape_url(unparsed_uri); ++ if ((buff = iconv_string(r, cd, unparsed_uri, ++ strlen(unparsed_uri))) == NULL) + return -1; +- ap_parse_uri(r, buff); ++ if (query_string && strlen(query_string) > 0) { ++ ap_parse_uri(r, ap_pstrcat(r->pool, buff, "?", query_string, NULL)); ++ } else { ++ ap_parse_uri(r, buff); ++ } + ap_getparents(r->uri); /* normalize given path for security */ + + /* Normalize encoding in HTTP request header(s) */ + diff --git a/www/mod_encoding/files/queryfix-patch22 b/www/mod_encoding/files/queryfix-patch22 new file mode 100644 index 000000000000..fcf71c312ddd --- /dev/null +++ b/www/mod_encoding/files/queryfix-patch22 @@ -0,0 +1,30 @@ +diff -urN mod_encoding.c.orig mod_encoding.c +--- mod_encoding.c.orig Tue Jun 11 18:07:14 2002 ++++ mod_encoding.c Fri Dec 13 11:43:46 2002 +@@ -129,13 +129,21 @@ + char *buff; + char *keys[] = { "Destination", NULL }; + int i; ++ char *unparsed_uri; ++ char *query_string; + + /* Normalize encoding in HTTP request line */ +- ap_unescape_url(r->unparsed_uri); +- if ((buff = iconv_string(r, cd, r->unparsed_uri, +- strlen(r->unparsed_uri))) == NULL) ++ query_string = apr_pstrdup(r->pool, r->unparsed_uri); ++ unparsed_uri = ap_getword(r->pool, &query_string, '?'); ++ ap_unescape_url(unparsed_uri); ++ if ((buff = iconv_string(r, cd, unparsed_uri, ++ strlen(unparsed_uri))) == NULL) + return -1; +- ap_parse_uri(r, buff); ++ if (query_string && strlen(query_string) > 0) { ++ ap_parse_uri(r, apr_pstrcat(r->pool, buff, "?", query_string, NULL)); ++ } else { ++ ap_parse_uri(r, buff); ++ } + ap_getparents(r->uri); /* normalize given path for security */ + + /* Normalize encoding in HTTP request header(s) */ + |