diff --git a/omnibus/config/patches/openscap/dpkginfo-status-fix.patch b/omnibus/config/patches/openscap/dpkginfo-status-fix.patch new file mode 100644 index 0000000000000..b869e7e69eca0 --- /dev/null +++ b/omnibus/config/patches/openscap/dpkginfo-status-fix.patch @@ -0,0 +1,25 @@ +commit d3397b17e413856f3ca8e072cd789ee1bb7e778f +Author: David du Colombier +Date: Fri Nov 17 12:28:17 2023 +0100 + + Fix parsing of Status in dpkginfo probe + + This change fixes a mistake made during a last-minute + change in 557ddeed1e3e234a655ad77a691869554064b293. + + The parsing the Status was incorrect and all + packages were considered as deinstalled. + +diff --git a/src/OVAL/probes/unix/linux/dpkginfo-helper.c b/src/OVAL/probes/unix/linux/dpkginfo-helper.c +index 2ba9fb474..fcbb8d150 100644 +--- a/src/OVAL/probes/unix/linux/dpkginfo-helper.c ++++ b/src/OVAL/probes/unix/linux/dpkginfo-helper.c +@@ -125,7 +125,7 @@ struct dpkginfo_reply_t* dpkginfo_get_by_name(const char *name, int *err) + } + } else if (reply != NULL) { + if (strcmp(key, "Status") == 0) { +- if (strcmp(value, "install") != 0) { ++ if (strncmp(value, "install", 7) != 0) { + // Package deinstalled. + dD("Package \"%s\" has been deinstalled.", name); + dpkginfo_free_reply(reply); diff --git a/omnibus/config/software/openscap.rb b/omnibus/config/software/openscap.rb index 12b3f40e9ed98..53e1a2bcf3fbc 100644 --- a/omnibus/config/software/openscap.rb +++ b/omnibus/config/software/openscap.rb @@ -58,6 +58,7 @@ patch source: "rpm-verbosity-err.patch", env: env # decrease rpmlog verbosity level to ERR patch source: "session-print-syschar.patch", env: env # add a function to print system characteristics patch source: "memusage-cgroup.patch", env: env # consider cgroup when determining memory usage + patch source: "dpkginfo-status-fix.patch", env: env # fix parsing of status in dpkginfo probe patch source: "oval_probe_session_reset.patch", env: env # use oval_probe_session_reset instead of oval_probe_session_reinit