From owner-svn-ports-head@FreeBSD.ORG Sun Feb 2 15:57:14 2014 Return-Path: Delivered-To: svn-ports-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9BFA7D2F; Sun, 2 Feb 2014 15:57:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7C2211671; Sun, 2 Feb 2014 15:57:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s12FvEYm012428; Sun, 2 Feb 2014 15:57:14 GMT (envelope-from ohauer@svn.freebsd.org) Received: (from ohauer@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s12FvD8U012425; Sun, 2 Feb 2014 15:57:13 GMT (envelope-from ohauer@svn.freebsd.org) Message-Id: <201402021557.s12FvD8U012425@svn.freebsd.org> From: Olli Hauer Date: Sun, 2 Feb 2014 15:57:13 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r342319 - in head/www/mod_limitipconn2: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Feb 2014 15:57:14 -0000 Author: ohauer Date: Sun Feb 2 15:57:13 2014 New Revision: 342319 URL: http://svnweb.freebsd.org/changeset/ports/342319 QAT: https://qat.redports.org/buildarchive/r342319/ Log: - update to version 0.24 - add local IP exception patch [1] found on upstream (mod_limitipconn_local_IP_patch.diff) PR: ports/186281 [1] Submitted by: Tilghman Lesher Approved by: Yuan-Chung Hsiao (maintainer per PM) Added: head/www/mod_limitipconn2/files/ head/www/mod_limitipconn2/files/patch-mod_limitipconn.c (contents, props changed) Modified: head/www/mod_limitipconn2/Makefile head/www/mod_limitipconn2/distinfo Modified: head/www/mod_limitipconn2/Makefile ============================================================================== --- head/www/mod_limitipconn2/Makefile Sun Feb 2 15:47:08 2014 (r342318) +++ head/www/mod_limitipconn2/Makefile Sun Feb 2 15:57:13 2014 (r342319) @@ -2,8 +2,7 @@ # $FreeBSD$ PORTNAME= mod_limitipconn -PORTVERSION= 0.23 -PORTREVISION= 3 +PORTVERSION= 0.24 CATEGORIES= www MASTER_SITES= http://dominia.org/djao/limit/ PKGNAMEPREFIX= ${APACHE_PKGNAMEPREFIX} @@ -15,7 +14,7 @@ COMMENT= Allows you to limit the number LICENSE= APACHE20 -USE_APACHE= 22 +USE_APACHE= 22+ USE_BZIP2= yes AP_FAST_BUILD= yes Modified: head/www/mod_limitipconn2/distinfo ============================================================================== --- head/www/mod_limitipconn2/distinfo Sun Feb 2 15:47:08 2014 (r342318) +++ head/www/mod_limitipconn2/distinfo Sun Feb 2 15:57:13 2014 (r342319) @@ -1,2 +1,2 @@ -SHA256 (apache2/mod_limitipconn-0.23.tar.bz2) = eca35131e2d17b4499d7be13190cc0cdd5c82d83660b8bc96c79dc617defa6ec -SIZE (apache2/mod_limitipconn-0.23.tar.bz2) = 9851 +SHA256 (apache2/mod_limitipconn-0.24.tar.bz2) = 69ca8fbf99d4e02db75e129df07d1604db771e9c10c1b199e2accaa96aec2a1f +SIZE (apache2/mod_limitipconn-0.24.tar.bz2) = 10150 Added: head/www/mod_limitipconn2/files/patch-mod_limitipconn.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/mod_limitipconn2/files/patch-mod_limitipconn.c Sun Feb 2 15:57:13 2014 (r342319) @@ -0,0 +1,92 @@ +--- ./mod_limitipconn.c.orig 2012-04-26 00:19:48.000000000 +0200 ++++ ./mod_limitipconn.c 2014-02-02 16:47:28.000000000 +0100 +@@ -42,6 +42,9 @@ + /* 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,6 +56,7 @@ + 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,6 +79,7 @@ + /* 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; + +@@ -112,7 +117,7 @@ + + /* 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) { ++ 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. */ +@@ -129,6 +134,20 @@ + "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 */ + #if AP_MODULE_MAGIC_AT_LEAST(20090131, 0) +@@ -328,6 +347,24 @@ + 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, +@@ -336,6 +373,8 @@ + "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}, + }; +