私は、SSH を組み込んだクライアント サーバー アーキテクチャのソフトウェアを構築しているチームに所属しています。libssh C APIを使用して、SSHサーバーを作成し、リモートサーバーコンピューターに展開する前にローカルマシンでテストしています。サーバーは正常に構築およびリンクされますが、実行時に受け入れ機能で BIO を作成できませんでしたというエラーが発生します。以下は私のサーバーコードです
unsigned int port = xxxx;
int log_func = SSH_LOG_PROTOCOL;
int rc;
static const char * dsakey = "rservd_dsa_file_key";
static const char * rsakey = "rservd_rsa_file_key";
ssh_init();
ssh_bind sshbind = ssh_bind_new();
ssh_session session = ssh_new();
const char * hostname = "127.0.0.1";
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDADDR, hostname);
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDPORT, &port);
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_DSAKEY, dsakey);
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_LOG_VERBOSITY, &log_func);
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_RSAKEY, rsakey);
if(ssh_bind_listen(sshbind)<0)
{
fprintf(stderr, "failed to listen at port %s\n", ssh_get_error(sshbind));
exit(-1);
}
rc = ssh_bind_accept(sshbind, session);
if(rc == SSH_ERROR)
{
fprintf(stderr, "Error in accepting a connection : %s\n", ssh_get_error(sshbind));
exit(-1);
}
ssh_bind_free(sshbind);
ssh_free(session);
グーグルで調べたところ、BIOはSSLと関係があることがわかりましたが、よくわかりません。libssh コミュニティはそれほど大きくないため、例は非常に少なく、私が望むほど明確ではありません。では、このエラーの原因は何であり、それを修正するにはどうすればよいでしょうか? 参考までにこれは libssh 0.5.0 です