[jira] [Commented] (SSHD-1244) Client fails window adjust above Integer.MAX_VALUE

2022-02-08 Thread Lyor Goldstein (Jira)


[ 
https://issues.apache.org/jira/browse/SSHD-1244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17488990#comment-17488990
 ] 

Lyor Goldstein commented on SSHD-1244:
--

Thanks - I'll merge it in and it will be available on our next official 
release. Meanwhile, if you really need it you can use the libraries you have 
compiled from the tree I created. +Note:+ the tree will be gone soon, but you 
can always re-compile the _master_ version since I will be merging into it.

> Client fails window adjust above Integer.MAX_VALUE
> --
>
> Key: SSHD-1244
> URL: https://issues.apache.org/jira/browse/SSHD-1244
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.8.0
>Reporter: Ryosuke Kanda
>Assignee: Lyor Goldstein
>Priority: Minor
> Attachments: Main.java
>
>
> If the new window size specified by SSH_MSG_CHANNEL_WINDOW_ADJUST exceeds 
> INT_MAX, it will not be recognized correctly.
> I think the cause is in the following places:
> org.apache.sshd.common.channel.Window.expand(int)
>  
> I am doing machine translation, so please allow it to be unnatural.
>  
> I encountered this issue when I was using ProFTPD as an SFTP server.
> The version of ProFTPD is 1.3.5e.
> The SFTP feature of ProFTPD notifies 2 ^ 32-1 bytes as the initial window 
> size by default.
> I've confirmed that SSHD can handle this without any problems, so I sent a 
> 4GB file to see what happens when Window Adjust is done.
> As a result, a Window Adjust was done and SSHD was unable to handle this 
> successfully.
>  
> I have attached the client implementation to this issue.
> (Maybe a poor implementation ...)
> The console logs, including the debug logs, were too large to attach.
> The parts that are clearly set for the SSH client are as follows.
> ServerKeyVerifier
> HostConfigEntryResolver
> KeyIdentityProvider
> In the log, the part where the error occurred is as follows.
> You can see that SSHD recognizes the new Window size as a negative value.
> {code:java}
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.sftp.client.impl.DefaultSftpClient$SftpChannelSubsystem - 
> handleWindowAdjust(SftpChannelSubsystem[id=0, 
> recipient=0]-ClientSessionImpl[kada@/192.168.12.222:18022][sftp]) 
> SSH_MSG_CHANNEL_WINDOW_ADJUST window=-94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> handleReadCycleFailure(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) IllegalArgumentException after 8166700 nanos 
> at read cycle=103401: Negative window size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> exceptionCaught(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) caught IllegalArgumentException[Negative 
> window size: -94217] - calling handler
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.client.session.ClientSessionImpl - 
> signalAuthFailure(ClientSessionImpl[kada@/192.168.12.222:18022]) 
> type=IllegalArgumentException, signalled=false, first=false: Negative window 
> size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] WARN 
> org.apache.sshd.client.session.ClientSessionImpl - 
> exceptionCaught(ClientSessionImpl[kada@/192.168.12.222:18022])[state=Opened] 
> IllegalArgumentException: Negative window size: -94217
> java.lang.IllegalArgumentException: Negative window size: -94217
>     at 
> org.apache.sshd.common.util.ValidateUtils.createFormattedException(ValidateUtils.java:213)
>     at 
> org.apache.sshd.common.util.ValidateUtils.throwIllegalArgumentException(ValidateUtils.java:179)
>     at 
> org.apache.sshd.common.util.ValidateUtils.checkTrue(ValidateUtils.java:162)
>     at org.apache.sshd.common.channel.Window.expand(Window.java:123)
>     at 
> org.apache.sshd.common.channel.AbstractChannel.handleWindowAdjust(AbstractChannel.java:894)
>     at 
> org.apache.sshd.client.channel.AbstractClientChannel.handleWindowAdjust(AbstractClientChannel.java:448)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.channelWindowAdjust(AbstractConnectionService.java:614)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.process(AbstractConnectionService.java:477)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:526)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:452)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1524)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:412)
>     at 
> 

[jira] [Commented] (SSHD-1244) Client fails window adjust above Integer.MAX_VALUE

2022-02-07 Thread Ryosuke Kanda (Jira)


