summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--channels.c4
-rw-r--r--monitor.c12
-rw-r--r--scp.c10
-rw-r--r--session.c9
-rw-r--r--sftp-client.c5
-rw-r--r--sftp-int.c3
-rw-r--r--sftp-server.c10
-rw-r--r--ssh-add.c9
-rw-r--r--sshconnect2.c3
10 files changed, 52 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 41c66dbd3..984223fb1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
120030310
2- (djm) OpenBSD CVS Sync
3 - markus@cvs.openbsd.org 2003/03/05 22:33:43
4 [channels.c monitor.c scp.c session.c sftp-client.c sftp-int.c]
5 [sftp-server.c ssh-add.c sshconnect2.c]
6 fix memory leaks; from dlheine@suif.Stanford.EDU/CLOUSEAU; ok djm@
7
120030225 820030225
2 - (djm) Fix some compile errors spotted by dtucker and his fabulous 9 - (djm) Fix some compile errors spotted by dtucker and his fabulous
3 tinderbox 10 tinderbox
@@ -1191,4 +1198,4 @@
1191 save auth method before monitor_reset_key_state(); bugzilla bug #284; 1198 save auth method before monitor_reset_key_state(); bugzilla bug #284;
1192 ok provos@ 1199 ok provos@
1193 1200
1194$Id: ChangeLog,v 1.2622 2003/02/24 23:22:35 djm Exp $ 1201$Id: ChangeLog,v 1.2623 2003/03/10 00:21:17 djm Exp $
diff --git a/channels.c b/channels.c
index ea1d46c21..1937b0244 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.186 2003/01/10 10:32:54 djm Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.187 2003/03/05 22:33:43 markus Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -1997,6 +1997,7 @@ channel_input_port_open(int type, u_int32_t seq, void *ctxt)
1997 c->remote_id = remote_id; 1997 c->remote_id = remote_id;
1998 } 1998 }
1999 if (c == NULL) { 1999 if (c == NULL) {
2000 xfree(originator_string);
2000 packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); 2001 packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE);
2001 packet_put_int(remote_id); 2002 packet_put_int(remote_id);
2002 packet_send(); 2003 packet_send();
@@ -2609,6 +2610,7 @@ x11_input_open(int type, u_int32_t seq, void *ctxt)
2609 /* Send refusal to the remote host. */ 2610 /* Send refusal to the remote host. */
2610 packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); 2611 packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE);
2611 packet_put_int(remote_id); 2612 packet_put_int(remote_id);
2613 xfree(remote_host);
2612 } else { 2614 } else {
2613 /* Send a confirmation to the remote host. */ 2615 /* Send a confirmation to the remote host. */
2614 packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION); 2616 packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION);
diff --git a/monitor.c b/monitor.c
index 694cd630a..2b4168831 100644
--- a/monitor.c
+++ b/monitor.c
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: monitor.c,v 1.32 2003/02/16 17:30:33 markus Exp $"); 28RCSID("$OpenBSD: monitor.c,v 1.33 2003/03/05 22:33:43 markus Exp $");
29 29
30#include <openssl/dh.h> 30#include <openssl/dh.h>
31 31
@@ -806,8 +806,9 @@ mm_answer_keyallowed(int socket, Buffer *m)
806 fatal("%s: unknown key type %d", __func__, type); 806 fatal("%s: unknown key type %d", __func__, type);
807 break; 807 break;
808 } 808 }
809 key_free(key);
810 } 809 }
810 if (key != NULL)
811 key_free(key);
811 812
812 /* clear temporarily storage (used by verify) */ 813 /* clear temporarily storage (used by verify) */
813 monitor_reset_key_state(); 814 monitor_reset_key_state();
@@ -1204,8 +1205,9 @@ mm_answer_rsa_keyallowed(int socket, Buffer *m)
1204 key_blob = blob; 1205 key_blob = blob;
1205 key_bloblen = blen; 1206 key_bloblen = blen;
1206 key_blobtype = MM_RSAUSERKEY; 1207 key_blobtype = MM_RSAUSERKEY;
1207 key_free(key);
1208 } 1208 }
1209 if (key != NULL)
1210 key_free(key);
1209 1211
1210 mm_append_debug(m); 1212 mm_append_debug(m);
1211 1213
@@ -1246,6 +1248,9 @@ mm_answer_rsa_challenge(int socket, Buffer *m)
1246 mm_request_send(socket, MONITOR_ANS_RSACHALLENGE, m); 1248 mm_request_send(socket, MONITOR_ANS_RSACHALLENGE, m);
1247 1249
1248 monitor_permit(mon_dispatch, MONITOR_REQ_RSARESPONSE, 1); 1250 monitor_permit(mon_dispatch, MONITOR_REQ_RSARESPONSE, 1);
1251
1252 xfree(blob);
1253 key_free(key);
1249 return (0); 1254 return (0);
1250} 1255}
1251 1256
@@ -1276,6 +1281,7 @@ mm_answer_rsa_response(int socket, Buffer *m)
1276 fatal("%s: received bad response to challenge", __func__); 1281 fatal("%s: received bad response to challenge", __func__);
1277 success = auth_rsa_verify_response(key, ssh1_challenge, response); 1282 success = auth_rsa_verify_response(key, ssh1_challenge, response);
1278 1283
1284 xfree(blob);
1279 key_free(key); 1285 key_free(key);
1280 xfree(response); 1286 xfree(response);
1281 1287
diff --git a/scp.c b/scp.c
index e44a1cf69..ab67c0bb8 100644
--- a/scp.c
+++ b/scp.c
@@ -75,7 +75,7 @@
75 */ 75 */
76 76
77#include "includes.h" 77#include "includes.h"
78RCSID("$OpenBSD: scp.c,v 1.101 2003/02/02 10:51:13 markus Exp $"); 78RCSID("$OpenBSD: scp.c,v 1.102 2003/03/05 22:33:43 markus Exp $");
79 79
80#include "xmalloc.h" 80#include "xmalloc.h"
81#include "atomicio.h" 81#include "atomicio.h"
@@ -395,10 +395,14 @@ toremote(targ, argc, argv)
395 suser = argv[i]; 395 suser = argv[i];
396 if (*suser == '\0') 396 if (*suser == '\0')
397 suser = pwd->pw_name; 397 suser = pwd->pw_name;
398 else if (!okname(suser)) 398 else if (!okname(suser)) {
399 xfree(bp);
399 continue; 400 continue;
400 if (tuser && !okname(tuser)) 401 }
402 if (tuser && !okname(tuser)) {
403 xfree(bp);
401 continue; 404 continue;
405 }
402 snprintf(bp, len, 406 snprintf(bp, len,
403 "%s%s %s -n " 407 "%s%s %s -n "
404 "-l %s %s %s %s '%s%s%s:%s'", 408 "-l %s %s %s %s '%s%s%s:%s'",
diff --git a/session.c b/session.c
index a1586d3b4..ce9db27ef 100644
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
33 */ 33 */
34 34
35#include "includes.h" 35#include "includes.h"
36RCSID("$OpenBSD: session.c,v 1.153 2003/02/06 09:26:23 markus Exp $"); 36RCSID("$OpenBSD: session.c,v 1.154 2003/03/05 22:33:43 markus Exp $");
37 37
38#include "ssh.h" 38#include "ssh.h"
39#include "ssh1.h" 39#include "ssh1.h"
@@ -951,7 +951,7 @@ do_setup_env(Session *s, const char *shell)
951{ 951{
952 char buf[256]; 952 char buf[256];
953 u_int i, envsize; 953 u_int i, envsize;
954 char **env; 954 char **env, *laddr;
955 struct passwd *pw = s->pw; 955 struct passwd *pw = s->pw;
956 956
957 /* Initialize the environment. */ 957 /* Initialize the environment. */
@@ -1030,9 +1030,10 @@ do_setup_env(Session *s, const char *shell)
1030 get_remote_ipaddr(), get_remote_port(), get_local_port()); 1030 get_remote_ipaddr(), get_remote_port(), get_local_port());
1031 child_set_env(&env, &envsize, "SSH_CLIENT", buf); 1031 child_set_env(&env, &envsize, "SSH_CLIENT", buf);
1032 1032
1033 laddr = get_local_ipaddr(packet_get_connection_in());
1033 snprintf(buf, sizeof buf, "%.50s %d %.50s %d", 1034 snprintf(buf, sizeof buf, "%.50s %d %.50s %d",
1034 get_remote_ipaddr(), get_remote_port(), 1035 get_remote_ipaddr(), get_remote_port(), laddr, get_local_port());
1035 get_local_ipaddr(packet_get_connection_in()), get_local_port()); 1036 xfree(laddr);
1036 child_set_env(&env, &envsize, "SSH_CONNECTION", buf); 1037 child_set_env(&env, &envsize, "SSH_CONNECTION", buf);
1037 1038
1038 if (s->ttyfd != -1) 1039 if (s->ttyfd != -1)
diff --git a/sftp-client.c b/sftp-client.c
index 8c12dae11..3b3279e65 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -28,7 +28,7 @@
28/* XXX: copy between two remote sites */ 28/* XXX: copy between two remote sites */
29 29
30#include "includes.h" 30#include "includes.h"
31RCSID("$OpenBSD: sftp-client.c,v 1.41 2003/01/14 10:58:00 djm Exp $"); 31RCSID("$OpenBSD: sftp-client.c,v 1.42 2003/03/05 22:33:43 markus Exp $");
32 32
33#include "openbsd-compat/sys-queue.h" 33#include "openbsd-compat/sys-queue.h"
34 34
@@ -374,6 +374,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int printflag,
374 error("Couldn't read directory: %s", 374 error("Couldn't read directory: %s",
375 fx2txt(status)); 375 fx2txt(status));
376 do_close(conn, handle, handle_len); 376 do_close(conn, handle, handle_len);
377 xfree(handle);
377 return(status); 378 return(status);
378 } 379 }
379 } else if (type != SSH2_FXP_NAME) 380 } else if (type != SSH2_FXP_NAME)
@@ -1113,6 +1114,8 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1113 remote_path, fx2txt(status)); 1114 remote_path, fx2txt(status));
1114 do_close(conn, handle, handle_len); 1115 do_close(conn, handle, handle_len);
1115 close(local_fd); 1116 close(local_fd);
1117 xfree(data);
1118 xfree(ack);
1116 goto done; 1119 goto done;
1117 } 1120 }
1118 debug3("In write loop, ack for %u %u bytes at %llu", 1121 debug3("In write loop, ack for %u %u bytes at %llu",
diff --git a/sftp-int.c b/sftp-int.c
index 013ea84e0..6987de9a3 100644
--- a/sftp-int.c
+++ b/sftp-int.c
@@ -25,7 +25,7 @@
25/* XXX: recursive operations */ 25/* XXX: recursive operations */
26 26
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: sftp-int.c,v 1.56 2003/01/16 03:41:55 djm Exp $"); 28RCSID("$OpenBSD: sftp-int.c,v 1.57 2003/03/05 22:33:43 markus Exp $");
29 29
30#include "buffer.h" 30#include "buffer.h"
31#include "xmalloc.h" 31#include "xmalloc.h"
@@ -1104,6 +1104,7 @@ interactive_loop(int fd_in, int fd_out, char *file1, char *file2)
1104 1104
1105 err = parse_dispatch_command(conn, cmd, &pwd, 1); 1105 err = parse_dispatch_command(conn, cmd, &pwd, 1);
1106 xfree(dir); 1106 xfree(dir);
1107 xfree(pwd);
1107 return (err); 1108 return (err);
1108 } 1109 }
1109 xfree(dir); 1110 xfree(dir);
diff --git a/sftp-server.c b/sftp-server.c
index 4eb31d94e..0c00003f8 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -22,7 +22,7 @@
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24#include "includes.h" 24#include "includes.h"
25RCSID("$OpenBSD: sftp-server.c,v 1.39 2003/02/06 09:29:18 markus Exp $"); 25RCSID("$OpenBSD: sftp-server.c,v 1.40 2003/03/05 22:33:43 markus Exp $");
26 26
27#include "buffer.h" 27#include "buffer.h"
28#include "bufaux.h" 28#include "bufaux.h"
@@ -158,7 +158,7 @@ handle_new(int use, char *name, int fd, DIR *dirp)
158 handles[i].use = use; 158 handles[i].use = use;
159 handles[i].dirp = dirp; 159 handles[i].dirp = dirp;
160 handles[i].fd = fd; 160 handles[i].fd = fd;
161 handles[i].name = name; 161 handles[i].name = xstrdup(name);
162 return i; 162 return i;
163 } 163 }
164 } 164 }
@@ -230,9 +230,11 @@ handle_close(int handle)
230 if (handle_is_ok(handle, HANDLE_FILE)) { 230 if (handle_is_ok(handle, HANDLE_FILE)) {
231 ret = close(handles[handle].fd); 231 ret = close(handles[handle].fd);
232 handles[handle].use = HANDLE_UNUSED; 232 handles[handle].use = HANDLE_UNUSED;
233 xfree(handles[handle].name);
233 } else if (handle_is_ok(handle, HANDLE_DIR)) { 234 } else if (handle_is_ok(handle, HANDLE_DIR)) {
234 ret = closedir(handles[handle].dirp); 235 ret = closedir(handles[handle].dirp);
235 handles[handle].use = HANDLE_UNUSED; 236 handles[handle].use = HANDLE_UNUSED;
237 xfree(handles[handle].name);
236 } else { 238 } else {
237 errno = ENOENT; 239 errno = ENOENT;
238 } 240 }
@@ -396,7 +398,7 @@ process_open(void)
396 if (fd < 0) { 398 if (fd < 0) {
397 status = errno_to_portable(errno); 399 status = errno_to_portable(errno);
398 } else { 400 } else {
399 handle = handle_new(HANDLE_FILE, xstrdup(name), fd, NULL); 401 handle = handle_new(HANDLE_FILE, name, fd, NULL);
400 if (handle < 0) { 402 if (handle < 0) {
401 close(fd); 403 close(fd);
402 } else { 404 } else {
@@ -681,7 +683,7 @@ process_opendir(void)
681 if (dirp == NULL) { 683 if (dirp == NULL) {
682 status = errno_to_portable(errno); 684 status = errno_to_portable(errno);
683 } else { 685 } else {
684 handle = handle_new(HANDLE_DIR, xstrdup(path), 0, dirp); 686 handle = handle_new(HANDLE_DIR, path, 0, dirp);
685 if (handle < 0) { 687 if (handle < 0) {
686 closedir(dirp); 688 closedir(dirp);
687 } else { 689 } else {
diff --git a/ssh-add.c b/ssh-add.c
index 0c2ce163c..9adec3094 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: ssh-add.c,v 1.65 2003/01/23 13:50:27 markus Exp $"); 38RCSID("$OpenBSD: ssh-add.c,v 1.66 2003/03/05 22:33:43 markus Exp $");
39 39
40#include <openssl/evp.h> 40#include <openssl/evp.h>
41 41
@@ -195,6 +195,7 @@ static int
195update_card(AuthenticationConnection *ac, int add, const char *id) 195update_card(AuthenticationConnection *ac, int add, const char *id)
196{ 196{
197 char *pin; 197 char *pin;
198 int ret = -1;
198 199
199 pin = read_passphrase("Enter passphrase for smartcard: ", RP_ALLOW_STDIN); 200 pin = read_passphrase("Enter passphrase for smartcard: ", RP_ALLOW_STDIN);
200 if (pin == NULL) 201 if (pin == NULL)
@@ -203,12 +204,14 @@ update_card(AuthenticationConnection *ac, int add, const char *id)
203 if (ssh_update_card(ac, add, id, pin)) { 204 if (ssh_update_card(ac, add, id, pin)) {
204 fprintf(stderr, "Card %s: %s\n", 205 fprintf(stderr, "Card %s: %s\n",
205 add ? "added" : "removed", id); 206 add ? "added" : "removed", id);
206 return 0; 207 ret = 0;
207 } else { 208 } else {
208 fprintf(stderr, "Could not %s card: %s\n", 209 fprintf(stderr, "Could not %s card: %s\n",
209 add ? "add" : "remove", id); 210 add ? "add" : "remove", id);
210 return -1; 211 ret = -1;
211 } 212 }
213 xfree(pin);
214 return ret;
212} 215}
213 216
214static int 217static int
diff --git a/sshconnect2.c b/sshconnect2.c
index 81d1b91c7..1f92f0296 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: sshconnect2.c,v 1.111 2003/02/16 17:09:57 markus Exp $"); 26RCSID("$OpenBSD: sshconnect2.c,v 1.112 2003/03/05 22:33:43 markus Exp $");
27 27
28#include "ssh.h" 28#include "ssh.h"
29#include "ssh2.h" 29#include "ssh2.h"
@@ -1014,6 +1014,7 @@ userauth_hostbased(Authctxt *authctxt)
1014 strlcpy(chost, p, len); 1014 strlcpy(chost, p, len);
1015 strlcat(chost, ".", len); 1015 strlcat(chost, ".", len);
1016 debug2("userauth_hostbased: chost %s", chost); 1016 debug2("userauth_hostbased: chost %s", chost);
1017 xfree(p);
1017 1018
1018 service = datafellows & SSH_BUG_HBSERVICE ? "ssh-userauth" : 1019 service = datafellows & SSH_BUG_HBSERVICE ? "ssh-userauth" :
1019 authctxt->service; 1020 authctxt->service;