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 fd9b662..0c66fff 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 b430a5f..3bb88ad 100644
--- a/src/libserver/cfg_utils.cxx
+++ b/src/libserver/cfg_utils.cxx
@@ -854,9 +854,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 28c42f9..a523f86 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()
