[cp-patches] FYI: Add printing security checks

Gary Benson gbenson at redhat.com
Tue Jun 20 11:39:33 UTC 2006


Hi all,

This commit adds security checks to all AWT peers' getPrintJob
methods.  None of the methods actually do anything yet, but having
the checks there means the Mauve tests pass.

Cheers,
Gary
-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.7880
diff -u -r1.7880 ChangeLog
--- ChangeLog	20 Jun 2006 11:24:41 -0000	1.7880
+++ ChangeLog	20 Jun 2006 11:35:39 -0000
@@ -1,3 +1,9 @@
+2006-06-20  Gary Benson  <gbenson at redhat.com>
+
+	* java/awt/Toolkit.java: Add security check.
+	* gnu/java/awt/peer/gtk/GtkToolkit.java: Likewise.
+	* gnu/java/awt/peer/qt/QtToolkit.java: Likewise.
+
 2006-06-20  Raif S. Naffah  <raif at swiftdsl.com.au>
 
 	* gnu/java/security/key/dss/DSSKey.java: Source formatting.
Index: java/awt/Toolkit.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Toolkit.java,v
retrieving revision 1.41
diff -u -r1.41 Toolkit.java
--- java/awt/Toolkit.java	15 May 2006 16:11:48 -0000	1.41
+++ java/awt/Toolkit.java	20 Jun 2006 11:35:39 -0000
@@ -695,6 +695,14 @@
   public PrintJob getPrintJob(Frame frame, String title,
                               JobAttributes jobAttr, PageAttributes pageAttr)
   {
+    // FIXME: it is possible this check may be removed
+    // if this method, when written, always delegates to
+    // getPrintJob(Frame, String, Properties).
+    SecurityManager sm;
+    sm = System.getSecurityManager();
+    if (sm != null)
+      sm.checkPrintJobAccess();
+
     return null;
   }
 
Index: gnu/java/awt/peer/gtk/GtkToolkit.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java,v
retrieving revision 1.87
diff -u -r1.87 GtkToolkit.java
--- gnu/java/awt/peer/gtk/GtkToolkit.java	5 Jun 2006 13:47:04 -0000	1.87
+++ gnu/java/awt/peer/gtk/GtkToolkit.java	20 Jun 2006 11:35:39 -0000
@@ -310,6 +310,11 @@
 
   public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props) 
   {
+    SecurityManager sm;
+    sm = System.getSecurityManager();
+    if (sm != null)
+      sm.checkPrintJobAccess();
+
     return null;
   }
 
Index: gnu/java/awt/peer/qt/QtToolkit.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/qt/QtToolkit.java,v
retrieving revision 1.6
diff -u -r1.6 QtToolkit.java
--- gnu/java/awt/peer/qt/QtToolkit.java	7 Jun 2006 22:00:01 -0000	1.6
+++ gnu/java/awt/peer/qt/QtToolkit.java	20 Jun 2006 11:35:39 -0000
@@ -402,6 +402,11 @@
 			      String jobtitle,
 			      Properties props)
   {
+    SecurityManager sm;
+    sm = System.getSecurityManager();
+    if (sm != null)
+      sm.checkPrintJobAccess();
+    
     throw new RuntimeException("Not implemented");
   }
 


More information about the Classpath-patches mailing list