[ 
https://issues.apache.org/jira/browse/SSHD-1244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17488555#comment-17488555
 ] 

Ryosuke Kanda commented on SSHD-1244:
-

I'm sorry I'm late. I tried.
Window Adjust was successful and was able to send a 4GB file.

Thank you for your prompt response.

 
{code:java}
10:33:13.394 | WARN  | 8]-nio2-thread-8 | o.a.s.c.c.Window                 | 
org.apache.sshd.common.channel.Window                             143 | 
expand(Window[client/remote](SftpChannelSubsystem[id=0, 
recipient=0]-ClientSessionImpl[kada@/192.168.12.222:18022][sftp])) 
window=4294873079 - truncated expanded size (4294901929) to 2147483647{code}
 

> Client fails window adjust above Integer.MAX_VALUE
> --
>
> Key: SSHD-1244
> URL: https://issues.apache.org/jira/browse/SSHD-1244
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.8.0
>Reporter: Ryosuke Kanda
>Assignee: Lyor Goldstein
>Priority: Minor
> Attachments: Main.java
>
>
> If the new window size specified by SSH_MSG_CHANNEL_WINDOW_ADJUST exceeds 
> INT_MAX, it will not be recognized correctly.
> I think the cause is in the following places:
> org.apache.sshd.common.channel.Window.expand(int)
>  
> I am doing machine translation, so please allow it to be unnatural.
>  
> I encountered this issue when I was using ProFTPD as an SFTP server.
> The version of ProFTPD is 1.3.5e.
> The SFTP feature of ProFTPD notifies 2 ^ 32-1 bytes as the initial window 
> size by default.
> I've confirmed that SSHD can handle this without any problems, so I sent a 
> 4GB file to see what happens when Window Adjust is done.
> As a result, a Window Adjust was done and SSHD was unable to handle this 
> successfully.
>  
> I have attached the client implementation to this issue.
> (Maybe a poor implementation ...)
> The console logs, including the debug logs, were too large to attach.
> The parts that are clearly set for the SSH client are as follows.
> ServerKeyVerifier
> HostConfigEntryResolver
> KeyIdentityProvider
> In the log, the part where the error occurred is as follows.
> You can see that SSHD recognizes the new Window size as a negative value.
> {code:java}
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.sftp.client.impl.DefaultSftpClient$SftpChannelSubsystem - 
> handleWindowAdjust(SftpChannelSubsystem[id=0, 
> recipient=0]-ClientSessionImpl[kada@/192.168.12.222:18022][sftp]) 
> SSH_MSG_CHANNEL_WINDOW_ADJUST window=-94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> handleReadCycleFailure(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) IllegalArgumentException after 8166700 nanos 
> at read cycle=103401: Negative window size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> exceptionCaught(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) caught IllegalArgumentException[Negative 
> window size: -94217] - calling handler
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.client.session.ClientSessionImpl - 
> signalAuthFailure(ClientSessionImpl[kada@/192.168.12.222:18022]) 
> type=IllegalArgumentException, signalled=false, first=false: Negative window 
> size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] WARN 
> org.apache.sshd.client.session.ClientSessionImpl - 
> exceptionCaught(ClientSessionImpl[kada@/192.168.12.222:18022])[state=Opened] 
> IllegalArgumentException: Negative window size: -94217
> java.lang.IllegalArgumentException: Negative window size: -94217
>     at 
> org.apache.sshd.common.util.ValidateUtils.createFormattedException(ValidateUtils.java:213)
>     at 
> org.apache.sshd.common.util.ValidateUtils.throwIllegalArgumentException(ValidateUtils.java:179)
>     at 
> org.apache.sshd.common.util.ValidateUtils.checkTrue(ValidateUtils.java:162)
>     at org.apache.sshd.common.channel.Window.expand(Window.java:123)
>     at 
> org.apache.sshd.common.channel.AbstractChannel.handleWindowAdjust(AbstractChannel.java:894)
>     at 
> org.apache.sshd.client.channel.AbstractClientChannel.handleWindowAdjust(AbstractClientChannel.java:448)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.channelWindowAdjust(AbstractConnectionService.java:614)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.process(AbstractConnectionService.java:477)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:526)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:452)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1524)
>     at 
> 

[jira] [Commented] (SSHD-1244) Client fails window adjust above Integer.MAX_VALUE

