summaryrefslogtreecommitdiff
path: root/sshconnect.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshconnect.c')
-rw-r--r--sshconnect.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/sshconnect.c b/sshconnect.c
index cf0711285..483eb85ac 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect.c,v 1.237 2013/02/22 19:13:56 markus Exp $ */ 1/* $OpenBSD: sshconnect.c,v 1.238 2013/05/17 00:13:14 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -112,7 +112,7 @@ ssh_proxy_connect(const char *host, u_short port, const char *proxy_command)
112 xasprintf(&tmp, "exec %s", proxy_command); 112 xasprintf(&tmp, "exec %s", proxy_command);
113 command_string = percent_expand(tmp, "h", host, "p", strport, 113 command_string = percent_expand(tmp, "h", host, "p", strport,
114 "r", options.user, (char *)NULL); 114 "r", options.user, (char *)NULL);
115 xfree(tmp); 115 free(tmp);
116 116
117 /* Create pipes for communicating with the proxy. */ 117 /* Create pipes for communicating with the proxy. */
118 if (pipe(pin) < 0 || pipe(pout) < 0) 118 if (pipe(pin) < 0 || pipe(pout) < 0)
@@ -166,7 +166,7 @@ ssh_proxy_connect(const char *host, u_short port, const char *proxy_command)
166 close(pout[1]); 166 close(pout[1]);
167 167
168 /* Free the command name. */ 168 /* Free the command name. */
169 xfree(command_string); 169 free(command_string);
170 170
171 /* Set the connection file descriptors. */ 171 /* Set the connection file descriptors. */
172 packet_set_connection(pout[0], pin[1]); 172 packet_set_connection(pout[0], pin[1]);
@@ -315,7 +315,7 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr,
315 fatal("Bogus return (%d) from select()", rc); 315 fatal("Bogus return (%d) from select()", rc);
316 } 316 }
317 317
318 xfree(fdset); 318 free(fdset);
319 319
320 done: 320 done:
321 if (result == 0 && *timeoutp > 0) { 321 if (result == 0 && *timeoutp > 0) {
@@ -534,7 +534,7 @@ ssh_exchange_identification(int timeout_ms)
534 debug("ssh_exchange_identification: %s", buf); 534 debug("ssh_exchange_identification: %s", buf);
535 } 535 }
536 server_version_string = xstrdup(buf); 536 server_version_string = xstrdup(buf);
537 xfree(fdset); 537 free(fdset);
538 538
539 /* 539 /*
540 * Check that the versions match. In future this might accept 540 * Check that the versions match. In future this might accept
@@ -610,8 +610,7 @@ confirm(const char *prompt)
610 ret = 0; 610 ret = 0;
611 if (p && strncasecmp(p, "yes", 3) == 0) 611 if (p && strncasecmp(p, "yes", 3) == 0)
612 ret = 1; 612 ret = 1;
613 if (p) 613 free(p);
614 xfree(p);
615 if (ret != -1) 614 if (ret != -1)
616 return ret; 615 return ret;
617 } 616 }
@@ -835,8 +834,8 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
835 ra = key_fingerprint(host_key, SSH_FP_MD5, 834 ra = key_fingerprint(host_key, SSH_FP_MD5,
836 SSH_FP_RANDOMART); 835 SSH_FP_RANDOMART);
837 logit("Host key fingerprint is %s\n%s\n", fp, ra); 836 logit("Host key fingerprint is %s\n%s\n", fp, ra);
838 xfree(ra); 837 free(ra);
839 xfree(fp); 838 free(fp);
840 } 839 }
841 break; 840 break;
842 case HOST_NEW: 841 case HOST_NEW:
@@ -896,8 +895,8 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
896 options.visual_host_key ? "\n" : "", 895 options.visual_host_key ? "\n" : "",
897 options.visual_host_key ? ra : "", 896 options.visual_host_key ? ra : "",
898 msg2); 897 msg2);
899 xfree(ra); 898 free(ra);
900 xfree(fp); 899 free(fp);
901 if (!confirm(msg)) 900 if (!confirm(msg))
902 goto fail; 901 goto fail;
903 } 902 }
@@ -1098,8 +1097,8 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
1098 } 1097 }
1099 } 1098 }
1100 1099
1101 xfree(ip); 1100 free(ip);
1102 xfree(host); 1101 free(host);
1103 if (host_hostkeys != NULL) 1102 if (host_hostkeys != NULL)
1104 free_hostkeys(host_hostkeys); 1103 free_hostkeys(host_hostkeys);
1105 if (ip_hostkeys != NULL) 1104 if (ip_hostkeys != NULL)
@@ -1121,8 +1120,8 @@ fail:
1121 } 1120 }
1122 if (raw_key != NULL) 1121 if (raw_key != NULL)
1123 key_free(raw_key); 1122 key_free(raw_key);
1124 xfree(ip); 1123 free(ip);
1125 xfree(host); 1124 free(host);
1126 if (host_hostkeys != NULL) 1125 if (host_hostkeys != NULL)
1127 free_hostkeys(host_hostkeys); 1126 free_hostkeys(host_hostkeys);
1128 if (ip_hostkeys != NULL) 1127 if (ip_hostkeys != NULL)
@@ -1139,7 +1138,7 @@ verify_host_key(char *host, struct sockaddr *hostaddr, Key *host_key)
1139 1138
1140 fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); 1139 fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX);
1141 debug("Server host key: %s %s", key_type(host_key), fp); 1140 debug("Server host key: %s %s", key_type(host_key), fp);
1142 xfree(fp); 1141 free(fp);
1143 1142
1144 /* XXX certs are not yet supported for DNS */ 1143 /* XXX certs are not yet supported for DNS */
1145 if (!key_is_cert(host_key) && options.verify_host_key_dns && 1144 if (!key_is_cert(host_key) && options.verify_host_key_dns &&
@@ -1204,7 +1203,7 @@ ssh_login(Sensitive *sensitive, const char *orighost,
1204 ssh_kex(host, hostaddr); 1203 ssh_kex(host, hostaddr);
1205 ssh_userauth1(local_user, server_user, host, sensitive); 1204 ssh_userauth1(local_user, server_user, host, sensitive);
1206 } 1205 }
1207 xfree(local_user); 1206 free(local_user);
1208} 1207}
1209 1208
1210void 1209void
@@ -1222,7 +1221,7 @@ ssh_put_password(char *password)
1222 strlcpy(padded, password, size); 1221 strlcpy(padded, password, size);
1223 packet_put_string(padded, size); 1222 packet_put_string(padded, size);
1224 memset(padded, 0, size); 1223 memset(padded, 0, size);
1225 xfree(padded); 1224 free(padded);
1226} 1225}
1227 1226
1228/* print all known host keys for a given host, but skip keys of given type */ 1227/* print all known host keys for a given host, but skip keys of given type */
@@ -1249,8 +1248,8 @@ show_other_keys(struct hostkeys *hostkeys, Key *key)
1249 key_type(found->key), fp); 1248 key_type(found->key), fp);
1250 if (options.visual_host_key) 1249 if (options.visual_host_key)
1251 logit("%s", ra); 1250 logit("%s", ra);
1252 xfree(ra); 1251 free(ra);
1253 xfree(fp); 1252 free(fp);
1254 ret = 1; 1253 ret = 1;
1255 } 1254 }
1256 return ret; 1255 return ret;
@@ -1273,7 +1272,7 @@ warn_changed_key(Key *host_key)
1273 key_type(host_key), fp); 1272 key_type(host_key), fp);
1274 error("Please contact your system administrator."); 1273 error("Please contact your system administrator.");
1275 1274
1276 xfree(fp); 1275 free(fp);
1277} 1276}
1278 1277
1279/* 1278/*