diff --git a/docs/libssh2_userauth_keyboard_interactive_ex.md b/docs/libssh2_userauth_keyboard_interactive_ex.md index 87eff43c..709458d6 100644 --- a/docs/libssh2_userauth_keyboard_interactive_ex.md +++ b/docs/libssh2_userauth_keyboard_interactive_ex.md @@ -36,11 +36,12 @@ for. *username_len* - Length of username parameter. *response_callback* - As authentication proceeds, the host issues several -(1 or more) challenges and requires responses. This callback is called at -this moment. The callback is responsible to obtain responses for the -challenges, fill the provided data structure and then return -control. Responses are sent to the host. String values are free(3)ed -by the library. The callback prototype must match this: +(1 or more) challenges and requires responses. This callback is called at this +moment. The callback is responsible to obtain responses for the challenges, +fill the provided data structure and then return control. Use the custom +LIBSSH2_ALLOC_FUNC (or, if not set, the default system allocator) to allocate +memory for the `text` field. Responses are sent to the host. The callback +prototype must match this: ~~~c void response(const char *name, diff --git a/include/libssh2.h b/include/libssh2.h index 267cf3a5..c14e3a56 100644 --- a/include/libssh2.h +++ b/include/libssh2.h @@ -218,14 +218,14 @@ typedef off_t libssh2_struct_stat_size; #endif typedef struct _LIBSSH2_USERAUTH_KBDINT_PROMPT { - unsigned char *text; /* FIXME: require LIBSSH2_ALLOC_FUNC */ + unsigned char *text; size_t length; unsigned char echo; } LIBSSH2_USERAUTH_KBDINT_PROMPT; typedef struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE { - char *text; /* FIXME: require LIBSSH2_ALLOC_FUNC */ + char *text; unsigned int length; /* FIXME: change type to size_t */ } LIBSSH2_USERAUTH_KBDINT_RESPONSE;