Hi again,

The checks at the end of java.io.FilePermission.implies are backward.
They're supposed to be checking that fp's actions are a subset of this
object's actions, but they're actually checking that this object's
actions are a subset of fp's.  The attached patch fixes.

Also, as an aside, the (simple) action checks are performed after the
(complex) pathname checks.  We'd refuse permission slightly faster if
we did the action checks first.

Cheers,
Gary
Index: ChangeLog
===================================================================
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.5612
diff -u -r1.5612 ChangeLog
--- ChangeLog   15 Nov 2005 23:07:23 -0000      1.5612
+++ ChangeLog   16 Nov 2005 15:09:25 -0000
@@ -1,3 +1,8 @@
+2005-11-16  Gary Benson  <[EMAIL PROTECTED]>
+
+       * java/io/FilePermission.java (implies): Correct the sense
+       in which action checks are applied.
+
 2005-11-16  Gary Benson  <[EMAIL PROTECTED]>
 
        * java/security/ProtectionDomain.java (toString): Use
Index: java/io/FilePermission.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/FilePermission.java,v
retrieving revision 1.19
diff -u -r1.19 FilePermission.java
--- java/io/FilePermission.java 2 Jul 2005 20:32:37 -0000       1.19
+++ java/io/FilePermission.java 16 Nov 2005 15:09:25 -0000
@@ -278,13 +278,13 @@
        break;
       }
 
-    if (readPerm && ! fp.readPerm)
+    if (fp.readPerm && ! readPerm)
       return false;
-    if (writePerm && ! fp.writePerm)
+    if (fp.writePerm && ! writePerm)
       return false;
-    if (executePerm && ! fp.executePerm)
+    if (fp.executePerm && ! executePerm)
       return false;
-    if (deletePerm && ! fp.deletePerm)
+    if (fp.deletePerm && ! deletePerm)
       return false;
     
     return true;
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to