2022-02-04 Thread Lyor Goldstein (Jira)


[ 
https://issues.apache.org/jira/browse/SSHD-1244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17487041#comment-17487041
 ] 

Lyor Goldstein commented on SSHD-1244:
--

I have staged what I believe is a fix in 
https://github.com/lgoldstein/mina-sshd/tree/SSHD-1244. Please compile it and 
try it out - let me know if it fixes this problem.

> Client fails window adjust above Integer.MAX_VALUE
> --
>
> Key: SSHD-1244
> URL: https://issues.apache.org/jira/browse/SSHD-1244
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.8.0
>Reporter: Ryosuke Kanda
>Assignee: Lyor Goldstein
>Priority: Minor
> Attachments: Main.java
>
>
> If the new window size specified by SSH_MSG_CHANNEL_WINDOW_ADJUST exceeds 
> INT_MAX, it will not be recognized correctly.
> I think the cause is in the following places:
> org.apache.sshd.common.channel.Window.expand(int)
>  
> I am doing machine translation, so please allow it to be unnatural.
>  
> I encountered this issue when I was using ProFTPD as an SFTP server.
> The version of ProFTPD is 1.3.5e.
> The SFTP feature of ProFTPD notifies 2 ^ 32-1 bytes as the initial window 
> size by default.
> I've confirmed that SSHD can handle this without any problems, so I sent a 
> 4GB file to see what happens when Window Adjust is done.
> As a result, a Window Adjust was done and SSHD was unable to handle this 
> successfully.
>  
> I have attached the client implementation to this issue.
> (Maybe a poor implementation ...)
> The console logs, including the debug logs, were too large to attach.
> The parts that are clearly set for the SSH client are as follows.
> ServerKeyVerifier
> HostConfigEntryResolver
> KeyIdentityProvider
> In the log, the part where the error occurred is as follows.
> You can see that SSHD recognizes the new Window size as a negative value.
> {code:java}
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.sftp.client.impl.DefaultSftpClient$SftpChannelSubsystem - 
> handleWindowAdjust(SftpChannelSubsystem[id=0, 
> recipient=0]-ClientSessionImpl[kada@/192.168.12.222:18022][sftp]) 
> SSH_MSG_CHANNEL_WINDOW_ADJUST window=-94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> handleReadCycleFailure(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) IllegalArgumentException after 8166700 nanos 
> at read cycle=103401: Negative window size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> exceptionCaught(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) caught IllegalArgumentException[Negative 
> window size: -94217] - calling handler
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.client.session.ClientSessionImpl - 
> signalAuthFailure(ClientSessionImpl[kada@/192.168.12.222:18022]) 
> type=IllegalArgumentException, signalled=false, first=false: Negative window 
> size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] WARN 
> org.apache.sshd.client.session.ClientSessionImpl - 
> exceptionCaught(ClientSessionImpl[kada@/192.168.12.222:18022])[state=Opened] 
> IllegalArgumentException: Negative window size: -94217
> java.lang.IllegalArgumentException: Negative window size: -94217
>     at 
> org.apache.sshd.common.util.ValidateUtils.createFormattedException(ValidateUtils.java:213)
>     at 
> org.apache.sshd.common.util.ValidateUtils.throwIllegalArgumentException(ValidateUtils.java:179)
>     at 
> org.apache.sshd.common.util.ValidateUtils.checkTrue(ValidateUtils.java:162)
>     at org.apache.sshd.common.channel.Window.expand(Window.java:123)
>     at 
> org.apache.sshd.common.channel.AbstractChannel.handleWindowAdjust(AbstractChannel.java:894)
>     at 
> org.apache.sshd.client.channel.AbstractClientChannel.handleWindowAdjust(AbstractClientChannel.java:448)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.channelWindowAdjust(AbstractConnectionService.java:614)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.process(AbstractConnectionService.java:477)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:526)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:452)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1524)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:412)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:64)
>     at 
> org.apache.sshd.common.io.nio2.Nio2Session.handleReadCycleCompletion(Nio2Session.java:359)
>     at 
> 

[jira] [Commented] (SSHD-1244) Client fails window adjust above Integer.MAX_VALUE

2022-02-04 Thread Lyor Goldstein (Jira)


