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