You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/03/24 14:00:38 UTC

DO NOT REPLY [Bug 27858] - UnixFTPEntryParser failed if permissions are other than rwx

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27858>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27858

UnixFTPEntryParser failed if permissions are other than rwx





------- Additional Comments From scohen@apache.org  2004-03-24 13:00 -------
Good catch, Mr.  Ivankovits! 
 
   for (int access = 0; access < 3; access++, g += 4) 
            { 
                // Use != '-' to avoid having to check for suid and sticky bits 
                file.setPermission(access, FTPFile.READ_PERMISSION, 
                                   (!group(g).equals("-"))); 
                file.setPermission(access, FTPFile.WRITE_PERMISSION, 
                                   (!group(g + 1).equals("-"))); 
                file.setPermission(access, FTPFile.EXECUTE_PERMISSION, 
                                   (!group(g + 2).equals("-"))); 
            } 
 
As you can see by the above code snippet from UnixFTPEntryParser the ignoring of suid and 
sticky bits is by design.  However, you are correct that the regex must handle these or the 
entry will fail to parse.  While this will not cause a NullPointerException, the parsing engine will 
remove the unparsed entry from the listing and that's not good.  Fixing the regex will prevent 
this from happening.  And since the current code checks for inequality to "-" no special 
mappings are needed. 
 
So I would say the patch should be the following: 
1) fix the regex as you have indicated 
2) add lines to the JUnit test for this class testing the new functionality.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org