Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detect/datasets: adds test for unset operation #2065

Conversation

catenacyber
Copy link
Collaborator

Ticket

Redmine ticket: https://redmine.openinfosecfoundation.org/issues/7195

Suricata feature was merged for OISF/suricata#11815 and in 7 also with OISF/suricata#11833

@catenacyber catenacyber added the tests pass These new tests should pass label Sep 26, 2024
@catenacyber catenacyber marked this pull request as draft September 26, 2024 19:29
@catenacyber
Copy link
Collaborator Author

This fails because datasets do not seem well fit for load + save with 2 different paths and SV using input and output

Suricata patch could be

diff --git a/src/detect-dataset.c b/src/detect-dataset.c
index ae23925f2c..587088240c 100644
--- a/src/detect-dataset.c
+++ b/src/detect-dataset.c
@@ -409,9 +409,15 @@ int DetectDatasetSetup (DetectEngineCtx *de_ctx, Signature *s, const char *rawst
         if (SetupSavePath(de_ctx, save, sizeof(save)) != 0)
             return -1;
         strlcpy(load, save, sizeof(load));
+    } else if (strlen(save) != 0 && strlen(load) != 0 &&
+               strcmp(save, load) != 0) {
+        if (SetupLoadPath(de_ctx, load, sizeof(load)) != 0)
+            return -1;
+        if (SetupSavePath(de_ctx, save, sizeof(save)) != 0)
+            return -1;
     }

@catenacyber
Copy link
Collaborator Author

New version in #2070

@inashivb
Copy link
Member

This fails because datasets do not seem well fit for load + save with 2 different paths and SV using input and output

If such a setting is allowed, perhaps we should get your Suricata patch below in too.

Suricata patch could be

diff --git a/src/detect-dataset.c b/src/detect-dataset.c
index ae23925f2c..587088240c 100644
--- a/src/detect-dataset.c
+++ b/src/detect-dataset.c
@@ -409,9 +409,15 @@ int DetectDatasetSetup (DetectEngineCtx *de_ctx, Signature *s, const char *rawst
         if (SetupSavePath(de_ctx, save, sizeof(save)) != 0)
             return -1;
         strlcpy(load, save, sizeof(load));
+    } else if (strlen(save) != 0 && strlen(load) != 0 &&
+               strcmp(save, load) != 0) {
+        if (SetupLoadPath(de_ctx, load, sizeof(load)) != 0)
+            return -1;
+        if (SetupSavePath(de_ctx, save, sizeof(save)) != 0)
+            return -1;
     }

@catenacyber
Copy link
Collaborator Author

If such a setting is allowed, perhaps we should get your Suricata patch below in too.

Maybe, you know better the expected behavior of datasets I guess...
Would you create a ticket ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests pass These new tests should pass
Development

Successfully merging this pull request may close these issues.

2 participants