[ 
https://issues.apache.org/jira/browse/SSHD-1244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17486879#comment-17486879
 ] 

Lyor Goldstein commented on SSHD-1244:
--

I agree - already working on it - I believe I found the problem and it seems a 
straightforward fix.

> Client fails window adjust above Integer.MAX_VALUE
> --
>
> Key: SSHD-1244
> URL: https://issues.apache.org/jira/browse/SSHD-1244
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.8.0
>Reporter: Ryosuke Kanda
>Assignee: Lyor Goldstein
>Priority: Minor
> Attachments: Main.java
>
>
> If the new window size specified by SSH_MSG_CHANNEL_WINDOW_ADJUST exceeds 
> INT_MAX, it will not be recognized correctly.
> I think the cause is in the following places:
> org.apache.sshd.common.channel.Window.expand(int)
>  
> I am doing machine translation, so please allow it to be unnatural.
>  
> I encountered this issue when I was using ProFTPD as an SFTP server.
> The version of ProFTPD is 1.3.5e.
> The SFTP feature of ProFTPD notifies 2 ^ 32-1 bytes as the initial window 
> size by default.
> I've confirmed that SSHD can handle this without any problems, so I sent a 
> 4GB file to see what happens when Window Adjust is done.
> As a result, a Window Adjust was done and SSHD was unable to handle this 
> successfully.
>  
> I have attached the client implementation to this issue.
> (Maybe a poor implementation ...)
> The console logs, including the debug logs, were too large to attach.
> The parts that are clearly set for the SSH client are as follows.
> ServerKeyVerifier
> HostConfigEntryResolver
> KeyIdentityProvider
> In the log, the part where the error occurred is as follows.
> You can see that SSHD recognizes the new Window size as a negative value.
> {code:java}
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.sftp.client.impl.DefaultSftpClient$SftpChannelSubsystem - 
> handleWindowAdjust(SftpChannelSubsystem[id=0, 
> recipient=0]-ClientSessionImpl[kada@/192.168.12.222:18022][sftp]) 
> SSH_MSG_CHANNEL_WINDOW_ADJUST window=-94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> handleReadCycleFailure(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) IllegalArgumentException after 8166700 nanos 
> at read cycle=103401: Negative window size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> exceptionCaught(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) caught IllegalArgumentException[Negative 
> window size: -94217] - calling handler
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.client.session.ClientSessionImpl - 
> signalAuthFailure(ClientSessionImpl[kada@/192.168.12.222:18022]) 
> type=IllegalArgumentException, signalled=false, first=false: Negative window 
> size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] WARN 
> org.apache.sshd.client.session.ClientSessionImpl - 
> exceptionCaught(ClientSessionImpl[kada@/192.168.12.222:18022])[state=Opened] 
> IllegalArgumentException: Negative window size: -94217
> java.lang.IllegalArgumentException: Negative window size: -94217
>     at 
> org.apache.sshd.common.util.ValidateUtils.createFormattedException(ValidateUtils.java:213)
>     at 
> org.apache.sshd.common.util.ValidateUtils.throwIllegalArgumentException(ValidateUtils.java:179)
>     at 
> org.apache.sshd.common.util.ValidateUtils.checkTrue(ValidateUtils.java:162)
>     at org.apache.sshd.common.channel.Window.expand(Window.java:123)
>     at 
> org.apache.sshd.common.channel.AbstractChannel.handleWindowAdjust(AbstractChannel.java:894)
>     at 
> org.apache.sshd.client.channel.AbstractClientChannel.handleWindowAdjust(AbstractClientChannel.java:448)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.channelWindowAdjust(AbstractConnectionService.java:614)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.process(AbstractConnectionService.java:477)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:526)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:452)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1524)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:412)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:64)
>     at 
> org.apache.sshd.common.io.nio2.Nio2Session.handleReadCycleCompletion(Nio2Session.java:359)
>     at 
> 

[jira] [Commented] (SSHD-1244) Client fails window adjust above Integer.MAX_VALUE

2022-02-03 Thread Thomas Wolf (Jira)


[ 
https://issues.apache.org/jira/browse/SSHD-1244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17486853#comment-17486853
 ] 

Thomas Wolf commented on SSHD-1244:
---

