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 |
/** |
/** |
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 |
/** |
/** |
229 |
{ |
{ |
230 |
// FIXME: Implement |
// FIXME: Implement |
231 |
|
|
232 |
return (null); |
return null; |
233 |
} |
} |
234 |
|
|
235 |
/** |
/** |
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; |
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; |
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; |
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 |
} |
} |