1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
From: =?utf-8?b?0L3QsNCx?= <nabijaczleweli@nabijaczleweli.xyz>
Date: Tue, 24 Jun 2025 17:20:11 +0200
Subject: Use system effective_tld_names.dat
Forwarded: not-needed
---
cmake/InstallRspamdFiles.cmake | 4 ----
conf/options.inc | 2 +-
src/libserver/cfg_utils.cxx | 4 +---
src/lua/lua_url.c | 2 +-
4 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/cmake/InstallRspamdFiles.cmake b/cmake/InstallRspamdFiles.cmake
index b6b631c..71f238c 100644
--- a/cmake/InstallRspamdFiles.cmake
+++ b/cmake/InstallRspamdFiles.cmake
@@ -34,10 +34,6 @@ function(InstallRspamdFiles)
install(FILES "src/plugins/lua/${LUA_PLUGIN}" DESTINATION ${PLUGINSDIR}/${_rp})
endforeach ()
- # Install TLD list
- install(FILES "contrib/publicsuffix/effective_tld_names.dat" DESTINATION
- "${SHAREDIR}")
-
# Install language data
install(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${SHAREDIR}/languages)")
file(GLOB LANGUAGES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/languages-data/*.json")
diff --git a/conf/options.inc b/conf/options.inc
index fb6c6af..dc288cc 100644
--- a/conf/options.inc
+++ b/conf/options.inc
@@ -36,7 +36,7 @@ dns {
retransmits = 5;
}
tempdir = "/tmp";
-url_tld = "${SHAREDIR}/effective_tld_names.dat";
+url_tld = "/usr/share/publicsuffix/effective_tld_names.dat";
classify_headers = [
"User-Agent",
"X-Mailer",
diff --git a/src/libserver/cfg_utils.cxx b/src/libserver/cfg_utils.cxx
index 1e96c32..c9b81d1 100644
--- a/src/libserver/cfg_utils.cxx
+++ b/src/libserver/cfg_utils.cxx
@@ -925,9 +925,7 @@ rspamd_config_post_load(struct rspamd_config *cfg,
if (opts & RSPAMD_CONFIG_INIT_URL) {
if (cfg->tld_file == nullptr) {
- /* Try to guess tld file */
- auto fpath = fmt::format("{0}{1}{2}", RSPAMD_SHAREDIR,
- G_DIR_SEPARATOR, "effective_tld_names.dat");
+ std::string fpath = "/usr/share/publicsuffix/effective_tld_names.dat";
if (access(fpath.c_str(), R_OK) != -1) {
msg_debug_config("url_tld option is not specified but %s is available,"
diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c
index 8e62318..8e40401 100644
--- a/src/lua/lua_url.c
+++ b/src/lua/lua_url.c
@@ -26,7 +26,7 @@
local url = require "rspamd_url"
local mpool = require "rspamd_mempool"
-url.init("/usr/share/rspamd/effective_tld_names.dat")
+url.init("/usr/share/publicsuffix/effective_tld_names.dat")
local pool = mpool.create()
local res = url.create(pool, 'Look at: http://user@test.example.com/test?query")
local t = res:to_table()
|