]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust/gen: turn *mut*const T into const T **
authorVictor Julien <victor@inliniac.net>
Mon, 3 Jun 2019 14:21:15 +0000 (16:21 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 20 Jun 2019 18:14:58 +0000 (20:14 +0200)
rust/gen-c-headers.py
src/detect-dce-stub-data.c
src/detect-dns-query.c
src/detect-krb5-cname.c
src/detect-krb5-sname.c
src/detect-smb-share.c
src/detect-template-rust-buffer.c

index 0dc29738988fa76418cab6eefe8ca8ab82fdc354..ac6e67334490bba5f5f0e2f4dec2e9f68bbcb9d0 100755 (executable)
@@ -131,7 +131,7 @@ def convert_type(rs_type):
             elif mod in [
                     "*mut *const",
                     "*mut*const"]:
-                return "%s **" % (type_map[rtype])
+                return "const %s **" % (type_map[rtype])
             else:
                 raise Exception("Unknown modifier '%s' in '%s'." % (
                     mod, rs_type))
index c9c754210d6ba895fa9f414e3bd4cf5731b41784..ccbaf341ccff722835f16f770a3186a8a7a984d6 100644 (file)
@@ -72,7 +72,7 @@ static InspectionBuffer *GetSMBData(DetectEngineThreadCtx *det_ctx,
     InspectionBuffer *buffer = InspectionBufferGet(det_ctx, list_id);
     if (buffer->inspect == NULL) {
         uint32_t data_len = 0;
-        uint8_t *data = NULL;
+        const uint8_t *data = NULL;
         uint8_t dir = flow_flags & (STREAM_TOSERVER|STREAM_TOCLIENT);
         if (rs_smb_tx_get_stub_data(txv, dir, &data, &data_len) != 1)
             return NULL;
index 4fdd727813e7bcde73ad9a2a02d099605cfa94e9..d8db60b251830e986dee733a5c32edb9cdf82820 100644 (file)
@@ -87,7 +87,7 @@ static InspectionBuffer *DnsQueryGetData(DetectEngineThreadCtx *det_ctx,
     const uint8_t *data;
     uint32_t data_len;
     if (rs_dns_tx_get_query_name(cbdata->txv, (uint16_t)cbdata->local_id,
-                (uint8_t **)&data, &data_len) == 0) {
+                &data, &data_len) == 0) {
         return NULL;
     }
     InspectionBufferSetup(buffer, data, data_len);
index 0a562e467c9c1e51adac1761be524a3e65174e30..b7c8de2bb8966f82db8fe34758aa74dee7ab2fc9 100644 (file)
@@ -70,7 +70,7 @@ static InspectionBuffer *GetKrb5CNameData(DetectEngineThreadCtx *det_ctx,
         return buffer;
 
     uint32_t b_len = 0;
-    uint8_t *b = NULL;
+    const uint8_t *b = NULL;
 
     if (rs_krb5_tx_get_cname(cbdata->txv, (uint16_t)cbdata->local_id, &b, &b_len) != 1)
         return NULL;
index d5f0bf5677f0945725fa29fee8bfec1987a7df2c..cf334428a5c2757a0e21896037f64d4abab148f2 100644 (file)
@@ -70,7 +70,7 @@ static InspectionBuffer *GetKrb5SNameData(DetectEngineThreadCtx *det_ctx,
         return buffer;
 
     uint32_t b_len = 0;
-    uint8_t *b = NULL;
+    const uint8_t *b = NULL;
 
     if (rs_krb5_tx_get_sname(cbdata->txv, (uint16_t)cbdata->local_id, &b, &b_len) != 1)
         return NULL;
index eb7f0d80a10e990c84a614ec0861d54dc82132f4..f2a21d9033b383857d108534ce7f95fa1fd174bc 100644 (file)
@@ -63,7 +63,7 @@ static InspectionBuffer *GetNamedPipeData(DetectEngineThreadCtx *det_ctx,
     InspectionBuffer *buffer = InspectionBufferGet(det_ctx, list_id);
     if (buffer->inspect == NULL) {
         uint32_t b_len = 0;
-        uint8_t *b = NULL;
+        const uint8_t *b = NULL;
 
         if (rs_smb_tx_get_named_pipe(txv, &b, &b_len) != 1)
             return NULL;
@@ -126,7 +126,7 @@ static InspectionBuffer *GetShareData(DetectEngineThreadCtx *det_ctx,
     InspectionBuffer *buffer = InspectionBufferGet(det_ctx, list_id);
     if (buffer->inspect == NULL) {
         uint32_t b_len = 0;
-        uint8_t *b = NULL;
+        const uint8_t *b = NULL;
 
         if (rs_smb_tx_get_share(txv, &b, &b_len) != 1)
             return NULL;
index 4a813af521b0bc77be240c14f16876ab94865b37..ff5c9eb53fbff333fc83842966620c3aaeef141c 100644 (file)
@@ -110,9 +110,9 @@ static int DetectEngineInspectTemplateRustBuffer(ThreadVars *tv,
     uint32_t data_len = 0;
 
     if (flags & STREAM_TOSERVER) {
-        rs_template_get_request_buffer(txv, (uint8_t **)&data, &data_len);
+        rs_template_get_request_buffer(txv, &data, &data_len);
     } else if (flags & STREAM_TOCLIENT) {
-        rs_template_get_response_buffer(txv, (uint8_t **)&data, &data_len);
+        rs_template_get_response_buffer(txv, &data, &data_len);
     }
 
     if (data != NULL) {