-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use example to connect to server #2
Comments
看错误的原因是在与服务端进行密钥交换的时候,未获取到数据,代码里面也没做空数据校验,导致索引异常了,您能把您那边出这个问题的示例代码给发一下吗,我这边复现一下,找到具体为什么会出现这个问题的原因! |
我就是直接跑的范例代码,来自 https://docs.rs/ssh-rs/latest/ssh_rs/ 不知道是否和服务器支持算法类型相关,之前我测试过thrussh,会报错说服务器支持的“aes128-ctr,aes192-ctr,aes256-ctr”和客户端没有共同算法。 服务器的sshd版本如下: sshd --help |
sshd_config
|
应该不是算法的原因,我看了openssh_7.4p1的源码,这个项目使用的算法在openssh_7.4p1版本是支持的 有可能是我代码里面没判断空数组直接取值的问题,在 src/tcp.rs/read 方法里,如果是非加密的数据,并没有判断读取得length是否大于0,直接就截取返回了, 我感觉是这里的原因, 因为在我的环境测试的时候非阻塞的情况下未获取到服务端的数据基本上都是返回的 io::ErrorKind::WouldBlock ,所以就忽略了这里, 我会在下次打包版本的时候,把这里加上校验,另外我会尽量找一个使用 openssh_7.4 左右的虚拟机测试一下原因。 openssh_7.4p1 支持的算法src/tcp.rs/read 代码 |
今天我尝试使用 centos7 一个系统测试连接, 是可以正常连接到的, 目前可以确定 7.4p1 版本的ssh是可以正常连接的,我不确定您那边是什么问题引发的,或许是网络原因。 这是我的sshd_config, 和你的内容一致
|
Try to use example to my server, get error as blow.
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 5',/home/zj/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/ssh-rs-0.1.2/src/key_agreement.rs:105:36
The text was updated successfully, but these errors were encountered: