[Home] [Help]
1: package body DBMS_JVM_EXP_PERMS as
2: EXP_END CONSTANT PLS_INTEGER := 999999;
3: EXP_START CONSTANT PLS_INTEGER := 0;
4: cursor policy_q is select kind, grantee, type_schema,type_name,
5: name,action, enabled from dba_java_policy where
6: enabled='ENABLED';
7: zone PLS_INTEGER := EXP_START;
8:
9:
99: run_seq number;
100:
101: Begin
102: -- we need to disable the RESTRICTion on RuntimePermission#LoadLibrary
103: select seq into pol_seq from dba_java_policy
104: where kind = 'RESTRICT' and type_schema='SYS'
105: and type_name = POLICYPERM and
106: name = '0:java.lang.RuntimePermission#loadLibrary.*';
107:
108: if(pol_seq != 0) then
109: dbms_java.disable_permission(pol_seq);
110: end if;
111:
112: select seq into run_seq from dba_java_policy
113: where kind = 'RESTRICT' and type_schema='SYS'
114: and type_name = 'java.lang.RuntimePermission' and
115: name = 'loadLibrary.*';
116:
119: end if;
120:
121:
122: -- This is the main loop that goes through each record
123: -- and check the target dba_java_policy table to see if there is
124: -- a like permission there already. If not then the permission
125: -- is created.
126:
127: for i in pcol.FIRST .. pcol.LAST
125: -- is created.
126:
127: for i in pcol.FIRST .. pcol.LAST
128: loop
129: -- Check if permission is already in dba_java_policy
130: select count(*) into row_count from dba_java_policy d where
131: pcol(i).kind = d.kind and
132: pcol(i).grantee = d.grantee and
133: pcol(i).type_schema = d.type_schema and
126:
127: for i in pcol.FIRST .. pcol.LAST
128: loop
129: -- Check if permission is already in dba_java_policy
130: select count(*) into row_count from dba_java_policy d where
131: pcol(i).kind = d.kind and
132: pcol(i).grantee = d.grantee and
133: pcol(i).type_schema = d.type_schema and
134: pcol(i).type_name = d.type_name and
200: action varchar2(4000);
201: enabled varchar2(8);
202:
203: Begin
204: -- open the dba_java_policy cursor and return temp tale creation
205: IF policy_q%ISOPEN = FALSE and state = 0 THEN
206: open policy_q;
207: new_block := 0;
208: return 'execute immediate (''CREATE TABLE TEMP_JAVA_PRIVS' ||
206: open policy_q;
207: new_block := 0;
208: return 'execute immediate (''CREATE TABLE TEMP_JAVA_PRIVS' ||
209: ' AS SELECT KIND, GRANTEE, TYPE_SCHEMA, TYPE_NAME,' ||
210: ' NAME, ACTION, ENABLED FROM DBA_JAVA_POLICY WHERE ROWNUM > 1'');';
211: end if;
212: -- Process the insert commands for import.
213: if policy_q%ISOPEN = TRUE then
214: Fetch policy_q into kind, grantee, type_schema,