if (ourhost.equals("*")) return true;
  public boolean implies(Permission perm)  {    SocketPermission p;        // First make sure we are the right object type    if (perm instanceof SocketPermission)      p = (SocketPermission) perm;    else            return false;        // Next check the actions    String ourlist = getActions();    String theirlist = p.getActions();    if (! ourlist.startsWith(theirlist))            return false;        // Now check ports    int ourfirstport = 0;    // Now check ports    int ourlastport = 0;    // Now check ports    int theirfirstport = 0;    // Now check ports    int theirlastport = 0;    // Get ours    if (hostport.indexOf(":") == -1)      {	ourfirstport = 0;	ourlastport = 65535;      }    else      {	// FIXME:  Needs bulletproofing.	// This will dump if hostport if all sorts of bad data was passed to	// the constructor	String range = hostport.substring(hostport.indexOf(":") + 1);	if (range.startsWith("-"))	  ourfirstport = 0;	else if (range.indexOf("-") == -1)	  ourfirstport = Integer.parseInt(range);	else	  ourfirstport =	    Integer.parseInt(range.substring(0, range.indexOf("-")));	if (range.endsWith("-"))	  ourlastport = 65535;	else if (range.indexOf("-") == -1)	  ourlastport = Integer.parseInt(range);	else	  ourlastport =	    Integer.parseInt(range.substring(range.indexOf("-") + 1,	                                     range.length()));      }    // Get theirs    if (p.hostport.indexOf(":") == -1)      {	theirfirstport = 0;	ourlastport = 65535;      }    else      {	// This will dump if hostport if all sorts of bad data was passed to	// the constructor	String range = p.hostport.substring(hostport.indexOf(":") + 1);	if (range.startsWith("-"))	  theirfirstport = 0;	else if (range.indexOf("-") == -1)	  theirfirstport = Integer.parseInt(range);	else	  theirfirstport =	    Integer.parseInt(range.substring(0, range.indexOf("-")));	if (range.endsWith("-"))	  theirlastport = 65535;	else if (range.indexOf("-") == -1)	  theirlastport = Integer.parseInt(range);	else	  theirlastport =	    Integer.parseInt(range.substring(range.indexOf("-") + 1,	                                     range.length()));        }    // Now check them    if ((theirfirstport < ourfirstport) || (theirlastport > ourlastport))      return false;        // Finally we can check the hosts    String ourhost;    // Finally we can check the hosts    String theirhost;    // Get ours    if (hostport.indexOf(":") == -1)      ourhost = hostport;    else      ourhost = hostport.substring(0, hostport.indexOf(":"));    // Get theirs    if (p.hostport.indexOf(":") == -1)      theirhost = p.hostport;    else      theirhost = p.hostport.substring(0, p.hostport.indexOf(":"));        // Are they equal?    if (ourhost.equals(theirhost))      return true;    // Try the canonical names    String ourcanonical = null;        // Try the canonical names    String theircanonical = null;    try      {            ourcanonical = InetAddress.getByName(ourhost).getHostName();            theircanonical = InetAddress.getByName(theirhost).getHostName();      }    catch (UnknownHostException e)      {	// Who didn't resolve?  Just assume current address is canonical enough            // Is this ok to do?	if (ourcanonical == null)	  ourcanonical = ourhost;	if (theircanonical == null)	  theircanonical = theirhost;        }    if (ourcanonical.equals(theircanonical))      return true;        // Well, last chance. Try for a wildcard    if (ourhost.indexOf("*.") != -1)      {            String wild_domain = ourhost.substring(ourhost.indexOf("*" + 1));	if (theircanonical.endsWith(wild_domain))	  return true;        }        // Didn't make it        return false;    }