www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: Need help with libssh2_userauth_keyboard_interactive method.

Re: Need help with libssh2_userauth_keyboard_interactive method.

From: Alexander Lamaison <swish_at_lammy.co.uk>
Date: Sat, 2 Mar 2013 16:49:26 +0000

On 28 February 2013 15:14, Velichko Yuriy <velichko.yuriy_at_gmail.com> wrote:
>
> Hello everyone!
>
> II try to use the libssh2 in my application. And I have question about the
> libssh2_userauth_keyboard_interactive function.
>
> I took the kbd_callback method from examples:
>
> static void kbd_callback(
>
> const char *name,
>
> int name_len,
>
> const char *instruction,
>
> int instruction_len,
>
> int num_prompts,
>
> const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts,
>
> LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses,
>
> void **abstract )
>
> {
>
> (void)name;
>
> (void)name_len;
>
> (void)instruction;
>
> (void)instruction_len;
>
> if (num_prompts == 1) {
>
> responses[0].text = strdup(password);
>
> responses[0].length = strlen(password);
>
> }
>
> (void)prompts;
>
> (void)abstract;
>
> }
>
>
> Here, the password is a global variable.
>
> QUESTION: Is there a method to pass the variable into this function?

Hi Velichko,

If you look again at the code you quoted, you'll see that you're not
passing the global variable. You are passing a copy of the string in
it. So you can get the text from whereever you want as long as you
copy it appropriately.

Alex

-- 
Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org)
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2013-03-02

the libssh2 team