summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2013-06-02 07:31:17 +1000
committerDarren Tucker <dtucker@zip.com.au>2013-06-02 07:31:17 +1000
commita627d42e51ffa71e014d7b2d2c07118122fd3ec3 (patch)
tree7bda769de81f509e28d800916fa20abd37906d79 /ssh.c
parentc7aad0058c957afeb26a3f703e8cb0eddeb62365 (diff)
- djm@cvs.openbsd.org 2013/05/17 00:13:13
[xmalloc.h cipher.c sftp-glob.c ssh-keyscan.c ssh.c sftp-common.c ssh-ecdsa.c auth2-chall.c compat.c readconf.c kexgexs.c monitor.c gss-genr.c cipher-3des1.c kex.c monitor_wrap.c ssh-pkcs11-client.c auth-options.c rsa.c auth2-pubkey.c sftp.c hostfile.c auth2.c servconf.c auth.c authfile.c xmalloc.c uuencode.c sftp-client.c auth2-gss.c sftp-server.c bufaux.c mac.c session.c jpake.c kexgexc.c sshconnect.c auth-chall.c auth2-passwd.c sshconnect1.c buffer.c kexecdhs.c kexdhs.c ssh-rsa.c auth1.c ssh-pkcs11.c auth2-kbdint.c kexdhc.c sshd.c umac.c ssh-dss.c auth2-jpake.c bufbn.c clientloop.c monitor_mm.c scp.c roaming_client.c serverloop.c key.c auth-rsa.c ssh-pkcs11-helper.c ssh-keysign.c ssh-keygen.c match.c channels.c sshconnect2.c addrmatch.c mux.c canohost.c kexecdhc.c schnorr.c ssh-add.c misc.c auth2-hostbased.c ssh-agent.c bufec.c groupaccess.c dns.c packet.c readpass.c authfd.c moduli.c] bye, bye xfree(); ok markus@
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/ssh.c b/ssh.c
index 534e7c6cf..0e96c9219 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.377 2013/04/19 11:10:18 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.378 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
@@ -226,7 +226,7 @@ tilde_expand_paths(char **paths, u_int num_paths)
226 226
227 for (i = 0; i < num_paths; i++) { 227 for (i = 0; i < num_paths; i++) {
228 cp = tilde_expand_filename(paths[i], original_real_uid); 228 cp = tilde_expand_filename(paths[i], original_real_uid);
229 xfree(paths[i]); 229 free(paths[i]);
230 paths[i] = cp; 230 paths[i] = cp;
231 } 231 }
232} 232}
@@ -473,7 +473,7 @@ main(int ac, char **av)
473 if (parse_forward(&fwd, optarg, 1, 0)) { 473 if (parse_forward(&fwd, optarg, 1, 0)) {
474 stdio_forward_host = fwd.listen_host; 474 stdio_forward_host = fwd.listen_host;
475 stdio_forward_port = fwd.listen_port; 475 stdio_forward_port = fwd.listen_port;
476 xfree(fwd.connect_host); 476 free(fwd.connect_host);
477 } else { 477 } else {
478 fprintf(stderr, 478 fprintf(stderr,
479 "Bad stdio forwarding specification '%s'\n", 479 "Bad stdio forwarding specification '%s'\n",
@@ -601,7 +601,7 @@ main(int ac, char **av)
601 line, "command-line", 0, &dummy, SSHCONF_USERCONF) 601 line, "command-line", 0, &dummy, SSHCONF_USERCONF)
602 != 0) 602 != 0)
603 exit(255); 603 exit(255);
604 xfree(line); 604 free(line);
605 break; 605 break;
606 case 's': 606 case 's':
607 subsystem_flag = 1; 607 subsystem_flag = 1;
@@ -688,7 +688,7 @@ main(int ac, char **av)
688 fatal("Can't specify both -y and -E"); 688 fatal("Can't specify both -y and -E");
689 if (logfile != NULL) { 689 if (logfile != NULL) {
690 log_redirect_stderr_to(logfile); 690 log_redirect_stderr_to(logfile);
691 xfree(logfile); 691 free(logfile);
692 } 692 }
693 log_init(argv0, 693 log_init(argv0,
694 options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level, 694 options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level,
@@ -778,7 +778,7 @@ main(int ac, char **av)
778 "p", portstr, "u", pw->pw_name, "L", shorthost, 778 "p", portstr, "u", pw->pw_name, "L", shorthost,
779 (char *)NULL); 779 (char *)NULL);
780 debug3("expanded LocalCommand: %s", options.local_command); 780 debug3("expanded LocalCommand: %s", options.local_command);
781 xfree(cp); 781 free(cp);
782 } 782 }
783 783
784 /* force lowercase for hostkey matching */ 784 /* force lowercase for hostkey matching */
@@ -790,24 +790,24 @@ main(int ac, char **av)
790 790
791 if (options.proxy_command != NULL && 791 if (options.proxy_command != NULL &&
792 strcmp(options.proxy_command, "none") == 0) { 792 strcmp(options.proxy_command, "none") == 0) {
793 xfree(options.proxy_command); 793 free(options.proxy_command);
794 options.proxy_command = NULL; 794 options.proxy_command = NULL;
795 } 795 }
796 if (options.control_path != NULL && 796 if (options.control_path != NULL &&
797 strcmp(options.control_path, "none") == 0) { 797 strcmp(options.control_path, "none") == 0) {
798 xfree(options.control_path); 798 free(options.control_path);
799 options.control_path = NULL; 799 options.control_path = NULL;
800 } 800 }
801 801
802 if (options.control_path != NULL) { 802 if (options.control_path != NULL) {
803 cp = tilde_expand_filename(options.control_path, 803 cp = tilde_expand_filename(options.control_path,
804 original_real_uid); 804 original_real_uid);
805 xfree(options.control_path); 805 free(options.control_path);
806 options.control_path = percent_expand(cp, "h", host, 806 options.control_path = percent_expand(cp, "h", host,
807 "l", thishost, "n", host_arg, "r", options.user, 807 "l", thishost, "n", host_arg, "r", options.user,
808 "p", portstr, "u", pw->pw_name, "L", shorthost, 808 "p", portstr, "u", pw->pw_name, "L", shorthost,
809 (char *)NULL); 809 (char *)NULL);
810 xfree(cp); 810 free(cp);
811 } 811 }
812 if (muxclient_command != 0 && options.control_path == NULL) 812 if (muxclient_command != 0 && options.control_path == NULL)
813 fatal("No ControlPath specified for \"-O\" command"); 813 fatal("No ControlPath specified for \"-O\" command");
@@ -958,13 +958,11 @@ main(int ac, char **av)
958 sensitive_data.keys[i] = NULL; 958 sensitive_data.keys[i] = NULL;
959 } 959 }
960 } 960 }
961 xfree(sensitive_data.keys); 961 free(sensitive_data.keys);
962 } 962 }
963 for (i = 0; i < options.num_identity_files; i++) { 963 for (i = 0; i < options.num_identity_files; i++) {
964 if (options.identity_files[i]) { 964 free(options.identity_files[i]);
965 xfree(options.identity_files[i]); 965 options.identity_files[i] = NULL;
966 options.identity_files[i] = NULL;
967 }
968 if (options.identity_keys[i]) { 966 if (options.identity_keys[i]) {
969 key_free(options.identity_keys[i]); 967 key_free(options.identity_keys[i]);
970 options.identity_keys[i] = NULL; 968 options.identity_keys[i] = NULL;
@@ -1554,7 +1552,7 @@ load_public_identity_files(void)
1554 xstrdup(options.pkcs11_provider); /* XXX */ 1552 xstrdup(options.pkcs11_provider); /* XXX */
1555 n_ids++; 1553 n_ids++;
1556 } 1554 }
1557 xfree(keys); 1555 free(keys);
1558 } 1556 }
1559#endif /* ENABLE_PKCS11 */ 1557#endif /* ENABLE_PKCS11 */
1560 if ((pw = getpwuid(original_real_uid)) == NULL) 1558 if ((pw = getpwuid(original_real_uid)) == NULL)
@@ -1567,7 +1565,7 @@ load_public_identity_files(void)
1567 for (i = 0; i < options.num_identity_files; i++) { 1565 for (i = 0; i < options.num_identity_files; i++) {
1568 if (n_ids >= SSH_MAX_IDENTITY_FILES || 1566 if (n_ids >= SSH_MAX_IDENTITY_FILES ||
1569 strcasecmp(options.identity_files[i], "none") == 0) { 1567 strcasecmp(options.identity_files[i], "none") == 0) {
1570 xfree(options.identity_files[i]); 1568 free(options.identity_files[i]);
1571 continue; 1569 continue;
1572 } 1570 }
1573 cp = tilde_expand_filename(options.identity_files[i], 1571 cp = tilde_expand_filename(options.identity_files[i],
@@ -1575,11 +1573,11 @@ load_public_identity_files(void)
1575 filename = percent_expand(cp, "d", pwdir, 1573 filename = percent_expand(cp, "d", pwdir,
1576 "u", pwname, "l", thishost, "h", host, 1574 "u", pwname, "l", thishost, "h", host,
1577 "r", options.user, (char *)NULL); 1575 "r", options.user, (char *)NULL);
1578 xfree(cp); 1576 free(cp);
1579 public = key_load_public(filename, NULL); 1577 public = key_load_public(filename, NULL);
1580 debug("identity file %s type %d", filename, 1578 debug("identity file %s type %d", filename,
1581 public ? public->type : -1); 1579 public ? public->type : -1);
1582 xfree(options.identity_files[i]); 1580 free(options.identity_files[i]);
1583 identity_files[n_ids] = filename; 1581 identity_files[n_ids] = filename;
1584 identity_keys[n_ids] = public; 1582 identity_keys[n_ids] = public;
1585 1583
@@ -1592,14 +1590,14 @@ load_public_identity_files(void)
1592 debug("identity file %s type %d", cp, 1590 debug("identity file %s type %d", cp,
1593 public ? public->type : -1); 1591 public ? public->type : -1);
1594 if (public == NULL) { 1592 if (public == NULL) {
1595 xfree(cp); 1593 free(cp);
1596 continue; 1594 continue;
1597 } 1595 }
1598 if (!key_is_cert(public)) { 1596 if (!key_is_cert(public)) {
1599 debug("%s: key %s type %s is not a certificate", 1597 debug("%s: key %s type %s is not a certificate",
1600 __func__, cp, key_type(public)); 1598 __func__, cp, key_type(public));
1601 key_free(public); 1599 key_free(public);
1602 xfree(cp); 1600 free(cp);
1603 continue; 1601 continue;
1604 } 1602 }
1605 identity_keys[n_ids] = public; 1603 identity_keys[n_ids] = public;
@@ -1612,9 +1610,9 @@ load_public_identity_files(void)
1612 memcpy(options.identity_keys, identity_keys, sizeof(identity_keys)); 1610 memcpy(options.identity_keys, identity_keys, sizeof(identity_keys));
1613 1611
1614 bzero(pwname, strlen(pwname)); 1612 bzero(pwname, strlen(pwname));
1615 xfree(pwname); 1613 free(pwname);
1616 bzero(pwdir, strlen(pwdir)); 1614 bzero(pwdir, strlen(pwdir));
1617 xfree(pwdir); 1615 free(pwdir);
1618} 1616}
1619 1617
1620static void 1618static void