[Rt-commit] rt branch, 4.2/oracle-dba-tables, created. rt-4.2.9-61-g56496f5

Alex Vandiver alexmv at bestpractical.com
Wed Dec 31 13:48:01 EST 2014


The branch, 4.2/oracle-dba-tables has been created
        at  56496f537c80d72dc04911b8a19fc60d7a1d19b7 (commit)

- Log -----------------------------------------------------------------
commit 56496f537c80d72dc04911b8a19fc60d7a1d19b7
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Dec 30 14:45:37 2014 -0500

    Switch from the DBA-only tables, to tables the user can inspect
    
    Despite the upgrade process being run as RT's "dba" user, in many Oracle
    installs the dba user is set to the RT user, which is granted full
    rights on its tablespace.  However, the dba_* tables are not accessible
    to this user.
    
    Switch to using the all_indexes and associated tables, which only
    include the data which is accessible to the user, unlike the dba_indexes
    table, which is entirely unreadable by users which are not truely the
    DBA.
    
    Fixes: I#30393

diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 29802ad..2b73ff6 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -1368,7 +1368,7 @@ sub Indexes {
     }
     elsif ( $db_type eq 'Oracle' ) {
         $list = $dbh->selectall_arrayref(
-            'select table_name, index_name from dba_indexes where index_name NOT LIKE ? AND lower(Owner) = ?',
+            'select table_name, index_name from all_indexes where index_name NOT LIKE ? AND lower(Owner) = ?',
             undef, 'SYS_%$$', lc RT->Config->Get('DatabaseUser'),
         );
     }
@@ -1476,7 +1476,7 @@ sub IndexInfo {
     }
     elsif ( $db_type eq 'Oracle' ) {
         my $index = $dbh->selectrow_arrayref(
-            'select uniqueness, funcidx_status from dba_indexes
+            'select uniqueness, funcidx_status from all_indexes
             where lower(table_name) = ? AND lower(index_name) = ? AND LOWER(Owner) = ?',
             undef, lc $args{'Table'}, lc $args{'Name'}, lc RT->Config->Get('DatabaseUser'),
         );
@@ -1485,12 +1485,12 @@ sub IndexInfo {
         $res{'Functional'} = $index->[1] ? 1 : 0;
 
         my %columns = map @$_, @{ $dbh->selectall_arrayref(
-            'select column_position, column_name from dba_ind_columns
+            'select column_position, column_name from all_ind_columns
             where lower(table_name) = ? AND lower(index_name) = ? AND LOWER(index_owner) = ?',
             undef, lc $args{'Table'}, lc $args{'Name'}, lc RT->Config->Get('DatabaseUser'),
         ) };
         $columns{ $_->[0] } = $_->[1] foreach @{ $dbh->selectall_arrayref(
-            'select column_position, column_expression from dba_ind_expressions
+            'select column_position, column_expression from all_ind_expressions
             where lower(table_name) = ? AND lower(index_name) = ? AND LOWER(index_owner) = ?',
             undef, lc $args{'Table'}, lc $args{'Name'}, lc RT->Config->Get('DatabaseUser'),
         ) };
@@ -1534,7 +1534,7 @@ sub DropIndex {
         my $user = RT->Config->Get('DatabaseUser');
         # Check if it has constraints associated with it
         my ($constraint) = $dbh->selectrow_arrayref(
-            'SELECT constraint_name, table_name FROM dba_constraints WHERE LOWER(owner) = ? AND LOWER(index_name) = ?',
+            'SELECT constraint_name, table_name FROM all_constraints WHERE LOWER(owner) = ? AND LOWER(index_name) = ?',
             undef, lc $user, lc $args{'Name'}
         );
         if ($constraint) {

-----------------------------------------------------------------------


More information about the rt-commit mailing list