]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
app/ftp: Use common API naming
authorJeff Lucovsky <jlucovsky@oisf.net>
Thu, 24 Apr 2025 12:32:58 +0000 (08:32 -0400)
committerVictor Julien <victor@inliniac.net>
Fri, 25 Apr 2025 07:51:46 +0000 (09:51 +0200)
Modify the Rust API functions to conform to project naming format:
SCFTP*

Issue: 7504

rust/src/ftp/mod.rs
src/app-layer-ftp.c

index 479126971ff492ef52255016708ec4099e714b04..8181bb0b951840f28b03413b01f8dc436dcb00f6 100644 (file)
@@ -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;
     }
index ef2aa0eaa46fd8a679594685bc42c00c6b5ca9e3..4823b5a2d6b742d6e40c23cf499715315dd6ff16 100644 (file)
@@ -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;
                 }