Yes, but RFC 4254 requires handling window sizes up to 2^32 -1. So it's quite 
possible to get a window size larger than {{{}Integer.MAX_VALUE{}}}. Apache 
MINA sshd handles the window size as a *signed* 32bit integer, but should 
handle it as an *unsigned* 32bit integer. See 
{{{}AbstractChannel.handleWindowAdjust(){}}}.

> Client fails window adjust above Integer.MAX_VALUE
> --
>
> Key: SSHD-1244
> URL: https://issues.apache.org/jira/browse/SSHD-1244
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.8.0
>Reporter: Ryosuke Kanda
>Assignee: Lyor Goldstein
>Priority: Minor
> Attachments: Main.java
>
>
> If the new window size specified by SSH_MSG_CHANNEL_WINDOW_ADJUST exceeds 
> INT_MAX, it will not be recognized correctly.
> I think the cause is in the following places:
> org.apache.sshd.common.channel.Window.expand(int)
>  
> I am doing machine translation, so please allow it to be unnatural.
>  
> I encountered this issue when I was using ProFTPD as an SFTP server.
> The version of ProFTPD is 1.3.5e.
> The SFTP feature of ProFTPD notifies 2 ^ 32-1 bytes as the initial window 
> size by default.
> I've confirmed that SSHD can handle this without any problems, so I sent a 
> 4GB file to see what happens when Window Adjust is done.
> As a result, a Window Adjust was done and SSHD was unable to handle this 
> successfully.
>  
> I have attached the client implementation to this issue.
> (Maybe a poor implementation ...)
> The console logs, including the debug logs, were too large to attach.
> The parts that are clearly set for the SSH client are as follows.
> ServerKeyVerifier
> HostConfigEntryResolver
> KeyIdentityProvider
> In the log, the part where the error occurred is as follows.
> You can see that SSHD recognizes the new Window size as a negative value.
> {code:java}
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.sftp.client.impl.DefaultSftpClient$SftpChannelSubsystem - 
> handleWindowAdjust(SftpChannelSubsystem[id=0, 
> recipient=0]-ClientSessionImpl[kada@/192.168.12.222:18022][sftp]) 
> SSH_MSG_CHANNEL_WINDOW_ADJUST window=-94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> handleReadCycleFailure(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) IllegalArgumentException after 8166700 nanos 
> at read cycle=103401: Negative window size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> exceptionCaught(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) caught IllegalArgumentException[Negative 
> window size: -94217] - calling handler
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.client.session.ClientSessionImpl - 
> signalAuthFailure(ClientSessionImpl[kada@/192.168.12.222:18022]) 
> type=IllegalArgumentException, signalled=false, first=false: Negative window 
> size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] WARN 
> org.apache.sshd.client.session.ClientSessionImpl - 
> exceptionCaught(ClientSessionImpl[kada@/192.168.12.222:18022])[state=Opened] 
> IllegalArgumentException: Negative window size: -94217
> java.lang.IllegalArgumentException: Negative window size: -94217
>     at 
> org.apache.sshd.common.util.ValidateUtils.createFormattedException(ValidateUtils.java:213)
>     at 
> org.apache.sshd.common.util.ValidateUtils.throwIllegalArgumentException(ValidateUtils.java:179)
>     at 
> org.apache.sshd.common.util.ValidateUtils.checkTrue(ValidateUtils.java:162)
>     at org.apache.sshd.common.channel.Window.expand(Window.java:123)
>     at 
> org.apache.sshd.common.channel.AbstractChannel.handleWindowAdjust(AbstractChannel.java:894)
>     at 
> org.apache.sshd.client.channel.AbstractClientChannel.handleWindowAdjust(AbstractClientChannel.java:448)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.channelWindowAdjust(AbstractConnectionService.java:614)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.process(AbstractConnectionService.java:477)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:526)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:452)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1524)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:412)
>     at 
> 

[jira] [Commented] (SSHD-1244) Client fails window adjust above Integer.MAX_VALUE

2022-02-03 Thread Lyor Goldstein (Jira)


[ 
https://issues.apache.org/jira/browse/SSHD-1244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17486816#comment-17486816
 ] 

Lyor Goldstein commented on SSHD-1244:
--

{quote}
You can see that SSHD recognizes the new Window size as a negative value.
{quote}
Not really, all I can see is that it seems that the peer has sent a negative 
value. I do not see MAX_INTEGER being treated as a negative value. If it is as 
you say, then the log is incomplete...

