Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/OVAL/probes/unix/linux/rpminfo_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ static int get_rpminfo(struct rpminfo_req *req, struct rpminfo_rep **rep, struct

int rpminfo_probe_offline_mode_supported()
{
return PROBE_OFFLINE_CHROOT;
return PROBE_OFFLINE_OWN;
}

void *rpminfo_probe_init(void)
Expand Down
3 changes: 1 addition & 2 deletions src/OVAL/probes/unix/linux/rpmverify_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ static int rpmverify_collect(probe_ctx *ctx,

int rpmverify_probe_offline_mode_supported()
{
// TODO: Switch this to OFFLINE_MODE_OWN once rpmtsSetRootDir is fully supported by librpm
return PROBE_OFFLINE_CHROOT;
return PROBE_OFFLINE_OWN;
}

void *rpmverify_probe_init(void)
Expand Down
3 changes: 1 addition & 2 deletions src/OVAL/probes/unix/linux/rpmverifyfile_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,7 @@ static int rpmverify_collect(probe_ctx *ctx,

int rpmverifyfile_probe_offline_mode_supported()
{
// TODO: Switch this to OFFLINE_MODE_OWN once rpmtsSetRootDir is fully supported by librpm
return PROBE_OFFLINE_CHROOT;
return PROBE_OFFLINE_OWN;
}

void *rpmverifyfile_probe_init(void)
Expand Down
19 changes: 19 additions & 0 deletions tests/probes/rpm/rpm_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,30 @@ function rpm_prepare_offline {
rpm -i ${RPMBUILD}/RPMS/noarch/foo-1.0-1.noarch.rpm --badreloc --relocate="/etc=${RPMTEST}/etc/" --dbpath="${RPMTEST}${RPMDB_PATH}"
}

# Variant for probes using PROBE_OFFLINE_OWN (rpmtsSetRootDir) that
# do not require chroot capability.
function rpm_prepare_offline_own {
set_offline_chroot_dir "$RPMTEST"
require "rpm" || return 255
rm -rf ${RPMTEST}
mkdir -p ${RPMTEST}/usr/lib/rpm
cp /usr/lib/rpm/rpmrc ${RPMTEST}/usr/lib/rpm/rpmrc
cp /usr/lib/rpm/macros ${RPMTEST}/usr/lib/rpm/macros
rpm_build
rpm -i ${RPMBUILD}/RPMS/noarch/foobar-1.0-1.noarch.rpm --badreloc --relocate="/etc=${RPMTEST}/etc/" --dbpath="${RPMTEST}${RPMDB_PATH}"
rpm -i ${RPMBUILD}/RPMS/noarch/foo-1.0-1.noarch.rpm --badreloc --relocate="/etc=${RPMTEST}/etc/" --dbpath="${RPMTEST}${RPMDB_PATH}"
}

function rpm_cleanup_offline {
rm -rf ${RPMTEST}
unset_chroot_offline_test_mode
}

function rpm_cleanup_offline_own {
rm -rf ${RPMTEST}
set_offline_chroot_dir ""
}

function rpm_query {
require "rpm" || return 255
if [ -d "$OSCAP_PROBE_ROOT" ]; then
Expand Down
4 changes: 2 additions & 2 deletions tests/probes/rpm/rpminfo/test_probes_rpminfo_offline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ set -e -o pipefail

test_init

rpm_prepare_offline
rpm_prepare_offline_own

test_run "rpminfo probe test (offline)" test_probes_rpminfo foo foobar

rpm_cleanup_offline
rpm_cleanup_offline_own

test_exit
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function perform_test {
}


rpm_prepare_offline
rpm_prepare_offline_own

test_run "rpmverify probe test not equals operation (offline)" perform_test

rpm_cleanup_offline
rpm_cleanup_offline_own
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ function test_probes_rpmverifyfile {

test_init

rpm_prepare_offline
rpm_prepare_offline_own

test_run "rpmverifyfile probe test with OVAL 5.11.1 (offline)" test_probes_rpmverifyfile

rpm_cleanup_offline
rpm_cleanup_offline_own

test_exit
Loading