version 1.310, 2023/04/06 03:21:31 |
version 1.311, 2023/08/28 03:28:43 |
|
|
ssh_packet_log_type(u_char type) |
ssh_packet_log_type(u_char type) |
{ |
{ |
switch (type) { |
switch (type) { |
|
case SSH2_MSG_PING: |
|
case SSH2_MSG_PONG: |
case SSH2_MSG_CHANNEL_DATA: |
case SSH2_MSG_CHANNEL_DATA: |
case SSH2_MSG_CHANNEL_EXTENDED_DATA: |
case SSH2_MSG_CHANNEL_EXTENDED_DATA: |
case SSH2_MSG_CHANNEL_WINDOW_ADJUST: |
case SSH2_MSG_CHANNEL_WINDOW_ADJUST: |
|
|
goto out; |
goto out; |
if (ssh_packet_log_type(*typep)) |
if (ssh_packet_log_type(*typep)) |
debug3("receive packet: type %u", *typep); |
debug3("receive packet: type %u", *typep); |
if (*typep < SSH2_MSG_MIN || *typep >= SSH2_MSG_LOCAL_MIN) { |
if (*typep < SSH2_MSG_MIN) { |
if ((r = sshpkt_disconnect(ssh, |
if ((r = sshpkt_disconnect(ssh, |
"Invalid ssh2 packet type: %d", *typep)) != 0 || |
"Invalid ssh2 packet type: %d", *typep)) != 0 || |
(r = ssh_packet_write_wait(ssh)) != 0) |
(r = ssh_packet_write_wait(ssh)) != 0) |
|
|
u_int reason, seqnr; |
u_int reason, seqnr; |
int r; |
int r; |
u_char *msg; |
u_char *msg; |
|
const u_char *d; |
|
size_t len; |
|
|
for (;;) { |
for (;;) { |
msg = NULL; |
msg = NULL; |
|
|
return r; |
return r; |
debug("Received SSH2_MSG_UNIMPLEMENTED for %u", |
debug("Received SSH2_MSG_UNIMPLEMENTED for %u", |
seqnr); |
seqnr); |
|
break; |
|
case SSH2_MSG_PING: |
|
if ((r = sshpkt_get_string_direct(ssh, &d, &len)) != 0) |
|
return r; |
|
DBG(debug("Received SSH2_MSG_PING len %zu", len)); |
|
if ((r = sshpkt_start(ssh, SSH2_MSG_PONG)) != 0 || |
|
(r = sshpkt_put_string(ssh, d, len)) != 0 || |
|
(r = sshpkt_send(ssh)) != 0) |
|
return r; |
|
break; |
|
case SSH2_MSG_PONG: |
|
if ((r = sshpkt_get_string_direct(ssh, |
|
NULL, &len)) != 0) |
|
return r; |
|
DBG(debug("Received SSH2_MSG_PONG len %zu", len)); |
break; |
break; |
default: |
default: |
return 0; |
return 0; |