Skip to content

Commit

Permalink
rust/ssh: rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonish committed Jan 21, 2025
1 parent bd44984 commit 9193694
Show file tree
Hide file tree
Showing 4 changed files with 449 additions and 388 deletions.
10 changes: 2 additions & 8 deletions rust/src/ssh/detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ pub unsafe extern "C" fn SCSshTxGetSoftware(

#[no_mangle]
pub unsafe extern "C" fn SCSshTxGetHassh(
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 {
let tx = cast_pointer!(tx, SSHTransaction);
match direction.into() {
Expand Down Expand Up @@ -111,10 +108,7 @@ pub unsafe extern "C" fn SCSshTxGetHassh(

#[no_mangle]
pub unsafe extern "C" fn SCSshTxGetHasshString(
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 {
let tx = cast_pointer!(tx, SSHTransaction);
match direction.into() {
Expand Down
24 changes: 20 additions & 4 deletions rust/src/ssh/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,17 @@ fn log_ssh(tx: &SSHTransaction, js: &mut JsonBuilder) -> Result<bool, JsonError>
}
if !tx.cli_hdr.protover.is_empty() {
js.open_object("client")?;
js.set_string_from_bytes_limited("proto_version", &tx.cli_hdr.protover, SSH_MAX_BANNER_LEN)?;
js.set_string_from_bytes_limited(
"proto_version",
&tx.cli_hdr.protover,
SSH_MAX_BANNER_LEN,
)?;
if !tx.cli_hdr.swver.is_empty() {
js.set_string_from_bytes_limited("software_version", &tx.cli_hdr.swver, SSH_MAX_BANNER_LEN)?;
js.set_string_from_bytes_limited(
"software_version",
&tx.cli_hdr.swver,
SSH_MAX_BANNER_LEN,
)?;
}
if !tx.cli_hdr.hassh.is_empty() || !tx.cli_hdr.hassh_string.is_empty() {
js.open_object("hassh")?;
Expand All @@ -43,9 +51,17 @@ fn log_ssh(tx: &SSHTransaction, js: &mut JsonBuilder) -> Result<bool, JsonError>
}
if !tx.srv_hdr.protover.is_empty() {
js.open_object("server")?;
js.set_string_from_bytes_limited("proto_version", &tx.srv_hdr.protover, SSH_MAX_BANNER_LEN)?;
js.set_string_from_bytes_limited(
"proto_version",
&tx.srv_hdr.protover,
SSH_MAX_BANNER_LEN,
)?;
if !tx.srv_hdr.swver.is_empty() {
js.set_string_from_bytes_limited("software_version", &tx.srv_hdr.swver, SSH_MAX_BANNER_LEN)?;
js.set_string_from_bytes_limited(
"software_version",
&tx.srv_hdr.swver,
SSH_MAX_BANNER_LEN,
)?;
}
if !tx.srv_hdr.hassh.is_empty() || !tx.srv_hdr.hassh_string.is_empty() {
js.open_object("hassh")?;
Expand Down
Loading

0 comments on commit 9193694

Please sign in to comment.