> Client fails window adjust above Integer.MAX_VALUE
> --
>
> Key: SSHD-1244
> URL: https://issues.apache.org/jira/browse/SSHD-1244
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.8.0
>Reporter: Ryosuke Kanda
>Assignee: Lyor Goldstein
>Priority: Minor
> Attachments: Main.java
>
>
> If the new window size specified by SSH_MSG_CHANNEL_WINDOW_ADJUST exceeds 
> INT_MAX, it will not be recognized correctly.
> I think the cause is in the following places:
> org.apache.sshd.common.channel.Window.expand(int)
>  
> I am doing machine translation, so please allow it to be unnatural.
>  
> I encountered this issue when I was using ProFTPD as an SFTP server.
> The version of ProFTPD is 1.3.5e.
> The SFTP feature of ProFTPD notifies 2 ^ 32-1 bytes as the initial window 
> size by default.
> I've confirmed that SSHD can handle this without any problems, so I sent a 
> 4GB file to see what happens when Window Adjust is done.
> As a result, a Window Adjust was done and SSHD was unable to handle this 
> successfully.
>  
> I have attached the client implementation to this issue.
> (Maybe a poor implementation ...)
> The console logs, including the debug logs, were too large to attach.
> The parts that are clearly set for the SSH client are as follows.
> ServerKeyVerifier
> HostConfigEntryResolver
> KeyIdentityProvider
> In the log, the part where the error occurred is as follows.
> You can see that SSHD recognizes the new Window size as a negative value.
> {code:java}
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.sftp.client.impl.DefaultSftpClient$SftpChannelSubsystem - 
> handleWindowAdjust(SftpChannelSubsystem[id=0, 
> recipient=0]-ClientSessionImpl[kada@/192.168.12.222:18022][sftp]) 
> SSH_MSG_CHANNEL_WINDOW_ADJUST window=-94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> handleReadCycleFailure(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) IllegalArgumentException after 8166700 nanos 
> at read cycle=103401: Negative window size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> exceptionCaught(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) caught IllegalArgumentException[Negative 
> window size: -94217] - calling handler
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.client.session.ClientSessionImpl - 
> signalAuthFailure(ClientSessionImpl[kada@/192.168.12.222:18022]) 
> type=IllegalArgumentException, signalled=false, first=false: Negative window 
> size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] WARN 
> org.apache.sshd.client.session.ClientSessionImpl - 
> exceptionCaught(ClientSessionImpl[kada@/192.168.12.222:18022])[state=Opened] 
> IllegalArgumentException: Negative window size: -94217
> java.lang.IllegalArgumentException: Negative window size: -94217
>     at 
> org.apache.sshd.common.util.ValidateUtils.createFormattedException(ValidateUtils.java:213)
>     at 
> org.apache.sshd.common.util.ValidateUtils.throwIllegalArgumentException(ValidateUtils.java:179)
>     at 
> org.apache.sshd.common.util.ValidateUtils.checkTrue(ValidateUtils.java:162)
>     at org.apache.sshd.common.channel.Window.expand(Window.java:123)
>     at 
> org.apache.sshd.common.channel.AbstractChannel.handleWindowAdjust(AbstractChannel.java:894)
>     at 
> org.apache.sshd.client.channel.AbstractClientChannel.handleWindowAdjust(AbstractClientChannel.java:448)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.channelWindowAdjust(AbstractConnectionService.java:614)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.process(AbstractConnectionService.java:477)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:526)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:452)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1524)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:412)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:64)
>  

[jira] [Commented] (SSHD-1244) Client fails window adjust above Integer.MAX_VALUE

2022-02-03 Thread Lyor Goldstein (Jira)


[ 
https://issues.apache.org/jira/browse/SSHD-1244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17486815#comment-17486815
 ] 

Lyor Goldstein commented on SSHD-1244:
--

{quote}
This seems to be a violation of [RFC4254 - section 5.2]...

Why? Don't know what is meant by "INT_MAX", but Integer.MAX_VALUE is 2^31-1.
{quote}
I know that, but the original description said
{quote}
If the new window size specified by SSH_MSG_CHANNEL_WINDOW_ADJUST exceeds 
INT_MAX
{quote}
Emphasis on *exceeds*

