comparison cli-authpubkey.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 06d52bcb8094
comparison
equal deleted inserted replaced
1286:7d02b83c61fd 1318:10e2a7727253
30 #include "ssh.h" 30 #include "ssh.h"
31 #include "runopts.h" 31 #include "runopts.h"
32 #include "auth.h" 32 #include "auth.h"
33 #include "agentfwd.h" 33 #include "agentfwd.h"
34 34
35 #ifdef ENABLE_CLI_PUBKEY_AUTH 35 #if DROPBEAR_CLI_PUBKEY_AUTH
36 static void send_msg_userauth_pubkey(sign_key *key, int type, int realsign); 36 static void send_msg_userauth_pubkey(sign_key *key, int type, int realsign);
37 37
38 /* Called when we receive a SSH_MSG_USERAUTH_FAILURE for a pubkey request. 38 /* Called when we receive a SSH_MSG_USERAUTH_FAILURE for a pubkey request.
39 * We use it to remove the key we tried from the list */ 39 * We use it to remove the key we tried from the list */
40 void cli_pubkeyfail() { 40 void cli_pubkeyfail() {
120 TRACE(("leave recv_msg_userauth_pk_ok")) 120 TRACE(("leave recv_msg_userauth_pk_ok"))
121 } 121 }
122 122
123 void cli_buf_put_sign(buffer* buf, sign_key *key, int type, 123 void cli_buf_put_sign(buffer* buf, sign_key *key, int type,
124 buffer *data_buf) { 124 buffer *data_buf) {
125 #ifdef ENABLE_CLI_AGENTFWD 125 #if DROPBEAR_CLI_AGENTFWD
126 if (key->source == SIGNKEY_SOURCE_AGENT) { 126 if (key->source == SIGNKEY_SOURCE_AGENT) {
127 /* Format the agent signature ourselves, as buf_put_sign would. */ 127 /* Format the agent signature ourselves, as buf_put_sign would. */
128 buffer *sigblob; 128 buffer *sigblob;
129 sigblob = buf_new(MAX_PUBKEY_SIZE); 129 sigblob = buf_new(MAX_PUBKEY_SIZE);
130 agent_buf_sign(sigblob, key, data_buf); 130 agent_buf_sign(sigblob, key, data_buf);
131 buf_putbufstring(buf, sigblob); 131 buf_putbufstring(buf, sigblob);
132 buf_free(sigblob); 132 buf_free(sigblob);
133 } else 133 } else
134 #endif /* ENABLE_CLI_AGENTFWD */ 134 #endif /* DROPBEAR_CLI_AGENTFWD */
135 { 135 {
136 buf_put_sign(buf, key, type, data_buf); 136 buf_put_sign(buf, key, type, data_buf);
137 } 137 }
138 } 138 }
139 139
183 /* Returns 1 if a key was tried */ 183 /* Returns 1 if a key was tried */
184 int cli_auth_pubkey() { 184 int cli_auth_pubkey() {
185 185
186 TRACE(("enter cli_auth_pubkey")) 186 TRACE(("enter cli_auth_pubkey"))
187 187
188 #ifdef ENABLE_CLI_AGENTFWD 188 #if DROPBEAR_CLI_AGENTFWD
189 if (!cli_opts.agent_keys_loaded) { 189 if (!cli_opts.agent_keys_loaded) {
190 /* get the list of available keys from the agent */ 190 /* get the list of available keys from the agent */
191 cli_load_agent_keys(cli_opts.privkeys); 191 cli_load_agent_keys(cli_opts.privkeys);
192 cli_opts.agent_keys_loaded = 1; 192 cli_opts.agent_keys_loaded = 1;
193 } 193 }
207 } 207 }
208 } 208 }
209 209
210 void cli_auth_pubkey_cleanup() { 210 void cli_auth_pubkey_cleanup() {
211 211
212 #ifdef ENABLE_CLI_AGENTFWD 212 #if DROPBEAR_CLI_AGENTFWD
213 m_close(cli_opts.agent_fd); 213 m_close(cli_opts.agent_fd);
214 cli_opts.agent_fd = -1; 214 cli_opts.agent_fd = -1;
215 #endif 215 #endif
216 216
217 while (cli_opts.privkeys->first) { 217 while (cli_opts.privkeys->first) {