summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/channels.c b/channels.c
index cc2613a88..9f042d44e 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.150 2001/12/20 22:50:24 djm Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.151 2001/12/27 20:39:58 markus Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -1734,7 +1734,6 @@ channel_input_data(int type, int plen, u_int32_t seq, void *ctxt)
1734 1734
1735 /* Get the data. */ 1735 /* Get the data. */
1736 data = packet_get_string(&data_len); 1736 data = packet_get_string(&data_len);
1737 packet_done();
1738 1737
1739 if (compat20) { 1738 if (compat20) {
1740 if (data_len > c->local_maxpacket) { 1739 if (data_len > c->local_maxpacket) {
@@ -1748,9 +1747,8 @@ channel_input_data(int type, int plen, u_int32_t seq, void *ctxt)
1748 return; 1747 return;
1749 } 1748 }
1750 c->local_window -= data_len; 1749 c->local_window -= data_len;
1751 }else{
1752 packet_integrity_check(plen, 4 + 4 + data_len, type);
1753 } 1750 }
1751 packet_done();
1754 buffer_append(&c->output, data, data_len); 1752 buffer_append(&c->output, data, data_len);
1755 xfree(data); 1753 xfree(data);
1756} 1754}
@@ -1801,9 +1799,8 @@ channel_input_ieof(int type, int plen, u_int32_t seq, void *ctxt)
1801 int id; 1799 int id;
1802 Channel *c; 1800 Channel *c;
1803 1801
1804 packet_integrity_check(plen, 4, type);
1805
1806 id = packet_get_int(); 1802 id = packet_get_int();
1803 packet_done();
1807 c = channel_lookup(id); 1804 c = channel_lookup(id);
1808 if (c == NULL) 1805 if (c == NULL)
1809 packet_disconnect("Received ieof for nonexistent channel %d.", id); 1806 packet_disconnect("Received ieof for nonexistent channel %d.", id);
@@ -1823,9 +1820,8 @@ channel_input_close(int type, int plen, u_int32_t seq, void *ctxt)
1823 int id; 1820 int id;
1824 Channel *c; 1821 Channel *c;
1825 1822
1826 packet_integrity_check(plen, 4, type);
1827
1828 id = packet_get_int(); 1823 id = packet_get_int();
1824 packet_done();
1829 c = channel_lookup(id); 1825 c = channel_lookup(id);
1830 if (c == NULL) 1826 if (c == NULL)
1831 packet_disconnect("Received close for nonexistent channel %d.", id); 1827 packet_disconnect("Received close for nonexistent channel %d.", id);
@@ -1861,7 +1857,8 @@ channel_input_oclose(int type, int plen, u_int32_t seq, void *ctxt)
1861{ 1857{
1862 int id = packet_get_int(); 1858 int id = packet_get_int();
1863 Channel *c = channel_lookup(id); 1859 Channel *c = channel_lookup(id);
1864 packet_integrity_check(plen, 4, type); 1860
1861 packet_done();
1865 if (c == NULL) 1862 if (c == NULL)
1866 packet_disconnect("Received oclose for nonexistent channel %d.", id); 1863 packet_disconnect("Received oclose for nonexistent channel %d.", id);
1867 chan_rcvd_oclose(c); 1864 chan_rcvd_oclose(c);
@@ -1889,9 +1886,6 @@ channel_input_open_confirmation(int type, int plen, u_int32_t seq, void *ctxt)
1889 int id, remote_id; 1886 int id, remote_id;
1890 Channel *c; 1887 Channel *c;
1891 1888
1892 if (!compat20)
1893 packet_integrity_check(plen, 4 + 4, type);
1894
1895 id = packet_get_int(); 1889 id = packet_get_int();
1896 c = channel_lookup(id); 1890 c = channel_lookup(id);
1897 1891
@@ -1906,7 +1900,6 @@ channel_input_open_confirmation(int type, int plen, u_int32_t seq, void *ctxt)
1906 if (compat20) { 1900 if (compat20) {
1907 c->remote_window = packet_get_int(); 1901 c->remote_window = packet_get_int();
1908 c->remote_maxpacket = packet_get_int(); 1902 c->remote_maxpacket = packet_get_int();
1909 packet_done();
1910 if (c->cb_fn != NULL && c->cb_event == type) { 1903 if (c->cb_fn != NULL && c->cb_event == type) {
1911 debug2("callback start"); 1904 debug2("callback start");
1912 c->cb_fn(c->self, c->cb_arg); 1905 c->cb_fn(c->self, c->cb_arg);
@@ -1915,6 +1908,7 @@ channel_input_open_confirmation(int type, int plen, u_int32_t seq, void *ctxt)
1915 debug("channel %d: open confirm rwindow %d rmax %d", c->self, 1908 debug("channel %d: open confirm rwindow %d rmax %d", c->self,
1916 c->remote_window, c->remote_maxpacket); 1909 c->remote_window, c->remote_maxpacket);
1917 } 1910 }
1911 packet_done();
1918} 1912}
1919 1913
1920static char * 1914static char *
@@ -1940,9 +1934,6 @@ channel_input_open_failure(int type, int plen, u_int32_t seq, void *ctxt)
1940 char *msg = NULL, *lang = NULL; 1934 char *msg = NULL, *lang = NULL;
1941 Channel *c; 1935 Channel *c;
1942 1936
1943 if (!compat20)
1944 packet_integrity_check(plen, 4, type);
1945
1946 id = packet_get_int(); 1937 id = packet_get_int();
1947 c = channel_lookup(id); 1938 c = channel_lookup(id);
1948 1939
@@ -1955,7 +1946,6 @@ channel_input_open_failure(int type, int plen, u_int32_t seq, void *ctxt)
1955 msg = packet_get_string(NULL); 1946 msg = packet_get_string(NULL);
1956 lang = packet_get_string(NULL); 1947 lang = packet_get_string(NULL);
1957 } 1948 }
1958 packet_done();
1959 log("channel %d: open failed: %s%s%s", id, 1949 log("channel %d: open failed: %s%s%s", id,
1960 reason2txt(reason), msg ? ": ": "", msg ? msg : ""); 1950 reason2txt(reason), msg ? ": ": "", msg ? msg : "");
1961 if (msg != NULL) 1951 if (msg != NULL)
@@ -1963,6 +1953,7 @@ channel_input_open_failure(int type, int plen, u_int32_t seq, void *ctxt)
1963 if (lang != NULL) 1953 if (lang != NULL)
1964 xfree(lang); 1954 xfree(lang);
1965 } 1955 }
1956 packet_done();
1966 /* Free the channel. This will also close the socket. */ 1957 /* Free the channel. This will also close the socket. */
1967 channel_free(c); 1958 channel_free(c);
1968} 1959}
@@ -2888,10 +2879,9 @@ auth_input_open_request(int type, int plen, u_int32_t seq, void *ctxt)
2888 int remote_id, sock; 2879 int remote_id, sock;
2889 char *name; 2880 char *name;
2890 2881
2891 packet_integrity_check(plen, 4, type);
2892
2893 /* Read the remote channel number from the message. */ 2882 /* Read the remote channel number from the message. */
2894 remote_id = packet_get_int(); 2883 remote_id = packet_get_int();
2884 packet_done();
2895 2885
2896 /* 2886 /*
2897 * Get a connection to the local authentication agent (this may again 2887 * Get a connection to the local authentication agent (this may again