ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r581055 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java
Date Mon, 01 Oct 2007 20:07:17 GMT
Author: jkf
Date: Mon Oct  1 13:07:17 2007
New Revision: 581055

URL: http://svn.apache.org/viewvc?rev=581055&view=rev
Log:
pr 43521, @ in filename not allowed anymore since @ allowed in password.

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java?rev=581055&r1=581054&r2=581055&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java Mon Oct  1
13:07:17 2007
@@ -310,10 +310,21 @@
     }
 
     private String parseUri(String uri) {
-        int indexOfAt = uri.lastIndexOf('@');
+
+        int indexOfAt = uri.indexOf('@');
         int indexOfColon = uri.indexOf(':');
+
         if (indexOfColon > -1 && indexOfColon < indexOfAt) {
             // user:password@host:/path notation
+            // everything upto the last @ before the last : is considered
+            // password. (so if the path contains an @ and a : it will not work)
+            int indexOfCurrentAt = indexOfAt;
+            int indexOfLastColon = uri.lastIndexOf(':');
+            while (indexOfCurrentAt > -1 && indexOfCurrentAt < indexOfLastColon)
+            {
+                indexOfAt = indexOfCurrentAt;
+                indexOfCurrentAt = uri.indexOf('@', indexOfCurrentAt + 1);
+            }
             setUsername(uri.substring(0, indexOfColon));
             setPassword(uri.substring(indexOfColon + 1, indexOfAt));
         } else {



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


Mime
View raw message