changeset 1104:5806c644469a

Turn get_response()'s return type and prompt argument into char *
author Gaël PORTAY <gael.portay@gmail.com>
date Sat, 02 May 2015 16:30:59 +0200
parents 303e27a78d2e
children c339657c9758
files cli-authinteract.c
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/cli-authinteract.c	Sun May 03 01:12:24 2015 +0200
+++ b/cli-authinteract.c	Sat May 02 16:30:59 2015 +0200
@@ -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));
@@ -71,9 +71,9 @@
 	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"))
 
@@ -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);