ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson, Rob (Global Trade)" <Rob.Ander...@nike.com>
Subject RE: Multiple <sshexec> invocations
Date Tue, 16 Aug 2005 18:13:32 GMT
I have logged a bug for this issue and attached a patch...

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

Committers: Please review the proposed fix and commit the change if you approve.

Thanks,

-Rob Anderson


> -----Original Message-----
> From: Anderson, Rob (Global Trade) 
> Sent: Tuesday, August 16, 2005 10:47 AM
> To: dev@ant.apache.org
> Cc: user@ant.apache.org; ymnk@jcraft.com
> Subject: RE: Multiple <sshexec> invocations
> 
> 
> That patch does not seem to work. setPassword() is only 
> called once when connecting to the same host again. I have 
> made the following change to fix this issue.
> 
> $ diff -p SSHUserInfo.java.orig SSHUserInfo.java
> *** SSHUserInfo.java.orig       Thu Jun  2 15:20:06 2005
> --- SSHUserInfo.java    Tue Aug 16 10:37:11 2005
> *************** public class SSHUserInfo implements User
> *** 152,162 ****
>   
>       public boolean promptPassword(String passwordPrompt) {
>           //log(passwordPrompt, Project.MSG_DEBUG);
> !         if (firstTime) {
> !             firstTime = false;
> !             return true;
> !         }
> !         return firstTime;
>       }
>   
>       public boolean promptYesNo(String message) {
> --- 152,158 ----
>   
>       public boolean promptPassword(String passwordPrompt) {
>           //log(passwordPrompt, Project.MSG_DEBUG);
> !               return true;
>       }
>   
>       public boolean promptYesNo(String message) {
> 
> This bassically negates the need for the firstTime variable. 
> Is that OK? I don't remember what that variable and the code 
> in promptPassword was for anyway.
> 
> There is a new issue that comes to light, once again. See the 
> output below...
> 
> Buildfile: ssh_twice_build.xml
> 
> linux:
>   [sshexec] Connecting to localhost:22
>   [sshexec] Hello from localhost
> 
> linux:
>   [sshexec] Connecting to localhost:22
> 
> BUILD SUCCESSFUL
> Total time: 8 seconds
> 
> The first time the target is run, the output is printed to 
> the console. The second time, it is not. There has been 
> discussion about this bug in the past, but no resolution. I 
> tried to look into it, but found myself in over my head.
> 
> 
> 
> > -----Original Message-----
> > From: ymnk@jcraft.com [mailto:ymnk@jcraft.com]
> > Sent: Monday, August 15, 2005 9:28 PM
> > To: Anderson, Rob (Global Trade)
> > Cc: user@ant.apache.org
> > Subject: Re: Multiple <sshexec> invocations
> > 
> > 
> > Hi,
> > 
> >    +-From: "Anderson, Rob (Global Trade)" <Rob.Anderson@nike.com> --
> >    |_Date: Mon, 15 Aug 2005 11:53:12 -0700 _________________________
> >    |
> >    |Try the same tests with jsch 0.1.16. What are the results? I
> >    |believe these are problems with Jsch.  -Rob Anderson
> >    ...
> >    |> BUILD FAILED
> >    |> P:\com_lgc\cycle11\infrasdk\build.xml:22:
> >    |> com.jcraft.jsch.JSchException:
> >    |> Auth cancel
> >    ...
> > 
> > I think this problem has come from following lines in
> >   org/apache/tools/ant/taskdefs/optional/ssh/SSHUserInfo.java
> > 
> > >public boolean promptPassword(String passwordPrompt) {
> > >  //log(passwordPrompt, Project.MSG_DEBUG);
> > >  if (firstTime) {
> > >    firstTime = false;
> > >     return true;
> > >   }
> > >   return firstTime;
> > >}
> > 
> > I mean that this method will always return 'false' in the 
> second time.
> > 
> > Here is a quick hack to work around this problem.
> > May I ask somebody to test this patch?
> > 
> > diff -Naur ssh/SSHUserInfo.java ssh.new/SSHUserInfo.java
> > --- ssh/SSHUserInfo.java        2005-07-08 13:39:23.000000000 +0000
> > +++ ssh.new/SSHUserInfo.java    2005-08-16 04:10:40.000000000 +0000
> > @@ -112,6 +112,7 @@
> >       * @param password The password to set
> >       */
> >      public void setPassword(String password) {
> > +        firstTime = true;
> >          this.password = password;
> >      }
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 


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


Mime
View raw message