Skip to content

Commit

Permalink
[omnibus] Fix parsing of Status in dpkginfo probe (#20930)
Browse files Browse the repository at this point in the history
This change fixes the parsing of Status
in dpkginfo probe.

The parsing the Status was incorrect and all
packages were considered as deinstalled.
  • Loading branch information
0intro authored Nov 17, 2023
1 parent 716a382 commit 35dc55b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions omnibus/config/patches/openscap/dpkginfo-status-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
commit d3397b17e413856f3ca8e072cd789ee1bb7e778f
Author: David du Colombier <[email protected]>
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);
1 change: 1 addition & 0 deletions omnibus/config/software/openscap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 35dc55b

Please sign in to comment.