commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 27858] - UnixFTPEntryParser failed if permissions are other than rwx
Date Wed, 24 Mar 2004 13:00:38 GMT
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


Mime
View raw message