[ 
https://issues.apache.org/jira/browse/QPID-1655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675728#action_12675728
 ] 

gemmellr edited comment on QPID-1655 at 2/22/09 4:21 PM:
---------------------------------------------------------------

QPID-1655_22feb2009.patch resolves this, and should be applied after the 
changes relating to QPID-1502


The underlying issue was related to use of createTempFile with a string 
containing an absolute file path. Instead of keeping a string reference to the 
access file, a File reference is now held, and this is use to get only the file 
name instead of the full path when create the temporary file. The file 
permissions are checked during the setAcessFile method now rather than the 
loadAccessFile method.

Additionally, the error went unnoticed as it was not signalled to the calling 
methods. The private saveAccessFile() method now throws any IOExceptions that 
arise during the process instead of silently catching them. The calling methods 
have been modified to catch these and take appropriate action, such as 
reversing any in-memory rights changes by restoring the old rights the user 
held, if any. Additionally, the createUser() method was updated to check that 
the rights are successfully applied, and if they are not it reverts the user 
creation in the principal database before reporting a false result.

The test was updated to test the rights manipulation more fully, including 
checking that the changes are saved to disk.

      was (Author: gemmellr):
    QPID-1655_22feb2009.patch resolves this as follows:

The underlying issue was related to use of createTempFile with a string 
containing an absolute file path. Instead of keeping a string reference to the 
access file, a File reference is now held, and this is use to get only the file 
name instead of the full path when create the temporary file. The file 
permissions are checked during the setAcessFile method now rather than the 
loadAccessFile method.

Additionally, the error went unnoticed as it was not signalled to the calling 
methods. The private saveAccessFile() method now throws any IOExceptions that 
arise during the process instead of silently catching them. The calling methods 
have been modified to catch these and take appropriate action, such as 
reversing any in-memory rights changes by restoring the old rights the user 
held, if any. Additionally, the createUser() method was updated to check that 
the rights are successfully applied, and if they are not it reverts the user 
creation in the principal database before reporting a false result.

The test was updated to test the rights manipulation more fully, including 
checking that the changes are saved to disk.
  
> AMQUserManagementMBean is unable to save the jmx user access rights file, but 
> does not signal this to calling methods
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: QPID-1655
>                 URL: https://issues.apache.org/jira/browse/QPID-1655
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: M4
>            Reporter: Robert Gemmell
>             Fix For: M5
>
>         Attachments: QPID-1655_22feb2009.patch
>
>
> AMQUserManagementMBean is unable to save the jmx user access rights file, 
> however it does not report this to the calling methods and so no error is 
> reported. The changes may appear to take effect because the cached values are 
> updated.
> On line 396 within the saveaccessfile method,  _accessFileName is used as the 
> prefix to create a temporary file, however _accessFileName contains an 
> absolute filesystem path and its use causes an FileNotFound IOException, 
> which the method catches and then does nothing with except output a log 
> message, so the calling methods are unaware the save has failed:
> 2009-02-09 10:23:28,608 WARN  [RMI TCP Connection(4)-127.0.1.1] 
> management.AMQUserManagementMBean (AMQUserManagementMBean.java:413) - Problem 
> occured saving 
> '/home/gemmellr/workspace/eclipse/qpid_trunk/qpid/java/build/etc/jmxremote.access'
>  changes may not be preserved. :java.io.IOException: No such file or directory

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to