[
https://issues.apache.org/jira/browse/JSPWIKI-833?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Harry Metske resolved JSPWIKI-833.
----------------------------------
Resolution: Fixed
Fixed in 2.10.1-svn-12.
Next time Dietrich, can you provide patch files ?
Thanks,
Harry
> temp policy file is created with wrong content
> ----------------------------------------------
>
> Key: JSPWIKI-833
> URL: https://issues.apache.org/jira/browse/JSPWIKI-833
> Project: JSPWiki
> Issue Type: Bug
> Components: Authentication & Authorization
> Affects Versions: 2.10
> Environment: JSPWiki v2.10.0 and Tomcat 7.0.43 under Windows Server
> 2008 R2
> Reporter: Dietrich Schmidt
> Fix For: 2.10.1
>
> Attachments: jspwiki-custom.policy, tempjspwiki-custom.policy
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> 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);
> }
--
This message was sent by Atlassian JIRA
(v6.2#6252)