From f65b8c3ebfb8a0e5e1fd828d2a4ed9aa611f71a5 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Sat, 11 Jan 2025 17:20:54 -0700 Subject: [PATCH] rcp: trim // to / and allow only single target --- usr/local/share/bastille/rcp.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/usr/local/share/bastille/rcp.sh b/usr/local/share/bastille/rcp.sh index 7b313577..ec1c5bd5 100644 --- a/usr/local/share/bastille/rcp.sh +++ b/usr/local/share/bastille/rcp.sh @@ -85,12 +85,13 @@ CPSOURCE="${2}" CPDEST="${3}" bastille_root_check -set_target "${TARGET}" +set_target_single "${TARGET}" for _jail in ${JAILS}; do info "[${_jail}]:" - bastille_jail_path="${bastille_jailsdir}/${_jail}/root" - if ! cp "${OPTION}" "${bastille_jail_path}${CPSOURCE}" "${CPDEST}"; then - error_continue "RCP failed: ${bastille_jail_path}${CPSOURCE} -> ${CPDEST}" + host_path="${CPDEST}" + jail_path="$(echo ${bastille_jailsdir}/${_jail}/root/${CPSOURCE} | sed 's#//#/#g')" + if ! cp "${OPTION}" "${jail_path}" "${host_path}"; then + error_continue "RCP failed: ${jail_path} -> ${host_path}" fi done