fate-recv: stricter checks of received data
authorMans Rullgard <mans@mansr.com>
Tue, 27 Jul 2010 06:30:16 +0000 (07:30 +0100)
committerMans Rullgard <mans@mansr.com>
Tue, 27 Jul 2010 06:30:16 +0000 (07:30 +0100)
fate-recv.sh

index bb43391..24d253d 100755 (executable)
@@ -1,6 +1,7 @@
 #! /bin/sh
 
 set -e
+export LC_ALL=C
 
 die(){
     echo "$@"
@@ -13,11 +14,11 @@ reptmp=$(mktemp -d)
 trap 'rm -r $reptmp' EXIT
 cd $reptmp
 
-tar xz
+tar xzk
 
 header=$(head -n1 report)
-date=$(expr "$header" : 'fate:0:\([0-9]*\)')
-slot=$(expr "$header" : 'fate:0:[0-9]*:\([^:]*\)')
+date=$(expr "$header" : 'fate:0:\([0-9]*\):')
+slot=$(expr "$header" : 'fate:0:[0-9]*:\([A-Za-z0-9_.-]*\):')
 
 test -n "$date" && test -n "$slot" || die "Invalid report header"