Subject: Re: [libssh2] userauth_keyboard_interactive problem

Re: [libssh2] userauth_keyboard_interactive problem

From: Dan Fandrich <>
Date: Fri, 14 Dec 2007 23:21:54 -0800

On Fri, Dec 14, 2007 at 11:51:47PM -0500, Paul Thomas wrote:
> For instance, let's say we have two threads that contain a C++ class
> that have the libssh2 library wrapped up. Because of the C callback
> function that's rquired, the C++ class must hold a static function
> that has the password. Since static functions can only access static
> data, the password must be stored in a static variable. Remember,
> static variables only have one instance among multiple instances of
> the same class. So those two threads will each change the static
> password variable and if the first thread changes it, the 2nd thread
> changes it and then the 1st thread tries to login, the 1st thread now
> tries to login with the 2nd thread's password. So if I use C++ then
> there's no way that I can use the libssh2 library with keyboard
> interactive authentication with threads.

You could store an array of functors for objects using libssh2 in
a static variable, then choose one of those from your static callback
function based on the libssh2 session ID that's passed in to the callback.

>>> Dan

--              The web change of address service
          Let webmasters know that your web site has moved
SF.Net email is sponsored by:
Check out the new Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.;164216239;13503038;w?
libssh2-devel mailing list
Received on 2007-12-15