]> git.ipfire.org Git - people/ms/suricata.git/commitdiff
applayer: pass parameter to StateAlloc
authorPhilippe Antoine <contact@catenacyber.fr>
Fri, 4 Sep 2020 13:29:41 +0000 (15:29 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 9 Sep 2020 14:22:11 +0000 (16:22 +0200)
This parameter is NULL or the pointer to the previous state
for the previous protocol in the case of a protocol change,
for instance from HTTP1 to HTTP2

This way, the new protocol can use the old protocol context.
For instance, HTTP2 mimicks the HTTP1 request, to have a HTTP2
transaction with both request and response

36 files changed:
rust/src/applayer.rs
rust/src/applayertemplate/template.rs
rust/src/dcerpc/dcerpc.rs
rust/src/dcerpc/dcerpc_udp.rs
rust/src/dhcp/dhcp.rs
rust/src/dns/dns.rs
rust/src/http2/http2.rs
rust/src/ikev2/ikev2.rs
rust/src/krb/krb5.rs
rust/src/mqtt/mqtt.rs
rust/src/nfs/nfs.rs
rust/src/ntp/ntp.rs
rust/src/rdp/rdp.rs
rust/src/rfb/rfb.rs
rust/src/sip/sip.rs
rust/src/smb/smb.rs
rust/src/snmp/snmp.rs
rust/src/ssh/ssh.rs
src/app-layer-dcerpc-udp.c
src/app-layer-dcerpc.c
src/app-layer-dnp3.c
src/app-layer-enip.c
src/app-layer-ftp.c
src/app-layer-htp.c
src/app-layer-modbus.c
src/app-layer-nfs-tcp.c
src/app-layer-nfs-udp.c
src/app-layer-parser.c
src/app-layer-parser.h
src/app-layer-register.h
src/app-layer-smtp.c
src/app-layer-smtp.h
src/app-layer-ssl.c
src/app-layer-template.c
src/app-layer-tftp.c
src/tests/detect-file-data.c

index 40d9064abac24f57f84163e72354a5ef6c1b41a0..d1086c7bc0cfc87e8c5f19d784013787775de2c7 100644 (file)
@@ -256,7 +256,7 @@ pub type ParseFn      = extern "C" fn (flow: *const Flow,
                                        data: *const c_void,
                                        flags: u8) -> AppLayerResult;
 pub type ProbeFn      = extern "C" fn (flow: *const Flow,direction: u8,input:*const u8, input_len: u32, rdir: *mut u8) -> AppProto;
-pub type StateAllocFn = extern "C" fn () -> *mut c_void;
+pub type StateAllocFn = extern "C" fn (*mut c_void, AppProto) -> *mut c_void;
 pub type StateFreeFn  = extern "C" fn (*mut c_void);
 pub type StateTxFreeFn  = extern "C" fn (*mut c_void, u64);
 pub type StateGetTxFn            = extern "C" fn (*mut c_void, u64) -> *mut c_void;
index c1c1d656b7e07487c55fa917b71b6f81bb7c2d0e..09a57fb806fb762c8854a121ff032400846d27c9 100644 (file)
@@ -284,7 +284,7 @@ pub extern "C" fn rs_template_probing_parser(
 }
 
 #[no_mangle]
-pub extern "C" fn rs_template_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_template_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = TemplateState::new();
     let boxed = Box::new(state);
     return unsafe { transmute(boxed) };
@@ -607,4 +607,4 @@ mod test {
         let r = state.parse_request(&buf[0..9]);
         assert_eq!(r, AppLayerResult{ status: 1, consumed: 7, needed: 3});
     }
-}
\ No newline at end of file
+}
index 54f230247777036d3d449c1d0f40dbb231792368..e6b615a563488a8e9a5c67587ddd2c9a4e38ffa7 100644 (file)
@@ -1137,7 +1137,7 @@ pub extern "C" fn rs_dcerpc_parse_response(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_dcerpc_state_new() -> *mut std::os::raw::c_void {
+pub unsafe extern "C" fn rs_dcerpc_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: core::AppProto) -> *mut std::os::raw::c_void {
     let state = DCERPCState::new();
     let boxed = Box::new(state);
     transmute(boxed)
index 798eb80991bef3072d68993c9226ed502303f3fb..30612a4985f1853bc54d9525cc636df701e069bd 100644 (file)
@@ -308,7 +308,7 @@ pub extern "C" fn rs_dcerpc_udp_state_free(state: *mut std::os::raw::c_void) {
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rs_dcerpc_udp_state_new() -> *mut std::os::raw::c_void {
+pub unsafe extern "C" fn rs_dcerpc_udp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: core::AppProto) -> *mut std::os::raw::c_void {
     let state = DCERPCUDPState::new();
     let boxed = Box::new(state);
     transmute(boxed)
index 75ee8a9ed58b69d0db6a2112897fb3bd70241401..6db2e5cf0cf880a4035c504824e2a59a64559a73 100644 (file)
@@ -306,7 +306,7 @@ pub extern "C" fn rs_dhcp_state_tx_free(
 }
 
 #[no_mangle]
-pub extern "C" fn rs_dhcp_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_dhcp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = DHCPState::new();
     let boxed = Box::new(state);
     return unsafe {
index 2a8f0cc126801276e01710cbb417e27ecb8a3c39..c1824cb8006cb68677ac9004d5e47ed4892f4729 100644 (file)
@@ -714,7 +714,7 @@ pub fn probe_tcp(input: &[u8]) -> (bool, bool, bool) {
 
 /// Returns *mut DNSState
 #[no_mangle]
-pub extern "C" fn rs_dns_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_dns_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = DNSState::new();
     let boxed = Box::new(state);
     return unsafe{transmute(boxed)};
index 52e14475661752a8061544c870c974d62eda0fe4..b525f811939f866c6b0b318e1d7934be1cb9bde5 100644 (file)
@@ -878,7 +878,7 @@ pub extern "C" fn rs_http2_probing_parser_tc(
 }
 
 #[no_mangle]
-pub extern "C" fn rs_http2_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_http2_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = HTTP2State::new();
     let boxed = Box::new(state);
     return unsafe { transmute(boxed) };
index 82717b0a19b0e4d61c8ccd4af96cec6ca05f97a9..f027c584c95ed47341ed74b5ded58d76410a8a8a 100644 (file)
@@ -445,7 +445,7 @@ impl Drop for IKEV2Transaction {
 
 /// Returns *mut IKEV2State
 #[no_mangle]
-pub extern "C" fn rs_ikev2_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_ikev2_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = IKEV2State::new();
     let boxed = Box::new(state);
     return unsafe{std::mem::transmute(boxed)};
index ef2a928e839f484017ce134d11508638ed6a021b..84b8187f2be84cbc207223ed3509f78d6dba6ae7 100644 (file)
@@ -273,7 +273,7 @@ pub fn test_weak_encryption(alg:EncryptionType) -> bool {
 
 /// Returns *mut KRB5State
 #[no_mangle]
-pub extern "C" fn rs_krb5_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_krb5_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = KRB5State::new();
     let boxed = Box::new(state);
     return unsafe{std::mem::transmute(boxed)};
index 7c5643fc353bcdffb54f5589456d8f9db4bbb8dd..0da856e1c1d37f4665f046d962d33e28def2dc37 100644 (file)
@@ -578,7 +578,7 @@ pub extern "C" fn rs_mqtt_probing_parser(
 }
 
 #[no_mangle]
-pub extern "C" fn rs_mqtt_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_mqtt_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = MQTTState::new();
     let boxed = Box::new(state);
     return unsafe { transmute(boxed) };
index 8b65c792c282be218600e5275065ee22e05c7f94..283370fe16c46d87a68d4b72379f2106888029dd 100644 (file)
@@ -1408,7 +1408,7 @@ impl NFSState {
 
 /// Returns *mut NFSState
 #[no_mangle]
-pub extern "C" fn rs_nfs_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_nfs_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = NFSState::new();
     let boxed = Box::new(state);
     SCLogDebug!("allocating state");
index 8d7d7d609c02c63cf6fdb3e128e93c36d2fd0d80..b76e9237c75c39175acf309405a555c070738501 100644 (file)
@@ -175,7 +175,7 @@ impl Drop for NTPTransaction {
 
 /// Returns *mut NTPState
 #[no_mangle]
-pub extern "C" fn rs_ntp_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_ntp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = NTPState::new();
     let boxed = Box::new(state);
     return unsafe{std::mem::transmute(boxed)};
index 20780bca1366b24eac782cd7f30fd0aa901658fc..8b8d1345661f2077f1b3ce8f882839871962e871 100644 (file)
@@ -365,7 +365,7 @@ impl RdpState {
 }
 
 #[no_mangle]
-pub extern "C" fn rs_rdp_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_rdp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = RdpState::new();
     let boxed = Box::new(state);
     return unsafe { std::mem::transmute(boxed) };
index 9cb596790cae2a44f2382f21c66d9fbdd9b69229..bdd0dd784d9bbf4a9c749285f536f51add6b93eb 100644 (file)
@@ -518,7 +518,7 @@ export_tx_set_detect_state!(
 );
 
 #[no_mangle]
-pub extern "C" fn rs_rfb_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_rfb_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = RFBState::new();
     let boxed = Box::new(state);
     return unsafe { transmute(boxed) };
index b20735ce85f663223ad47fae477f80d339351099..b44461d84e95759654df6ddd4f6618b73c924d2f 100755 (executable)
@@ -169,7 +169,7 @@ impl Drop for SIPTransaction {
 }
 
 #[no_mangle]
-pub extern "C" fn rs_sip_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_sip_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = SIPState::new();
     let boxed = Box::new(state);
     return unsafe { std::mem::transmute(boxed) };
index c8874e0d0178a62af4a9a3ed7bfd157a509fea20..8071d50ca89f0b02a356e605db1959f07430d8df 100644 (file)
@@ -1824,7 +1824,7 @@ impl SMBState {
 
 /// Returns *mut SMBState
 #[no_mangle]
-pub extern "C" fn rs_smb_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_smb_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = SMBState::new();
     let boxed = Box::new(state);
     SCLogDebug!("allocating state");
index cbdf6d2c211a3a2f03852ae9e378c9d38891bed3..a96e4a25dc8036cb205d6d5f586071c635d99985 100644 (file)
@@ -297,7 +297,7 @@ impl<'a> Drop for SNMPTransaction<'a> {
 
 /// Returns *mut SNMPState
 #[no_mangle]
-pub extern "C" fn rs_snmp_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_snmp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = SNMPState::new();
     let boxed = Box::new(state);
     return unsafe{std::mem::transmute(boxed)};
index b4e93e8009bc9fe395df7d12bcbc78bf71db320c..34e62bf763afef8aa4dc598d437081cdaa12a288 100644 (file)
@@ -428,7 +428,7 @@ pub extern "C" fn rs_ssh_state_get_event_info_by_id(
 }
 
 #[no_mangle]
-pub extern "C" fn rs_ssh_state_new() -> *mut std::os::raw::c_void {
+pub extern "C" fn rs_ssh_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
     let state = SSHState::new();
     let boxed = Box::new(state);
     return unsafe { transmute(boxed) };
index 052cb6bc1f980a9b9458d21cbd89a8acf906d547..6c2e96b53d2609e295c9ac06ffba9b4fea7bda0b 100644 (file)
@@ -57,9 +57,9 @@ static AppLayerResult RustDCERPCUDPParse(Flow *f, void *dcerpc_state,
                                local_data, flags);
 }
 
-static void *RustDCERPCUDPStateNew(void)
+static void *RustDCERPCUDPStateNew(void *state_orig, AppProto proto_orig)
 {
-    return rs_dcerpc_udp_state_new();
+    return rs_dcerpc_udp_state_new(state_orig, proto_orig);
 }
 
 static void RustDCERPCUDPStateFree(void *s)
index bb0d1baac929d334e9df9dde9a9451a3db6f03b3..45ad3ac31bd6cfeda2aeeb03224769006eef86b9 100644 (file)
@@ -81,9 +81,9 @@ static AppLayerResult DCERPCParseResponse(Flow *f, void *dcerpc_state,
     }
 }
 
-static void *RustDCERPCStateNew(void)
+static void *RustDCERPCStateNew(void *state_orig, AppProto proto_orig)
 {
-    return rs_dcerpc_state_new();
+    return rs_dcerpc_state_new(state_orig, proto_orig);
 }
 
 static void DCERPCStateFree(void *s)
index 0a9a0cbadc43b6ebd7e4aa9f2ba6a5b275b76ae9..e87d7453b472098114cdefee708edfb1ce7a628c 100644 (file)
@@ -432,7 +432,7 @@ static int DNP3ReassembleApplicationLayer(const uint8_t *input,
  *
  * The DNP3 state object represents a single DNP3 TCP session.
  */
-static void *DNP3StateAlloc(void)
+static void *DNP3StateAlloc(void *orig_state, AppProto proto_orig)
 {
     SCEnter();
     DNP3State *dnp3;
@@ -2510,7 +2510,7 @@ static int DNP3ParserTestParsePDU01(void)
         0xe1, 0xc8, 0x01, 0x01, 0x00, 0x06, 0x77, 0x6e
     };
 
-    DNP3State *dnp3state = DNP3StateAlloc();
+    DNP3State *dnp3state = DNP3StateAlloc(NULL, ALPROTO_UNKNOWN);
     int pdus = DNP3HandleRequestLinkLayer(dnp3state, pkt, sizeof(pkt));
     FAIL_IF(pdus < 1);
     DNP3Transaction *dnp3tx = DNP3GetTx(dnp3state, 0);
@@ -2549,7 +2549,7 @@ static int DNP3ParserDecodeG70V3Test(void)
         0xc4, 0x8b
     };
 
-    DNP3State *dnp3state = DNP3StateAlloc();
+    DNP3State *dnp3state = DNP3StateAlloc(NULL, ALPROTO_UNKNOWN);
     FAIL_IF_NULL(dnp3state);
     int bytes = DNP3HandleRequestLinkLayer(dnp3state, pkt, sizeof(pkt));
     FAIL_IF(bytes != sizeof(pkt));
@@ -2610,7 +2610,7 @@ static int DNP3ParserUnknownEventAlertTest(void)
 
     DNP3FixCrc(pkt + 10, sizeof(pkt) - 10);
 
-    DNP3State *dnp3state = DNP3StateAlloc();
+    DNP3State *dnp3state = DNP3StateAlloc(NULL, ALPROTO_UNKNOWN);
     FAIL_IF_NULL(dnp3state);
     int bytes = DNP3HandleRequestLinkLayer(dnp3state, pkt, sizeof(pkt));
     FAIL_IF(bytes != sizeof(pkt));
index aace890a8e57de8fb1b17a4795845df12f2820e3..339edcb4bfab6c861f650553bd683ffb7d7c7117 100644 (file)
@@ -159,7 +159,7 @@ static int ENIPStateGetEventInfoById(int event_id, const char **event_name,
  *
  *  return state
  */
-static void *ENIPStateAlloc(void)
+static void *ENIPStateAlloc(void *orig_state, AppProto proto_orig)
 {
     SCLogDebug("ENIPStateAlloc");
     void *s = SCMalloc(sizeof(ENIPState));
index 1a3e91cb2750a30881bdba71afb7b11c67b9bfca..66a4a651492cdc25ad0273c7f1967ed3d91c4302 100644 (file)
@@ -833,7 +833,7 @@ static uint64_t ftp_state_memuse = 0;
 static uint64_t ftp_state_memcnt = 0;
 #endif
 
-static void *FTPStateAlloc(void)
+static void *FTPStateAlloc(void *orig_state, AppProto proto_orig)
 {
     void *s = FTPCalloc(1, sizeof(FtpState));
     if (unlikely(s == NULL))
@@ -1152,7 +1152,7 @@ static uint64_t ftpdata_state_memuse = 0;
 static uint64_t ftpdata_state_memcnt = 0;
 #endif
 
-static void *FTPDataStateAlloc(void)
+static void *FTPDataStateAlloc(void *orig_state, AppProto proto_orig)
 {
     void *s = FTPCalloc(1, sizeof(FtpDataState));
     if (unlikely(s == NULL))
index a573c323005451c897af0a7d211edce8e7dd9d63..06f9a31245fc587778034f474c64ad5a089cc79c 100644 (file)
@@ -340,7 +340,7 @@ static AppLayerDecoderEvents *HTPGetEvents(void *tx)
 /** \brief Function to allocates the HTTP state memory and also creates the HTTP
  *         connection parser to be used by the HTP library
  */
-static void *HTPStateAlloc(void)
+static void *HTPStateAlloc(void *orig_state, AppProto proto_orig)
 {
     SCEnter();
 
index f5908e7fc9bb2da46d7e34a7930cdc4e18925b41..97cfa7e3365817fc9ad2e0e735dbac022f0cc709 100644 (file)
@@ -1394,7 +1394,7 @@ static AppLayerResult ModbusParseResponse(Flow      *f,
 /** \internal
  *     \brief Function to allocate the Modbus state memory
  */
-static void *ModbusStateAlloc(void)
+static void *ModbusStateAlloc(void *orig_state, AppProto proto_orig)
 {
     ModbusState *modbus;
 
index 0d753d554727bd73929bd671a157eedf26a1f1c8..92ed47e937d07ea8a41cd820d1e94ef4fa7961b0 100644 (file)
@@ -66,9 +66,9 @@ SCEnumCharMap nfs_decoder_event_table[] = {
     { NULL, 0 }
 };
 
-static void *NFSTCPStateAlloc(void)
+static void *NFSTCPStateAlloc(void *orig_state, AppProto proto_orig)
 {
-    return rs_nfs_state_new();
+    return rs_nfs_state_new(orig_state, proto_orig);
 }
 
 static void NFSTCPStateFree(void *state)
index a7a8bc224d04e1ea177ff75aa2889f98d0e02f36..7b44487d82838b1e161f97451731cd9fd494291b 100644 (file)
@@ -63,9 +63,9 @@ SCEnumCharMap nfs_udp_decoder_event_table[] = {
     { NULL, 0 }
 };
 
-static void *NFSStateAlloc(void)
+static void *NFSStateAlloc(void *orig_state, AppProto proto_orig)
 {
-    return rs_nfs_state_new();
+    return rs_nfs_state_new(orig_state, proto_orig);
 }
 
 static void NFSStateFree(void *state)
index 7c0fdcbdfc0165497048eec8964b3c9349d75cba..f3b92c16757fc29dfb67851b4a7b247b87c4b855 100644 (file)
@@ -99,7 +99,7 @@ typedef struct AppLayerParserProtoCtx_
     bool logger;
     uint32_t logger_bits;   /**< registered loggers for this proto */
 
-    void *(*StateAlloc)(void);
+    void *(*StateAlloc)(void *, AppProto);
     void (*StateFree)(void *);
     void (*StateTransactionFree)(void *, uint64_t);
     void *(*LocalStorageAlloc)(void);
@@ -396,8 +396,7 @@ uint32_t AppLayerParserGetOptionFlags(uint8_t protomap, AppProto alproto)
 }
 
 void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto,
-                           void *(*StateAlloc)(void),
-                           void (*StateFree)(void *))
+        void *(*StateAlloc)(void *, AppProto), void (*StateFree)(void *))
 {
     SCEnter();
 
@@ -1216,7 +1215,7 @@ int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow
 
     alstate = f->alstate;
     if (alstate == NULL) {
-        f->alstate = alstate = p->StateAlloc();
+        f->alstate = alstate = p->StateAlloc(alstate, f->alproto_orig);
         if (alstate == NULL)
             goto error;
         SCLogDebug("alloced new app layer state %p (name %s)",
@@ -1679,7 +1678,7 @@ static AppLayerResult TestProtocolParser(Flow *f, void *test_state, AppLayerPars
 
 /** \brief Function to allocates the Test protocol state memory
  */
-static void *TestProtocolStateAlloc(void)
+static void *TestProtocolStateAlloc(void *orig_state, AppProto proto_orig)
 {
     SCEnter();
     void *s = SCMalloc(sizeof(TestState));
index 19201d6a4ec56a30891fd2e1933b2bc05b082285..d662f18665a737c4ccb75166f149010b13ffb9ef 100644 (file)
@@ -145,8 +145,7 @@ void AppLayerParserRegisterParserAcceptableDataDirection(uint8_t ipproto,
 void AppLayerParserRegisterOptionFlags(uint8_t ipproto, AppProto alproto,
         uint32_t flags);
 void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto,
-                           void *(*StateAlloc)(void),
-                           void (*StateFree)(void *));
+        void *(*StateAlloc)(void *, AppProto), void (*StateFree)(void *));
 void AppLayerParserRegisterLocalStorageFunc(uint8_t ipproto, AppProto proto,
                                  void *(*LocalStorageAlloc)(void),
                                  void (*LocalStorageFree)(void *));
index 29aba9d417794ff7fe883c4b5d47dfdedee3cd97..7e5ef8c1f191fec4633a3037ce2c03f848f0b5d9 100644 (file)
@@ -35,7 +35,7 @@ typedef struct AppLayerParser {
     uint16_t min_depth;
     uint16_t max_depth;
 
-    void *(*StateAlloc)(void);
+    void *(*StateAlloc)(void *, AppProto);
     void (*StateFree)(void *);
 
     AppLayerParserFPtr ParseTS;
index 2de623d34a5a15e41e20d23624d1852044f5b91b..68defb13dd811a9fce056d496e4ccc01308066ce 100644 (file)
@@ -1432,7 +1432,7 @@ static AppLayerResult SMTPParseServerRecord(Flow *f, void *alstate,
  * \internal
  * \brief Function to allocate SMTP state memory.
  */
-void *SMTPStateAlloc(void)
+void *SMTPStateAlloc(void *orig_state, AppProto proto_orig)
 {
     SMTPState *smtp_state = SCMalloc(sizeof(SMTPState));
     if (unlikely(smtp_state == NULL))
@@ -5154,7 +5154,7 @@ static int SMTPProcessDataChunkTest02(void){
     memset(&ssn, 0, sizeof(ssn));
     FLOW_INITIALIZE(&f);
     f.protoctx = &ssn;
-    f.alstate = SMTPStateAlloc();
+    f.alstate = SMTPStateAlloc(NULL, ALPROTO_UNKNOWN);
     MimeDecParseState *state = MimeDecInitParser(&f, NULL);
     ((MimeDecEntity *)state->stack->top->data)->ctnt_flags = CTNT_IS_ATTACHMENT;
     state->body_begin = 1;
@@ -5185,7 +5185,7 @@ static int SMTPProcessDataChunkTest03(void){
     Flow f;
     FLOW_INITIALIZE(&f);
     f.protoctx = &ssn;
-    f.alstate = SMTPStateAlloc();
+    f.alstate = SMTPStateAlloc(NULL, ALPROTO_UNKNOWN);
     MimeDecParseState *state = MimeDecInitParser(&f, NULL);
     ((MimeDecEntity *)state->stack->top->data)->ctnt_flags = CTNT_IS_ATTACHMENT;
     int ret;
@@ -5241,7 +5241,7 @@ static int SMTPProcessDataChunkTest04(void){
     Flow f;
     FLOW_INITIALIZE(&f);
     f.protoctx = &ssn;
-    f.alstate = SMTPStateAlloc();
+    f.alstate = SMTPStateAlloc(NULL, ALPROTO_UNKNOWN);
     MimeDecParseState *state = MimeDecInitParser(&f, NULL);
     ((MimeDecEntity *)state->stack->top->data)->ctnt_flags = CTNT_IS_ATTACHMENT;
     int ret = MIME_DEC_OK;
@@ -5281,7 +5281,7 @@ static int SMTPProcessDataChunkTest05(void){
     int ret;
     FLOW_INITIALIZE(&f);
     f.protoctx = &ssn;
-    f.alstate = SMTPStateAlloc();
+    f.alstate = SMTPStateAlloc(NULL, ALPROTO_UNKNOWN);
     FAIL_IF(f.alstate == NULL);
     MimeDecParseState *state = MimeDecInitParser(&f, NULL);
     ((MimeDecEntity *)state->stack->top->data)->ctnt_flags = CTNT_IS_ATTACHMENT;
index 473652a57353afd6fc9a7f8a0b9eef1d3e4d7bca..b8ca5e0fcb693e09b61d0729a5ba8fcf399530cd 100644 (file)
@@ -174,7 +174,7 @@ typedef struct SMTPState_ {
 extern SMTPConfig smtp_config;
 
 int SMTPProcessDataChunk(const uint8_t *chunk, uint32_t len, MimeDecParseState *state);
-void *SMTPStateAlloc(void);
+void *SMTPStateAlloc(void *orig_state, AppProto proto_orig);
 void RegisterSMTPParsers(void);
 void SMTPParserCleanup(void);
 void SMTPParserRegisterTests(void);
index 557253058ea9192a3288100fb00984cc0e8224dd..2cd1f861d475e17645c2e6e78742783bbbd25052 100644 (file)
@@ -2634,7 +2634,7 @@ static AppLayerResult SSLParseServerRecord(Flow *f, void *alstate, AppLayerParse
  * \internal
  * \brief Function to allocate the SSL state memory.
  */
-static void *SSLStateAlloc(void)
+static void *SSLStateAlloc(void *orig_state, AppProto proto_orig)
 {
     SSLState *ssl_state = SCMalloc(sizeof(SSLState));
     if (unlikely(ssl_state == NULL))
index 83eab5fa3d87cbc636eb50ef1b7e611f332d28f4..d01968cad6e7211326de9410caac989c945fd2a2 100644 (file)
@@ -105,7 +105,7 @@ static void TemplateTxFree(void *txv)
     SCFree(tx);
 }
 
-static void *TemplateStateAlloc(void)
+static void *TemplateStateAlloc(void *orig_state, AppProto proto_orig)
 {
     SCLogNotice("Allocating template state.");
     TemplateState *state = SCCalloc(1, sizeof(TemplateState));
index f5ec69e7f6d60240832d80e0132d66ac74aeb3e8..f41a059a36a02f1e9e02cb800718dffd922d8da2 100644 (file)
@@ -44,7 +44,7 @@
  * be the size of a header. */
 #define TFTP_MIN_FRAME_LEN 4
 
-static void *TFTPStateAlloc(void)
+static void *TFTPStateAlloc(void *orig_state, AppProto proto_orig)
 {
     return rs_tftp_state_alloc();
 }
index d1dabd67a67893dd11f8700fa42a71654505eff8..8dbcf73a9bd8fc017e8815171105ad810171154c 100644 (file)
@@ -73,7 +73,7 @@ static int DetectEngineSMTPFiledataTest01(void)
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
     f.flags |= FLOW_IPV4;
-    f.alstate = SMTPStateAlloc();
+    f.alstate = SMTPStateAlloc(NULL, ALPROTO_UNKNOWN);
 
     MimeDecParseState *state = MimeDecInitParser(&f, NULL);
     ((MimeDecEntity *)state->stack->top->data)->ctnt_flags = CTNT_IS_ATTACHMENT;
@@ -205,7 +205,7 @@ static int DetectEngineSMTPFiledataTest03(void)
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
     f.flags |= FLOW_IPV4;
-    f.alstate = SMTPStateAlloc();
+    f.alstate = SMTPStateAlloc(NULL, ALPROTO_UNKNOWN);
 
     MimeDecParseState *state = MimeDecInitParser(&f, NULL);
     ((MimeDecEntity *)state->stack->top->data)->ctnt_flags = CTNT_IS_ATTACHMENT;