incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1202087 - /sling/trunk/contrib/extensions/security/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
Date Tue, 15 Nov 2011 08:30:41 GMT
Author: cziegeler
Date: Tue Nov 15 08:30:41 2011
New Revision: 1202087

URL: http://svn.apache.org/viewvc?rev=1202087&view=rev
Log:
SLING-2279 : ReferrerFilter should not reverse lookup the IPs of interfaces. Apply patch from
Tobias Bocanegra

Modified:
    sling/trunk/contrib/extensions/security/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java

Modified: sling/trunk/contrib/extensions/security/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/security/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java?rev=1202087&r1=1202086&r2=1202087&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/security/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
(original)
+++ sling/trunk/contrib/extensions/security/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
Tue Nov 15 08:30:41 2011
@@ -104,24 +104,13 @@ public class ReferrerFilter implements F
                 while(ias.hasMoreElements()){
                     final InetAddress ia = ias.nextElement();
                     final String address = ia.getHostAddress().trim().toLowerCase();
-                    final String name = ia.getHostName().trim().toLowerCase();
                     if ( ia instanceof Inet4Address ) {
                         referrers.add("http://" + address + ":0");
                         referrers.add("https://" + address + ":0");
-                        referrers.add("http://" + name + ":0");
-                        referrers.add("https://" + name + ":0");
-                        if (name.indexOf('.')>-1){
-                            int index = name.indexOf('.');
-                            String host = name.substring(0, index);
-                            referrers.add("http://" + host.trim().toLowerCase() + ":0");
-                            referrers.add("https://" + host.trim().toLowerCase() + ":0");
-                        }
                     }
                     if ( ia instanceof Inet6Address ) {
                         referrers.add("http://[" + address + "]" + ":0");
                         referrers.add("https://[" + address + "]" + ":0");
-                        referrers.add("http://[" + name + "]" + ":0");
-                        referrers.add("https://[" + name + "]" + ":0");
                     }
                 }
             }
@@ -335,7 +324,7 @@ public class ReferrerFilter implements F
     /**
      * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
      */
-    public void init(FilterConfig arg0) throws ServletException {
+    public void init(final FilterConfig config) throws ServletException {
         // nothing to do
     }
 
@@ -352,8 +341,7 @@ public class ReferrerFilter implements F
          * Print out the allowedReferrers
          * @see org.apache.felix.webconsole.ConfigurationPrinter#printConfiguration(java.io.PrintWriter)
          */
-        @SuppressWarnings("unused")
-        public void printConfiguration(PrintWriter pw) {
+        public void printConfiguration(final PrintWriter pw) {
             pw.println("Current Apache Sling Referrer Filter Allowed Referrers:");
             pw.println();
             for (final URL url : allowedReferrers) {



Mime
View raw message