From: Nick Porter Date: Wed, 30 Apr 2025 13:47:28 +0000 (+0100) Subject: Ignore packaging system upgrade produced config files X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd358aae2efc0f228afb44331707b86a11bc77ef;p=thirdparty%2Ffreeradius-server.git Ignore packaging system upgrade produced config files Both deb and rpm packaging systems will detect changed config files and create extra files, which if we load them will create conflicts. --- diff --git a/src/lib/server/cf_file.c b/src/lib/server/cf_file.c index ebda463984..7271ecbf54 100644 --- a/src/lib/server/cf_file.c +++ b/src/lib/server/cf_file.c @@ -1090,6 +1090,7 @@ static int process_include(cf_stack_t *stack, CONF_SECTION *parent, char const * */ while ((dp = readdir(dir)) != NULL) { char const *p; + size_t len; if (dp->d_name[0] == '.') continue; @@ -1106,6 +1107,19 @@ static int process_include(cf_stack_t *stack, CONF_SECTION *parent, char const * } if (*p != '\0') continue; + /* + * Ignore config files generated by deb / rpm packaging updates. + */ + len = strlen(dp->d_name); + if ((len > 10) && (strncmp(&dp->d_name[len - 10], ".dpkg-dist", 10) == 0)) { + pkg_file: + WARN("Ignoring packaging system produced file %s%s", frame->directory, dp->d_name); + continue; + } + if ((len > 9) && (strncmp(&dp->d_name[len - 9], ".dpkg-old", 9) == 0)) goto pkg_file; + if ((len > 7) && (strncmp(&dp->d_name[len - 7], ".rpmnew", 9) == 0)) goto pkg_file; + if ((len > 8) && (strncmp(&dp->d_name[len - 8], ".rpmsave", 10) == 0)) goto pkg_file; + snprintf(stack->buff[1], stack->bufsize, "%s%s", frame->directory, dp->d_name);