/[classpath]/classpath/java/net/SocketPermission.java
ViewVC logotype

Diff of /classpath/java/net/SocketPermission.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by mkoch, Sat Apr 17 18:42:20 2004 UTC revision 1.15 by mkoch, Fri Oct 15 10:04:52 2004 UTC
# Line 151  public final class SocketPermission exte Line 151  public final class SocketPermission exte
151    public boolean equals(Object obj)    public boolean equals(Object obj)
152    {    {
153      if (! (obj instanceof SocketPermission))      if (! (obj instanceof SocketPermission))
154        return (false);        return false;
155    
156      if (((SocketPermission) obj).hostport.equals(hostport))      if (((SocketPermission) obj).hostport.equals(hostport))
157        if (((SocketPermission) obj).actions.equals(actions))        if (((SocketPermission) obj).actions.equals(actions))
158          return (true);          return true;
159    
160      return (false);      return false;
161    }    }
162    
163    /**    /**
# Line 216  public final class SocketPermission exte Line 216  public final class SocketPermission exte
216      else if (actions.indexOf("resolve") != -1)      else if (actions.indexOf("resolve") != -1)
217        sb.append("resolve");        sb.append("resolve");
218    
219      return (sb.toString());      return sb.toString();
220    }    }
221    
222    /**    /**
# Line 229  public final class SocketPermission exte Line 229  public final class SocketPermission exte
229    {    {
230      // FIXME: Implement      // FIXME: Implement
231    
232      return (null);      return null;
233    }    }
234    
235    /**    /**
# Line 265  public final class SocketPermission exte Line 265  public final class SocketPermission exte
265      if (perm instanceof SocketPermission)      if (perm instanceof SocketPermission)
266        p = (SocketPermission) perm;        p = (SocketPermission) perm;
267      else      else
268        return (false);        return false;
269    
270      // Next check the actions      // Next check the actions
271      String ourlist = getActions();      String ourlist = getActions();
272      String theirlist = p.getActions();      String theirlist = p.getActions();
273    
274      if (! ourlist.startsWith(theirlist))      if (! ourlist.startsWith(theirlist))
275        return (false);        return false;
276    
277      // Now check ports      // Now check ports
278      int ourfirstport = 0;      int ourfirstport = 0;
# Line 347  public final class SocketPermission exte Line 347  public final class SocketPermission exte
347    
348      // Now check them      // Now check them
349      if ((theirfirstport < ourfirstport) || (theirlastport > ourlastport))      if ((theirfirstport < ourfirstport) || (theirlastport > ourlastport))
350        return (false);        return false;
351    
352      // Finally we can check the hosts      // Finally we can check the hosts
353      String ourhost;      String ourhost;
# Line 369  public final class SocketPermission exte Line 369  public final class SocketPermission exte
369    
370      // Are they equal?      // Are they equal?
371      if (ourhost.equals(theirhost))      if (ourhost.equals(theirhost))
372        return (true);        return true;
373    
374      // Try the canonical names      // Try the canonical names
375      String ourcanonical = null;      String ourcanonical = null;
# Line 392  public final class SocketPermission exte Line 392  public final class SocketPermission exte
392        }        }
393    
394      if (ourcanonical.equals(theircanonical))      if (ourcanonical.equals(theircanonical))
395        return (true);        return true;
396    
397      // Well, last chance.  Try for a wildcard      // Well, last chance.  Try for a wildcard
398      if (ourhost.indexOf("*.") != -1)      if (ourhost.indexOf("*.") != -1)
399        {        {
400          String wild_domain = ourhost.substring(ourhost.indexOf("*" + 1));          String wild_domain = ourhost.substring(ourhost.indexOf("*" + 1));
401          if (theircanonical.endsWith(wild_domain))          if (theircanonical.endsWith(wild_domain))
402            return (true);            return true;
403        }        }
404    
405      // Didn't make it      // Didn't make it
406      return (false);      return false;
407    }    }
408  }  }

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26