From 75fccc5d58827d6b4500048102537ac539d84f3b Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 30 Mar 2019 07:27:26 +0000 Subject: [PATCH] Pass SshServerConfig through to sesschan.c. This will let me change the behaviour of the main session channel based on command-line tweaks. --- sesschan.c | 5 ++++- ssh1connection-server.c | 3 ++- ssh2connection-server.c | 2 +- sshserver.h | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sesschan.c b/sesschan.c index 6725a643..5a7ffcfc 100644 --- a/sesschan.c +++ b/sesschan.c @@ -43,6 +43,7 @@ typedef struct sesschan { bufchain subsys_input; SftpServer *sftpsrv; ScpServer *scpsrv; + const SshServerConfig *ssc; Channel chan; } sesschan; @@ -198,7 +199,8 @@ static const SeatVtable sesschan_seat_vt = { }; Channel *sesschan_new(SshChannel *c, LogContext *logctx, - const SftpServerVtable *sftpserver_vt) + const SftpServerVtable *sftpserver_vt, + const SshServerConfig *ssc) { sesschan *sess = snew(sesschan); memset(sess, 0, sizeof(sesschan)); @@ -207,6 +209,7 @@ Channel *sesschan_new(SshChannel *c, LogContext *logctx, sess->chan.vt = &sesschan_channelvt; sess->chan.initial_fixed_window_size = 0; sess->parent_logctx = logctx; + sess->ssc = ssc; /* Start with a completely default Conf */ sess->conf = conf_new(); diff --git a/ssh1connection-server.c b/ssh1connection-server.c index 41786306..ee05fbd2 100644 --- a/ssh1connection-server.c +++ b/ssh1connection-server.c @@ -59,7 +59,8 @@ void ssh1_connection_direction_specific_setup( if (!s->mainchan_chan) { s->mainchan_sc.vt = &ssh1sesschan_vtable; s->mainchan_sc.cl = &s->cl; - s->mainchan_chan = sesschan_new(&s->mainchan_sc, s->ppl.logctx, NULL); + s->mainchan_chan = sesschan_new( + &s->mainchan_sc, s->ppl.logctx, NULL, s->ssc); } } diff --git a/ssh2connection-server.c b/ssh2connection-server.c index a8ff1b0a..1467db11 100644 --- a/ssh2connection-server.c +++ b/ssh2connection-server.c @@ -30,7 +30,7 @@ static ChanopenResult chan_open_session( ppl_logevent("Opened session channel"); CHANOPEN_RETURN_SUCCESS(sesschan_new(sc, s->ppl.logctx, - s->sftpserver_vt)); + s->sftpserver_vt, s->ssc)); } static ChanopenResult chan_open_direct_tcpip( diff --git a/sshserver.h b/sshserver.h index 9c00c829..4df5c230 100644 --- a/sshserver.h +++ b/sshserver.h @@ -88,7 +88,8 @@ PacketProtocolLayer *ssh1_login_server_new( AuthPolicy *authpolicy, const SshServerConfig *ssc); Channel *sesschan_new(SshChannel *c, LogContext *logctx, - const SftpServerVtable *sftpserver_vt); + const SftpServerVtable *sftpserver_vt, + const SshServerConfig *ssc); Backend *pty_backend_create( Seat *seat, LogContext *logctx, Conf *conf, char **argv, const char *cmd,