aboutsummaryrefslogtreecommitdiff
path: root/src/channels.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-06-28 17:52:58 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-06-29 14:41:14 +0200
commit206f3ff895d3d822ac4f23426136537129f9f062 (patch)
tree59728e18437ec9308d14a50082ef831b5b158612 /src/channels.c
parent81b4320318966e83678641a06717c301b071971b (diff)
downloadlibssh-206f3ff895d3d822ac4f23426136537129f9f062.tar.gz
libssh-206f3ff895d3d822ac4f23426136537129f9f062.tar.xz
libssh-206f3ff895d3d822ac4f23426136537129f9f062.zip
Rest in Peace SSHv1
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'src/channels.c')
-rw-r--r--src/channels.c89
1 files changed, 3 insertions, 86 deletions
diff --git a/src/channels.c b/src/channels.c
index 38e9280c..85906d03 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -106,7 +106,6 @@ ssh_channel ssh_channel_new(ssh_session session) {
}
channel->session = session;
- channel->version = session->version;
channel->exit_status = -1;
channel->flags = SSH_CHANNEL_FLAG_NOT_BOUND;
@@ -346,13 +345,6 @@ static int grow_window(ssh_session session, ssh_channel channel, int minimumsize
uint32_t new_window = minimumsize > WINDOWBASE ? minimumsize : WINDOWBASE;
int rc;
-#ifdef WITH_SSH1
- if (session->version == 1){
- channel->remote_window = new_window;
-
- return SSH_OK;
- }
-#endif
if(new_window <= channel->local_window){
SSH_LOG(SSH_LOG_PROTOCOL,
"growing window (channel %d:%d) to %d bytes : not needed (%d bytes)",
@@ -398,8 +390,6 @@ error:
*
* @brief Parse a channel-related packet to resolve it to a ssh_channel.
*
- * This works on SSH1 sessions too.
- *
* @param[in] session The current SSH session.
*
* @param[in] packet The buffer to parse packet from. The read pointer will
@@ -412,11 +402,7 @@ static ssh_channel channel_from_msg(ssh_session session, ssh_buffer packet) {
ssh_channel channel;
uint32_t chan;
int rc;
-#ifdef WITH_SSH1
- /* With SSH1, the channel is always the first one */
- if(session->version==1)
- return ssh_get_channel1(session);
-#endif
+
rc = ssh_buffer_unpack(packet,"d",&chan);
if (rc != SSH_OK) {
ssh_set_error(session, SSH_FATAL,
@@ -874,12 +860,6 @@ int ssh_channel_open_session(ssh_channel channel) {
return SSH_ERROR;
}
-#ifdef WITH_SSH1
- if (channel->session->version == 1) {
- return ssh_channel_open_session1(channel);
- }
-#endif
-
return channel_open(channel,
"session",
CHANNEL_INITIAL_WINDOW,
@@ -907,12 +887,6 @@ int ssh_channel_open_auth_agent(ssh_channel channel){
return SSH_ERROR;
}
-#ifdef WITH_SSH1
- if (channel->session->version == 1) {
- return SSH_ERROR;
- }
-#endif
-
return channel_open(channel,
"auth-agent@openssh.com",
CHANNEL_INITIAL_WINDOW,
@@ -1263,13 +1237,7 @@ static int channel_write_common(ssh_channel channel,
if (session->session_state == SSH_SESSION_STATE_ERROR) {
return SSH_ERROR;
}
-#ifdef WITH_SSH1
- if (channel->version == 1) {
- rc = ssh_channel_write1(channel, data, len);
- return rc;
- }
-#endif
if (ssh_waitsession_unblocked(session) == 0){
rc = ssh_handle_packets_termination(session, SSH_TIMEOUT_DEFAULT,
ssh_waitsession_unblocked, session);
@@ -1477,8 +1445,6 @@ void ssh_channel_set_blocking(ssh_channel channel, int blocking) {
* @internal
*
* @brief handle a SSH_CHANNEL_SUCCESS packet and set the channel state.
- *
- * This works on SSH1 sessions too.
*/
SSH_PACKET_CALLBACK(ssh_packet_channel_success){
ssh_channel channel;
@@ -1509,8 +1475,6 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_success){
* @internal
*
* @brief Handle a SSH_CHANNEL_FAILURE packet and set the channel state.
- *
- * This works on SSH1 sessions too.
*/
SSH_PACKET_CALLBACK(ssh_packet_channel_failure){
ssh_channel channel;
@@ -1663,13 +1627,6 @@ int ssh_channel_request_pty_size(ssh_channel channel, const char *terminal,
return rc;
}
-#ifdef WITH_SSH1
- if (channel->version==1) {
- rc = ssh_channel_request_pty_size1(channel,terminal, col, row);
-
- return rc;
- }
-#endif
switch(channel->request_state){
case SSH_CHANNEL_REQ_STATE_NONE:
break;
@@ -1741,14 +1698,6 @@ int ssh_channel_change_pty_size(ssh_channel channel, int cols, int rows) {
ssh_buffer buffer = NULL;
int rc = SSH_ERROR;
-#ifdef WITH_SSH1
- if (channel->version == 1) {
- rc = ssh_channel_change_pty_size1(channel,cols,rows);
-
- return rc;
- }
-#endif
-
buffer = ssh_buffer_new();
if (buffer == NULL) {
ssh_set_error_oom(session);
@@ -1787,12 +1736,8 @@ int ssh_channel_request_shell(ssh_channel channel) {
if(channel == NULL) {
return SSH_ERROR;
}
-#ifdef WITH_SSH1
- if (channel->version == 1) {
- return ssh_channel_request_shell1(channel);
- }
-#endif
- return channel_request(channel, "shell", NULL, 1);
+
+ return channel_request(channel, "shell", NULL, 1);
}
/**
@@ -2428,11 +2373,6 @@ int ssh_channel_request_exec(ssh_channel channel, const char *cmd) {
return rc;
}
-#ifdef WITH_SSH1
- if (channel->version == 1) {
- return ssh_channel_request_exec1(channel, cmd);
- }
-#endif
switch(channel->request_state){
case SSH_CHANNEL_REQ_STATE_NONE:
break;
@@ -2503,12 +2443,6 @@ int ssh_channel_request_send_signal(ssh_channel channel, const char *sig) {
return rc;
}
-#ifdef WITH_SSH1
- if (channel->version == 1) {
- return SSH_ERROR; // TODO: Add support for SSH-v1 if possible.
- }
-#endif
-
buffer = ssh_buffer_new();
if (buffer == NULL) {
ssh_set_error_oom(channel->session);
@@ -2551,12 +2485,6 @@ int ssh_channel_request_send_break(ssh_channel channel, uint32_t length) {
return SSH_ERROR;
}
-#ifdef WITH_SSH1
- if (channel->version == 1) {
- return SSH_ERROR;
- }
-#endif
-
buffer = ssh_buffer_new();
if (buffer == NULL) {
ssh_set_error_oom(channel->session);
@@ -3432,12 +3360,6 @@ int ssh_channel_request_send_exit_status(ssh_channel channel, int exit_status) {
return SSH_ERROR;
}
-#ifdef WITH_SSH1
- if (channel->version == 1) {
- return SSH_ERROR; // TODO: Add support for SSH-v1 if possible.
- }
-#endif
-
buffer = ssh_buffer_new();
if (buffer == NULL) {
ssh_set_error_oom(channel->session);
@@ -3487,11 +3409,6 @@ int ssh_channel_request_send_exit_signal(ssh_channel channel, const char *sig,
ssh_set_error_invalid(channel->session);
return rc;
}
-#ifdef WITH_SSH1
- if (channel->version == 1) {
- return SSH_ERROR; // TODO: Add support for SSH-v1 if possible.
- }
-#endif
buffer = ssh_buffer_new();
if (buffer == NULL) {