diff --git a/plugins/pfring/runmode-pfring.c b/plugins/pfring/runmode-pfring.c index 6a37ca2ea2..83e2ae7653 100644 --- a/plugins/pfring/runmode-pfring.c +++ b/plugins/pfring/runmode-pfring.c @@ -134,7 +134,7 @@ static void *OldParsePfringConfig(const char *iface) SCLogInfo("%s: ZC interface detected, not setting cluster-id", pfconf->iface); } else if ((pfconf->threads == 1) && (strncmp(pfconf->iface, "dna", 3) == 0)) { SCLogInfo("DNA interface detected, not setting cluster-id"); - } else if (SCConfGet("pfring.cluster-id", &tmpclusterid) != 1) { + } else if (SCConfGetNonNull("pfring.cluster-id", &tmpclusterid) != 1) { SCLogError("Could not get cluster-id from config"); } else { if (StringParseInt32(&pfconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) { @@ -152,7 +152,7 @@ static void *OldParsePfringConfig(const char *iface) } else if ((pfconf->threads == 1) && (strncmp(pfconf->iface, "dna", 3) == 0)) { SCLogInfo( "%s: DNA interface detected, not setting cluster type for PF_RING", pfconf->iface); - } else if (SCConfGet("pfring.cluster-type", &tmpctype) != 1) { + } else if (SCConfGetNonNull("pfring.cluster-type", &tmpctype) != 1) { SCLogError("Could not get cluster-type from config"); } else if (strcmp(tmpctype, "cluster_round_robin") == 0) { SCLogInfo("%s: Using round-robin cluster mode for PF_RING", pfconf->iface); @@ -275,7 +275,7 @@ static void *ParsePfringConfig(const char *iface) (void)SC_ATOMIC_ADD(pfconf->ref, pfconf->threads); /* command line value has precedence */ - if (SCConfGet("pfring.cluster-id", &tmpclusterid) == 1) { + if (SCConfGetNonNull("pfring.cluster-id", &tmpclusterid) == 1) { if (StringParseInt32(&pfconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) { SCLogWarning("Invalid value for " "pfring.cluster-id: '%s'. Resetting to 1.", @@ -425,7 +425,7 @@ static int GetDevAndParser(const char **live_dev, ConfigIfaceParserFunc *parser) *parser = OldParsePfringConfig; /* In v1: try to get interface name from config */ if (*live_dev == NULL) { - if (SCConfGet("pfring.interface", live_dev) == 1) { + if (SCConfGetNonNull("pfring.interface", live_dev) == 1) { SCLogInfo("Using interface %s", *live_dev); LiveRegisterDevice(*live_dev); } else { diff --git a/src/app-layer-htp-mem.c b/src/app-layer-htp-mem.c index e72416bec8..e332499cf2 100644 --- a/src/app-layer-htp-mem.c +++ b/src/app-layer-htp-mem.c @@ -48,7 +48,7 @@ void HTPParseMemcap(void) /** set config values for memcap, prealloc and hash_size */ uint64_t memcap; - if ((SCConfGet("app-layer.protocols.http.memcap", &conf_val)) == 1) { + if ((SCConfGetNonNull("app-layer.protocols.http.memcap", &conf_val)) == 1) { if (ParseSizeStringU64(conf_val, &memcap) < 0) { SCLogError("Error parsing http.memcap " "from conf file - %s. Killing engine", diff --git a/src/app-layer-htp-range.c b/src/app-layer-htp-range.c index 9c7e7e6380..18f2406a67 100644 --- a/src/app-layer-htp-range.c +++ b/src/app-layer-htp-range.c @@ -174,7 +174,7 @@ void HttpRangeContainersInit(void) const char *str = NULL; uint64_t memcap = HTTP_RANGE_DEFAULT_MEMCAP; uint32_t timeout = HTTP_RANGE_DEFAULT_TIMEOUT; - if (SCConfGet("app-layer.protocols.http.byterange.memcap", &str) == 1) { + if (SCConfGetNonNull("app-layer.protocols.http.byterange.memcap", &str) == 1) { if (ParseSizeStringU64(str, &memcap) < 0) { SCLogWarning("memcap value cannot be deduced: %s," " resetting to default", @@ -182,7 +182,7 @@ void HttpRangeContainersInit(void) memcap = 0; } } - if (SCConfGet("app-layer.protocols.http.byterange.timeout", &str) == 1) { + if (SCConfGetNonNull("app-layer.protocols.http.byterange.timeout", &str) == 1) { size_t slen = strlen(str); if (slen > UINT16_MAX || StringParseUint32(&timeout, 10, (uint16_t)slen, str) <= 0) { SCLogWarning("timeout value cannot be deduced: %s," diff --git a/src/app-layer-smtp.c b/src/app-layer-smtp.c index b3f2827166..7938a94a04 100644 --- a/src/app-layer-smtp.c +++ b/src/app-layer-smtp.c @@ -444,7 +444,7 @@ static void SMTPConfigure(void) { uint64_t value = SMTP_DEFAULT_MAX_TX; smtp_config.max_tx = SMTP_DEFAULT_MAX_TX; const char *str = NULL; - if (SCConfGet("app-layer.protocols.smtp.max-tx", &str) == 1) { + if (SCConfGetNonNull("app-layer.protocols.smtp.max-tx", &str) == 1) { if (ParseSizeStringU64(str, &value) < 0) { SCLogWarning("max-tx value cannot be deduced: %s," " keeping default", diff --git a/src/app-layer-ssh.c b/src/app-layer-ssh.c index bb681f91a9..98e30450dd 100644 --- a/src/app-layer-ssh.c +++ b/src/app-layer-ssh.c @@ -90,7 +90,7 @@ void RegisterSSHParsers(void) /* Check if we should generate Hassh fingerprints */ int enable_hassh = SSH_CONFIG_DEFAULT_HASSH; const char *strval = NULL; - if (SCConfGet("app-layer.protocols.ssh.hassh", &strval) != 1) { + if (SCConfGetNonNull("app-layer.protocols.ssh.hassh", &strval) != 1) { enable_hassh = SSH_CONFIG_DEFAULT_HASSH; } else if (strcmp(strval, "auto") == 0) { enable_hassh = SSH_CONFIG_DEFAULT_HASSH; diff --git a/src/app-layer-ssl.c b/src/app-layer-ssl.c index 2d18fc2b58..32c256735a 100644 --- a/src/app-layer-ssl.c +++ b/src/app-layer-ssl.c @@ -3137,7 +3137,7 @@ static void CheckJA3Enabled(void) const char *strval = NULL; /* Check if we should generate JA3 fingerprints */ int enable_ja3 = SSL_CONFIG_DEFAULT_JA3; - if (SCConfGet("app-layer.protocols.tls.ja3-fingerprints", &strval) != 1) { + if (SCConfGetNonNull("app-layer.protocols.tls.ja3-fingerprints", &strval) != 1) { enable_ja3 = SSL_CONFIG_DEFAULT_JA3; } else if (strcmp(strval, "auto") == 0) { enable_ja3 = SSL_CONFIG_DEFAULT_JA3; @@ -3162,7 +3162,7 @@ static void CheckJA4Enabled(void) const char *strval = NULL; /* Check if we should generate JA4 fingerprints */ int enable_ja4 = SSL_CONFIG_DEFAULT_JA4; - if (SCConfGet("app-layer.protocols.tls.ja4-fingerprints", &strval) != 1) { + if (SCConfGetNonNull("app-layer.protocols.tls.ja4-fingerprints", &strval) != 1) { enable_ja4 = SSL_CONFIG_DEFAULT_JA4; } else if (strcmp(strval, "auto") == 0) { enable_ja4 = SSL_CONFIG_DEFAULT_JA4; diff --git a/src/counters.c b/src/counters.c index ca97b0d4bf..c7b23977bd 100644 --- a/src/counters.c +++ b/src/counters.c @@ -285,7 +285,7 @@ static void StatsInitCtxPreOutput(void) } const char *prefix = NULL; - if (SCConfGet("stats.decoder-events-prefix", &prefix) != 1) { + if (SCConfGetNonNull("stats.decoder-events-prefix", &prefix) != 1) { prefix = "decoder.event"; } stats_decoder_events_prefix = prefix; diff --git a/src/datasets.c b/src/datasets.c index 9d6586d61c..8d57aed23d 100644 --- a/src/datasets.c +++ b/src/datasets.c @@ -599,7 +599,7 @@ void DatasetPostReloadCleanup(void) void DatasetGetDefaultMemcap(uint64_t *memcap, uint32_t *hashsize) { const char *str = NULL; - if (SCConfGet("datasets.defaults.memcap", &str) == 1) { + if (SCConfGetNonNull("datasets.defaults.memcap", &str) == 1) { if (ParseSizeStringU64(str, memcap) < 0) { SCLogWarning("memcap value cannot be deduced: %s," " resetting to default", @@ -609,7 +609,7 @@ void DatasetGetDefaultMemcap(uint64_t *memcap, uint32_t *hashsize) } *hashsize = (uint32_t)DATASETS_HASHSIZE_DEFAULT; - if (SCConfGet("datasets.defaults.hashsize", &str) == 1) { + if (SCConfGetNonNull("datasets.defaults.hashsize", &str) == 1) { if (ParseSizeStringU32(str, hashsize) < 0) { *hashsize = (uint32_t)DATASETS_HASHSIZE_DEFAULT; SCLogWarning("hashsize value cannot be deduced: %s," @@ -628,12 +628,12 @@ int DatasetsInit(void) DatasetGetDefaultMemcap(&default_memcap, &default_hashsize); if (datasets != NULL) { const char *str = NULL; - if (SCConfGet("datasets.limits.total-hashsizes", &str) == 1) { + if (SCConfGetNonNull("datasets.limits.total-hashsizes", &str) == 1) { if (ParseSizeStringU32(str, &dataset_max_total_hashsize) < 0) { FatalError("failed to parse datasets.limits.total-hashsizes value: %s", str); } } - if (SCConfGet("datasets.limits.single-hashsize", &str) == 1) { + if (SCConfGetNonNull("datasets.limits.single-hashsize", &str) == 1) { if (ParseSizeStringU32(str, &dataset_max_one_hashsize) < 0) { FatalError("failed to parse datasets.limits.single-hashsize value: %s", str); } diff --git a/src/defrag-hash.c b/src/defrag-hash.c index a3bfb48a36..71ef386542 100644 --- a/src/defrag-hash.c +++ b/src/defrag-hash.c @@ -188,7 +188,7 @@ void DefragInitConfig(bool quiet) uint64_t defrag_memcap; /** set config values for memcap, prealloc and hash_size */ - if ((SCConfGet("defrag.memcap", &conf_val)) == 1) { + if ((SCConfGetNonNull("defrag.memcap", &conf_val)) == 1) { if (ParseSizeStringU64(conf_val, &defrag_memcap) < 0) { SCLogError("Error parsing defrag.memcap " "from conf file - %s. Killing engine", @@ -198,7 +198,7 @@ void DefragInitConfig(bool quiet) SC_ATOMIC_SET(defrag_config.memcap, defrag_memcap); } } - if ((SCConfGet("defrag.hash-size", &conf_val)) == 1) { + if ((SCConfGetNonNull("defrag.hash-size", &conf_val)) == 1) { if (StringParseUint32(&configval, 10, strlen(conf_val), conf_val) > 0) { defrag_config.hash_size = configval; @@ -207,7 +207,7 @@ void DefragInitConfig(bool quiet) } } - if ((SCConfGet("defrag.trackers", &conf_val)) == 1) { + if ((SCConfGetNonNull("defrag.trackers", &conf_val)) == 1) { if (StringParseUint32(&configval, 10, strlen(conf_val), conf_val) > 0) { defrag_config.prealloc = configval; @@ -250,7 +250,7 @@ void DefragInitConfig(bool quiet) (uintmax_t)sizeof(DefragTrackerHashRow)); } - if ((SCConfGet("defrag.prealloc", &conf_val)) == 1) { + if ((SCConfGetNonNull("defrag.prealloc", &conf_val)) == 1) { if (SCConfValIsTrue(conf_val)) { /* pre allocate defrag trackers */ for (i = 0; i < defrag_config.prealloc; i++) { diff --git a/src/detect-engine-threshold.c b/src/detect-engine-threshold.c index 2d4e87919f..d2049b4744 100644 --- a/src/detect-engine-threshold.c +++ b/src/detect-engine-threshold.c @@ -195,7 +195,7 @@ static int ThresholdsInit(struct Thresholds *t) uint64_t memcap = 16 * 1024 * 1024; const char *str; - if (SCConfGet("detect.thresholds.memcap", &str) == 1) { + if (SCConfGetNonNull("detect.thresholds.memcap", &str) == 1) { if (ParseSizeStringU64(str, &memcap) < 0) { SCLogError("Error parsing detect.thresholds.memcap from conf file - %s", str); return -1; diff --git a/src/detect-engine.c b/src/detect-engine.c index d10cdbf2d4..abcd358cfa 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -4456,7 +4456,7 @@ int DetectEngineMultiTenantSetup(const bool unix_socket) master->multi_tenant_enabled = 1; const char *handler = NULL; - if (SCConfGet("multi-detect.selector", &handler) == 1) { + if (SCConfGetNonNull("multi-detect.selector", &handler) == 1) { SCLogConfig("multi-tenant selector type %s", handler); if (strcmp(handler, "vlan") == 0) { diff --git a/src/detect-uricontent.c b/src/detect-uricontent.c index 2203f66b3b..4c931cbc11 100644 --- a/src/detect-uricontent.c +++ b/src/detect-uricontent.c @@ -113,7 +113,7 @@ int DetectUricontentSetup(DetectEngineCtx *de_ctx, Signature *s, const char *con SCEnter(); const char *legacy = NULL; - if (SCConfGet("legacy.uricontent", &legacy) == 1) { + if (SCConfGetNonNull("legacy.uricontent", &legacy) == 1) { if (strcasecmp("disabled", legacy) == 0) { SCLogError("uricontent deprecated. To " "use a rule with \"uricontent\", either set the " diff --git a/src/host.c b/src/host.c index 83ce5bc193..eafe72a546 100644 --- a/src/host.c +++ b/src/host.c @@ -192,7 +192,7 @@ void HostInitConfig(bool quiet) uint32_t configval = 0; /** set config values for memcap, prealloc and hash_size */ - if ((SCConfGet("host.memcap", &conf_val)) == 1) { + if ((SCConfGetNonNull("host.memcap", &conf_val)) == 1) { uint64_t host_memcap = 0; if (ParseSizeStringU64(conf_val, &host_memcap) < 0) { SCLogError("Error parsing host.memcap " @@ -203,14 +203,14 @@ void HostInitConfig(bool quiet) SC_ATOMIC_SET(host_config.memcap, host_memcap); } } - if ((SCConfGet("host.hash-size", &conf_val)) == 1) { + if ((SCConfGetNonNull("host.hash-size", &conf_val)) == 1) { if (StringParseUint32(&configval, 10, strlen(conf_val), conf_val) > 0) { host_config.hash_size = configval; } } - if ((SCConfGet("host.prealloc", &conf_val)) == 1) { + if ((SCConfGetNonNull("host.prealloc", &conf_val)) == 1) { if (StringParseUint32(&configval, 10, strlen(conf_val), conf_val) > 0) { host_config.prealloc = configval; diff --git a/src/ippair.c b/src/ippair.c index 12480ee6cd..78ecf115df 100644 --- a/src/ippair.c +++ b/src/ippair.c @@ -187,7 +187,7 @@ void IPPairInitConfig(bool quiet) /** set config values for memcap, prealloc and hash_size */ uint64_t ippair_memcap; - if ((SCConfGet("ippair.memcap", &conf_val)) == 1) { + if ((SCConfGetNonNull("ippair.memcap", &conf_val)) == 1) { if (ParseSizeStringU64(conf_val, &ippair_memcap) < 0) { SCLogError("Error parsing ippair.memcap " "from conf file - %s. Killing engine", @@ -197,14 +197,14 @@ void IPPairInitConfig(bool quiet) SC_ATOMIC_SET(ippair_config.memcap, ippair_memcap); } } - if ((SCConfGet("ippair.hash-size", &conf_val)) == 1) { + if ((SCConfGetNonNull("ippair.hash-size", &conf_val)) == 1) { if (StringParseUint32(&configval, 10, strlen(conf_val), conf_val) > 0) { ippair_config.hash_size = configval; } } - if ((SCConfGet("ippair.prealloc", &conf_val)) == 1) { + if ((SCConfGetNonNull("ippair.prealloc", &conf_val)) == 1) { if (StringParseUint32(&configval, 10, strlen(conf_val), conf_val) > 0) { ippair_config.prealloc = configval; diff --git a/src/reputation.c b/src/reputation.c index f3ba837633..e4b7e9016a 100644 --- a/src/reputation.c +++ b/src/reputation.c @@ -520,7 +520,7 @@ static char *SRepCompleteFilePath(char *file) /* Path not specified */ if (PathIsRelative(file)) { - if (SCConfGet("default-reputation-path", &defaultpath) == 1) { + if (SCConfGetNonNull("default-reputation-path", &defaultpath) == 1) { SCLogDebug("Default path: %s", defaultpath); size_t path_len = sizeof(char) * (strlen(defaultpath) + strlen(file) + 2); diff --git a/src/runmode-erf-file.c b/src/runmode-erf-file.c index 39ff305efd..063237b23d 100644 --- a/src/runmode-erf-file.c +++ b/src/runmode-erf-file.c @@ -53,7 +53,7 @@ int RunModeErfFileSingle(void) SCEnter(); - if (SCConfGet("erf-file.file", &file) == 0) { + if (SCConfGetNonNull("erf-file.file", &file) == 0) { FatalError("Failed to get erf-file.file from config."); } @@ -110,7 +110,7 @@ int RunModeErfFileAutoFp(void) uint16_t thread; const char *file = NULL; - if (SCConfGet("erf-file.file", &file) == 0) { + if (SCConfGetNonNull("erf-file.file", &file) == 0) { FatalError("Failed retrieving erf-file.file from config"); } diff --git a/src/runmode-pcap-file.c b/src/runmode-pcap-file.c index f07ae2a411..cbbbf09293 100644 --- a/src/runmode-pcap-file.c +++ b/src/runmode-pcap-file.c @@ -55,7 +55,7 @@ int RunModeFilePcapSingle(void) const char *file = NULL; char tname[TM_THREAD_NAME_MAX]; - if (SCConfGet("pcap-file.file", &file) == 0) { + if (SCConfGetNonNull("pcap-file.file", &file) == 0) { FatalError("Failed retrieving pcap-file from Conf"); } @@ -125,7 +125,7 @@ int RunModeFilePcapAutoFp(void) uint16_t thread; const char *file = NULL; - if (SCConfGet("pcap-file.file", &file) == 0) { + if (SCConfGetNonNull("pcap-file.file", &file) == 0) { FatalError("Failed retrieving pcap-file from Conf"); } SCLogDebug("file %s", file); diff --git a/src/runmode-pcap.c b/src/runmode-pcap.c index 100485da02..43ac10d3e1 100644 --- a/src/runmode-pcap.c +++ b/src/runmode-pcap.c @@ -100,7 +100,7 @@ static void *ParsePcapConfig(const char *iface) aconf->checksum_mode = CHECKSUM_VALIDATION_AUTO; aconf->bpf_filter = NULL; - if ((SCConfGet("bpf-filter", &tmpbpf)) == 1) { + if ((SCConfGetNonNull("bpf-filter", &tmpbpf)) == 1) { aconf->bpf_filter = tmpbpf; } diff --git a/src/source-nfq.c b/src/source-nfq.c index a85ba60282..d1f879a0ad 100644 --- a/src/source-nfq.c +++ b/src/source-nfq.c @@ -215,7 +215,7 @@ void NFQInitConfig(bool quiet) memset(&nfq_config, 0, sizeof(nfq_config)); - if ((SCConfGet("nfq.mode", &nfq_mode)) == 0) { + if ((SCConfGetNonNull("nfq.mode", &nfq_mode)) == 0) { nfq_config.mode = NFQ_ACCEPT_MODE; } else { if (!strcmp("accept", nfq_mode)) { diff --git a/src/source-pcap-file.c b/src/source-pcap-file.c index 75252bc3bb..e8b9c6e4c6 100644 --- a/src/source-pcap-file.c +++ b/src/source-pcap-file.c @@ -152,7 +152,7 @@ void PcapFileGlobalInit(void) pcap_g.read_buffer_size = PCAP_FILE_BUFFER_SIZE_DEFAULT; const char *str = NULL; - if (SCConfGet("pcap-file.buffer-size", &str) == 1) { + if (SCConfGetNonNull("pcap-file.buffer-size", &str) == 1) { uint32_t value = 0; if (ParseSizeStringU32(str, &value) < 0) { SCLogWarning("failed to parse pcap-file.buffer-size %s", str); @@ -248,7 +248,7 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d } } - if (SCConfGet("bpf-filter", &(tmp_bpf_string)) != 1) { + if (SCConfGetNonNull("bpf-filter", &(tmp_bpf_string)) != 1) { SCLogDebug("could not get bpf or none specified"); } else { ptv->shared.bpf_string = SCStrdup(tmp_bpf_string); @@ -373,7 +373,7 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d ptv->behavior.directory = pv; } - if (SCConfGet("pcap-file.checksum-checks", &tmpstring) != 1) { + if (SCConfGetNonNull("pcap-file.checksum-checks", &tmpstring) != 1) { pcap_g.conf_checksum_mode = CHECKSUM_VALIDATION_AUTO; } else { if (strcmp(tmpstring, "auto") == 0) { diff --git a/src/stream-tcp.c b/src/stream-tcp.c index 22fd16ea16..f2335ae90e 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -531,7 +531,7 @@ void StreamTcpInitConfig(bool quiet) } const char *temp_stream_memcap_str; - if (SCConfGet("stream.memcap", &temp_stream_memcap_str) == 1) { + if (SCConfGetNonNull("stream.memcap", &temp_stream_memcap_str) == 1) { uint64_t stream_memcap_copy; if (ParseSizeStringU64(temp_stream_memcap_str, &stream_memcap_copy) < 0) { SCLogError("Error parsing stream.memcap " @@ -583,7 +583,7 @@ void StreamTcpInitConfig(bool quiet) } const char *temp_stream_inline_str; - if (SCConfGet("stream.inline", &temp_stream_inline_str) == 1) { + if (SCConfGetNonNull("stream.inline", &temp_stream_inline_str) == 1) { int inl = 0; /* checking for "auto" and falling back to boolean to provide @@ -703,7 +703,7 @@ void StreamTcpInitConfig(bool quiet) } const char *temp_stream_reassembly_memcap_str; - if (SCConfGet("stream.reassembly.memcap", &temp_stream_reassembly_memcap_str) == 1) { + if (SCConfGetNonNull("stream.reassembly.memcap", &temp_stream_reassembly_memcap_str) == 1) { uint64_t stream_reassembly_memcap_copy; if (ParseSizeStringU64(temp_stream_reassembly_memcap_str, &stream_reassembly_memcap_copy) < 0) { @@ -725,7 +725,7 @@ void StreamTcpInitConfig(bool quiet) } const char *temp_stream_reassembly_depth_str; - if (SCConfGet("stream.reassembly.depth", &temp_stream_reassembly_depth_str) == 1) { + if (SCConfGetNonNull("stream.reassembly.depth", &temp_stream_reassembly_depth_str) == 1) { if (ParseSizeStringU32(temp_stream_reassembly_depth_str, &stream_config.reassembly_depth) < 0) { SCLogError("Error parsing " @@ -753,7 +753,7 @@ void StreamTcpInitConfig(bool quiet) if (randomize) { const char *temp_rdrange; - if (SCConfGet("stream.reassembly.randomize-chunk-range", &temp_rdrange) == 1) { + if (SCConfGetNonNull("stream.reassembly.randomize-chunk-range", &temp_rdrange) == 1) { if (ParseSizeStringU16(temp_rdrange, &rdrange) < 0) { SCLogError("Error parsing " "stream.reassembly.randomize-chunk-range " @@ -768,7 +768,7 @@ void StreamTcpInitConfig(bool quiet) } const char *temp_stream_reassembly_toserver_chunk_size_str; - if (SCConfGet("stream.reassembly.toserver-chunk-size", + if (SCConfGetNonNull("stream.reassembly.toserver-chunk-size", &temp_stream_reassembly_toserver_chunk_size_str) == 1) { if (ParseSizeStringU16(temp_stream_reassembly_toserver_chunk_size_str, &stream_config.reassembly_toserver_chunk_size) < 0) { @@ -790,7 +790,7 @@ void StreamTcpInitConfig(bool quiet) rdrange / 100); } const char *temp_stream_reassembly_toclient_chunk_size_str; - if (SCConfGet("stream.reassembly.toclient-chunk-size", + if (SCConfGetNonNull("stream.reassembly.toclient-chunk-size", &temp_stream_reassembly_toclient_chunk_size_str) == 1) { if (ParseSizeStringU16(temp_stream_reassembly_toclient_chunk_size_str, &stream_config.reassembly_toclient_chunk_size) < 0) { diff --git a/src/suricata.c b/src/suricata.c index 04d29dfb56..ccb5b4cc1c 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -2196,7 +2196,7 @@ static int MayDaemonize(SCInstance *suri) if (suri->daemon == 1 && suri->pid_filename == NULL) { const char *pid_filename; - if (SCConfGet("pid-file", &pid_filename) == 1) { + if (SCConfGetNonNull("pid-file", &pid_filename) == 1) { SCLogInfo("Use pid file %s from config file.", pid_filename); } else { pid_filename = DEFAULT_PID_FILENAME; @@ -2549,7 +2549,7 @@ static int ConfigGetCaptureValue(SCInstance *suri) /* Pull the default packet size from the config, if not found fall * back on a sane default. */ const char *temp_default_packet_size; - if ((SCConfGet("default-packet-size", &temp_default_packet_size)) != 1) { + if ((SCConfGetNonNull("default-packet-size", &temp_default_packet_size)) != 1) { int lthread; int nlive; int strip_trailing_plus = 0; @@ -2686,7 +2686,7 @@ static void PostConfLoadedSetupHostMode(void) { const char *hostmode = NULL; - if (SCConfGet("host-mode", &hostmode) == 1) { + if (SCConfGetNonNull("host-mode", &hostmode) == 1) { if (!strcmp(hostmode, "router")) { host_mode = SURI_HOST_IS_ROUTER; } else if (!strcmp(hostmode, "sniffer-only")) { @@ -2769,7 +2769,7 @@ int PostConfLoadedSetup(SCInstance *suri) if (suri->checksum_validation == -1) { const char *cv = NULL; - if (SCConfGet("capture.checksum-validation", &cv) == 1) { + if (SCConfGetNonNull("capture.checksum-validation", &cv) == 1) { if (strcmp(cv, "none") == 0) { suri->checksum_validation = 0; } else if (strcmp(cv, "all") == 0) { @@ -2838,7 +2838,7 @@ int PostConfLoadedSetup(SCInstance *suri) /* Suricata will use this umask if provided. By default it will use the umask passed on from the shell. */ const char *custom_umask; - if (SCConfGet("umask", &custom_umask) == 1) { + if (SCConfGetNonNull("umask", &custom_umask) == 1) { uint16_t mask; if (StringParseUint16(&mask, 8, (uint16_t)strlen(custom_umask), custom_umask) > 0) { umask((mode_t)mask); diff --git a/src/tests/stream-tcp.c b/src/tests/stream-tcp.c index 1b897248ed..f0fa76cca8 100644 --- a/src/tests/stream-tcp.c +++ b/src/tests/stream-tcp.c @@ -1074,7 +1074,7 @@ static const char *StreamTcpParseOSPolicy(char *conf_var_name) goto end; } - if (SCConfGet(conf_var_full_name, &conf_var_value) != 1) { + if (SCConfGetNonNull(conf_var_full_name, &conf_var_value) != 1) { SCLogError("Error in getting conf value for conf name %s", conf_var_full_name); goto end; } diff --git a/src/tmqh-flow.c b/src/tmqh-flow.c index fa5d924352..af1069951d 100644 --- a/src/tmqh-flow.c +++ b/src/tmqh-flow.c @@ -57,7 +57,7 @@ void TmqhFlowRegister(void) tmqh_table[TMQH_FLOW].RegisterTests = TmqhFlowRegisterTests; const char *scheduler = NULL; - if (SCConfGet("autofp-scheduler", &scheduler) == 1) { + if (SCConfGetNonNull("autofp-scheduler", &scheduler) == 1) { if (strcasecmp(scheduler, "round-robin") == 0) { SCLogNotice("using flow hash instead of round robin"); tmqh_table[TMQH_FLOW].OutHandler = TmqhOutputFlowHash; diff --git a/src/unix-manager.c b/src/unix-manager.c index ceb9acb0b8..66f956f92d 100644 --- a/src/unix-manager.c +++ b/src/unix-manager.c @@ -121,7 +121,7 @@ static int UnixNew(UnixCommand * this) TAILQ_INIT(&this->clients); int check_dir = 0; - if (SCConfGet("unix-command.filename", &socketname) == 1) { + if (SCConfGetNonNull("unix-command.filename", &socketname) == 1) { if (PathIsAbsolute(socketname)) { strlcpy(sockettarget, socketname, sizeof(sockettarget)); } else { @@ -888,7 +888,7 @@ static TmEcode UnixManagerConfGetCommand(json_t *cmd, } variable = (char *)json_string_value(jarg); - if (SCConfGet(variable, &confval) != 1) { + if (SCConfGetNonNull(variable, &confval) != 1) { json_object_set_new(server_msg, "message", json_string("Unable to get value")); SCReturnInt(TM_ECODE_FAILED); } diff --git a/src/util-bpf.c b/src/util-bpf.c index bf54819d76..a58da2ece5 100644 --- a/src/util-bpf.c +++ b/src/util-bpf.c @@ -36,7 +36,7 @@ void ConfSetBPFFilter( } /* command line value has precedence */ - if (SCConfGet("bpf-filter", bpf_filter) == 1) { + if (SCConfGetNonNull("bpf-filter", bpf_filter) == 1) { if (strlen(*bpf_filter) > 0) { SCLogConfig("%s: using command-line provided bpf filter '%s'", iface, *bpf_filter); } diff --git a/src/util-classification-config.c b/src/util-classification-config.c index d7f4e9cc83..fb111be819 100644 --- a/src/util-classification-config.c +++ b/src/util-classification-config.c @@ -160,13 +160,13 @@ static const char *SCClassConfGetConfFilename(const DetectEngineCtx *de_ctx) /* try loading prefix setting, fall back to global if that * fails. */ - if (SCConfGet(config_value, &log_filename) != 1) { - if (SCConfGet("classification-file", &log_filename) != 1) { + if (SCConfGetNonNull(config_value, &log_filename) != 1) { + if (SCConfGetNonNull("classification-file", &log_filename) != 1) { log_filename = (char *)SC_CLASS_CONF_DEF_CONF_FILEPATH; } } } else { - if (SCConfGet("classification-file", &log_filename) != 1) { + if (SCConfGetNonNull("classification-file", &log_filename) != 1) { log_filename = (char *)SC_CLASS_CONF_DEF_CONF_FILEPATH; } } diff --git a/src/util-conf.c b/src/util-conf.c index 734aab80a9..9aab8b6023 100644 --- a/src/util-conf.c +++ b/src/util-conf.c @@ -39,7 +39,7 @@ const char *SCConfigGetLogDirectory(void) { const char *log_dir = NULL; - if (SCConfGet("default-log-dir", &log_dir) != 1) { + if (SCConfGetNonNull("default-log-dir", &log_dir) != 1) { #ifdef OS_WIN32 log_dir = _getcwd(NULL, 0); if (log_dir == NULL) { @@ -81,7 +81,7 @@ const char *ConfigGetDataDirectory(void) { const char *data_dir = NULL; - if (SCConfGet("default-data-dir", &data_dir) != 1) { + if (SCConfGetNonNull("default-data-dir", &data_dir) != 1) { #ifdef OS_WIN32 data_dir = _getcwd(NULL, 0); if (data_dir == NULL) { diff --git a/src/util-daemon.c b/src/util-daemon.c index d191077f91..35d2e7d1fa 100644 --- a/src/util-daemon.c +++ b/src/util-daemon.c @@ -131,7 +131,7 @@ void Daemonize (void) FatalError("Error creating new session"); } - if (SCConfGet("daemon-directory", &daemondir) == 1) { + if (SCConfGetNonNull("daemon-directory", &daemondir) == 1) { if ((chdir(daemondir)) < 0) { FatalError("Error changing to working directory"); } diff --git a/src/util-debug.c b/src/util-debug.c index c0e61f6ba7..9f9c957924 100644 --- a/src/util-debug.c +++ b/src/util-debug.c @@ -1445,7 +1445,7 @@ void SCLogLoadConfig(int daemon, int verbose, uint32_t userid, uint32_t groupid) /* Get default log level and format. */ const char *default_log_level_s = NULL; - if (SCConfGet("logging.default-log-level", &default_log_level_s) == 1) { + if (SCConfGetNonNull("logging.default-log-level", &default_log_level_s) == 1) { SCLogLevel default_log_level = SCMapEnumNameToValue(default_log_level_s, sc_log_level_map); if (default_log_level == -1) { @@ -1457,7 +1457,7 @@ void SCLogLoadConfig(int daemon, int verbose, uint32_t userid, uint32_t groupid) sc_lid->global_log_level = MAX(min_level, SC_LOG_NOTICE); } - if (SCConfGet("logging.default-log-format", &sc_lid->global_log_format) != 1) + if (SCConfGetNonNull("logging.default-log-format", &sc_lid->global_log_format) != 1) sc_lid->global_log_format = SCLogGetDefaultLogFormat(sc_lid->global_log_level); (void)SCConfGet("logging.default-output-filter", &sc_lid->op_filter); diff --git a/src/util-landlock.c b/src/util-landlock.c index 198c3abe71..ddba3c5125 100644 --- a/src/util-landlock.c +++ b/src/util-landlock.c @@ -208,7 +208,7 @@ void LandlockSandboxing(SCInstance *suri) } if (suri->run_mode == RUNMODE_PCAP_FILE) { const char *pcap_file; - if (SCConfGet("pcap-file.file", &pcap_file) == 1) { + if (SCConfGetNonNull("pcap-file.file", &pcap_file) == 1) { char *file_name = SCStrdup(pcap_file); if (file_name != NULL) { struct stat statbuf; @@ -241,7 +241,7 @@ void LandlockSandboxing(SCInstance *suri) } if (ConfUnixSocketIsEnable()) { const char *socketname; - if (SCConfGet("unix-command.filename", &socketname) == 1) { + if (SCConfGetNonNull("unix-command.filename", &socketname) == 1) { if (PathIsAbsolute(socketname)) { char *file_name = SCStrdup(socketname); if (file_name != NULL) { @@ -257,7 +257,7 @@ void LandlockSandboxing(SCInstance *suri) } if (!suri->sig_file_exclusive) { const char *rule_path; - if (SCConfGet("default-rule-path", &rule_path) == 1 && rule_path) { + if (SCConfGetNonNull("default-rule-path", &rule_path) == 1 && rule_path) { LandlockSandboxingReadPath(ruleset, rule_path); } } diff --git a/src/util-reference-config.c b/src/util-reference-config.c index 677a891c31..1290932a5b 100644 --- a/src/util-reference-config.c +++ b/src/util-reference-config.c @@ -150,13 +150,13 @@ static const char *SCRConfGetConfFilename(const DetectEngineCtx *de_ctx) /* try loading prefix setting, fall back to global if that * fails. */ - if (SCConfGet(config_value, &path) != 1) { - if (SCConfGet("reference-config-file", &path) != 1) { + if (SCConfGetNonNull(config_value, &path) != 1) { + if (SCConfGetNonNull("reference-config-file", &path) != 1) { return (char *)SC_RCONF_DEFAULT_FILE_PATH; } } } else { - if (SCConfGet("reference-config-file", &path) != 1) { + if (SCConfGetNonNull("reference-config-file", &path) != 1) { return (char *)SC_RCONF_DEFAULT_FILE_PATH; } } diff --git a/src/util-rule-vars.c b/src/util-rule-vars.c index 0ce1015e72..0bdde4e1ee 100644 --- a/src/util-rule-vars.c +++ b/src/util-rule-vars.c @@ -97,7 +97,7 @@ const char *SCRuleVarsGetConfVar(const DetectEngineCtx *de_ctx, } } - if (SCConfGet(conf_var_full_name, &conf_var_full_name_value) != 1) { + if (SCConfGetNonNull(conf_var_full_name, &conf_var_full_name_value) != 1) { SCLogError("Variable \"%s\" is not defined in " "configuration file", conf_var_name); diff --git a/src/util-thash.c b/src/util-thash.c index a006d3cc52..e6363d9446 100644 --- a/src/util-thash.c +++ b/src/util-thash.c @@ -226,7 +226,7 @@ static int THashInitConfig(THashTableContext *ctx, const char *cnf_prefix) /** set config values for memcap, prealloc and hash_size */ GET_VAR(cnf_prefix, "memcap"); - if ((SCConfGet(varname, &conf_val)) == 1) { + if ((SCConfGetNonNull(varname, &conf_val)) == 1) { uint64_t memcap; if (ParseSizeStringU64(conf_val, &memcap) < 0) { SCLogError("Error parsing %s " @@ -238,14 +238,14 @@ static int THashInitConfig(THashTableContext *ctx, const char *cnf_prefix) SC_ATOMIC_SET(ctx->config.memcap, memcap); } GET_VAR(cnf_prefix, "hash-size"); - if ((SCConfGet(varname, &conf_val)) == 1) { + if ((SCConfGetNonNull(varname, &conf_val)) == 1) { if (StringParseUint32(&configval, 10, (uint16_t)strlen(conf_val), conf_val) > 0) { ctx->config.hash_size = configval; } } GET_VAR(cnf_prefix, "prealloc"); - if ((SCConfGet(varname, &conf_val)) == 1) { + if ((SCConfGetNonNull(varname, &conf_val)) == 1) { if (StringParseUint32(&configval, 10, (uint16_t)strlen(conf_val), conf_val) > 0) { ctx->config.prealloc = configval; } else { diff --git a/src/util-threshold-config.c b/src/util-threshold-config.c index 9c7e175e06..66628563c2 100644 --- a/src/util-threshold-config.c +++ b/src/util-threshold-config.c @@ -139,13 +139,13 @@ static const char *SCThresholdConfGetConfFilename(const DetectEngineCtx *de_ctx) /* try loading prefix setting, fall back to global if that * fails. */ - if (SCConfGet(config_value, &log_filename) != 1) { - if (SCConfGet("threshold-file", &log_filename) != 1) { + if (SCConfGetNonNull(config_value, &log_filename) != 1) { + if (SCConfGetNonNull("threshold-file", &log_filename) != 1) { log_filename = (char *)THRESHOLD_CONF_DEF_CONF_FILEPATH; } } } else { - if (SCConfGet("threshold-file", &log_filename) != 1) { + if (SCConfGetNonNull("threshold-file", &log_filename) != 1) { log_filename = (char *)THRESHOLD_CONF_DEF_CONF_FILEPATH; } }