can't grant java.io.FilePermission [message #559586] |
Wed, 04 July 2012 08:43 |
_jum
Messages: 577 Registered: February 2008
|
Senior Member |
|
|
In ORACLE 11.2.0.1.0 I can grant java.io.FilePermission. I use (as SYS) a cript like:
DROP USER SCOTT CASCADE;
User dropped.
CREATE USER SCOTT
IDENTIFIED BY tiger
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMP
PROFILE DEFAULT
ACCOUNT UNLOCK;
GRANT RESOURCE TO SCOTT;
GRANT CONNECT TO SCOTT;
ALTER USER SCOTT DEFAULT ROLE ALL;
User dropped.
User created.
Grant complete.
Grant complete.
User altered.
DECLARE
KEYNUM NUMBER;
BEGIN
SYS.DBMS_JAVA.GRANT_PERMISSION(
grantee => 'SCOTT'
,permission_type => 'SYS:java.io.FilePermission'
,permission_name => 'C:\TEMP'
,permission_action => 'read'
,key => KEYNUM
);
END;
/
PL/SQL procedure successfully completed.
SELECT *
FROM DBA_JAVA_POLICY
WHERE grantee='SCOTT';
KIND GRANTEE TYPE_SCHEMA TYPE_NAME NAME ACTION ENABLED SEQ
-----------------------------------------------------------------------------------
GRANT SCOTT SYS java.io.FilePermission C:\TEMP read ENABLED 198
In ORACLE 11.2.0.2.0 I can't grant java.io.FilePermission:
DROP USER SCOTT CASCADE;
User dropped.
CREATE USER SCOTT
IDENTIFIED BY tiger
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMP
PROFILE DEFAULT
ACCOUNT UNLOCK;
GRANT RESOURCE TO SCOTT;
GRANT CONNECT TO SCOTT;
ALTER USER SCOTT DEFAULT ROLE ALL;
User dropped.
User created.
Grant complete.
Grant complete.
User altered.
DECLARE
KEYNUM NUMBER;
BEGIN
SYS.DBMS_JAVA.GRANT_PERMISSION(
grantee => 'SCOTT'
,permission_type => 'SYS:java.io.FilePermission'
,permission_name => 'C:\TEMP'
,permission_action => 'read'
,key => KEYNUM
);
END;
/
Error at line 15
ORA-29532: Java call terminated by uncaught Java exception: java.lang.SecurityException: policy table update java.io.FilePermission, C:\TEMP
ORA-06512: at "SYS.DBMS_JAVA", line 752
ORA-06512: at line 4
Script Terminated on line 15.
SELECT *
FROM DBA_JAVA_POLICY
WHERE grantee='SCOTT';
no rows selected.
What could be the reason ?
|
|
|
|
|
|
Re: can't grant java.io.FilePermission [message #559598 is a reply to message #559586] |
Wed, 04 July 2012 12:47 |
|
Barbara Boehmer
Messages: 9104 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
The only way that I am able to reproduce the error is by attempting to run your code while connected as a user who lacks DBA privileges. Did you run it as SYS AS SYSDBA or what?
SCOTT@orcl_11gR2> SELECT * FROM v$version
2 /
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
5 rows selected.
SCOTT@orcl_11gR2> connect grantor/grantor
Connected.
GRANTOR@orcl_11gR2> DECLARE
2 KEYNUM NUMBER;
3 BEGIN
4 SYS.DBMS_JAVA.GRANT_PERMISSION(
5 grantee => 'TEST'
6 ,permission_type => 'SYS:java.io.FilePermission'
7 ,permission_name => 'C:\TEMP'
8 ,permission_action => 'read'
9 ,key => KEYNUM
10 );
11 END;
12 /
DECLARE
*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.SecurityException: policy table update java.io.FilePermission,
C:\TEMP
ORA-06512: at "SYS.DBMS_JAVA", line 752
ORA-06512: at line 4
GRANTOR@orcl_11gR2> connect scott/tiger
Connected.
SCOTT@orcl_11gR2> grant dba to grantor
2 /
Grant succeeded.
SCOTT@orcl_11gR2> connect grantor/grantor
Connected.
GRANTOR@orcl_11gR2> DECLARE
2 KEYNUM NUMBER;
3 BEGIN
4 SYS.DBMS_JAVA.GRANT_PERMISSION(
5 grantee => 'TEST'
6 ,permission_type => 'SYS:java.io.FilePermission'
7 ,permission_name => 'C:\TEMP'
8 ,permission_action => 'read'
9 ,key => KEYNUM
10 );
11 END;
12 /
PL/SQL procedure successfully completed.
|
|
|
Re: can't grant java.io.FilePermission [message #559624 is a reply to message #559598] |
Thu, 05 July 2012 00:50 |
_jum
Messages: 577 Registered: February 2008
|
Senior Member |
|
|
@Michel - here the results:
SELECT *
FROM DBA_JAVA_POLICY
WHERE grantee='PUBLIC';
KIND GRANTEE TYPE_SCHEMA TYPE_NAME NAME ACTION ENABLED SEQ
-----------------------------------------------------------------------------------
GRANT PUBLIC SYS java.lang.RuntimePermission exitVM ENABLED 26
GRANT PUBLIC SYS java.lang.RuntimePermission getenv.ORACLE_HOME ENABLED 32
GRANT PUBLIC SYS java.lang.RuntimePermission getenv.TNS_ADMIN ENABLED 31
RESTRICT PUBLIC SYS java.lang.RuntimePermission loadLibrary.* ENABLED 97
GRANT PUBLIC SYS java.lang.RuntimePermission modifyThread ENABLED 28
GRANT PUBLIC SYS java.lang.RuntimePermission modifyThreadGroup ENABLED 29
GRANT PUBLIC SYS java.lang.RuntimePermission preferences ENABLED 30
GRANT PUBLIC SYS java.util.PropertyPermission * read ENABLED 2
GRANT PUBLIC SYS java.util.PropertyPermission oracle.net.tns_admin write ENABLED 33
GRANT PUBLIC SYS java.util.PropertyPermission user.language write ENABLED 25
RESTRICT PUBLIC SYS oracle.aurora.rdbms.security.PolicyTablePermission 0:java.lang.RuntimePermission#loadLibrary.* ENABLED 98
GRANT PUBLIC SYS oracle.aurora.security.JServerPermission DUMMY DISABLED 114
GRANT PUBLIC SYS oracle.aurora.security.JServerPermission LoadClassInPackage.* ENABLED 34
RESTRICT PUBLIC SYS oracle.aurora.security.JServerPermission LoadClassInPackage.java.* ENABLED 35
RESTRICT PUBLIC SYS oracle.aurora.security.JServerPermission LoadClassInPackage.oracle.aurora.* ENABLED 36
RESTRICT PUBLIC SYS oracle.aurora.security.JServerPermission LoadClassInPackage.oracle.jdbc.* ENABLED 37
RESTRICT PUBLIC SYS oracle.aurora.security.JServerPermission LoadClassInPackage.oracle.ord.* ENABLED 128
@Barbara - I'm SYSDBA in this scenario, the only difference is the ORACLE version.
|
|
|
|
|
|
Re: can't grant java.io.FilePermission [message #559637 is a reply to message #559632] |
Thu, 05 July 2012 03:14 |
_jum
Messages: 577 Registered: February 2008
|
Senior Member |
|
|
Changed back to DBA and tried again with no success:
SELECT granted_role,
admin_option,
default_role
FROM user_role_privs
WHERE GRANTED_ROLE='DBA';
GRANTED_ROLE ADMIN_OPTION DEFAULT_ROLE
------------------------------ ------------ ------------
DBA NO NO
1 row selected.
|
|
|
|
Re: can't grant java.io.FilePermission [message #559650 is a reply to message #559640] |
Thu, 05 July 2012 05:03 |
_jum
Messages: 577 Registered: February 2008
|
Senior Member |
|
|
Thank You @Michel, overlooked this.
Changed the USER DEFAULT ROLE and now the session_roles shows DBA too, but the result is the same...
The ORA-29532 error only takes place, if a valid USERNAME is used for GRANTEE, in the other cases the procedure gives no error - but of course no entry in the DBA_JAVA_POLICY.
I wonder, if something in the JAVA-Installation of the server went wrong. But all JAVA objects are vaild.
In the meantime I'll change with the instance to ORACLE 11.2.0.1.0 server as workaround.
|
|
|
|
|
|