summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-05-14 13:45:42 +1000
committerDamien Miller <djm@mindrot.org>2003-05-14 13:45:42 +1000
commitb1ca8bb159bba7cedebe8fa467bf29e4ab1a65be (patch)
treebfd881a8f80929bb17f02aafe58e275bacfeb0de
parentdb2747259c1a433a504085f733768d0d209eb50d (diff)
- markus@cvs.openbsd.org 2003/05/11 20:30:25
[channels.c clientloop.c serverloop.c session.c ssh.c] make channel_new() strdup the 'remote_name' (not the caller); ok theo
-rw-r--r--ChangeLog5
-rw-r--r--channels.c29
-rw-r--r--clientloop.c9
-rw-r--r--serverloop.c6
-rw-r--r--session.c4
-rw-r--r--ssh.c4
6 files changed, 26 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index 3f6e36681..795bae3c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -42,6 +42,9 @@
42 rsa1 private or rsa1 public and ssh2 keys. 42 rsa1 private or rsa1 public and ssh2 keys.
43 this makes ssh-keygen -e fail for ssh1 keys more gracefully 43 this makes ssh-keygen -e fail for ssh1 keys more gracefully
44 for example; report from itojun (netbsd pr 20550). 44 for example; report from itojun (netbsd pr 20550).
45 - markus@cvs.openbsd.org 2003/05/11 20:30:25
46 [channels.c clientloop.c serverloop.c session.c ssh.c]
47 make channel_new() strdup the 'remote_name' (not the caller); ok theo
45 48
4620030512 4920030512
47 - (djm) Redhat spec: Don't install profile.d scripts when not 50 - (djm) Redhat spec: Don't install profile.d scripts when not
@@ -1429,4 +1432,4 @@
1429 save auth method before monitor_reset_key_state(); bugzilla bug #284; 1432 save auth method before monitor_reset_key_state(); bugzilla bug #284;
1430 ok provos@ 1433 ok provos@
1431 1434
1432$Id: ChangeLog,v 1.2687 2003/05/14 03:45:22 djm Exp $ 1435$Id: ChangeLog,v 1.2688 2003/05/14 03:45:42 djm Exp $
diff --git a/channels.c b/channels.c
index 27707a128..ad879cc61 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.189 2003/04/14 14:17:50 markus Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.190 2003/05/11 20:30:24 markus Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -256,7 +256,7 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
256 c->local_consumed = 0; 256 c->local_consumed = 0;
257 c->local_maxpacket = maxpack; 257 c->local_maxpacket = maxpack;
258 c->remote_id = -1; 258 c->remote_id = -1;
259 c->remote_name = remote_name; 259 c->remote_name = xstrdup(remote_name);
260 c->remote_window = 0; 260 c->remote_window = 0;
261 c->remote_maxpacket = 0; 261 c->remote_maxpacket = 0;
262 c->force_drain = 0; 262 c->force_drain = 0;
@@ -1013,8 +1013,7 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
1013 1013
1014 nc = channel_new("accepted x11 socket", 1014 nc = channel_new("accepted x11 socket",
1015 SSH_CHANNEL_OPENING, newsock, newsock, -1, 1015 SSH_CHANNEL_OPENING, newsock, newsock, -1,
1016 c->local_window_max, c->local_maxpacket, 1016 c->local_window_max, c->local_maxpacket, 0, buf, 1);
1017 0, xstrdup(buf), 1);
1018 if (compat20) { 1017 if (compat20) {
1019 packet_start(SSH2_MSG_CHANNEL_OPEN); 1018 packet_start(SSH2_MSG_CHANNEL_OPEN);
1020 packet_put_cstring("x11"); 1019 packet_put_cstring("x11");
@@ -1129,10 +1128,8 @@ channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset)
1129 return; 1128 return;
1130 } 1129 }
1131 set_nodelay(newsock); 1130 set_nodelay(newsock);
1132 nc = channel_new(rtype, 1131 nc = channel_new(rtype, nextstate, newsock, newsock, -1,
1133 nextstate, newsock, newsock, -1, 1132 c->local_window_max, c->local_maxpacket, 0, rtype, 1);
1134 c->local_window_max, c->local_maxpacket,
1135 0, xstrdup(rtype), 1);
1136 nc->listening_port = c->listening_port; 1133 nc->listening_port = c->listening_port;
1137 nc->host_port = c->host_port; 1134 nc->host_port = c->host_port;
1138 strlcpy(nc->path, c->path, sizeof(nc->path)); 1135 strlcpy(nc->path, c->path, sizeof(nc->path));
@@ -1158,7 +1155,6 @@ static void
1158channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) 1155channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset)
1159{ 1156{
1160 Channel *nc; 1157 Channel *nc;
1161 char *name;
1162 int newsock; 1158 int newsock;
1163 struct sockaddr addr; 1159 struct sockaddr addr;
1164 socklen_t addrlen; 1160 socklen_t addrlen;
@@ -1170,11 +1166,10 @@ channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset)
1170 error("accept from auth socket: %.100s", strerror(errno)); 1166 error("accept from auth socket: %.100s", strerror(errno));
1171 return; 1167 return;
1172 } 1168 }
1173 name = xstrdup("accepted auth socket");
1174 nc = channel_new("accepted auth socket", 1169 nc = channel_new("accepted auth socket",
1175 SSH_CHANNEL_OPENING, newsock, newsock, -1, 1170 SSH_CHANNEL_OPENING, newsock, newsock, -1,
1176 c->local_window_max, c->local_maxpacket, 1171 c->local_window_max, c->local_maxpacket,
1177 0, name, 1); 1172 0, "accepted auth socket", 1);
1178 if (compat20) { 1173 if (compat20) {
1179 packet_start(SSH2_MSG_CHANNEL_OPEN); 1174 packet_start(SSH2_MSG_CHANNEL_OPEN);
1180 packet_put_cstring("auth-agent@openssh.com"); 1175 packet_put_cstring("auth-agent@openssh.com");
@@ -1996,8 +1991,8 @@ channel_input_port_open(int type, u_int32_t seq, void *ctxt)
1996 originator_string, 1); 1991 originator_string, 1);
1997 c->remote_id = remote_id; 1992 c->remote_id = remote_id;
1998 } 1993 }
1994 xfree(originator_string);
1999 if (c == NULL) { 1995 if (c == NULL) {
2000 xfree(originator_string);
2001 packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); 1996 packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE);
2002 packet_put_int(remote_id); 1997 packet_put_int(remote_id);
2003 packet_send(); 1998 packet_send();
@@ -2094,7 +2089,7 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por
2094 /* Allocate a channel number for the socket. */ 2089 /* Allocate a channel number for the socket. */
2095 c = channel_new("port listener", type, sock, sock, -1, 2090 c = channel_new("port listener", type, sock, sock, -1,
2096 CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 2091 CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
2097 0, xstrdup("port listener"), 1); 2092 0, "port listener", 1);
2098 strlcpy(c->path, host, sizeof(c->path)); 2093 strlcpy(c->path, host, sizeof(c->path));
2099 c->host_port = port_to_connect; 2094 c->host_port = port_to_connect;
2100 c->listening_port = listen_port; 2095 c->listening_port = listen_port;
@@ -2450,7 +2445,7 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost,
2450 nc = channel_new("x11 listener", 2445 nc = channel_new("x11 listener",
2451 SSH_CHANNEL_X11_LISTENER, sock, sock, -1, 2446 SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
2452 CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 2447 CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT,
2453 0, xstrdup("X11 inet listener"), 1); 2448 0, "X11 inet listener", 1);
2454 nc->single_connection = single_connection; 2449 nc->single_connection = single_connection;
2455 } 2450 }
2456 2451
@@ -2607,11 +2602,11 @@ x11_input_open(int type, u_int32_t seq, void *ctxt)
2607 c->remote_id = remote_id; 2602 c->remote_id = remote_id;
2608 c->force_drain = 1; 2603 c->force_drain = 1;
2609 } 2604 }
2605 xfree(remote_host);
2610 if (c == NULL) { 2606 if (c == NULL) {
2611 /* Send refusal to the remote host. */ 2607 /* Send refusal to the remote host. */
2612 packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); 2608 packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE);
2613 packet_put_int(remote_id); 2609 packet_put_int(remote_id);
2614 xfree(remote_host);
2615 } else { 2610 } else {
2616 /* Send a confirmation to the remote host. */ 2611 /* Send a confirmation to the remote host. */
2617 packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION); 2612 packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION);
@@ -2733,7 +2728,6 @@ auth_input_open_request(int type, u_int32_t seq, void *ctxt)
2733{ 2728{
2734 Channel *c = NULL; 2729 Channel *c = NULL;
2735 int remote_id, sock; 2730 int remote_id, sock;
2736 char *name;
2737 2731
2738 /* Read the remote channel number from the message. */ 2732 /* Read the remote channel number from the message. */
2739 remote_id = packet_get_int(); 2733 remote_id = packet_get_int();
@@ -2752,9 +2746,8 @@ auth_input_open_request(int type, u_int32_t seq, void *ctxt)
2752 * agent. 2746 * agent.
2753 */ 2747 */
2754 if (sock >= 0) { 2748 if (sock >= 0) {
2755 name = xstrdup("authentication agent connection");
2756 c = channel_new("", SSH_CHANNEL_OPEN, sock, sock, 2749 c = channel_new("", SSH_CHANNEL_OPEN, sock, sock,
2757 -1, 0, 0, 0, name, 1); 2750 -1, 0, 0, 0, "authentication agent connection", 1);
2758 c->remote_id = remote_id; 2751 c->remote_id = remote_id;
2759 c->force_drain = 1; 2752 c->force_drain = 1;
2760 } 2753 }
diff --git a/clientloop.c b/clientloop.c
index e4ef71632..e5270aa57 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -59,7 +59,7 @@
59 */ 59 */
60 60
61#include "includes.h" 61#include "includes.h"
62RCSID("$OpenBSD: clientloop.c,v 1.109 2003/04/08 20:21:28 itojun Exp $"); 62RCSID("$OpenBSD: clientloop.c,v 1.110 2003/05/11 20:30:24 markus Exp $");
63 63
64#include "ssh.h" 64#include "ssh.h"
65#include "ssh1.h" 65#include "ssh1.h"
@@ -1145,7 +1145,7 @@ client_request_forwarded_tcpip(const char *request_type, int rchan)
1145 c = channel_new("forwarded-tcpip", 1145 c = channel_new("forwarded-tcpip",
1146 SSH_CHANNEL_CONNECTING, sock, sock, -1, 1146 SSH_CHANNEL_CONNECTING, sock, sock, -1,
1147 CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0, 1147 CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0,
1148 xstrdup(originator_address), 1); 1148 originator_address, 1);
1149 xfree(originator_address); 1149 xfree(originator_address);
1150 xfree(listen_address); 1150 xfree(listen_address);
1151 return c; 1151 return c;
@@ -1181,8 +1181,7 @@ client_request_x11(const char *request_type, int rchan)
1181 return NULL; 1181 return NULL;
1182 c = channel_new("x11", 1182 c = channel_new("x11",
1183 SSH_CHANNEL_X11_OPEN, sock, sock, -1, 1183 SSH_CHANNEL_X11_OPEN, sock, sock, -1,
1184 CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, 1184 CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, "x11", 1);
1185 xstrdup("x11"), 1);
1186 c->force_drain = 1; 1185 c->force_drain = 1;
1187 return c; 1186 return c;
1188} 1187}
@@ -1204,7 +1203,7 @@ client_request_agent(const char *request_type, int rchan)
1204 c = channel_new("authentication agent connection", 1203 c = channel_new("authentication agent connection",
1205 SSH_CHANNEL_OPEN, sock, sock, -1, 1204 SSH_CHANNEL_OPEN, sock, sock, -1,
1206 CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0, 1205 CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0,
1207 xstrdup("authentication agent connection"), 1); 1206 "authentication agent connection", 1);
1208 c->force_drain = 1; 1207 c->force_drain = 1;
1209 return c; 1208 return c;
1210} 1209}
diff --git a/serverloop.c b/serverloop.c
index 187afc716..39c2a488c 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: serverloop.c,v 1.107 2003/04/02 09:48:07 markus Exp $"); 38RCSID("$OpenBSD: serverloop.c,v 1.108 2003/05/11 20:30:24 markus Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "packet.h" 41#include "packet.h"
@@ -880,7 +880,7 @@ server_request_direct_tcpip(char *ctype)
880 return NULL; 880 return NULL;
881 c = channel_new(ctype, SSH_CHANNEL_CONNECTING, 881 c = channel_new(ctype, SSH_CHANNEL_CONNECTING,
882 sock, sock, -1, CHAN_TCP_WINDOW_DEFAULT, 882 sock, sock, -1, CHAN_TCP_WINDOW_DEFAULT,
883 CHAN_TCP_PACKET_DEFAULT, 0, xstrdup("direct-tcpip"), 1); 883 CHAN_TCP_PACKET_DEFAULT, 0, "direct-tcpip", 1);
884 return c; 884 return c;
885} 885}
886 886
@@ -899,7 +899,7 @@ server_request_session(char *ctype)
899 */ 899 */
900 c = channel_new(ctype, SSH_CHANNEL_LARVAL, 900 c = channel_new(ctype, SSH_CHANNEL_LARVAL,
901 -1, -1, -1, /*window size*/0, CHAN_SES_PACKET_DEFAULT, 901 -1, -1, -1, /*window size*/0, CHAN_SES_PACKET_DEFAULT,
902 0, xstrdup("server-session"), 1); 902 0, "server-session", 1);
903 if (session_open(xxx_authctxt, c->self) != 1) { 903 if (session_open(xxx_authctxt, c->self) != 1) {
904 debug("session open failed, free channel %d", c->self); 904 debug("session open failed, free channel %d", c->self);
905 channel_free(c); 905 channel_free(c);
diff --git a/session.c b/session.c
index f52bc6585..1a86f5f81 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.155 2003/04/08 20:21:29 itojun Exp $"); 36RCSID("$OpenBSD: session.c,v 1.156 2003/05/11 20:30:25 markus Exp $");
37 37
38#include "ssh.h" 38#include "ssh.h"
39#include "ssh1.h" 39#include "ssh1.h"
@@ -192,7 +192,7 @@ auth_input_request_forwarding(struct passwd * pw)
192 nc = channel_new("auth socket", 192 nc = channel_new("auth socket",
193 SSH_CHANNEL_AUTH_SOCKET, sock, sock, -1, 193 SSH_CHANNEL_AUTH_SOCKET, sock, sock, -1,
194 CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 194 CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT,
195 0, xstrdup("auth socket"), 1); 195 0, "auth socket", 1);
196 strlcpy(nc->path, auth_sock_name, sizeof(nc->path)); 196 strlcpy(nc->path, auth_sock_name, sizeof(nc->path));
197 return 1; 197 return 1;
198} 198}
diff --git a/ssh.c b/ssh.c
index 307b5f26a..6f5a146fe 100644
--- a/ssh.c
+++ b/ssh.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: ssh.c,v 1.191 2003/04/08 20:21:29 itojun Exp $"); 43RCSID("$OpenBSD: ssh.c,v 1.192 2003/05/11 20:30:25 markus Exp $");
44 44
45#include <openssl/evp.h> 45#include <openssl/evp.h>
46#include <openssl/err.h> 46#include <openssl/err.h>
@@ -1132,7 +1132,7 @@ ssh_session2_open(void)
1132 c = channel_new( 1132 c = channel_new(
1133 "session", SSH_CHANNEL_OPENING, in, out, err, 1133 "session", SSH_CHANNEL_OPENING, in, out, err,
1134 window, packetmax, CHAN_EXTENDED_WRITE, 1134 window, packetmax, CHAN_EXTENDED_WRITE,
1135 xstrdup("client-session"), /*nonblock*/0); 1135 "client-session", /*nonblock*/0);
1136 1136
1137 debug3("ssh_session2_open: channel_new: %d", c->self); 1137 debug3("ssh_session2_open: channel_new: %d", c->self);
1138 1138