Description
When executing an sftp request with the multi interface, it doesn't seem to complete if the request fails due to an authentication error. It seems easy enough to reproduce with the hiperfifo example. After starting hiperfifo, I send the url "sftp://s@localhost/var/l", which results in the following output:
Creating named pipe "hiper.fifo"
Now, pipe some URL's into > hiper.fifo
Adding easy 0x7fe5a9807800 to multi 0x7fe5a9405350 (sftp://s@localhost/var/l)
multi_timer_cb: Setting timeout to 1 ms
- Trying 127.0.0.1...
Progress: sftp://s@localhost/var/l (0/0)
Progress: sftp://s@localhost/var/l (0/0)
socket callback: s=7 e=0x7fe5a9807800 what=OUT Adding data: OUT
multi_timer_cb: Setting timeout to 1 ms
REMAINING: 1- Connected to localhost (127.0.0.1) port 22 (#0)
Progress: sftp://s@localhost/var/l (0/0)
Progress: sftp://s@localhost/var/l (0/0)
socket callback: s=7 e=0x7fe5a9807800 what=IN Changing action from OUT to IN
REMAINING: 1
multi_timer_cb: Setting timeout to 1 ms
REMAINING: 1
Progress: sftp://s@localhost/var/l (0/0)
multi_timer_cb: Setting timeout to 198 ms
REMAINING: 1
Progress: sftp://s@localhost/var/l (0/0)
REMAINING: 1
Progress: sftp://s@localhost/var/l (0/0)
REMAINING: 1
Progress: sftp://s@localhost/var/l (0/0)
REMAINING: 1- SSH MD5 fingerprint: 89dcc2863281ded6467103a7a3d69ba1
Progress: sftp://s@localhost/var/l (0/0)
REMAINING: 1- SSH authentication methods available: publickey,keyboard-interactive
- Using SSH public key file '(nil)'
- Using SSH private key file '/Users/stack/.ssh/id_rsa'
Progress: sftp://s@localhost/var/l (0/0)
REMAINING: 1- SSH public key authentication failed: Username/PublicKey combination invalid
Progress: sftp://s@localhost/var/l (0/0)
socket callback: s=7 e=0x7fe5a9807800 what=REMOVE
REMAINING: 1- No identity would match
Progress: sftp://s@localhost/var/l (0/0)
REMAINING: 1
^C
Note that the last message is "No identity would match", but the REMAINING count is still one. So, the request is still active. Compare this to the output of curl against the same url:
- Trying 127.0.0.1...
- Connected to localhost (127.0.0.1) port 22 (#0)
- SSH MD5 fingerprint: 89dcc2863281ded6467103a7a3d69ba1
- SSH host check: 0, key: AAAAB3NzaC1yc2EAAAABIwAAAQEAs19QFrigpKqUboN8oDhfhqIfZZoqB0Kk9fene3zqivp7bdYwRNV4y6BcEt5vEL42zw0Mo2goMn18luPxSEWg+e7VdBaRL/qrYK6PYevCzvKkqr83zorUq1zeOJNSY+dURCZbR6wIH32Ksf1iiok5EiUXTzdYDnyohGbk1QXGrAVrMqDfrAI0e3L1Y3O55ePHicz38cZtAdj9Zkl4rOn9Ok/4gbLQ4FUtQnqzEAbHNXlWgeDmM1URdc+b6i7F2wbaeHCkbsRLikjWIx5OH8MrAtplRwV6nNd2iXWE5CIOxUXPt8Tt084HeggIdQrkUePTRhtO0IZY35wdkOEZELEYrQ==
- SSH authentication methods available: publickey,keyboard-interactive
- Using SSH public key file '(nil)'
- Using SSH private key file '/Users/stack/.ssh/id_rsa'
- SSH public key authentication failed: Username/PublicKey combination invalid
- No identity would match
- Authentication failure
- Closing connection 0
curl: (67) Authentication failure
Note the "Authentication failure" message that shows up here, but not in multi mode. So, it seems like the final state transition is not happening. It also looks like the problem does not occur in all multi-mode interfaces, it might just be when using curl_multi_socket_action(). I tried to write a test program that used curl_multi_wait()/curl_multi_perform() and that seemed to work.
Activity
SSH: three state machine fixups