db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1164214 - in /db/derby/code/branches/10.6/java: engine/org/apache/derby/diag/ engine/org/apache/derby/loc/ shared/org/apache/derby/shared/common/reference/ testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Thu, 01 Sep 2011 19:10:14 GMT
Author: rhillegas
Date: Thu Sep  1 19:10:13 2011
New Revision: 1164214

URL: http://svn.apache.org/viewvc?rev=1164214&view=rev
Log:
DERBY-5395: Port 1163740 from trunk to 10.6 branch.

Added:
    db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/DiagUtil.java
      - copied, changed from r1163740, db/derby/code/trunk/java/engine/org/apache/derby/diag/DiagUtil.java
    db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DBOAccessTest.java
      - copied unchanged from r1163740, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DBOAccessTest.java
Modified:
    db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/ErrorLogReader.java
    db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/StatementCache.java
    db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/StatementDuration.java
    db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/TransactionTable.java
    db/derby/code/branches/10.6/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/branches/10.6/java/shared/org/apache/derby/shared/common/reference/SQLState.java
    db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java

Copied: db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/DiagUtil.java (from
r1163740, db/derby/code/trunk/java/engine/org/apache/derby/diag/DiagUtil.java)
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/DiagUtil.java?p2=db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/DiagUtil.java&p1=db/derby/code/trunk/java/engine/org/apache/derby/diag/DiagUtil.java&r1=1163740&r2=1164214&rev=1164214&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/diag/DiagUtil.java (original)
+++ db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/DiagUtil.java Thu Sep  1
19:10:13 2011
@@ -47,7 +47,7 @@ abstract    class   DiagUtil
         if ( dd.usesSqlAuthorization() )
         {
             String  databaseOwner = dd.getAuthorizationDatabaseOwner();
-            String  currentUser = lcc.getStatementContext().getSQLSessionContext().getCurrentUser();
+            String  currentUser = lcc.getAuthorizationId();
 
             if ( !databaseOwner.equals( currentUser ) )
             {

Modified: db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/ErrorLogReader.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/ErrorLogReader.java?rev=1164214&r1=1164213&r2=1164214&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/ErrorLogReader.java (original)
+++ db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/ErrorLogReader.java Thu
Sep  1 19:10:13 2011
@@ -26,6 +26,8 @@ import java.io.FileNotFoundException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.FileInputStream;
+import java.security.PrivilegedAction;
+import java.security.AccessController;
 
 import java.util.Hashtable;
 import java.util.Enumeration;
@@ -35,8 +37,10 @@ import java.sql.SQLException;
 import java.sql.Types;
 import org.apache.derby.vti.VTITemplate;
 import org.apache.derby.iapi.reference.Limits;
+import org.apache.derby.iapi.reference.Property;
 import org.apache.derby.iapi.util.StringUtil;
 
+import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.sql.ResultColumnDescriptor;
 import org.apache.derby.impl.jdbc.EmbedResultSetMetaData;
 
@@ -117,9 +121,20 @@ public class ErrorLogReader extends VTIT
 		ErrorLogReader('filename') will access the specified
 		file name.
 	 */
-	public ErrorLogReader()
+	public ErrorLogReader() throws StandardException
 	{
-		String home = System.getProperty("derby.system.home");
+        DiagUtil.checkAccess();
+
+        final String home = (String)AccessController.doPrivileged
+            (
+             new PrivilegedAction()
+             {
+                 public Object run()
+                 {
+                     return System.getProperty( Property.SYSTEM_HOME_PROPERTY );
+                 }
+             }
+             );
 
 		inputFileName = "derby.log";
 
@@ -129,8 +144,10 @@ public class ErrorLogReader extends VTIT
 		}
 	}
 
-	public ErrorLogReader(String inputFileName)
+	public ErrorLogReader(String inputFileName) throws StandardException
 	{
+        DiagUtil.checkAccess();
+
 		this.inputFileName = inputFileName;
 	}
 

Modified: db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/StatementCache.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/StatementCache.java?rev=1164214&r1=1164213&r2=1164214&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/StatementCache.java (original)
+++ db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/StatementCache.java Thu
Sep  1 19:10:13 2011
@@ -29,10 +29,11 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.Vector;
 
+import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.Limits;
 import org.apache.derby.iapi.services.cache.CacheManager;
+import org.apache.derby.iapi.services.context.ContextService;
 import org.apache.derby.iapi.sql.ResultColumnDescriptor;
-import org.apache.derby.iapi.sql.conn.ConnectionUtil;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 import org.apache.derby.iapi.util.StringUtil;
 import org.apache.derby.impl.jdbc.EmbedResultSetMetaData;
@@ -73,10 +74,13 @@ public final class StatementCache extend
 	private GenericPreparedStatement currentPs;
 	private boolean wasNull;
 
-	public StatementCache() throws SQLException {
+	public StatementCache() throws StandardException {
 
-		LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();
+        DiagUtil.checkAccess();
         
+        LanguageConnectionContext lcc = (LanguageConnectionContext)
+            ContextService.getContextOrNull(LanguageConnectionContext.CONTEXT_ID);
+
         CacheManager statementCache =
             lcc.getLanguageConnectionFactory().getStatementCache();
 

Modified: db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/StatementDuration.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/StatementDuration.java?rev=1164214&r1=1164213&r2=1164214&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/StatementDuration.java (original)
+++ db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/StatementDuration.java Thu
Sep  1 19:10:13 2011
@@ -26,7 +26,9 @@ import java.io.FileNotFoundException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.FileInputStream;
-
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+import java.text.SimpleDateFormat;
 import java.util.Hashtable;
 import java.util.Enumeration;
 import java.util.Properties;
@@ -35,9 +37,11 @@ import java.sql.SQLException;
 import java.sql.Timestamp;
 import java.sql.Types;
 import org.apache.derby.vti.VTITemplate;
+import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.sql.ResultColumnDescriptor;
 import org.apache.derby.impl.jdbc.EmbedResultSetMetaData;
 import org.apache.derby.iapi.reference.Limits;
+import org.apache.derby.iapi.reference.Property;
 import org.apache.derby.iapi.util.StringUtil;
 
 /**
@@ -107,9 +111,20 @@ public class StatementDuration extends V
 		StatementDuration('filename') will access the specified
 		file name.
 	 */
-	public StatementDuration()
+	public StatementDuration()  throws StandardException
 	{
-		String home = System.getProperty("derby.system.home");
+        DiagUtil.checkAccess();
+
+        final String home = (String)AccessController.doPrivileged
+            (
+             new PrivilegedAction()
+             {
+                 public Object run()
+                 {
+                     return System.getProperty( Property.SYSTEM_HOME_PROPERTY );
+                 }
+             }
+             );
 
 		inputFileName = "derby.log";
 
@@ -119,8 +134,10 @@ public class StatementDuration extends V
 		}
 	}
 
-	public StatementDuration(String inputFileName)
+	public StatementDuration(String inputFileName)  throws StandardException
 	{
+        DiagUtil.checkAccess();
+
 		this.inputFileName = inputFileName;
 	}
 

Modified: db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/TransactionTable.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/TransactionTable.java?rev=1164214&r1=1164213&r2=1164214&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/TransactionTable.java (original)
+++ db/derby/code/branches/10.6/java/engine/org/apache/derby/diag/TransactionTable.java Thu
Sep  1 19:10:13 2011
@@ -21,6 +21,7 @@
 
 package org.apache.derby.diag;
 
+import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 import org.apache.derby.iapi.sql.conn.ConnectionUtil;
 import org.apache.derby.iapi.store.access.TransactionInfo;
@@ -86,6 +87,11 @@ public class TransactionTable extends VT
 	int currentRow;
 	private boolean wasNull;
 
+    public  TransactionTable()    throws StandardException
+    {
+        DiagUtil.checkAccess();
+    }
+    
 	/**
 		@see java.sql.ResultSet#getMetaData
 	 */

Modified: db/derby/code/branches/10.6/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/engine/org/apache/derby/loc/messages.xml?rev=1164214&r1=1164213&r2=1164214&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/branches/10.6/java/engine/org/apache/derby/loc/messages.xml Thu Sep  1 19:10:13
2011
@@ -1201,6 +1201,11 @@ Guide.
             </msg>
 
             <msg>
+                <name>4251D</name>
+                <text>Only the database owner can view this data.</text>
+            </msg>
+
+            <msg>
                 <name>42601</name>
                 <text>In an ALTER TABLE statement, the column '{0}' has been specified
as NOT NULL and either the DEFAULT clause was not specified or was specified as DEFAULT NULL.</text>
                 <arg>columnName</arg>

Modified: db/derby/code/branches/10.6/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=1164214&r1=1164213&r2=1164214&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/shared/org/apache/derby/shared/common/reference/SQLState.java
(original)
+++ db/derby/code/branches/10.6/java/shared/org/apache/derby/shared/common/reference/SQLState.java
Thu Sep  1 19:10:13 2011
@@ -769,6 +769,7 @@ public interface SQLState {
     String AUTH_ROLE_DBO_ONLY                                          = "4251A";
 	String AUTH_PUBLIC_ILLEGAL_AUTHORIZATION_ID                        = "4251B";
 	String AUTH_ROLE_GRANT_CIRCULARITY                                 = "4251C";
+	String DBO_ONLY                                                         = "4251D";
 
 	String LANG_DB2_NOT_NULL_COLUMN_INVALID_DEFAULT                    = "42601";
 	String LANG_DB2_INVALID_HEXADECIMAL_CONSTANT                    = "42606";

Modified: db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=1164214&r1=1164213&r2=1164214&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
(original)
+++ db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Thu Sep  1 19:10:13 2011
@@ -213,6 +213,7 @@ public class _Suite extends BaseTestCase
         suite.addTest(SequenceTest.suite());
         suite.addTest(SequencePermsTest.suite());
         suite.addTest(SequenceGeneratorTest.suite());
+        suite.addTest(DBOAccessTest.suite());
         suite.addTest(OLAPTest.suite());
         suite.addTest(OrderByAndOffsetFetchInSubqueries.suite());
         suite.addTest(Derby5005Test.suite());



Mime
View raw message