agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
[Pljava-dev] One more question today: Permision failure in Backend.java
3+ messages / 0 participants
[nested] [flat]

* [Pljava-dev] One more question today: Permision failure in Backend.java
@ 2008-03-05 18:32 
  2008-03-05 19:06 ` [Pljava-dev] One more question today: Permision failure in Backend.java 
  0 siblings, 1 reply; 3+ messages in thread

From:  @ 2008-03-05 18:32 UTC (permalink / raw)

I'm attempting to open and read a file from within my java application
triggered by postgres.

I'm doing a simple "FileInputStream" command to open the file:
        wsdl = new FileInputStream(wsdlFile);



I see this error:
				ERROR:
org.postgresql.pljava.TriggerException: In Trigger
provisionorder_trigger on relation serviceproviderprovisioned: Failed to
validate WSDL.
				WSDL file =
/var/lib/pgsql/prodeasystems.net/provisionOrders.wsdl

				read on
/var/lib/pgsql/prodeasystems.net/provisionOrders.wsdl
				java.lang.SecurityException: read on
/var/lib/pgsql/prodeasystems.net/provisionOrders.wsdl
				        at
org.postgresql.pljava.internal.Backend$1.assertPermission(Backend.java:1
76)
				        at
org.postgresql.pljava.internal.Backend$PLJavaSecurityManager.nonRecursiv
eCheck(Backend.java:111)
				        at
org.postgresql.pljava.internal.Backend$PLJavaSecurityManager.checkPermis
sion(Backend.java:89)
				        at
java.lang.SecurityManager.checkRead(Unknown Source)
				        at
java.io.FileInputStream.<init>(Unknown Source)
				        at
java.io.FileInputStream.<init>(Unknown Source)
				        at
com.prodeasystems.rsc.prvstester.Provisioning.validateWsdl(Provisioning.
java:544)
				        at
com.prodeasystems.rsc.prvstester.Provisioning.ProvisionOrder2(Provisioni
ng.java:327)


This is the section of code that seems to be sending the error.  If I'm
reading it right, I have to have my DATA file deployed in the
"java.home" directory?  Is that true?  Where is the "java.home" variable
set for pljava/Postgres?  



    154         private static final SecurityManager
s_trustedSecurityManager = new PLJavaSecurityManager()
    155         {
    156                 void assertPermission(Permission perm)
    157                 {
    158                         if(perm instanceof FilePermission)
    159                         {
    160                                 String actions =
perm.getActions();
    161                                 if("read".equals(actions))
    162                                 {
    163                                         // Must be able to read
timezone info etc. in the java
    164                                         // installation
directory.
    165                                         //
    166                                         File javaHome = new
File(System.getProperty("java.home"));
    167                                         File accessedFile = new
File(perm.getName());
    168                                         File fileDir =
accessedFile.getParentFile();
    169                                         while(fileDir != null)
    170                                         {
    171
if(fileDir.equals(javaHome))
    172                                                         return;
    173                                                 fileDir =
fileDir.getParentFile();
    174                                         }
    175                                 }
    176                                 throw new
SecurityException(perm.getActions() + " on " + perm.getName());
    177                         }
    178                         super.assertPermission(perm);
    179                 }
    180         };
    181
Michael

_____________________________________________
From: Mike Toler 
Sent: Wednesday, March 05, 2008 11:03 AM
To: 'pljava-dev at pgfoundry.org'
Subject: ResultSet is read-only error for Trigger?

I'm trying to do a very simple trigger  before moving onto the complex
stuff that I need pljava for.

My Java code is extremely simple:
    public static void ProvisionOrder2(TriggerData td) throws
SQLException {
               
            ResultSet _new = td.getNew();
            _new.updateBoolean("provisioningcomplete",true);
     }

My trigger setup is likewise pretty simple:
		CREATE OR REPLACE FUNCTION provisionorder()
		  RETURNS "trigger" AS
	
'com.prodeasystems.rsc.prvstester.Provisioning.ProvisionOrder2'
		  LANGUAGE 'java' VOLATILE;
		ALTER FUNCTION provisionorder() OWNER TO postgres;

		CREATE TRIGGER provisionorder_trigger
		  AFTER UPDATE
		  ON serviceproviderprovisioned
		  FOR EACH ROW
		  EXECUTE PROCEDURE provisionorder();

When I update my row, I see the following error:
provision=# update serviceproviderprovisioned set
readytoprovision='true' where rhcjid='x';
ERROR:  org.postgresql.pljava.jdbc.UnsupportedFeatureException: Feature
not supported: ResultSet is read-only


The example provided in the users guide
(http://wiki.tada.se/display/pljava/Triggers) implies that the
ResultSets can be manipulated.  Why am I seeing this error?

Michael Toler
System Test Engineer
Prodea Systems, Inc.
214-278-1834 (office)
972-816-7790 (mobile)




This message is confidential to Prodea Systems, Inc unless otherwise indicated 
or apparent from its nature. This message is directed to the intended recipient 
only, who may be readily determined by the sender of this message and its 
contents. If the reader of this message is not the intended recipient, or an 
employee or agent responsible for delivering this message to the intended 
recipient:(a)any dissemination or copying of this message is strictly 
prohibited; and(b)immediately notify the sender by return message and destroy 
any copies of this message in any form(electronic, paper or otherwise) that you 
have.The delivery of this message and its information is neither intended to be 
nor constitutes a disclosure or waiver of any trade secrets, intellectual 
property, attorney work product, or attorney-client communications. The 
authority of the individual sending this message to legally bind Prodea Systems  
is neither apparent nor implied,and must be independently verified.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20080305/54a14aca/attachment.html;



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* [Pljava-dev] One more question today: Permision failure in Backend.java
  2008-03-05 18:32 [Pljava-dev] One more question today: Permision failure in Backend.java 
@ 2008-03-05 19:06 ` 
  2012-10-25 11:42   ` [Pljava-dev] One more question today: Permision failure in Backend.java 
  0 siblings, 1 reply; 3+ messages in thread

From:  @ 2008-03-05 19:06 UTC (permalink / raw)



On Wed, 5 Mar 2008, Mike Toler wrote:

> I'm attempting to open and read a file from within my java application
> triggered by postgres.
>
> I'm doing a simple "FileInputStream" command to open the file:
>        wsdl = new FileInputStream(wsdlFile);
>

Embedded postgresql server languages come in two versions, trusted and 
untrusted.  The "java" language is trusted meaning that it won't let 
normal users escape security permissions setup for them.  For example if 
they could open any file, they could open the database files directly and 
read data they shouldn't have access to.  You probably want the "javaU" 
language which is untrusted.

http://wiki.tada.se/display/pljava/Security
http://www.postgresql.org/docs/8.3/static/plperl-trusted.html

Kris Jurka




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* [Pljava-dev] One more question today: Permision failure in Backend.java
  2008-03-05 18:32 [Pljava-dev] One more question today: Permision failure in Backend.java 
  2008-03-05 19:06 ` [Pljava-dev] One more question today: Permision failure in Backend.java 
@ 2012-10-25 11:42   ` 
  0 siblings, 0 replies; 3+ messages in thread

From:  @ 2012-10-25 11:42 UTC (permalink / raw)

Thank your,

what can i do to use  java correctelly, this because in my  functiob pljava,

i have this erreur:



ERREUR:  java.lang.SecurityException: read on \H:\Program
Files\PostgreSQL\9.0\lib\plEtudiant.jar

********** Erreur **********

ERREUR: java.lang.SecurityException: read on \H:\Program
Files\PostgreSQL\9.0\lib\plEtudiant.jar
?tat SQL :XX000

 
but when i put  javau, it work correctly  but de security is not 





--
View this message in context: http://postgresql.1045698.n5.nabble.com/One-more-question-today-Permision-failure-in-Backend-java-tp...
Sent from the PL/Java mailing list archive at Nabble.com.




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2012-10-25 11:42 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-03-05 18:32 [Pljava-dev] One more question today: Permision failure in Backend.java 
2008-03-05 19:06 ` 
2012-10-25 11:42   ` 

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox