CVS update: JGroups/src/org/jgroups/auth AuthToken.java RegexMembership.java

"Bela Ban" <[email protected]> Wed, 15 Sep 2010 13:37:06 +0000
Newsgroups gmane.comp.java.javagroups.cvs
Message-ID <[email protected]>
  User: belaban 
  Date: 10/09/15 13:37:06

  Modified:    src/org/jgroups/auth AuthToken.java RegexMembership.java
  Log:
  ns
  
  Revision  Changes    Path
  1.9       +2 -0      JGroups/src/org/jgroups/auth/AuthToken.java
  
  Index: AuthToken.java
  ===================================================================
  RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/auth/AuthToken.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AuthToken.java	7 Oct 2009 16:29:29 -0000	1.8
  +++ AuthToken.java	15 Sep 2010 13:37:06 -0000	1.9
  @@ -23,6 +23,8 @@
           this.auth = auth;
       }
   
  +    public void init() {}
  +
       /**
        * Used to return the full package and class name of the implementation. This is used by the
        * AUTH protocol to create an instance of the implementation.
  
  
  
  1.2       +21 -16    JGroups/src/org/jgroups/auth/RegexMembership.java
  
  Index: RegexMembership.java
  ===================================================================
  RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/auth/RegexMembership.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RegexMembership.java	15 Sep 2010 12:12:14 -0000	1.1
  +++ RegexMembership.java	15 Sep 2010 13:37:06 -0000	1.2
  @@ -38,7 +38,7 @@
    * Matches the IP address or logical name of a joiner against a regular expression and accepts or rejects based on
    * pattern matching
    * @author Bela Ban
  - * @version $Id: RegexMembership.java,v 1.1 2010/09/15 12:12:14 belaban Exp $
  + * @version $Id: RegexMembership.java,v 1.2 2010/09/15 13:37:06 belaban Exp $
    */
   public class RegexMembership extends AuthToken {
   
  @@ -82,30 +82,35 @@
   
       public boolean authenticate(AuthToken token, Message msg) {
           Address sender=msg.getSrc();
  -        String ip_addr=null;
  -        String logical_name=null;
  +
   
           if(match_ip_address) {
               PhysicalAddress src=sender != null? (PhysicalAddress)auth.down(new Event(Event.GET_PHYSICAL_ADDRESS, sender)) : null;
  -            if(src != null)
  -                ip_addr=src.toString();
  -            Matcher matcher=pattern.matcher(ip_addr);
  -            if(matcher.matches())
  -                return true;
  +            String ip_addr=src != null? src.toString() : null;
  +            if(ip_addr != null) {
  +                Matcher matcher=pattern.matcher(ip_addr);
  +                boolean result=matcher.matches();
  +                if(log.isTraceEnabled())
  +                    log.trace("matching ip_address: pattern= " + pattern + ", input= " + ip_addr + ", result= " + result);
  +                if(result)
  +                    return true;
  +            }
           }
           if(match_logical_name) {
  -            logical_name=sender != null? UUID.get(sender) : null;
  -            Matcher matcher=pattern.matcher(logical_name);
  -            if(matcher.matches())
  -                return true;
  +            String logical_name=sender != null? UUID.get(sender) : null;
  +            if(logical_name != null) {
  +                Matcher matcher=pattern.matcher(logical_name);
  +                boolean result=matcher.matches();
  +                if(log.isTraceEnabled())
  +                    log.trace("matching logical_name: pattern= " + pattern + ", input= " + logical_name + ", result= " + result);
  +                if(result)
  +                    return true;
  +            }
           }
           return false;
       }
   
  -    private static boolean hasPort(String member) {
  -        return member.contains(":");
  -    }
  -
  +   
   
       public void writeTo(DataOutputStream out) throws IOException {
       }
  
  
  

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev