comparison cli-authpasswd.c @ 1318:10e2a7727253 coverity

merge coverity
author Matt Johnston <matt@ucc.asn.au>
date Fri, 22 Jul 2016 00:08:02 +0800
parents 750ec4ec4cbe
children df8d8ec1801c
comparison
equal deleted inserted replaced
1286:7d02b83c61fd 1318:10e2a7727253
27 #include "dbutil.h" 27 #include "dbutil.h"
28 #include "session.h" 28 #include "session.h"
29 #include "ssh.h" 29 #include "ssh.h"
30 #include "runopts.h" 30 #include "runopts.h"
31 31
32 #ifdef ENABLE_CLI_PASSWORD_AUTH 32 #if DROPBEAR_CLI_PASSWORD_AUTH
33 33
34 #ifdef ENABLE_CLI_ASKPASS_HELPER 34 #if DROPBEAR_CLI_ASKPASS_HELPER
35 /* Returns 1 if we want to use the askpass program, 0 otherwise */ 35 /* Returns 1 if we want to use the askpass program, 0 otherwise */
36 static int want_askpass() 36 static int want_askpass()
37 { 37 {
38 char* askpass_prog = NULL; 38 char* askpass_prog = NULL;
39 39
111 buf[len - 1] = '\0'; 111 buf[len - 1] = '\0';
112 112
113 TRACE(("leave gui_getpass")) 113 TRACE(("leave gui_getpass"))
114 return(buf); 114 return(buf);
115 } 115 }
116 #endif /* ENABLE_CLI_ASKPASS_HELPER */ 116 #endif /* DROPBEAR_CLI_ASKPASS_HELPER */
117 117
118 void cli_auth_password() { 118 void cli_auth_password() {
119 119
120 char* password = NULL; 120 char* password = NULL;
121 char prompt[80]; 121 char prompt[80];
123 TRACE(("enter cli_auth_password")) 123 TRACE(("enter cli_auth_password"))
124 CHECKCLEARTOWRITE(); 124 CHECKCLEARTOWRITE();
125 125
126 snprintf(prompt, sizeof(prompt), "%s@%s's password: ", 126 snprintf(prompt, sizeof(prompt), "%s@%s's password: ",
127 cli_opts.username, cli_opts.remotehost); 127 cli_opts.username, cli_opts.remotehost);
128 #ifdef ENABLE_CLI_ASKPASS_HELPER 128 #if DROPBEAR_CLI_ASKPASS_HELPER
129 if (want_askpass()) 129 if (want_askpass())
130 { 130 {
131 password = gui_getpass(prompt); 131 password = gui_getpass(prompt);
132 if (!password) { 132 if (!password) {
133 dropbear_exit("No password"); 133 dropbear_exit("No password");
156 encrypt_packet(); 156 encrypt_packet();
157 m_burn(password, strlen(password)); 157 m_burn(password, strlen(password));
158 158
159 TRACE(("leave cli_auth_password")) 159 TRACE(("leave cli_auth_password"))
160 } 160 }
161 #endif /* ENABLE_CLI_PASSWORD_AUTH */ 161 #endif /* DROPBEAR_CLI_PASSWORD_AUTH */