|
|
@ -16,7 +16,7 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
use super::ssh::SSHTransaction;
|
|
|
|
use super::ssh::SSHTransaction;
|
|
|
|
use crate::core::{STREAM_TOCLIENT, STREAM_TOSERVER};
|
|
|
|
use crate::core::Direction;
|
|
|
|
use std::ptr;
|
|
|
|
use std::ptr;
|
|
|
|
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
#[no_mangle]
|
|
|
@ -24,8 +24,8 @@ pub unsafe extern "C" fn rs_ssh_tx_get_protocol(
|
|
|
|
tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8,
|
|
|
|
tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8,
|
|
|
|
) -> u8 {
|
|
|
|
) -> u8 {
|
|
|
|
let tx = cast_pointer!(tx, SSHTransaction);
|
|
|
|
let tx = cast_pointer!(tx, SSHTransaction);
|
|
|
|
match direction {
|
|
|
|
match direction.into() {
|
|
|
|
STREAM_TOSERVER => {
|
|
|
|
Direction::ToServer => {
|
|
|
|
let m = &tx.cli_hdr.protover;
|
|
|
|
let m = &tx.cli_hdr.protover;
|
|
|
|
if m.len() > 0 {
|
|
|
|
if m.len() > 0 {
|
|
|
|
*buffer = m.as_ptr();
|
|
|
|
*buffer = m.as_ptr();
|
|
|
@ -33,7 +33,7 @@ pub unsafe extern "C" fn rs_ssh_tx_get_protocol(
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
STREAM_TOCLIENT => {
|
|
|
|
Direction::ToClient => {
|
|
|
|
let m = &tx.srv_hdr.protover;
|
|
|
|
let m = &tx.srv_hdr.protover;
|
|
|
|
if m.len() > 0 {
|
|
|
|
if m.len() > 0 {
|
|
|
|
*buffer = m.as_ptr();
|
|
|
|
*buffer = m.as_ptr();
|
|
|
@ -41,7 +41,6 @@ pub unsafe extern "C" fn rs_ssh_tx_get_protocol(
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_ => {}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*buffer = ptr::null();
|
|
|
|
*buffer = ptr::null();
|
|
|
|
*buffer_len = 0;
|
|
|
|
*buffer_len = 0;
|
|
|
@ -54,8 +53,8 @@ pub unsafe extern "C" fn rs_ssh_tx_get_software(
|
|
|
|
tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8,
|
|
|
|
tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8,
|
|
|
|
) -> u8 {
|
|
|
|
) -> u8 {
|
|
|
|
let tx = cast_pointer!(tx, SSHTransaction);
|
|
|
|
let tx = cast_pointer!(tx, SSHTransaction);
|
|
|
|
match direction {
|
|
|
|
match direction.into() {
|
|
|
|
STREAM_TOSERVER => {
|
|
|
|
Direction::ToServer => {
|
|
|
|
let m = &tx.cli_hdr.swver;
|
|
|
|
let m = &tx.cli_hdr.swver;
|
|
|
|
if m.len() > 0 {
|
|
|
|
if m.len() > 0 {
|
|
|
|
*buffer = m.as_ptr();
|
|
|
|
*buffer = m.as_ptr();
|
|
|
@ -63,7 +62,7 @@ pub unsafe extern "C" fn rs_ssh_tx_get_software(
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
STREAM_TOCLIENT => {
|
|
|
|
Direction::ToClient => {
|
|
|
|
let m = &tx.srv_hdr.swver;
|
|
|
|
let m = &tx.srv_hdr.swver;
|
|
|
|
if m.len() > 0 {
|
|
|
|
if m.len() > 0 {
|
|
|
|
*buffer = m.as_ptr();
|
|
|
|
*buffer = m.as_ptr();
|
|
|
@ -71,7 +70,6 @@ pub unsafe extern "C" fn rs_ssh_tx_get_software(
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_ => {}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*buffer = ptr::null();
|
|
|
|
*buffer = ptr::null();
|
|
|
|
*buffer_len = 0;
|
|
|
|
*buffer_len = 0;
|
|
|
@ -87,8 +85,8 @@ pub unsafe extern "C" fn rs_ssh_tx_get_hassh(
|
|
|
|
direction: u8,
|
|
|
|
direction: u8,
|
|
|
|
) -> u8 {
|
|
|
|
) -> u8 {
|
|
|
|
let tx = cast_pointer!(tx, SSHTransaction);
|
|
|
|
let tx = cast_pointer!(tx, SSHTransaction);
|
|
|
|
match direction {
|
|
|
|
match direction.into() {
|
|
|
|
STREAM_TOSERVER => {
|
|
|
|
Direction::ToServer => {
|
|
|
|
let m = &tx.cli_hdr.hassh;
|
|
|
|
let m = &tx.cli_hdr.hassh;
|
|
|
|
if m.len() > 0 {
|
|
|
|
if m.len() > 0 {
|
|
|
|
*buffer = m.as_ptr();
|
|
|
|
*buffer = m.as_ptr();
|
|
|
@ -96,7 +94,7 @@ pub unsafe extern "C" fn rs_ssh_tx_get_hassh(
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
STREAM_TOCLIENT => {
|
|
|
|
Direction::ToClient => {
|
|
|
|
let m = &tx.srv_hdr.hassh;
|
|
|
|
let m = &tx.srv_hdr.hassh;
|
|
|
|
if m.len() > 0 {
|
|
|
|
if m.len() > 0 {
|
|
|
|
*buffer = m.as_ptr();
|
|
|
|
*buffer = m.as_ptr();
|
|
|
@ -104,7 +102,6 @@ pub unsafe extern "C" fn rs_ssh_tx_get_hassh(
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_ => {}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*buffer = ptr::null();
|
|
|
|
*buffer = ptr::null();
|
|
|
|
*buffer_len = 0;
|
|
|
|
*buffer_len = 0;
|
|
|
@ -120,8 +117,8 @@ pub unsafe extern "C" fn rs_ssh_tx_get_hassh_string(
|
|
|
|
direction: u8,
|
|
|
|
direction: u8,
|
|
|
|
) -> u8 {
|
|
|
|
) -> u8 {
|
|
|
|
let tx = cast_pointer!(tx, SSHTransaction);
|
|
|
|
let tx = cast_pointer!(tx, SSHTransaction);
|
|
|
|
match direction {
|
|
|
|
match direction.into() {
|
|
|
|
STREAM_TOSERVER => {
|
|
|
|
Direction::ToServer => {
|
|
|
|
let m = &tx.cli_hdr.hassh_string;
|
|
|
|
let m = &tx.cli_hdr.hassh_string;
|
|
|
|
if m.len() > 0 {
|
|
|
|
if m.len() > 0 {
|
|
|
|
*buffer = m.as_ptr();
|
|
|
|
*buffer = m.as_ptr();
|
|
|
@ -129,7 +126,7 @@ pub unsafe extern "C" fn rs_ssh_tx_get_hassh_string(
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
STREAM_TOCLIENT => {
|
|
|
|
Direction::ToClient => {
|
|
|
|
let m = &tx.srv_hdr.hassh_string;
|
|
|
|
let m = &tx.srv_hdr.hassh_string;
|
|
|
|
if m.len() > 0 {
|
|
|
|
if m.len() > 0 {
|
|
|
|
*buffer = m.as_ptr();
|
|
|
|
*buffer = m.as_ptr();
|
|
|
@ -137,7 +134,6 @@ pub unsafe extern "C" fn rs_ssh_tx_get_hassh_string(
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_ => {}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*buffer = ptr::null();
|
|
|
|
*buffer = ptr::null();
|
|
|
|
*buffer_len = 0;
|
|
|
|
*buffer_len = 0;
|
|
|
|