Subject: Re: [libssh2] userauth_keyboard_interactive problem

Re: [libssh2] userauth_keyboard_interactive problem

From: Mikhail Gusarov <dottedmag_at_dottedmag.net>
Date: Sat, 15 Dec 2007 12:15:45 +0600

"Paul Thomas" <thomaspu_at_gmail.com> writes:

> So when I'm using the library, my class has to have a static member
> function so that it can be passed into you library as a function
> pointer. Unfortunately a non-static member function can not be passed
> into the library.

You've got "abstract" void* pointer attached to every libssh2 to pass
any context to your handler (use libssh2_session_abstract to access it):

static void
MyCplusPlusWrapper::keyboardinteractive_handler(
        const char* name,
        int name_len, ...,
        void* abstract)
{
  MyCplusPlusWrapper* this_ = static_cast<MyCplusPlusWrapper*>(abstract);

  this_-> ....
}

This is pretty common pattern in C world, I'm pretty sure you've seen it
numerous times under the "ctx" or "context" name.

> 2) Is there any possibility that a future version of libssh2 will give
> the ability to just do something as simple as:
>
> libssh2_userauth_keyboard_interactive( session, username, password)
>
> Then if someone like me is using C++, then we aren't stuck only using
> static functions with keyboard interactive auth.

It's impossible. Have a look at the protocol specification.

-- 
JID: dottedmag_at_jabber.dottedmag.net
-------------------------------------------------------------------------
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