From 3024e3652f64eb2a3fe09b172134914dd5c7cc9b Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 29 Apr 2009 10:53:23 +0000 Subject: Improve ssh_userauth_kbdint_getprompt. git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@645 7dcaeef0-15fb-0310-b436-a5af3365683c --- libssh/auth.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'libssh/auth.c') diff --git a/libssh/auth.c b/libssh/auth.c index 052e5a3..ea25134 100644 --- a/libssh/auth.c +++ b/libssh/auth.c @@ -1366,23 +1366,33 @@ char *ssh_userauth_kbdint_getinstruction(SSH_SESSION *session) { return session->kbdint->instruction; } -/** You have called ssh_userauth_kbdint() and got SSH_AUTH_INFO. this - * function returns the questions from the server - * \brief get a prompt from a message block - * \param session ssh session - * \param i index number of the ith prompt - * \param echo when different of NULL, it will obtain a boolean meaning that the - * resulting user input should be echoed or not (like passwords) - * \returns pointer to the prompt. Do not free it +/** + * @brief Get a prompt from a message block. + * + * You have called ssh_userauth_kbdint() and got SSH_AUTH_INFO. This + * function returns the questions from the server. + * + * @param session The ssh session to use. + * + * @param i The inndex number of the i'th prompt. + * + * @param echo When different of NULL, it will obtain a boolean meaning + * that the resulting user input should be echoed or not + * (like passwords). + * + * @returns A pointer to the prompt. Do not free it. */ - char *ssh_userauth_kbdint_getprompt(SSH_SESSION *session, unsigned int i, - char *echo){ - if(i > session->kbdint->nprompts) - return NULL; - if(echo) - *echo=session->kbdint->echo[i]; - return session->kbdint->prompts[i]; + char *echo) { + if (i > session->kbdint->nprompts) { + return NULL; + } + + if (echo) { + *echo = session->kbdint->echo[i]; + } + + return session->kbdint->prompts[i]; } /** You have called ssh_userauth_kbdint() and got SSH_AUTH_INFO. this -- cgit