1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

session: Add SSH1 support in ssh_send_ignore()

Signed-off-by: Yanis Kurganov <ykurganov@ptsecurity.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Yanis Kurganov
2017-04-11 09:49:55 +02:00
committed by Andreas Schneider
parent 9dc650b7fb
commit 72fdb4867e

View File

@@ -31,6 +31,9 @@
#include "libssh/crypto.h" #include "libssh/crypto.h"
#include "libssh/server.h" #include "libssh/server.h"
#include "libssh/socket.h" #include "libssh/socket.h"
#ifdef WITH_SSH1
#include "libssh/ssh1.h"
#endif /* WITH_SSH1 */
#include "libssh/ssh2.h" #include "libssh/ssh2.h"
#include "libssh/agent.h" #include "libssh/agent.h"
#include "libssh/packet.h" #include "libssh/packet.h"
@@ -830,13 +833,17 @@ void ssh_socket_exception_callback(int code, int errno_code, void *user){
* @return SSH_OK on success, SSH_ERROR otherwise. * @return SSH_OK on success, SSH_ERROR otherwise.
*/ */
int ssh_send_ignore (ssh_session session, const char *data) { int ssh_send_ignore (ssh_session session, const char *data) {
#ifdef WITH_SSH1
const int type = session->version == 1 ? SSH_MSG_IGNORE : SSH2_MSG_IGNORE;
#else /* WITH_SSH1 */
const int type = SSH2_MSG_IGNORE;
#endif /* WITH_SSH1 */
int rc; int rc;
if (ssh_socket_is_open(session->socket)) { if (ssh_socket_is_open(session->socket)) {
rc = ssh_buffer_pack(session->out_buffer, rc = ssh_buffer_pack(session->out_buffer,
"bs", "bs",
SSH2_MSG_IGNORE, type,
data); data);
if (rc != SSH_OK){ if (rc != SSH_OK){
ssh_set_error_oom(session); ssh_set_error_oom(session);