Subject: Re: [libssh2] userauth_keyboard_interactive problem

Re: [libssh2] userauth_keyboard_interactive problem

From: Dan Fandrich <dan_at_coneharvesters.com>
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

-- 
http://www.MoveAnnouncer.com              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 SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2007-12-15