[Pljava-dev] Strange error on linux but not on windows

From: vorarlberger at gmail(dot)com (Vorarlberger)
To:
Subject: [Pljava-dev] Strange error on linux but not on windows
Date: 2011-09-21 17:26:56
Message-ID: CALtUeZZ5VEMHjgs9HTvGZZRrcbSxkdxG2NhHtiZUQ7BFDV9L4g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Hi

Do you define the function as LANGUAGE JAVAU? If that doesn't get
> around the security issue you have found a bug I guess.
>

Yes I did. And in fact I think I found a bug. Check out this small java
code:

package net.sourceforge.pgbsh;

import java.io.*;
import javax.net.ssl.*;

public class Test {
public static boolean testSSL() throws IOException {
int port = 443;
String hostName = "www.sun.com" ;

SSLSocketFactory sslFact = (SSLSocketFactory)
SSLSocketFactory.getDefault ();
SSLSocket socket = (SSLSocket) sslFact.createSocket(hostName, port);
InputStream in = socket . getInputStream ();
OutputStream out = socket . getOutputStream ();

// la la la ...

in.close ();
out.close ();

return true;
}
}

And create the SQL function:
CREATE OR REPLACE FUNCTION test_ssl()
RETURNS boolean
AS 'net.sourceforge.pgbsh.Test.testSSL'
LANGUAGE javau;

Now, when you do this on windows, there is no problem:
postgres=# select test_ssl();
test_ssl
----------
t
(1 Zeile)

postgres=#

But when you do exactly the same on linux, you can not:
postgres=# select test_ssl();
ERROR: java.io.IOException

... I think it depends on the "only root can listen on ports < 1000" thing
...

Cheers
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20110921/45cefb84/attachment.html>

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Vorarlberger 2011-09-24 07:20:59 [Pljava-dev] Strange error on linux but not on windows
Previous Message Johann 'Myrkraverk' Oskarsson 2011-09-20 15:11:28 [Pljava-dev] Strange error on linux but not on windows