> Client fails window adjust above Integer.MAX_VALUE
> --
>
> Key: SSHD-1244
> URL: https://issues.apache.org/jira/browse/SSHD-1244
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.8.0
>Reporter: Ryosuke Kanda
>Assignee: Lyor Goldstein
>Priority: Minor
> Attachments: Main.java
>
>
> If the new window size specified by SSH_MSG_CHANNEL_WINDOW_ADJUST exceeds 
> INT_MAX, it will not be recognized correctly.
> I think the cause is in the following places:
> org.apache.sshd.common.channel.Window.expand(int)
>  
> I am doing machine translation, so please allow it to be unnatural.
>  
> I encountered this issue when I was using ProFTPD as an SFTP server.
> The version of ProFTPD is 1.3.5e.
> The SFTP feature of ProFTPD notifies 2 ^ 32-1 bytes as the initial window 
> size by default.
> I've confirmed that SSHD can handle this without any problems, so I sent a 
> 4GB file to see what happens when Window Adjust is done.
> As a result, a Window Adjust was done and SSHD was unable to handle this 
> successfully.
>  
> I have attached the client implementation to this issue.
> (Maybe a poor implementation ...)
> The console logs, including the debug logs, were too large to attach.
> The parts that are clearly set for the SSH client are as follows.
> ServerKeyVerifier
> HostConfigEntryResolver
> KeyIdentityProvider
> In the log, the part where the error occurred is as follows.
> You can see that SSHD recognizes the new Window size as a negative value.
> {code:java}
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.sftp.client.impl.DefaultSftpClient$SftpChannelSubsystem - 
> handleWindowAdjust(SftpChannelSubsystem[id=0, 
> recipient=0]-ClientSessionImpl[kada@/192.168.12.222:18022][sftp]) 
> SSH_MSG_CHANNEL_WINDOW_ADJUST window=-94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> handleReadCycleFailure(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) IllegalArgumentException after 8166700 nanos 
> at read cycle=103401: Negative window size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> exceptionCaught(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) caught IllegalArgumentException[Negative 
> window size: -94217] - calling handler
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.client.session.ClientSessionImpl - 
> signalAuthFailure(ClientSessionImpl[kada@/192.168.12.222:18022]) 
> type=IllegalArgumentException, signalled=false, first=false: Negative window 
> size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] WARN 
> org.apache.sshd.client.session.ClientSessionImpl - 
> exceptionCaught(ClientSessionImpl[kada@/192.168.12.222:18022])[state=Opened] 
> IllegalArgumentException: Negative window size: -94217
> java.lang.IllegalArgumentException: Negative window size: -94217
>     at 
> org.apache.sshd.common.util.ValidateUtils.createFormattedException(ValidateUtils.java:213)
>     at 
> org.apache.sshd.common.util.ValidateUtils.throwIllegalArgumentException(ValidateUtils.java:179)
>     at 
> org.apache.sshd.common.util.ValidateUtils.checkTrue(ValidateUtils.java:162)
>     at org.apache.sshd.common.channel.Window.expand(Window.java:123)
>     at 
> org.apache.sshd.common.channel.AbstractChannel.handleWindowAdjust(AbstractChannel.java:894)
>     at 
> org.apache.sshd.client.channel.AbstractClientChannel.handleWindowAdjust(AbstractClientChannel.java:448)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.channelWindowAdjust(AbstractConnectionService.java:614)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.process(AbstractConnectionService.java:477)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:526)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:452)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1524)
>     at 
> org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:412)
>     at 
> 

[jira] [Commented] (SSHD-1244) Client fails window adjust above Integer.MAX_VALUE

2022-02-03 Thread Ryosuke Kanda (Jira)


[ 
https://issues.apache.org/jira/browse/SSHD-1244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17486774#comment-17486774
 ] 

Ryosuke Kanda commented on SSHD-1244:
-

> Don't know what is meant by "INT_MAX", but Integer.MAX_VALUE is 2^31-1.

Thank you. Update the title.

> This seems to be a violation of [RFC4254 - section 5.2]

As mentioned above, "INT_MAX" refers to 2 ^ 31-1 which is the maximum value of 
int type that is not unsigned.
Therefore, I think it is a problem that we cannot receive a value that exceeds 
this (and does not exceed 2 ^ 32-1).


