Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Feb 2014 15:57:13 +0000 (UTC)
From:      Olli Hauer <ohauer@FreeBSD.org>
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
Message-ID:  <201402021557.s12FvD8U012425@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <tlesher@mtadistributors.com>
  Approved by:	Yuan-Chung Hsiao <ychsiao@gmail.com> (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},
+ };
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402021557.s12FvD8U012425>