From 17509ee003be095fb4e5baa097145117b3ac7f58 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Wed, 28 Sep 2011 11:43:59 +0200 Subject: [PATCH] bug #670: let the user disable fs copy to context ISO (cherry picked from commit 291da9962c726e94dad9505606028fa09ca762d5) --- src/tm_mad/lvm/tm_context.sh | 9 ++++++++- src/tm_mad/shared/tm_context.sh | 10 ++++++++-- src/tm_mad/ssh/tm_context.sh | 10 ++++++++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/tm_mad/lvm/tm_context.sh b/src/tm_mad/lvm/tm_context.sh index 6d6aea06ab..74061b6637 100755 --- a/src/tm_mad/lvm/tm_context.sh +++ b/src/tm_mad/lvm/tm_context.sh @@ -16,6 +16,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +CONTEXT_FILE=$1 + while (( "$#" )); do if [ "$#" == "1" ]; then DST=$1 @@ -56,7 +58,12 @@ for f in $SRC; do ;; *) - exec_and_log "cp -R $f $ISO_DIR" + if [ $SECURE_CONTEXT -eq 0 -o "$f" == "$CONTEXT_FILE" ]; then + exec_and_log "cp -R $f $ISO_DIR" \ + "Error copying $f to $ISO_DIR" + else + log "not copying potentialy dangerous file $f" + fi ;; esac done diff --git a/src/tm_mad/shared/tm_context.sh b/src/tm_mad/shared/tm_context.sh index db05f2dda0..fef2593fbe 100755 --- a/src/tm_mad/shared/tm_context.sh +++ b/src/tm_mad/shared/tm_context.sh @@ -16,6 +16,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +CONTEXT_FILE=$1 + while (( "$#" )); do if [ "$#" == "1" ]; then DST=$1 @@ -53,8 +55,12 @@ for f in $SRC; do ;; *) - exec_and_log "cp -R $f $ISO_DIR" \ - "Error copying $f to $ISO_DIR" + if [ $SECURE_CONTEXT -eq 0 -o "$f" == "$CONTEXT_FILE" ]; then + exec_and_log "cp -R $f $ISO_DIR" \ + "Error copying $f to $ISO_DIR" + else + log "not copying potentialy dangerous file $f" + fi ;; esac done diff --git a/src/tm_mad/ssh/tm_context.sh b/src/tm_mad/ssh/tm_context.sh index d5c16f6721..772b549e7f 100755 --- a/src/tm_mad/ssh/tm_context.sh +++ b/src/tm_mad/ssh/tm_context.sh @@ -16,6 +16,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +CONTEXT_FILE=$1 + while (( "$#" )); do if [ "$#" == "1" ]; then DST=$1 @@ -58,8 +60,12 @@ for f in $SRC; do ;; *) - exec_and_log "cp -R $f $ISO_DIR" \ - "Error copying $f to $ISO_DIR" + if [ $SECURE_CONTEXT -eq 0 -o "$f" == "$CONTEXT_FILE" ]; then + exec_and_log "cp -R $f $ISO_DIR" \ + "Error copying $f to $ISO_DIR" + else + log "not copying potentialy dangerous file $f" + fi ;; esac done