> How do you know that this is the reason for the failure ?

As added to the description.
What should I do if I need a complete debug log?

> BTW, what does ProFTPD have to do with SSHD ?

Earlier, there were reports that our product (using SSHD) could not communicate 
with ProFTPD.
This product is currently about to switch to the newer SSHD.
As a result of switching, we are checking whether the problems that occurred in 
the past will be improved.

> Client fails window adjust above Integer.MAX_VALUE
> --
>
> Key: SSHD-1244
> URL: https://issues.apache.org/jira/browse/SSHD-1244
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.8.0
>Reporter: Ryosuke Kanda
>Assignee: Lyor Goldstein
>Priority: Minor
> Attachments: Main.java
>
>
> If the new window size specified by SSH_MSG_CHANNEL_WINDOW_ADJUST exceeds 
> INT_MAX, it will not be recognized correctly.
> I think the cause is in the following places:
> org.apache.sshd.common.channel.Window.expand(int)
>  
> I am doing machine translation, so please allow it to be unnatural.
>  
> I encountered this issue when I was using ProFTPD as an SFTP server.
> The version of ProFTPD is 1.3.5e.
> The SFTP feature of ProFTPD notifies 2 ^ 32-1 bytes as the initial window 
> size by default.
> I've confirmed that SSHD can handle this without any problems, so I sent a 
> 4GB file to see what happens when Window Adjust is done.
> As a result, a Window Adjust was done and SSHD was unable to handle this 
> successfully.
>  
> I have attached the client implementation to this issue.
> (Maybe a poor implementation ...)
> The console logs, including the debug logs, were too large to attach.
> The parts that are clearly set for the SSH client are as follows.
> ServerKeyVerifier
> HostConfigEntryResolver
> KeyIdentityProvider
> In the log, the part where the error occurred is as follows.
> You can see that SSHD recognizes the new Window size as a negative value.
> {code:java}
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.sftp.client.impl.DefaultSftpClient$SftpChannelSubsystem - 
> handleWindowAdjust(SftpChannelSubsystem[id=0, 
> recipient=0]-ClientSessionImpl[kada@/192.168.12.222:18022][sftp]) 
> SSH_MSG_CHANNEL_WINDOW_ADJUST window=-94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> handleReadCycleFailure(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) IllegalArgumentException after 8166700 nanos 
> at read cycle=103401: Negative window size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.common.io.nio2.Nio2Session - 
> exceptionCaught(Nio2Session[local=/0:0:0:0:0:0:0:0:51143, 
> remote=/192.168.12.222:18022]) caught IllegalArgumentException[Negative 
> window size: -94217] - calling handler
> [sshd-SshClient[343f4d3d]-nio2-thread-5] DEBUG 
> org.apache.sshd.client.session.ClientSessionImpl - 
> signalAuthFailure(ClientSessionImpl[kada@/192.168.12.222:18022]) 
> type=IllegalArgumentException, signalled=false, first=false: Negative window 
> size: -94217
> [sshd-SshClient[343f4d3d]-nio2-thread-5] WARN 
> org.apache.sshd.client.session.ClientSessionImpl - 
> exceptionCaught(ClientSessionImpl[kada@/192.168.12.222:18022])[state=Opened] 
> IllegalArgumentException: Negative window size: -94217
> java.lang.IllegalArgumentException: Negative window size: -94217
>     at 
> org.apache.sshd.common.util.ValidateUtils.createFormattedException(ValidateUtils.java:213)
>     at 
> org.apache.sshd.common.util.ValidateUtils.throwIllegalArgumentException(ValidateUtils.java:179)
>     at 
> org.apache.sshd.common.util.ValidateUtils.checkTrue(ValidateUtils.java:162)
>     at org.apache.sshd.common.channel.Window.expand(Window.java:123)
>     at 
> org.apache.sshd.common.channel.AbstractChannel.handleWindowAdjust(AbstractChannel.java:894)
>     at 
> org.apache.sshd.client.channel.AbstractClientChannel.handleWindowAdjust(AbstractClientChannel.java:448)
>     at 
> org.apache.sshd.common.session.helpers.AbstractConnectionService.channelWindowAdjust(AbstractConnectionService.java:614)
>     at 
>