Uploaded image for project: 'JSPWiki'
  1. JSPWiki
  2. JSPWIKI-833

temp policy file is created with wrong content

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.10
    • 2.10.1
    • None
    • JSPWiki v2.10.0 and Tomcat 7.0.43 under Windows Server 2008 R2

    Description

      After adding this line
      jspwiki.policy.file=jspwiki-custom.policy
      to jspwiki-custom.properties I experienced strange problems.

      Thus I checked the log file and found two lines about creating a temp policy file. I located this temp policy file in the tomcat temp directory and found, that
      it was too long and filled with bytes, which appeared earlier in the file.

      I have appended the temp file and the original jspwiki-custom.policy.

      So I debugged jspwiki (/tags/jspwiki_2_10_0) and found this code in
      AuthenticationManager.java, line 647

      byte[] buff = new byte[1024];
      while( is.read(buff) != -1 )

      { os.write(buff); }

      which is wrong, as it always writes 1024 bytes, even at the end of the file.

      Thus I am suggesting this alternative:

      byte[] buff = new byte[1024];
      int bytes = 0;
      while( (bytes = is.read(buff)) != -1 )

      { os.write(buff, 0, bytes); }

      Attachments

        1. tempjspwiki-custom.policy
          2 kB
          Dietrich Schmidt
        2. jspwiki-custom.policy
          2 kB
          Dietrich Schmidt

        Activity

          People

            Unassigned Unassigned
            Deteros Dietrich Schmidt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified