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

User home policy file not read correctly on Win32 with NS4.x browsers

XMLWordPrintable

    • hopper
    • x86
    • windows_xp
    • Verified

      ###@###.### 2002-03-14

      Build used : Plugin PIT02 build
      Date of Build: 2002-03-11
      JRE Version: 1.4.1
      Build location: http://sqesvr/deployment3/hopper/2002-03-11/win32/
      Browser: NS4.x


      On Win32 with NS4.x, couple of test suites are not working
      The reason being that, It throws out Access control Exception
      (see attached trace file)
       
      The same testsuite works fine with Merlin and PIT01 build
      I suspect the fix for Bug 4619757 has caused this side effect.

      Steps:
      ------
      1) Create a .java.policy file in your home directory and add the lines indicated below

        grant {
        permission java.util.PropertyPermission "java.home", "read";
        permission java.io.FilePermission "${java.home}${/}-",
       "read,write,exec
        ute,delete";
        permission java.io.FilePermission "${java.home}\lib\applet",
       "read";
        };


      2) copy hostile.jar from http://sqesvr/deployment2/vmanda/ATF/lib/hostile.jar
         to <jre>/lib/applet
      3) ensure this jar has 'rwx' permissions for all.
      4) Bring up Command window, and go to C: (local hard disk drive)
      5) Launch browser (IE/NS) with absolute path
         (c:\progra~1\Netscape\Communicator\Program\netscape.exe)
      6) Load URL
      http://sqesvr.sfbay.sun.com/deployment2/vmanda/ATF/javascripts/functional/Applet
      Security.html

      7) The Test Passes (no exceptions). Great just as expected.


      To reproduce the problem
      ------------------------
      8) Now Map some network directory to a different drive. (we exported
      /net/sqesvr/deployment2)
      9) Repeat steps 3-6.
       
      This time however we see the AccessControlException thrown indicating
      no permissions to read \<jre loc\lib\applet\hostile.jar not being able
      to read.
       
      Not clear why the bug should show up this time
      (For src of the applet itself, go to /home/vmanda/fwtests/src/cmd/tests/non-visual-noalc/AppletSecurity/www )
      The applet read the class from hostile.jar and tries to create a dir 'abc'.
      If it could create, the test FAILS.
      If it could not then test is flagged as PASS.


      Now a workaround
      -----------------
      10) Now view file <jre>/lib/security/java.security
      11) change line
      policy.url.2=file://${user.home}/.java.policy
      to

      policy.url.2=file:///${user.home}/.java.policy
      or to
      policy.url.2=file:/${user.home}/.java.policy


      11) Rerun steps 8-9
      This time however the test does PASS.




      just another observation
      ------------------------


      With the default supplied java.security file,
      if from the mapped drive, I execute the netscape lnk (drap netscape icon from
      desktop to command window), the test works fine
      and if I used absolute netscape path, then it fails

      Example
      If I use
      y:>"c:\Document and Settings\Administrator\Desktop\Netscape4.72.lnk"
      the test loads fine

      If I use
      y:>c:\progra~1\Netscape\Communicator\Program\netscape.exe
      the test fails with hostile.jar read exception.


      If I do change java.security file to have 3 or single slashe, then both the above pass.


      ###@###.### 2002-03-14

      Attached is the trace file with -Djava.security.debug=policy

      Clearly it states that it could not read the Java Policy file


      Java(TM) Plug-in: Version 1.4.1
      Using JRE version 1.4.1-internal Java HotSpot(TM) Client VM
      User home directory = C:\Documents and Settings\Administrator
      Proxy Configuration: Manual Configuration
           Proxy: http=wcscaa.sfbay.sun.com:8080,ftp=wcscaa.sfbay.sun.com:8080,gopher=wc
      scaa.sfbay.sun.com:8080
           Proxy Overrides: *sfbay.sun.com,*10.5.26.48:8080,*10.5.26.48,*kittest.sfbay.s
      un.com,*kittest.sfbay.sun.com:8080


      ----------------------------------------------------
      c: clear console window
      f: finalize objects on finalization queue
      g: garbage collect
      h: display this help message
      l: dump classloader list
      m: print memory usage
      o: trigger logging
      p: reload proxy configuration
      q: hide console
      r: reload policy configuration
      s: dump system properties
      t: dump thread list
      v: dump thread stack
      x: clear classloader cache
      0-5: set trace level to <n>
      ----------------------------------------------------
      policy: reading file:C:/PROGRA~1/Java/J2RE14~1.1/lib/security/java.policy
      policy: Adding policy entry:
      policy: signedBy null
      policy: codeBase file:C:/PROGRA~1/Java/J2RE14~1.1/lib/ext/*
      policy: (java.security.AllPermission <all permissions> <all actions>)
      policy:
      policy: Adding policy entry:
      policy: signedBy null
      policy: codeBase null
      policy: (java.lang.RuntimePermission stopThread)
      policy: (java.net.SocketPermission localhost:1024- listen,resolve)
      policy: (java.util.PropertyPermission java.version read)
      policy: (java.util.PropertyPermission java.vendor read)
      policy: (java.util.PropertyPermission java.vendor.url read)
      policy: (java.util.PropertyPermission java.class.version read)
      policy: (java.util.PropertyPermission os.name read)
      policy: (java.util.PropertyPermission os.version read)
      policy: (java.util.PropertyPermission os.arch read)
      policy: (java.util.PropertyPermission file.separator read)
      policy: (java.util.PropertyPermission path.separator read)
      policy: (java.util.PropertyPermission line.separator read)
      policy: (java.util.PropertyPermission java.specification.version read)
      policy: (java.util.PropertyPermission java.specification.vendor read)
      policy: (java.util.PropertyPermission java.specification.name read)
      policy: (java.util.PropertyPermission java.vm.specification.version read)
      policy: (java.util.PropertyPermission java.vm.specification.vendor read)
      policy: (java.util.PropertyPermission java.vm.specification.name read)
      policy: (java.util.PropertyPermission java.vm.version read)

      policy: (java.util.PropertyPermission java.vm.vendor read)
      policy: (java.util.PropertyPermission java.vm.name read)
      policy:
      policy: reading file://C:/Documents and Settings/Administrator/.java.policy
      policy: error parsing file://C:/Documents and Settings/Administrator/.java.policy
      policy: java.io.FileNotFoundException: \Documents and Settings\Administrator\.java
      .policy (The system cannot find the path specified)
      java.io.FileNotFoundException: \Documents and Settings\Administrator\.java.policy
      (The system cannot find the path specified)
              at java.io.FileInputStream.open(Native Method)
              at java.io.FileInputStream.<init>(Unknown Source)
              at java.io.FileInputStream.<init>(Unknown Source)
              at sun.security.provider.PolicyFile.getInputStream(Unknown Source)
              at sun.security.provider.PolicyFile.init(Unknown Source)
              at sun.security.provider.PolicyFile.access$300(Unknown Source)
              at sun.security.provider.PolicyFile$1.run(Unknown Source)
              at java.security.AccessController.doPrivileged(Native Method)
              at sun.security.provider.PolicyFile.initPolicyFile(Unknown Source)
              at sun.security.provider.PolicyFile.initPolicyFile(Unknown Source)
              at sun.security.provider.PolicyFile.init(Unknown Source)
              at sun.security.provider.PolicyFile.<init>(Unknown Source)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sourc
      e)
              at java.lang.reflect.Constructor.newInstance(Unknown Source)
              at java.lang.Class.newInstance0(Unknown Source)
              at java.lang.Class.newInstance(Unknown Source)
              at java.security.Policy.getPolicyNoCheck(Unknown Source)
              at java.security.Policy.getPolicy(Unknown Source)
              at sun.applet.AppletPanel$4.run(Unknown Source)
              at java.security.AccessController.doPrivileged(Native Method)
              at sun.applet.AppletPanel.getAccessControlContext(Unknown Source)
              at sun.applet.AppletPanel.getClassLoader(Unknown Source)
              at sun.applet.AppletPanel.createAppletThread(Unknown Source)
              at sun.applet.AppletPanel.init(Unknown Source)
              at sun.plugin.AppletViewer.appletInit(Unknown Source)
              at sun.plugin.viewer.LifeCycleManager.initAppletPanel(Unknown Source)
              at sun.plugin.viewer.WNetscapePluginObject$Initer.run(Unknown Source)
      policy: evaluate codesources:
              Policy CodeSource: (file:/C:/Program%20Files/Java/j2re1.4.1/lib/ext/* <no
      certificates>)
              Active CodeSource: (null <no certificates>)
      policy: evaluation (codesource) failed
      policy: evaluate codesources:
              Policy CodeSource: (null <no certificates>)
              Active CodeSource: (null <no certificates>)
      policy: evaluate principals:
              Policy Principals: []
              Active Principals: []
      policy: evaluation (codesource/principals) passed
      policy: granting (java.lang.RuntimePermission stopThread)
      policy: granting (java.net.SocketPermission localhost:1024- listen,resolve)
      policy: granting (java.util.PropertyPermission java.version read)
      policy: granting (java.util.PropertyPermission java.vendor read)
      policy: granting (java.util.PropertyPermission java.vendor.url read)
      policy: granting (java.util.PropertyPermission java.class.version read)
      policy: granting (java.util.PropertyPermission os.name read)
      policy: granting (java.util.PropertyPermission os.version read)
      policy: granting (java.util.PropertyPermission os.arch read)
      policy: granting (java.util.PropertyPermission file.separator read)
      policy: granting (java.util.PropertyPermission path.separator read)
      policy: granting (java.util.PropertyPermission line.separator read)
      policy: granting (java.util.PropertyPermission java.specification.version read)
      policy: granting (java.util.PropertyPermission java.specification.vendor read)
      policy: granting (java.util.PropertyPermission java.specification.name read)
      policy: granting (java.util.PropertyPermission java.vm.specification.version rea
      d)
      policy: granting (java.util.PropertyPermission java.vm.specification.vendor read
      )
      policy: granting (java.util.PropertyPermission java.vm.specification.name read)
      policy: granting (java.util.PropertyPermission java.vm.version read)
      policy: granting (java.util.PropertyPermission java.vm.vendor read)
      policy: granting (java.util.PropertyPermission java.vm.name read)
      policy: evaluate codesources:
              Policy CodeSource: (file:/C:/Program%20Files/Java/j2re1.4.1/lib/ext/* <no
      certificates>)
              Active CodeSource: (http://javaweb.sfbay.sun.com/~vmanda/fwtests/src/cmd/t
      ests/non-visual/AppletSecurity/www/ <no certificates>)
      policy: evaluation (codesource) failed
      policy: evaluate codesources:
              Policy CodeSource: (null <no certificates>)
              Active CodeSource: (http://javaweb.sfbay.sun.com/~vmanda/fwtests/src/cmd/t
      ests/non-visual/AppletSecurity/www/ <no certificates>)
      policy: evaluate principals:
              Policy Principals: []
              Active Principals: []
      policy: evaluation (codesource/principals) passed
      policy: granting (java.lang.RuntimePermission stopThread)
      policy: granting (java.net.SocketPermission localhost:1024- listen,resolve)
      policy: granting (java.util.PropertyPermission java.version read)
      policy: granting (java.util.PropertyPermission java.vendor read)
      policy: granting (java.util.PropertyPermission java.vendor.url read)
      policy: granting (java.util.PropertyPermission java.class.version read)
      policy: granting (java.util.PropertyPermission os.name read)
      policy: granting (java.util.PropertyPermission os.version read)
      policy: granting (java.util.PropertyPermission os.arch read)
      policy: granting (java.util.PropertyPermission file.separator read)
      policy: granting (java.util.PropertyPermission path.separator read)
      policy: granting (java.util.PropertyPermission line.separator read)
      policy: granting (java.util.PropertyPermission java.specification.version read)
      policy: granting (java.util.PropertyPermission java.specification.vendor read)
      policy: granting (java.util.PropertyPermission java.specification.name read)
      policy: granting (java.util.PropertyPermission java.vm.specification.version rea
      d)
      policy: granting (java.util.PropertyPermission java.vm.specification.vendor read
      )
      policy: granting (java.util.PropertyPermission java.vm.specification.name read)
      policy: granting (java.util.PropertyPermission java.vm.version read)
      policy: granting (java.util.PropertyPermission java.vm.vendor read)
      policy: granting (java.util.PropertyPermission java.vm.name read)
      java.security.AccessControlException: access denied (java.io.FilePermission \C:\PR
      OGRA~1\Java\J2RE14~1.1\lib\applet\hostile.jar read)
              at java.security.AccessControlContext.checkPermission(Unknown Source)
              at java.security.AccessController.checkPermission(Unknown Source)
              at java.lang.SecurityManager.checkPermission(Unknown Source)
              at java.net.URLClassLoader$5.run(Unknown Source)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.net.URLClassLoader.getPermissions(Unknown Source)
              at sun.applet.AppletClassLoader.getPermissions(Unknown Source)
              at sun.plugin.security.PluginClassLoader.getPermissions(Unknown Source)
              at java.security.SecureClassLoader.getProtectionDomain(Unknown Source)
              at java.security.SecureClassLoader.defineClass(Unknown Source)
              at java.net.URLClassLoader.defineClass(Unknown Source)
              at java.net.URLClassLoader.access$100(Unknown Source)
              at java.net.URLClassLoader$1.run(Unknown Source)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.net.URLClassLoader.findClass(Unknown Source)
              at sun.applet.AppletClassLoader.findClass(Unknown Source)
              at sun.plugin.security.PluginClassLoader.findClass(Unknown Source)
              at java.lang.ClassLoader.loadClass(Unknown Source)
              at sun.applet.AppletClassLoader.loadClass(Unknown Source)
              at java.lang.ClassLoader.loadClass(Unknown Source)
              at java.lang.ClassLoader.loadClassInternal(Unknown Source)
              at java.lang.ClassLoader.defineClass0(Native Method)
              at java.lang.ClassLoader.defineClass(Unknown Source)
              at java.security.SecureClassLoader.defineClass(Unknown Source)
              at sun.applet.AppletClassLoader.findClass(Unknown Source)
              at sun.plugin.security.PluginClassLoader.findClass(Unknown Source)
              at java.lang.ClassLoader.loadClass(Unknown Source)
              at sun.applet.AppletClassLoader.loadClass(Unknown Source)
              at java.lang.ClassLoader.loadClass(Unknown Source)
              at sun.applet.AppletClassLoader.loadCode(Unknown Source)
              at sun.applet.AppletPanel.createApplet(Unknown Source)
              at sun.plugin.AppletViewer.createApplet(Unknown Source)
              at sun.applet.AppletPanel.runLoader(Unknown Source)
              at sun.applet.AppletPanel.run(Unknown Source)
              at java.lang.Thread.run(Unknown Source)


            claisunw Charlie Lai (Inactive)
            rpallathsunw Rajendra Pallath (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: