Mercurial > dropbear
diff cli-authinteract.c @ 1121:bb3a03feb31f
Merge pull request #13 from gazoo74/fix-warnings
Fix warnings
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 04 Jun 2015 22:25:28 +0800 |
parents | 506e769ed6d1 |
children | aaf576b27a10 |
line wrap: on
line diff
--- a/cli-authinteract.c Wed Jun 03 22:59:59 2015 +0800 +++ b/cli-authinteract.c Thu Jun 04 22:25:28 2015 +0800 @@ -31,10 +31,10 @@ #ifdef ENABLE_CLI_INTERACT_AUTH -static unsigned char* get_response(unsigned char* prompt) +static char* get_response(char* prompt) { FILE* tty = NULL; - unsigned char* response = NULL; + char* response = NULL; /* not a password, but a reasonable limit */ char buf[DROPBEAR_MAX_CLI_PASS]; char* ret = NULL; @@ -50,13 +50,13 @@ } if (ret == NULL) { - response = (unsigned char*)m_strdup(""); + response = m_strdup(""); } else { unsigned int buflen = strlen(buf); /* fgets includes newlines */ if (buflen > 0 && buf[buflen-1] == '\n') buf[buflen-1] = '\0'; - response = (unsigned char*)m_strdup(buf); + response = m_strdup(buf); } m_burn(buf, sizeof(buf)); @@ -66,14 +66,14 @@ void recv_msg_userauth_info_request() { - unsigned char *name = NULL; - unsigned char *instruction = NULL; + char *name = NULL; + char *instruction = NULL; unsigned int num_prompts = 0; unsigned int i; - unsigned char *prompt = NULL; + char *prompt = NULL; unsigned int echo = 0; - unsigned char *response = NULL; + char *response = NULL; TRACE(("enter recv_msg_recv_userauth_info_request")) @@ -84,8 +84,8 @@ } cli_ses.interact_request_received = 1; - name = buf_getstring(ses.payload, NULL); - instruction = buf_getstring(ses.payload, NULL); + name = (char *)buf_getstring(ses.payload, NULL); + instruction = (char *)buf_getstring(ses.payload, NULL); /* language tag */ buf_eatstring(ses.payload); @@ -115,13 +115,13 @@ for (i = 0; i < num_prompts; i++) { unsigned int response_len = 0; - prompt = buf_getstring(ses.payload, NULL); + prompt = (char *)buf_getstring(ses.payload, NULL); cleantext(prompt); echo = buf_getbool(ses.payload); if (!echo) { - unsigned char* p = getpass_or_cancel(prompt); + char* p = getpass_or_cancel(prompt); response = m_strdup(p); m_burn(p, strlen(p)); } else { @@ -129,7 +129,7 @@ } response_len = strlen(response); - buf_putstring(ses.writepayload, response, response_len); + buf_putstring(ses.writepayload, (const unsigned char *)response, response_len); m_burn(response, response_len); m_free(prompt); m_free(response); @@ -149,22 +149,22 @@ buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST); /* username */ - buf_putstring(ses.writepayload, cli_opts.username, + buf_putstring(ses.writepayload, (const unsigned char *)cli_opts.username, strlen(cli_opts.username)); /* service name */ - buf_putstring(ses.writepayload, SSH_SERVICE_CONNECTION, + buf_putstring(ses.writepayload, (const unsigned char *)SSH_SERVICE_CONNECTION, SSH_SERVICE_CONNECTION_LEN); /* method */ - buf_putstring(ses.writepayload, AUTH_METHOD_INTERACT, + buf_putstring(ses.writepayload, (const unsigned char *)AUTH_METHOD_INTERACT, AUTH_METHOD_INTERACT_LEN); /* empty language tag */ - buf_putstring(ses.writepayload, "", 0); + buf_putstring(ses.writepayload, (const unsigned char *)"", 0); /* empty submethods */ - buf_putstring(ses.writepayload, "", 0); + buf_putstring(ses.writepayload, (const unsigned char *)"", 0); encrypt_packet(); cli_ses.interact_request_received = 0;