db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r674808 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
Date Tue, 08 Jul 2008 13:05:52 GMT
Author: dag
Date: Tue Jul  8 06:05:51 2008
New Revision: 674808

URL: http://svn.apache.org/viewvc?rev=674808&view=rev
Log:
DERBY-3736 Revoking a column level privilege from a user, a prepared statement relying on
that privilege can still be executed

Patch derby-3736b, which fixes this issue, and adds a new testcase.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java?rev=674808&r1=674807&r2=674808&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java
Tue Jul  8 06:05:51 2008
@@ -276,6 +276,16 @@
 					{
 						privileges_revoked = true;
 						dd.getDependencyManager().invalidateFor(colPermsDescs[i], DependencyManager.REVOKE_PRIVILEGE,
lcc);
+						// When revoking a privilege from a Table we need to
+						// invalidate all GPSs refering to it. But GPSs aren't
+						// Dependents of colPermsDescs[i], but of the
+						// TableDescriptor itself, so we must send
+						// INTERNAL_RECOMPILE_REQUEST to the TableDescriptor's
+						// Dependents.
+						dd.getDependencyManager().invalidateFor
+							(td,
+							 DependencyManager.INTERNAL_RECOMPILE_REQUEST,
+							 lcc);
 					}
 				}
 			}

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java?rev=674808&r1=674807&r2=674808&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
Tue Jul  8 06:05:51 2008
@@ -9088,8 +9088,45 @@
         // expect error
         
         assertStatementError("42502", pSt2);
-        
-        
+
+        // -----------------------------------
+        // Now try with column level privilege
+        // DERBY-3736
+        st_user1.executeUpdate(
+            " grant select(i) on ttt2 to user2");
+
+        // set connection user2
+        // prepare statement, ok
+
+        pSt2 = user2.prepareStatement(
+            "select * from user1.ttt2");
+
+        // ok
+
+        rs = pSt2.executeQuery();
+        expColNames = new String [] {"I"};
+        JDBC.assertColumnNames(rs, expColNames);
+
+        expRS = new String [][]
+        {
+            {"8"}
+        };
+
+        JDBC.assertFullResultSet(rs, expRS, true);
+
+        // set connection user1
+
+        st_user1.executeUpdate(
+            " revoke select(i) on ttt2 from user2");
+
+        // set connection user2
+        // expect error
+
+        assertStatementError("42502", pSt2);
+
+        // end of test case for DERBY-3736
+        // --------------------------------
+
         // set connection user2
         // 
         // ---------------------------------------------------------



Mime
View raw message