]> git.pld-linux.org Git - packages/apache1-mod_rpaf.git/blobdiff - mod_rpaf_degtine.patch
- rediff
[packages/apache1-mod_rpaf.git] / mod_rpaf_degtine.patch
index f8f7fd1378e04d264bfa9341e4f77a767990c53c..4aa63dd2793e5c269317e56957b186cbdcb64e9c 100644 (file)
@@ -1,8 +1,7 @@
-diff -ur mod_rpaf-0.5/mod_rpaf-2.0.c libapache-mod-rpaf-0.5/mod_rpaf-2.0.c
---- mod_rpaf-0.5/mod_rpaf-2.0.c        2004-03-17 15:47:30.000000000 +0000
-+++ libapache-mod-rpaf-0.5/mod_rpaf-2.0.c      2006-06-16 18:04:05.000000000 +0100
-@@ -130,6 +130,16 @@
-     return 0;
+--- mod_rpaf-0.6/mod_rpaf-2.0.c        2008-01-01 05:05:40.000000000 +0200
++++ mod_rpaf-0.6-degtine/mod_rpaf-2.0.c        2008-01-14 12:47:44.248571877 +0200
+@@ -152,6 +152,16 @@
+     return APR_SUCCESS;
  }
  
 +static char* last_not_in_array(apr_array_header_t *forwarded_for,
@@ -18,22 +17,32 @@ diff -ur mod_rpaf-0.5/mod_rpaf-2.0.c libapache-mod-rpaf-0.5/mod_rpaf-2.0.c
  static int change_remote_ip(request_rec *r) {
      const char *fwdvalue;
      char *val;
-@@ -147,7 +157,7 @@
-                 if (*fwdvalue != '\0')
-                     ++fwdvalue;
-             }
+@@ -183,7 +193,7 @@
+             rcr->old_ip = apr_pstrdup(r->connection->pool, r->connection->remote_ip);
+             rcr->r = r;
+             apr_pool_cleanup_register(r->pool, (void *)rcr, rpaf_cleanup, apr_pool_cleanup_null);
 -            r->connection->remote_ip = apr_pstrdup(r->connection->pool, ((char **)arr->elts)[((arr->nelts)-1)]);
 +            r->connection->remote_ip = apr_pstrdup(r->connection->pool, last_not_in_array(arr, cfg->proxy_ips));
-             r->connection->remote_addr->sa.sin.sin_addr.s_addr = inet_addr(r->connection->remote_ip);
+             r->connection->remote_addr->sa.sin.sin_addr.s_addr = apr_inet_addr(r->connection->remote_ip);
              if (cfg->sethostname) {
                  const char *hostvalue;
-diff -ur mod_rpaf-0.5/mod_rpaf.c libapache-mod-rpaf-0.5/mod_rpaf.c
---- mod_rpaf-0.5/mod_rpaf.c    2004-03-17 15:47:30.000000000 +0000
-+++ libapache-mod-rpaf-0.5/mod_rpaf.c  2006-06-16 18:04:38.000000000 +0100
-@@ -130,6 +130,16 @@
-     return 0;
- }
+--- mod_rpaf-0.6/mod_rpaf.c    2008-01-01 05:03:15.000000000 +0200
++++ mod_rpaf-0.6-degtine/mod_rpaf.c    2008-01-14 12:47:44.248571877 +0200
+@@ -148,7 +148,25 @@
+ static void rpaf_cleanup(void *data) {
+     rpaf_cleanup_rec *rcr = (rpaf_cleanup_rec *)data;
+     rcr->r->connection->remote_ip   = ap_pstrdup(rcr->r->connection->pool, rcr->old_ip);
++#ifdef INET6
++      switch (rcr->r->connection->remote_addr.ss_family) {
++      case AF_INET:
++              inet_pton(AF_INET, rcr->r->connection->remote_ip, &((struct sockaddr_in*)&rcr->r->connection->remote_addr)->sin_addr.s_addr);
++              break;
++      }
++#else
+     rcr->r->connection->remote_addr.sin_addr.s_addr = inet_addr(rcr->r->connection->remote_ip);
++#endif
++}
++
 +static char* last_not_in_array(array_header *forwarded_for,
 +                             array_header *proxy_ips) {
 +    int i;
@@ -42,18 +51,26 @@ diff -ur mod_rpaf-0.5/mod_rpaf.c libapache-mod-rpaf-0.5/mod_rpaf.c
 +          break;
 +    }
 +    return ((char **)forwarded_for->elts)[i];
-+}
-+
+ }
  static int change_remote_ip(request_rec *r) {
-     const char *fwdvalue;
-     char *val;
-@@ -147,7 +157,7 @@
-                 if (*fwdvalue != '\0')
-                     ++fwdvalue;
-             }
+@@ -182,8 +200,17 @@
+             rcr->old_ip = ap_pstrdup(r->connection->pool, r->connection->remote_ip);
+             rcr->r = r;
+             ap_register_cleanup(r->pool, (void *)rcr, rpaf_cleanup, ap_null_cleanup);
 -            r->connection->remote_ip = ap_pstrdup(r->connection->pool, ((char **)arr->elts)[((arr->nelts)-1)]);
+-            r->connection->remote_addr.sin_addr.s_addr = inet_addr(r->connection->remote_ip);
 +            r->connection->remote_ip = ap_pstrdup(r->connection->pool, last_not_in_array(arr, cfg->proxy_ips));
-             r->connection->remote_addr.sin_addr.s_addr = inet_addr(r->connection->remote_ip);
++#ifdef INET6
++                      switch (r->connection->remote_addr.ss_family) {
++                      case AF_INET:
++                              inet_pton(AF_INET, r->connection->remote_ip, &((struct sockaddr_in*)&r->connection->remote_addr)->sin_addr.s_addr);
++                              break;
++                      }
++#else
++                      r->connection->remote_addr.sin_addr.s_addr = inet_addr(r->connection->remote_ip);
++#endif
++
              if (cfg->sethostname) {
                  const char *hostvalue;
-
+                 if (hostvalue = ap_table_get(r->headers_in, "X-Forwarded-Host")) {
This page took 0.061771 seconds and 4 git commands to generate.