diff options
author | Jonathan Bauer | 2017-12-01 18:27:38 +0100 |
---|---|---|
committer | Jonathan Bauer | 2017-12-01 18:27:38 +0100 |
commit | ae681fa769d3204c14ba2dfda817cd721b45060c (patch) | |
tree | a79d222d2d573255bcb60e60fdcb05ac00bd1937 /core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc | |
parent | [idleaction] Fix detection of X sessions for warnings (diff) | |
download | mltk-ae681fa769d3204c14ba2dfda817cd721b45060c.tar.gz mltk-ae681fa769d3204c14ba2dfda817cd721b45060c.tar.xz mltk-ae681fa769d3204c14ba2dfda817cd721b45060c.zip |
[run-virt] sanitize downloaded maschine desc
coming from dmsd. This should help avoid bad syntax errors.
Diffstat (limited to 'core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc')
-rw-r--r-- | core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc index 807c2840..20d5fac9 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc @@ -32,6 +32,14 @@ download_metadata() { writelog "Downloaded VM description from '${SLX_VMCHOOSER_BASE_URL}/lecture/${IMGUUID}' successfully." if [ -s "$TMPCONFIG" ]; then # Downloaded a non-zero VM description file, all good + # sanitize what we got to make sure, we don't have a bad starting + # point + local TMPTMPCONFIG="$(mktemp)" + grep -E '^\s*(#|[^=]+=[^"]*"[^"]*"\s*$|[^=]+=[^"]+$|$)' "$TMPCONFIG" > "$TMPTMPCONFIG" + if ! diff -q "$TMPCONFIG" "$TMPTMPCONFIG"; then + writelog "'$TMPCONFIG' was pruned by the post-download sanitizer!" + fi + mv "$TMPTMPCONFIG" "$TMPCONFIG" return 0 else writelog "Server sent zero byte virtual machine description file." |