You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2004/03/26 13:32:21 UTC
cvs commit: jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser UnixFTPEntryParserTest.java
scohen 2004/03/26 04:32:21
Modified: net/src/java/org/apache/commons/net/ftp/parser
UnixFTPEntryParser.java
net/src/test/org/apache/commons/net/ftp/parser
UnixFTPEntryParserTest.java
Log:
PR:27858
Obtained from:mario@ops.co.at (Mario Ivankovits)
Submitted by:Steve Cohen
Reviewed by: Steve Cohen
CVS: ----------------------------------------------------------------------
CVS: PR:
CVS: If this change addresses a PR in the problem report tracking
CVS: database, then enter the PR number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system, such as NCSA,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to Apache by someone else; i.e.,
CVS: they sent us a patch or a new module, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.
Revision Changes Path
1.11 +28 -4 jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java
Index: UnixFTPEntryParser.java
===================================================================
RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- UnixFTPEntryParser.java 18 Mar 2004 13:47:02 -0000 1.10
+++ UnixFTPEntryParser.java 26 Mar 2004 12:32:21 -0000 1.11
@@ -40,10 +40,26 @@
/**
* this is the regular expression used by this parser.
+ *
+ * Permissions:
+ * r the file is readable
+ * w the file is writable
+ * x the file is executable
+ * - the indicated permission is not granted
+ * L mandatory locking occurs during access (the set-group-ID bit is
+ * on and the group execution bit is off)
+ * s the set-user-ID or set-group-ID bit is on, and the corresponding
+ * user or group execution bit is also on
+ * S undefined bit-state (the set-user-ID bit is on and the user
+ * execution bit is off)
+ * t the 1000 (octal) bit, or sticky bit, is on [see chmod(1)], and
+ * execution is on
+ * T the 1000 bit is turned on, and execution is off (undefined bit-
+ * state)
*/
private static final String REGEX =
"([bcdlf-])"
- + "(((r|-)(w|-)(x|-))((r|-)(w|-)(x|-))((r|-)(w|-)(x|-)))\\s+"
+ + "(((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-])))\\s+"
+ "(\\d+)\\s+"
+ "(\\S+)\\s+"
+ "(?:(\\S+)\\s+)?"
@@ -126,8 +142,16 @@
(!group(g).equals("-")));
file.setPermission(access, FTPFile.WRITE_PERMISSION,
(!group(g + 1).equals("-")));
- file.setPermission(access, FTPFile.EXECUTE_PERMISSION,
- (!group(g + 2).equals("-")));
+
+ String execPerm = group(g + 2);
+ if (!execPerm.equals("-") && !Character.isUpperCase(execPerm.charAt(0)))
+ {
+ file.setPermission(access, FTPFile.EXECUTE_PERMISSION, true);
+ }
+ else
+ {
+ file.setPermission(access, FTPFile.EXECUTE_PERMISSION, false);
+ }
}
if (!isDevice)
1.9 +6 -2 jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java
Index: UnixFTPEntryParserTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- UnixFTPEntryParserTest.java 29 Feb 2004 10:26:53 -0000 1.8
+++ UnixFTPEntryParserTest.java 26 Mar 2004 12:32:21 -0000 1.9
@@ -23,7 +23,7 @@
/**
* @author <a href="mailto:scohen@apache.org">Steve Cohen</a>
- * @versionn $Id$
+ * @version $Id$
*/
public class UnixFTPEntryParserTest extends FTPParseTestFramework
{
@@ -63,7 +63,11 @@
"-rw-r--r-- 1 500 500 166 Nov 12 2001 73131-testtes2.AFP",
"-rw-r--r-- 1 500 500 2040000 Aug 5 07:35 testRemoteUPCopyNIX",
"-rw-r--r-- 1 500 500 2040000 Aug 5 07:31 testRemoteUPDCopyNIX",
- "-rw-r--r-- 1 500 500 2040000 Aug 5 07:31 testRemoteUPVCopyNIX"
+ "-rw-r--r-- 1 500 500 2040000 Aug 5 07:31 testRemoteUPVCopyNIX",
+ "-rw-r--r-T 1 500 500 0 Mar 25 08:20 testSticky",
+ "-rwxr-xr-t 1 500 500 0 Mar 25 08:21 testStickyExec",
+ "-rwSr-Sr-- 1 500 500 0 Mar 25 08:22 testSuid",
+ "-rwsr-sr-- 1 500 500 0 Mar 25 08:23 testSuidExec"
};
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org