summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--channels.c45
-rw-r--r--channels.h3
-rw-r--r--clientloop.c44
4 files changed, 48 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index 5da6cd64e..7f7b6f2a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,9 @@
13 [progressmeter.c] 13 [progressmeter.c]
14 don't print trailing \0; bug #709; Robert.Dahlem@siemens.com 14 don't print trailing \0; bug #709; Robert.Dahlem@siemens.com
15 ok millert/deraadt@ 15 ok millert/deraadt@
16 - markus@cvs.openbsd.org 2003/09/23 20:41:11
17 [channels.c channels.h clientloop.c]
18 move client only agent code to clientloop.c
16 19
1720030930 2020030930
18 - (bal) Fix issues in openbsd-compat/realpath.c 21 - (bal) Fix issues in openbsd-compat/realpath.c
@@ -1248,4 +1251,4 @@
1248 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. 1251 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
1249 Report from murple@murple.net, diagnosis from dtucker@zip.com.au 1252 Report from murple@murple.net, diagnosis from dtucker@zip.com.au
1250 1253
1251$Id: ChangeLog,v 1.3046 2003/10/02 06:15:15 dtucker Exp $ 1254$Id: ChangeLog,v 1.3047 2003/10/02 06:17:00 dtucker Exp $
diff --git a/channels.c b/channels.c
index af2ae18b1..060d0f507 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.196 2003/09/19 11:31:33 markus Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.197 2003/09/23 20:41:11 markus Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -2838,46 +2838,3 @@ auth_request_forwarding(void)
2838 packet_send(); 2838 packet_send();
2839 packet_write_wait(); 2839 packet_write_wait();
2840} 2840}
2841
2842/* This is called to process an SSH_SMSG_AGENT_OPEN message. */
2843
2844void
2845auth_input_open_request(int type, u_int32_t seq, void *ctxt)
2846{
2847 Channel *c = NULL;
2848 int remote_id, sock;
2849
2850 /* Read the remote channel number from the message. */
2851 remote_id = packet_get_int();
2852 packet_check_eom();
2853
2854 /*
2855 * Get a connection to the local authentication agent (this may again
2856 * get forwarded).
2857 */
2858 sock = ssh_get_authentication_socket();
2859
2860 /*
2861 * If we could not connect the agent, send an error message back to
2862 * the server. This should never happen unless the agent dies,
2863 * because authentication forwarding is only enabled if we have an
2864 * agent.
2865 */
2866 if (sock >= 0) {
2867 c = channel_new("", SSH_CHANNEL_OPEN, sock, sock,
2868 -1, 0, 0, 0, "authentication agent connection", 1);
2869 c->remote_id = remote_id;
2870 c->force_drain = 1;
2871 }
2872 if (c == NULL) {
2873 packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE);
2874 packet_put_int(remote_id);
2875 } else {
2876 /* Send a confirmation to the remote host. */
2877 debug("Forwarding authentication connection.");
2878 packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION);
2879 packet_put_int(remote_id);
2880 packet_put_int(c->self);
2881 }
2882 packet_send();
2883}
diff --git a/channels.h b/channels.h
index bd2e92589..7d981479b 100644
--- a/channels.h
+++ b/channels.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.h,v 1.70 2002/06/24 14:33:27 markus Exp $ */ 1/* $OpenBSD: channels.h,v 1.71 2003/09/23 20:41:11 markus Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -214,7 +214,6 @@ void deny_input_open(int, u_int32_t, void *);
214/* agent forwarding */ 214/* agent forwarding */
215 215
216void auth_request_forwarding(void); 216void auth_request_forwarding(void);
217void auth_input_open_request(int, u_int32_t, void *);
218 217
219/* channel close */ 218/* channel close */
220 219
diff --git a/clientloop.c b/clientloop.c
index d3a32a81a..e7a7d9fa7 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.114 2003/09/23 20:17:11 markus Exp $"); 62RCSID("$OpenBSD: clientloop.c,v 1.115 2003/09/23 20:41:11 markus Exp $");
63 63
64#include "ssh.h" 64#include "ssh.h"
65#include "ssh1.h" 65#include "ssh1.h"
@@ -1125,6 +1125,46 @@ client_input_exit_status(int type, u_int32_t seq, void *ctxt)
1125 /* Flag that we want to exit. */ 1125 /* Flag that we want to exit. */
1126 quit_pending = 1; 1126 quit_pending = 1;
1127} 1127}
1128static void
1129client_input_agent_open(int type, u_int32_t seq, void *ctxt)
1130{
1131 Channel *c = NULL;
1132 int remote_id, sock;
1133
1134 /* Read the remote channel number from the message. */
1135 remote_id = packet_get_int();
1136 packet_check_eom();
1137
1138 /*
1139 * Get a connection to the local authentication agent (this may again
1140 * get forwarded).
1141 */
1142 sock = ssh_get_authentication_socket();
1143
1144 /*
1145 * If we could not connect the agent, send an error message back to
1146 * the server. This should never happen unless the agent dies,
1147 * because authentication forwarding is only enabled if we have an
1148 * agent.
1149 */
1150 if (sock >= 0) {
1151 c = channel_new("", SSH_CHANNEL_OPEN, sock, sock,
1152 -1, 0, 0, 0, "authentication agent connection", 1);
1153 c->remote_id = remote_id;
1154 c->force_drain = 1;
1155 }
1156 if (c == NULL) {
1157 packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE);
1158 packet_put_int(remote_id);
1159 } else {
1160 /* Send a confirmation to the remote host. */
1161 debug("Forwarding authentication connection.");
1162 packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION);
1163 packet_put_int(remote_id);
1164 packet_put_int(c->self);
1165 }
1166 packet_send();
1167}
1128 1168
1129static Channel * 1169static Channel *
1130client_request_forwarded_tcpip(const char *request_type, int rchan) 1170client_request_forwarded_tcpip(const char *request_type, int rchan)
@@ -1360,7 +1400,7 @@ client_init_dispatch_13(void)
1360 dispatch_set(SSH_SMSG_STDOUT_DATA, &client_input_stdout_data); 1400 dispatch_set(SSH_SMSG_STDOUT_DATA, &client_input_stdout_data);
1361 1401
1362 dispatch_set(SSH_SMSG_AGENT_OPEN, options.forward_agent ? 1402 dispatch_set(SSH_SMSG_AGENT_OPEN, options.forward_agent ?
1363 &auth_input_open_request : &deny_input_open); 1403 &client_input_agent_open : &deny_input_open);
1364 dispatch_set(SSH_SMSG_X11_OPEN, options.forward_x11 ? 1404 dispatch_set(SSH_SMSG_X11_OPEN, options.forward_x11 ?
1365 &x11_input_open : &deny_input_open); 1405 &x11_input_open : &deny_input_open);
1366} 1406}