]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
reference: change scope of add func to global
authorVictor Julien <victor@inliniac.net>
Wed, 2 Oct 2019 19:29:32 +0000 (21:29 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 8 Oct 2019 18:31:09 +0000 (20:31 +0200)
src/util-reference-config.c
src/util-reference-config.h

index fe57f6a64ec9292fc04cc7a160868dcb75b2c853..5951d637aa1e850157dd7ce50772bb9a693c2e7b 100644 (file)
@@ -242,7 +242,7 @@ static char *SCRConfStringToLowercase(const char *str)
  * \retval  0 On success.
  * \retval -1 On failure.
  */
-static int SCRConfAddReference(char *rawstr, DetectEngineCtx *de_ctx)
+int SCRConfAddReference(DetectEngineCtx *de_ctx, const char *line)
 {
     char system[REFERENCE_SYSTEM_NAME_MAX];
     char url[REFERENCE_CONTENT_NAME_MAX];
@@ -254,7 +254,7 @@ static int SCRConfAddReference(char *rawstr, DetectEngineCtx *de_ctx)
     int ret = 0;
     int ov[MAX_SUBSTRINGS];
 
-    ret = pcre_exec(regex, regex_study, rawstr, strlen(rawstr), 0, 0, ov, 30);
+    ret = pcre_exec(regex, regex_study, line, strlen(line), 0, 0, ov, 30);
     if (ret < 0) {
         SCLogError(SC_ERR_REFERENCE_CONFIG, "Invalid Reference Config in "
                    "reference.config file");
@@ -262,14 +262,14 @@ static int SCRConfAddReference(char *rawstr, DetectEngineCtx *de_ctx)
     }
 
     /* retrieve the reference system */
-    ret = pcre_copy_substring((char *)rawstr, ov, 30, 1, system, sizeof(system));
+    ret = pcre_copy_substring((char *)line, ov, 30, 1, system, sizeof(system));
     if (ret < 0) {
         SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre_copy_substring() failed");
         goto error;
     }
 
     /* retrieve the reference url */
-    ret = pcre_copy_substring((char *)rawstr, ov, 30, 2, url, sizeof(url));
+    ret = pcre_copy_substring((char *)line, ov, 30, 2, url, sizeof(url));
     if (ret < 0) {
         SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre_copy_substring() failed");
         goto error;
@@ -343,7 +343,7 @@ static void SCRConfParseFile(DetectEngineCtx *de_ctx, FILE *fd)
         if (SCRConfIsLineBlankOrComment(line))
             continue;
 
-        SCRConfAddReference(line, de_ctx);
+        SCRConfAddReference(de_ctx, line);
         i++;
     }
 
index fc7ea34e8689d85388944472d7d4ec5c0737263a..0bbab62af3cb4a32e9139d6a23ae7cd327324e9a 100644 (file)
@@ -43,6 +43,7 @@ int SCRConfLoadReferenceConfigFile(DetectEngineCtx *, FILE *);
 void SCRConfDeInitContext(DetectEngineCtx *);
 SCRConfReference *SCRConfGetReference(const char *,
                                       DetectEngineCtx *);
+int SCRConfAddReference(DetectEngineCtx *de_ctx, const char *line);
 void SCRConfRegisterTests(void);
 
 /* these below functions are only used by unittests */