diff options
Diffstat (limited to 'sshconnect.c')
-rw-r--r-- | sshconnect.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/sshconnect.c b/sshconnect.c index 1fa1d5963..ad960fdbf 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 | } |
@@ -1103,8 +1102,8 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, | |||
1103 | } | 1102 | } |
1104 | } | 1103 | } |
1105 | 1104 | ||
1106 | xfree(ip); | 1105 | free(ip); |
1107 | xfree(host); | 1106 | free(host); |
1108 | if (host_hostkeys != NULL) | 1107 | if (host_hostkeys != NULL) |
1109 | free_hostkeys(host_hostkeys); | 1108 | free_hostkeys(host_hostkeys); |
1110 | if (ip_hostkeys != NULL) | 1109 | if (ip_hostkeys != NULL) |
@@ -1126,8 +1125,8 @@ fail: | |||
1126 | } | 1125 | } |
1127 | if (raw_key != NULL) | 1126 | if (raw_key != NULL) |
1128 | key_free(raw_key); | 1127 | key_free(raw_key); |
1129 | xfree(ip); | 1128 | free(ip); |
1130 | xfree(host); | 1129 | free(host); |
1131 | if (host_hostkeys != NULL) | 1130 | if (host_hostkeys != NULL) |
1132 | free_hostkeys(host_hostkeys); | 1131 | free_hostkeys(host_hostkeys); |
1133 | if (ip_hostkeys != NULL) | 1132 | if (ip_hostkeys != NULL) |
@@ -1144,7 +1143,7 @@ verify_host_key(char *host, struct sockaddr *hostaddr, Key *host_key) | |||
1144 | 1143 | ||
1145 | fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); | 1144 | fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); |
1146 | debug("Server host key: %s %s", key_type(host_key), fp); | 1145 | debug("Server host key: %s %s", key_type(host_key), fp); |
1147 | xfree(fp); | 1146 | free(fp); |
1148 | 1147 | ||
1149 | /* XXX certs are not yet supported for DNS */ | 1148 | /* XXX certs are not yet supported for DNS */ |
1150 | if (!key_is_cert(host_key) && options.verify_host_key_dns && | 1149 | if (!key_is_cert(host_key) && options.verify_host_key_dns && |
@@ -1209,7 +1208,7 @@ ssh_login(Sensitive *sensitive, const char *orighost, | |||
1209 | ssh_kex(host, hostaddr); | 1208 | ssh_kex(host, hostaddr); |
1210 | ssh_userauth1(local_user, server_user, host, sensitive); | 1209 | ssh_userauth1(local_user, server_user, host, sensitive); |
1211 | } | 1210 | } |
1212 | xfree(local_user); | 1211 | free(local_user); |
1213 | } | 1212 | } |
1214 | 1213 | ||
1215 | void | 1214 | void |
@@ -1227,7 +1226,7 @@ ssh_put_password(char *password) | |||
1227 | strlcpy(padded, password, size); | 1226 | strlcpy(padded, password, size); |
1228 | packet_put_string(padded, size); | 1227 | packet_put_string(padded, size); |
1229 | memset(padded, 0, size); | 1228 | memset(padded, 0, size); |
1230 | xfree(padded); | 1229 | free(padded); |
1231 | } | 1230 | } |
1232 | 1231 | ||
1233 | /* print all known host keys for a given host, but skip keys of given type */ | 1232 | /* print all known host keys for a given host, but skip keys of given type */ |
@@ -1254,8 +1253,8 @@ show_other_keys(struct hostkeys *hostkeys, Key *key) | |||
1254 | key_type(found->key), fp); | 1253 | key_type(found->key), fp); |
1255 | if (options.visual_host_key) | 1254 | if (options.visual_host_key) |
1256 | logit("%s", ra); | 1255 | logit("%s", ra); |
1257 | xfree(ra); | 1256 | free(ra); |
1258 | xfree(fp); | 1257 | free(fp); |
1259 | ret = 1; | 1258 | ret = 1; |
1260 | } | 1259 | } |
1261 | return ret; | 1260 | return ret; |
@@ -1278,7 +1277,7 @@ warn_changed_key(Key *host_key) | |||
1278 | key_type(host_key), fp); | 1277 | key_type(host_key), fp); |
1279 | error("Please contact your system administrator."); | 1278 | error("Please contact your system administrator."); |
1280 | 1279 | ||
1281 | xfree(fp); | 1280 | free(fp); |
1282 | } | 1281 | } |
1283 | 1282 | ||
1284 | /* | 1283 | /* |