[Twisted-Python] More Conch Questions

Robert DiFalco robert.difalco at gmail.com
Sun Nov 29 10:41:26 MST 2020


I'm continuing to wrestle with conch, this time around authentication and
notifying deferred of auth failure.

It seems like the SSH factory has a deferred to be notified of auth
failures here:
https://github.com/twisted/twisted/blob/trunk/src/twisted/conch/client/direct.py#L61-L66

Unfortunately, this deferred is cleared because prior to auth, it
receives this on successful connect:
https://github.com/twisted/twisted/blob/trunk/src/twisted/conch/client/direct.py#L83-L88

As you can see this clears the deferred so it is no longer available to get
an errback. This also prevents the SSHClientTransport from getting a
sendDisconnect.

To try it change the user to something invalid here:
https://gist.github.com/radifalco/5a5cca4bf8d49d5c61113e36f9be7553#file-sftp-py-L328

This will never get a callback to errback.

I guess I would have expected this to get the error but it actually
succeeds with None. As a result there is no deferred to get the auth
failure and my app waits forever for a notification.

There is one ting I *think* I know how to do, add a timeout with a callback
later on the sftpClient deferred. But that seems lame. What I'd like to do
is to get this ConchError as it has the actual reason for the connection
failure.  Thoughts?

https://github.com/twisted/twisted/blob/trunk/src/twisted/conch/client/direct.py#L61-L66
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20201129/549aa4ee/attachment-0001.htm>


More information about the Twisted-Python mailing list