Hi, I'm writing a c++ wrapper around ssh for KDE, mainly for use in a sftp client. My problem is when starting ssh with the sftp subsystem openssh gives no indication that password authentication succeeded. This makes it difficult for my wrapper to determine if the connection succeeded. Now determining it didn't succeed can be done by checking for another password prompt. The problem with this is password verification could take time (correct?). So if I send the password then immediately do a read from the terminal, there is no guarantee I'll get the second password prompt if the password was incorrect, right? I could wait a couple of seconds and if I don't get another password prompt assume authentication succeeded, but this is a bad solution. Are there any other techniques I could employ? thanks, Lucas
On Sat, 11 Aug 2001, Lucas Fisher wrote:> Hi, > I'm writing a c++ wrapper around ssh for KDE, mainly for use in a sftp > client. My problem is when starting ssh with the sftp subsystem openssh > gives no indication that password authentication succeeded. This makes it > difficult for my wrapper to determine if the connection succeeded. Now > determining it didn't succeed can be done by checking for another password > prompt. The problem with this is password verification could take time > (correct?). So if I send the password then immediately do a read from the > terminal, there is no guarantee I'll get the second password prompt > if the password was incorrect, right? I could wait a couple > of seconds and if I don't get another password prompt assume > authentication succeeded, but this is a bad solution. Are there any > other techniques I could employ?You could select() with a timeout. Better still you could write a native GUI sftp client using the routines in sftp-client.[ch]. -d -- | Damien Miller <djm at mindrot.org> \ ``E-mail attachments are the poor man's | http://www.mindrot.org / distributed filesystem'' - Dan Geer
Of course I realize right after I sent the last message that I could use the -v option to increase the verbosity and parse that information. Lucas
i think the commercial ssh.com ssh client has a special option that makes ssh print out a string when authentication is successful. On Sat, Aug 11, 2001 at 01:29:32AM -0500, Lucas Fisher wrote:> Hi, > I'm writing a c++ wrapper around ssh for KDE, mainly for use in a sftp > client. My problem is when starting ssh with the sftp subsystem openssh > gives no indication that password authentication succeeded. This makes it > difficult for my wrapper to determine if the connection succeeded. Now > determining it didn't succeed can be done by checking for another password > prompt. The problem with this is password verification could take time > (correct?). So if I send the password then immediately do a read from the > terminal, there is no guarantee I'll get the second password prompt if the > password was incorrect, right? I could wait a couple of seconds and if I > don't get another password prompt assume authentication succeeded, but this > is a bad solution. Are there any other techniques I could employ? > > thanks, > Lucas