diff options
author | is <is@pkgsrc.org> | 2014-08-27 11:15:14 +0000 |
---|---|---|
committer | is <is@pkgsrc.org> | 2014-08-27 11:15:14 +0000 |
commit | 9b7cf80a1d7bbaed8f3eec5f52f69eab8837e369 (patch) | |
tree | e0b39e74659dd3ea9e9c1899a0c4c503d640d25d /www/ap2-limitipconn | |
parent | 65bbde0821ea3cafd0dafb59f92a8c5806cd4ad2 (diff) | |
download | pkgsrc-9b7cf80a1d7bbaed8f3eec5f52f69eab8837e369.tar.gz |
Version of ap22-limitipconn that builds with apache24
Diffstat (limited to 'www/ap2-limitipconn')
-rw-r--r-- | www/ap2-limitipconn/DESCR | 3 | ||||
-rw-r--r-- | www/ap2-limitipconn/Makefile | 41 | ||||
-rw-r--r-- | www/ap2-limitipconn/PLIST | 3 | ||||
-rw-r--r-- | www/ap2-limitipconn/distinfo | 8 | ||||
-rw-r--r-- | www/ap2-limitipconn/patches/mod_limitipconn_local_IP_patch_2.diff | 112 |
5 files changed, 167 insertions, 0 deletions
diff --git a/www/ap2-limitipconn/DESCR b/www/ap2-limitipconn/DESCR new file mode 100644 index 00000000000..5d38e8c7ccb --- /dev/null +++ b/www/ap2-limitipconn/DESCR @@ -0,0 +1,3 @@ +Apache 2.0 C module to limit the maximum number of simultaneous +connections per IP address. Allows inclusion and exclusion of files +based on MIME type. diff --git a/www/ap2-limitipconn/Makefile b/www/ap2-limitipconn/Makefile new file mode 100644 index 00000000000..c4c79102bf6 --- /dev/null +++ b/www/ap2-limitipconn/Makefile @@ -0,0 +1,41 @@ +# $NetBSD: Makefile,v 1.1 2014/08/27 11:15:14 is Exp $ +# +# * APACHE_PKG_PREFIX = ap24 +# * PKG_APACHE = apache24 + +LICVER= limitipconn-0.24 + +DISTNAME= mod_${LICVER} +EXTRACT_SUFX= .tar.bz2 +PKGNAME= ${APACHE_PKG_PREFIX}-${LICVER} +PKGREVISION= 1 +CATEGORIES= www +MASTER_SITES= http://dominia.org/djao/limit/ +LICENSE= apache-2.0 + + +PATCH_SITES= http://dominia.org/djao/limit/contrib/dg/ +PATCHFILES= mod_limitipconn_local_IP_patch_2.diff + +MAINTAINER= tv@NetBSD.org +HOMEPAGE= http://dominia.org/djao/limitipconn2.html +COMMENT= Limits per-IP connections to an Apache 2 server + +APACHE_MODULE= yes +MAKE_FLAGS+= APXS=${APXS:Q} +USE_LIBTOOL= yes +PKG_DESTDIR_SUPPORT= user-destdir + +INSTALLATION_DIRS+= lib/httpd + +do-install: + ${BUILDLINK_PREFIX.apache}/share/httpd/build/instdso.sh \ + SH_LIBTOOL=${BUILDLINK_PREFIX.apache}/share/httpd/build/libtool \ + ${WRKSRC}/mod_limitipconn.la \ + ${DESTDIR}${PREFIX}/lib/httpd +post-install: + ${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/share/doc/mod_limitipconn + ${INSTALL_DATA} ${WRKSRC}/README ${DESTDIR}${PREFIX}/share/doc/mod_limitipconn/ + +.include "../../mk/apache.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/www/ap2-limitipconn/PLIST b/www/ap2-limitipconn/PLIST new file mode 100644 index 00000000000..f12054b5329 --- /dev/null +++ b/www/ap2-limitipconn/PLIST @@ -0,0 +1,3 @@ +@comment $NetBSD: PLIST,v 1.1 2014/08/27 11:15:14 is Exp $ +lib/httpd/mod_limitipconn.so +share/doc/mod_limitipconn/README diff --git a/www/ap2-limitipconn/distinfo b/www/ap2-limitipconn/distinfo new file mode 100644 index 00000000000..79062e06e0c --- /dev/null +++ b/www/ap2-limitipconn/distinfo @@ -0,0 +1,8 @@ +$NetBSD: distinfo,v 1.1 2014/08/27 11:15:14 is Exp $ + +SHA1 (mod_limitipconn-0.24.tar.bz2) = 5ca2f3c883f6c4470ab9d8090f299b7533728550 +RMD160 (mod_limitipconn-0.24.tar.bz2) = a0c89dfd0fbb539c61381604d986187822b0ac08 +Size (mod_limitipconn-0.24.tar.bz2) = 10150 bytes +SHA1 (mod_limitipconn_local_IP_patch_2.diff) = 925b15a3bdc33653deda286d504664bdfaff7c2a +RMD160 (mod_limitipconn_local_IP_patch_2.diff) = f8b5e18697139343a5801f8fd94edad890797481 +Size (mod_limitipconn_local_IP_patch_2.diff) = 4080 bytes diff --git a/www/ap2-limitipconn/patches/mod_limitipconn_local_IP_patch_2.diff b/www/ap2-limitipconn/patches/mod_limitipconn_local_IP_patch_2.diff new file mode 100644 index 00000000000..d086fe5eb43 --- /dev/null +++ b/www/ap2-limitipconn/patches/mod_limitipconn_local_IP_patch_2.diff @@ -0,0 +1,112 @@ +*** mod_limitipconn.c.orig Sun Mar 2 23:06:20 2008 +--- mod_limitipconn.c Thu Feb 4 17:32:21 2010 +*************** +*** 42,47 **** +--- 42,50 ---- + /* array of MIME types to limit check; all other types are exempt */ + apr_array_header_t *excl_limit; + ++ apr_array_header_t *local_ip; /* array of local ip exempt from limit ++ checking */ ++ + } limitipconn_config; + + static limitipconn_config *create_config(apr_pool_t *p) +*************** +*** 53,58 **** +--- 56,62 ---- + cfg->limit = 0; + cfg->no_limit = apr_array_make(p, 0, sizeof(char *)); + cfg->excl_limit = apr_array_make(p, 0, sizeof(char *)); ++ cfg->local_ip = apr_array_make(p, 0, sizeof(char *)); + + return cfg; + } +*************** +*** 75,80 **** +--- 79,85 ---- + /* convert Apache arrays to normal C arrays */ + char **nolim = (char **) cfg->no_limit->elts; + char **exlim = (char **) cfg->excl_limit->elts; ++ char **localip = (char **) cfg->local_ip->elts; + + const char *address; + +*************** +*** 108,114 **** + + /* Only check the MIME-type if we have MIME-type stuff in our config. + The extra subreq can be quite expensive. */ +! if(cfg->no_limit->nelts > 0 || cfg->excl_limit->nelts > 0) { + /* Look up the Content-type of this request. We need a subrequest + * here since this module might be called before the URI has been + * translated into a MIME type. */ +--- 113,119 ---- + + /* Only check the MIME-type if we have MIME-type stuff in our config. + The extra subreq can be quite expensive. */ +! if(cfg->no_limit->nelts > 0 || cfg->excl_limit->nelts > 0 || cfg->local_ip->nelts) { + /* Look up the Content-type of this request. We need a subrequest + * here since this module might be called before the URI has been + * translated into a MIME type. */ +*************** +*** 123,128 **** +--- 128,147 ---- + "mod_limitipconn: uri: %s Content-Type: %s", + r->uri, content_type); + ++ /* Cycle through the local ip list; if the ip is local, ++ * return OK */ ++ ++ for (i = 0; i < cfg->local_ip->nelts; i++) { ++ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, ++ "mod_limitipconn: ip check: \"%s\" ? \"%s\"", address, localip[i]); ++ if ((ap_strcasecmp_match(address, localip[i]) == 0) ++ || (strncmp(localip[i], address, strlen(localip[i])) == 0)) { ++ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, ++ "mod_limitipconn: ip exempt: %s", address); ++ return DECLINED; ++ } ++ } ++ + /* Cycle through the exempt list; if our content_type is exempt, + * return OK */ + for (i = 0; i < cfg->no_limit->nelts; i++) { +*************** +*** 311,316 **** +--- 330,353 ---- + return NULL; + } + ++ /* Parse the LocalIP directive */ ++ static const char *local_ip_config_cmd(cmd_parms *parms, void *mconfig, ++ const char *arg) ++ { ++ limitipconn_config *cfg = (limitipconn_config *) mconfig; ++ limitipconn_config *scfg = (limitipconn_config *) ++ ap_get_module_config(parms->server->module_config, &limitipconn_module); ++ ++ if (parms->path != NULL) { ++ /* Per-directory context */ ++ *(char **) apr_array_push(cfg->local_ip) = apr_pstrdup(parms->pool, arg); ++ } else { ++ /* global context */ ++ *(char **) apr_array_push(scfg->local_ip) = apr_pstrdup(parms->pool, arg); ++ } ++ return NULL; ++ } ++ + /* Array describing structure of configuration directives */ + static command_rec limitipconn_cmds[] = { + AP_INIT_TAKE1("MaxConnPerIP", limit_config_cmd, NULL, OR_LIMIT|RSRC_CONF, +*************** +*** 319,324 **** +--- 356,363 ---- + "MIME types for which limit checking is disabled"), + AP_INIT_ITERATE("OnlyIPLimit", excl_limit_config_cmd, NULL, + OR_LIMIT|RSRC_CONF, "restrict limit checking to these MIME types only"), ++ AP_INIT_ITERATE("LocalIP", local_ip_config_cmd, NULL, OR_LIMIT|RSRC_CONF, ++ "no checking on local IP"), + {NULL}, + }; + |