From: Jeff Lucovsky Date: Thu, 24 Apr 2025 12:32:58 +0000 (-0400) Subject: app/ftp: Use common API naming X-Git-Tag: suricata-8.0.0-rc1~421 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04bf28d6a1628c6b5c1f72557da4598e42b75f8c;p=thirdparty%2Fsuricata.git app/ftp: Use common API naming Modify the Rust API functions to conform to project naming format: SCFTP* Issue: 7504 --- diff --git a/rust/src/ftp/mod.rs b/rust/src/ftp/mod.rs index 479126971f..8181bb0b95 100644 --- a/rust/src/ftp/mod.rs +++ b/rust/src/ftp/mod.rs @@ -47,7 +47,7 @@ fn parse_u16(i: &[u8]) -> IResult<&[u8], u16> { } // PORT 192,168,0,13,234,10 -pub fn ftp_active_port(i: &[u8]) -> IResult<&[u8], u16> { +fn ftp_active_port(i: &[u8]) -> IResult<&[u8], u16> { let (i, _) = tag("PORT")(i)?; let (i, _) = delimited(multispace0, digit1, multispace0)(i)?; let (i, _) = tuple(( @@ -66,7 +66,7 @@ pub fn ftp_active_port(i: &[u8]) -> IResult<&[u8], u16> { } // 227 Entering Passive Mode (212,27,32,66,221,243). -pub fn ftp_pasv_response(i: &[u8]) -> IResult<&[u8], u16> { +fn ftp_pasv_response(i: &[u8]) -> IResult<&[u8], u16> { let (i, _) = tag("227")(i)?; let (i, _) = take_until("(")(i)?; let (i, _) = tag("(")(i)?; @@ -90,7 +90,7 @@ pub fn ftp_pasv_response(i: &[u8]) -> IResult<&[u8], u16> { } #[no_mangle] -pub unsafe extern "C" fn rs_ftp_active_port(input: *const u8, len: u32) -> u16 { +pub unsafe extern "C" fn SCFTPParsePort(input: *const u8, len: u32) -> u16 { if input.is_null() { return 0; } @@ -110,7 +110,7 @@ pub unsafe extern "C" fn rs_ftp_active_port(input: *const u8, len: u32) -> u16 { } #[no_mangle] -pub unsafe extern "C" fn rs_ftp_pasv_response(input: *const u8, len: u32) -> u16 { +pub unsafe extern "C" fn SCFTPParsePortPasv(input: *const u8, len: u32) -> u16 { if input.is_null() { return 0; } @@ -141,7 +141,7 @@ pub fn ftp_epsv_response(i: &[u8]) -> IResult<&[u8], u16> { } // EPRT |2|2a01:e34:ee97:b130:8c3e:45ea:5ac6:e301|41813| -pub fn ftp_active_eprt(i: &[u8]) -> IResult<&[u8], u16> { +fn ftp_active_eprt(i: &[u8]) -> IResult<&[u8], u16> { let (i, _) = tag("EPRT")(i)?; let (i, _) = take_until("|")(i)?; let (i, _) = tag("|")(i)?; @@ -155,7 +155,7 @@ pub fn ftp_active_eprt(i: &[u8]) -> IResult<&[u8], u16> { } #[no_mangle] -pub unsafe extern "C" fn rs_ftp_active_eprt(input: *const u8, len: u32) -> u16 { +pub unsafe extern "C" fn SCFTPParsePortEprt(input: *const u8, len: u32) -> u16 { if input.is_null() { return 0; } @@ -174,7 +174,7 @@ pub unsafe extern "C" fn rs_ftp_active_eprt(input: *const u8, len: u32) -> u16 { return 0; } #[no_mangle] -pub unsafe extern "C" fn rs_ftp_epsv_response(input: *const u8, len: u32) -> u16 { +pub unsafe extern "C" fn SCFTPParsePortEpsv(input: *const u8, len: u32) -> u16 { if input.is_null() { return 0; } diff --git a/src/app-layer-ftp.c b/src/app-layer-ftp.c index ef2aa0eaa4..4823b5a2d6 100644 --- a/src/app-layer-ftp.c +++ b/src/app-layer-ftp.c @@ -561,7 +561,7 @@ static AppLayerResult FTPParseRequest(Flow *f, void *ftp_state, AppLayerParserSt static int FTPParsePassiveResponse(FtpState *state, const uint8_t *input, uint32_t input_len) { - uint16_t dyn_port = rs_ftp_pasv_response(input, input_len); + uint16_t dyn_port = SCFTPParsePortPasv(input, input_len); if (dyn_port == 0) { return -1; } @@ -576,7 +576,7 @@ static int FTPParsePassiveResponse(FtpState *state, const uint8_t *input, uint32 static int FTPParsePassiveResponseV6(FtpState *state, const uint8_t *input, uint32_t input_len) { - uint16_t dyn_port = rs_ftp_epsv_response(input, input_len); + uint16_t dyn_port = SCFTPParsePortEpsv(input, input_len); if (dyn_port == 0) { return -1; } @@ -659,7 +659,7 @@ static AppLayerResult FTPParseResponse(Flow *f, void *ftp_state, AppLayerParserS break; case FTP_COMMAND_EPRT: - dyn_port = rs_ftp_active_eprt(state->port_line, state->port_line_len); + dyn_port = SCFTPParsePortEprt(state->port_line, state->port_line_len); if (dyn_port == 0) { goto tx_complete; } @@ -671,7 +671,7 @@ static AppLayerResult FTPParseResponse(Flow *f, void *ftp_state, AppLayerParserS break; case FTP_COMMAND_PORT: - dyn_port = rs_ftp_active_port(state->port_line, state->port_line_len); + dyn_port = SCFTPParsePort(state->port_line, state->port_line_len); if (dyn_port == 0) { goto tx_complete; }