lib/lib.sh: Sanitize the tag when making a temporary directory.
[distorted-letsencrypt] / lib / lib.sh
index 467f1ca..dd85bbf 100644 (file)
@@ -15,10 +15,12 @@ run_as_user () {
   PATH=$home/bin:/usr/local/bin:/bin:/usr/bin; export PATH
 }
 
+sanitize () { echo "$1" | tr -c 'A-Za-z0-9-\n' _; }
+
 prepare_tmp () {
   tag=$1
 
-  tmp=$home/tmp/$tag.$$
+  tmp=$home/tmp/$(sanitize "$tag").$$
   rm -rf $tmp
   mkdir $tmp
   trap 'cd $home; rm -rf $tmp' EXIT INT TERM