Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4952034

some rmi methods throw unspecified Security exceptions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 5.0
    • core-libs
    • sparc
    • solaris_2.6



      Name: szR10253 Date: 11/11/2003


      Filed By : SPB JCK team (###@###.###)
      JDK : java full version "1.5.0-beta-b26"
      JCK : 1.5
      Platform[s] : Solaris
      switch/Mode :
      JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
      Failing Test [s] : N/A


      Problem description
      ===================
      Some methods, namely:
      java.rmi.Naming.bind(String name, Remote obj)
      java.rmi.Naming.list(String name)
      java.rmi.Naming.lookup(String name)
      java.rmi.registry.LocateRegistry.createRegistry(int port)
      java.rmi.registry.LocateRegistry.createRegistry(int port,
                            RMIClientSocketFactory csf,
                            RMIServerSocketFactory ssf)
      java.rmi.server.UnicastRemoteObject.exportObject(Remote obj, int port)

      throw unspecified security exceptions if the user code does not have
      permission to connect to localhost. By spec these methods should throw only RemoteException.
      The spec should specify what permissions are needed to these methods or the connections should be made inside doPrivileged blocks.


          
      Minimized test:
      ===============
      ------- Test.java -------
      import java.rmi.registry.LocateRegistry;

      public class Test {

          public static void main(String[] args) {
              try {
                  LocateRegistry.createRegistry(0);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }

      ------- end-of-Test.java -------

      Minimized test output:
      ======================
      java.security.AccessControlException: access denied (java.net.SocketPermission localhost:1024- listen,resolve)
          at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
          at java.security.AccessController.checkPermission(AccessController.java:401)
          at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
          at java.lang.SecurityManager.checkListen(SecurityManager.java:1110)
          at java.net.ServerSocket.bind(ServerSocket.java:373)
          at java.net.ServerSocket.<init>(ServerSocket.java:240)
          at java.net.ServerSocket.<init>(ServerSocket.java:152)
          at sun.rmi.transport.proxy.RMIDirectSocketFactory.createServerSocket(RMIDirectSocketFactory.java:27)
          at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(RMIMasterSocketFactory.java:333)
          at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:622)
          at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:231)
          at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:178)
          at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:382)
          at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:116)
          at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:180)
          at sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:92)
          at sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:78)
          at java.rmi.registry.LocateRegistry.createRegistry(LocateRegistry.java:186)
          at Test3.main(Test.java:7)


      JCK test source location:
      ==========================
      /java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests

      How to reproduce:
      =================
      java -Djava.security.manager Test

      Additional comments:
      ====================
      To run this example, please, remove the following permission from the the default policy file (${java.home}/jre/lib/security/java.policy):

      permission java.net.SocketPermission "localhost:1024-", "listen";


      ======================================================================

      Name: szR10253 Date: 11/11/2003

      I've used the following java.policy file to reproduce the bug:
      --------------- java.policy -------------
      // Standard extensions get all permissions by default

      grant codeBase "file:${java.home}/*" {
              permission java.security.AllPermission;
      };

      // default permissions granted to all domains

      grant {
      };
      -----------------------------------------


      ======================================================================

            peterjones Peter Jones (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: