[ 
https://issues.apache.org/jira/browse/DERBY-6438?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-6438:
--------------------------------------

    Attachment: d6438-1a.diff

The attached patch d6438-1a.diff adds the following permission to the default 
server policy:

{code}
  // Allow the server to listen to the socket on the port specified with the
  // -p option to "NetworkServerControl start" on the command line, or with
  // the portNumber parameter to the NetworkServerControl constructor in the
  // API, or with the property derby.drda.portNumber. The default is 1527.
  permission java.net.SocketPermission "localhost:${derby.security.port}",
      "listen";
{code}

It also adds some code to NetworkServerControl so that 
{{$\{derby.security.port\}}} gets replaced by the actual port that the network 
server is going to listen on.

This change made it possible to start a network server on any port in my 
environment.

Additionally, the patch states the listen permission explicitly in the test 
policy files. With that change, I was able to run suites.All with 
derby.tests.basePort=1000, which would fail miserably without the patch.

I've also verified that the full regression test suite runs cleanly without the 
derby.tests.basePort property.

> Explicitly grant SocketPermission "listen" in default server policy
> -------------------------------------------------------------------
>
>                 Key: DERBY-6438
>                 URL: https://issues.apache.org/jira/browse/DERBY-6438
>             Project: Derby
>          Issue Type: Improvement
>          Components: Network Server
>    Affects Versions: 10.11.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: d6438-1a.diff
>
>
> The network server needs SocketPermission "listen" on the port that it 
> listens to, but this permission is not granted by the basic server policy 
> that's installed by default. This doesn't cause any problems in most cases, 
> since the JVM's default policy grants all code bases SocketPermission 
> "listen" on a range of ports, and Derby's network server port is within that 
> range.
> Still, the network server should not rely on this fact. It is possible to run 
> the network server on any port, not only those ports that happen be in the 
> range that's given carte blanche by the platform's default policy. The 
> network server will however not be able to run on those ports with the basic 
> policy currently, only with a custom policy or with the security manager 
> disabled.
> The default policy should make this permission explicit.



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to