]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
gnore packaging system upgrade produced config files
authorNick Porter <nick@portercomputing.co.uk>
Wed, 30 Apr 2025 16:21:56 +0000 (17:21 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Wed, 30 Apr 2025 16:21:56 +0000 (17:21 +0100)
Both deb and rpm packaging systems will detect changed config files and
create extra files, which if we load them will create conflicts.

src/main/conffile.c

index 75bb5d616e1ea7b053e5951e1d55c23920c20400..bc8969f37aa8d384ef858d0d67e86caf04c37e5d 100644 (file)
@@ -2632,6 +2632,19 @@ static int cf_section_read(char const *filename, int *lineno, FILE *fp,
                                        }
                                        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", value, 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;
+
                                        slen = snprintf(buf2, sizeof(buf2), "%s%s",
                                                        value, dp->d_name);
                                        if (slen >= (int) sizeof(buf2) || slen < 0) {