Skip to content

Commit 8102d7b

Browse files
committed
Merge branch 'maint-1.2' into maint-1.3
2 parents 527d4f7 + a7f9d28 commit 8102d7b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

utils/oscap-ssh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,12 @@ echo "Starting the evaluation..."
284284
# changing directory because of --oval-results support. oval results files are
285285
# dumped into PWD, and we can't be sure by the file names - we need controlled
286286
# environment
287-
ssh_execute_with_command_and_options "cd $REMOTE_TEMP_DIR; $OSCAP_SUDO oscap $(command_array_to_string oscap_args)" "$SSH_TTY_ALLOCATION_OPTION"
287+
if [ -z "$OSCAP_SUDO" ]; then
288+
ssh_execute_with_command_and_options "cd $REMOTE_TEMP_DIR; oscap $(command_array_to_string oscap_args)" "$SSH_TTY_ALLOCATION_OPTION"
289+
else
290+
OSCAP_CMD="oscap $(command_array_to_string oscap_args); rc=\$?; chown \$SUDO_USER $REMOTE_TEMP_DIR/*; exit \$rc"
291+
ssh_execute_with_command_and_options "cd $REMOTE_TEMP_DIR; $OSCAP_SUDO sh -c '$OSCAP_CMD'" "$SSH_TTY_ALLOCATION_OPTION"
292+
fi
288293
OSCAP_EXIT_CODE=$?
289294
echo "oscap exit code: $OSCAP_EXIT_CODE"
290295

0 commit comments

Comments
 (0)