Assuming the getpass is the one the from the std lib, I don't see why you're overriding getPassword at all.<br><br>according to the API docs, you should be able to get a custom prompt just by adding a prompt parameter:<br>
<a href="http://twistedmatrix.com/documents/8.1.0/api/twisted.conch.ssh.userauth.SSHUserAuthClient.html#getPassword">http://twistedmatrix.com/documents/8.1.0/api/twisted.conch.ssh.userauth.SSHUserAuthClient.html#getPassword</a><br>
<br>and you probably don't want to call succeed() on the deferred you are returning, since that likely screws up the whole auth calback chain<br><br>if you were looking at this example: <a href="http://www.devshed.com/c/a/Python/SSH-with-Twisted/4/">http://www.devshed.com/c/a/Python/SSH-with-Twisted/4/</a><br>
realize that it might be misleading, as the author overrides the __init__ of his SSHUserAuthClient and passes the password in directly<br>(he does not prompt the user for it)<br><br>...or I could be misunderstanding the way the module works... :)<br>
<br>Good Luck!<br><br>Kevin Horn<br><br><div class="gmail_quote">On Tue, Oct 28, 2008 at 2:36 PM, Andy Fundinger <span dir="ltr"><<a href="mailto:Andy@newworldelectric.com">Andy@newworldelectric.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">For the password problem, I think what you want to do is raise an<br>
exception, which will in turn cause your defereds to call their error<br>
backs. In the error back you can handle the particular error however<br>
you need to. That's probably something you need to either setup in<br>
the getpass module, alternatively, that may be setup already and just<br>
waiting for you to addErrback() on it.<br>
<br>
- Andy Fundinger<br>
<div class="Ih2E3d"><br>
On Tue, Oct 28, 2008 at 11:19 AM, Jean-Paul Calderone<br>
<<a href="mailto:exarkun@divmod.com">exarkun@divmod.com</a>> wrote:<br>
> On Tue, 28 Oct 2008 10:42:49 -0400 (EDT), Brian Levin <<a href="mailto:b.levin@hvcc.edu">b.levin@hvcc.edu</a>><br>
> wrote:<br>
>><br>
>> I apologizes if these are simple questions. I am a complete newb when it<br>
>> comes to python and twisted. I am trying to pass a command via ssh to a<br>
>> server. I am having 2 problems. I am hoping that someone can help me. I<br>
>> have been unable to find answers in "the google".<br>
>><br>
</div><div class="Ih2E3d">>> Problem 2: A bad password or username causes and infinite loop. I need<br>
>> to find a way to cause an error or return a false value when the password or<br>
>> username is bad.<br>
><br>
> I'm not sure about this one.<br>
><br>
> Jean-Paul<br>
><br>
> _______________________________________________<br>
> Twisted-Python mailing list<br>
> <a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
> <a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
><br>
<br>
<br>
<br>
</div><font color="#888888">--<br>
Blog: <a href="http://channel3b.wordpress.com" target="_blank">http://channel3b.wordpress.com</a><br>
Second Life Name: Ciemaar Flintoff<br>
<br>
Watch out for the invisible man.<br>
</font><div><div></div><div class="Wj3C7c"><br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</div></div></blockquote></div><br>