From f7c537f02e998b191cc0901baf0fb9679fc99914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Wed, 14 Aug 2019 10:21:27 +0200 Subject: [PATCH 1/2] Allow to configure the path to the redis socket Add a new CMake directive (-DREDIS_SOCKET_PATH=/path/to/socket)to allow to set the path to the redis unix socket at build time. Additionally change the default path to use the default socket path of redis on debian and ubuntu which is (/var)/run/redis/redis.sock. --- CMakeLists.txt | 8 ++++++++ util/kb.h | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 07879cf8f..62ec0c373 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,6 +183,14 @@ if (NOT GVM_SYSCONF_DIR) set (GVM_SYSCONF_DIR "${SYSCONFDIR}/gvm") endif (NOT GVM_SYSCONF_DIR) + +if (NOT REDIS_SOCKET_PATH) + set (REDIS_SOCKET_PATH "/run/redis/redis.sock") +endif () + +add_definitions (-DREDIS_SOCKET_PATH="${REDIS_SOCKET_PATH}") +message ("-- Using redis socket ${REDIS_SOCKET_PATH}") + message ("-- Install prefix: ${CMAKE_INSTALL_PREFIX}") if (ENABLE_COVERAGE) diff --git a/util/kb.h b/util/kb.h index 23a412d4a..c5221fd1c 100644 --- a/util/kb.h +++ b/util/kb.h @@ -34,7 +34,11 @@ /** * @brief Default KB location. */ -#define KB_PATH_DEFAULT "/tmp/redis.sock" +#ifdef REDIS_SOCKET_PATH +#define KB_PATH_DEFAULT REDIS_SOCKET_PATH +#else +#define KB_PATH_DEFAULT "/run/redis/redis.sock" +#endif /** * @brief Possible type of a kb_item. From 84c0971c3120df75c8696d558476c6016d56407c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Wed, 14 Aug 2019 10:26:41 +0200 Subject: [PATCH 2/2] Add changelog entries for redis socket changes --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e66a3813..178123cde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### Added +- Allow to configure the path to the redis socket via CMake [#256](https://github.com/greenbone/gvm-libs/pull/256) - A new data model for unified handling of cross references in the NVT meta data as been added. All previous API elements to handle cve, bid, xref werehas been removed. [#225](https://github.com/greenbone/gvm-libs/pull/225) [#232](https://github.com/greenbone/gvm-libs/pull/232). ### Changed +- Change the default path to the redis socket to /run/redis/redis.sock [#256](https://github.com/greenbone/gvm-libs/pull/256) - Handle EAI_AGAIN in gvm_host_reverse_lookup() IPv6 case and function refactor. [#229](https://github.com/greenbone/gvm-libs/pull/229) - Prevent g_strsplit to be called with NULL. [#238](https://github.com/greenbone/gvm-libs/pull/238)