Make the ssh_userauth_kbdint functions to get the prompts const.
They shouldn't be modified or free'd by a user.
Этот коммит содержится в:
родитель
8843d8b68d
Коммит
41a8fb5810
@ -370,9 +370,9 @@ int ssh_userauth_agent_pubkey(SSH_SESSION *session, const char *username,
|
||||
int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase);
|
||||
int ssh_userauth_kbdint(SSH_SESSION *session, const char *user, const char *submethods);
|
||||
int ssh_userauth_kbdint_getnprompts(SSH_SESSION *session);
|
||||
char *ssh_userauth_kbdint_getname(SSH_SESSION *session);
|
||||
char *ssh_userauth_kbdint_getinstruction(SSH_SESSION *session);
|
||||
char *ssh_userauth_kbdint_getprompt(SSH_SESSION *session, unsigned int i, char *echo);
|
||||
const char *ssh_userauth_kbdint_getname(SSH_SESSION *session);
|
||||
const char *ssh_userauth_kbdint_getinstruction(SSH_SESSION *session);
|
||||
const char *ssh_userauth_kbdint_getprompt(SSH_SESSION *session, unsigned int i, char *echo);
|
||||
int ssh_userauth_kbdint_setanswer(SSH_SESSION *session, unsigned int i,
|
||||
const char *answer);
|
||||
|
||||
|
@ -1417,7 +1417,7 @@ int ssh_userauth_kbdint_getnprompts(SSH_SESSION *session) {
|
||||
*
|
||||
* @returns The name of the message block. Do not free it.
|
||||
*/
|
||||
char *ssh_userauth_kbdint_getname(SSH_SESSION *session) {
|
||||
const char *ssh_userauth_kbdint_getname(SSH_SESSION *session) {
|
||||
return session->kbdint->name;
|
||||
}
|
||||
|
||||
@ -1432,7 +1432,7 @@ char *ssh_userauth_kbdint_getname(SSH_SESSION *session) {
|
||||
* @returns The instruction of the message block.
|
||||
*/
|
||||
|
||||
char *ssh_userauth_kbdint_getinstruction(SSH_SESSION *session) {
|
||||
const char *ssh_userauth_kbdint_getinstruction(SSH_SESSION *session) {
|
||||
return session->kbdint->instruction;
|
||||
}
|
||||
|
||||
@ -1452,7 +1452,7 @@ char *ssh_userauth_kbdint_getinstruction(SSH_SESSION *session) {
|
||||
*
|
||||
* @returns A pointer to the prompt. Do not free it.
|
||||
*/
|
||||
char *ssh_userauth_kbdint_getprompt(SSH_SESSION *session, unsigned int i,
|
||||
const char *ssh_userauth_kbdint_getprompt(SSH_SESSION *session, unsigned int i,
|
||||
char *echo) {
|
||||
if (i > session->kbdint->nprompts) {
|
||||
return NULL;
|
||||
|
3
sample.c
3
sample.c
@ -367,7 +367,8 @@ void do_sftp(SSH_SESSION *session){
|
||||
|
||||
static int auth_kbdint(SSH_SESSION *session){
|
||||
int err=ssh_userauth_kbdint(session,NULL,NULL);
|
||||
char *name,*instruction,*prompt,*ptr;
|
||||
const char *name, *instruction, *prompt;
|
||||
char *ptr;
|
||||
char buffer[128];
|
||||
int i,n;
|
||||
char echo;
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user