]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
csd-wrapper: make it work again if binaries are compressed
authorAndré Draszik <git@andred.net>
Tue, 23 Nov 2021 12:16:43 +0000 (12:16 +0000)
committerAndré Draszik <git@andred.net>
Tue, 23 Nov 2021 12:30:37 +0000 (12:30 +0000)
CSD binaries can be uncompressed or .gz compressed, and the
csd-wrapper.sh script here tries to support both cases,
but actually doesn't work in the compressed case.

It just ends up specifying incorrect URLs and destination
file names, making this miserably fail:
    + curl -s -k https://xx.xxx.xxx.xx/CACHE/sdesktop/hostscan/linux_x64/cscan -o /home/xxx/.cisco/hostscan/bin/cscan.tmp
    + [[ ! -f /home/xxx/.cisco/hostscan/bin/cscan.tmp ]]
    + [[ ! -s /home/xxx/.cisco/hostscan/bin/cscan.tmp ]]
    + [[ ! -s /home/xxx/.cisco/hostscan/bin/cscan.tmp ]]
    + rm /home/xxx/.cisco/hostscan/bin/cscan.tmp
    + echo 'Failure on cscan, trying gz'
    Failure on cscan, trying gz
    + FILE_GZ=/home/xxx/.cisco/hostscan/bin/cscan.tmp.gz
    + curl -s -k --pinnedpubkey sha256//vI158z4H4BLBZKv927uWmvsJbFZzGEilTkI36lKv5BM= https://xx.xxx.xxx.xx/CACHE/sdesktop/hostscan/linux_x64//home/xxx/.cisco/hostscan/bin/cscan.tmp.gz -o /home/xxx/.cisco/hostscan/bin/cscan.tmp.gz
    + gunzip --verbose --decompress /home/xxx/.cisco/hostscan/bin/cscan.tmp.gz

    gzip: /home/xxx/.cisco/hostscan/bin/cscan.tmp.gz: unexpected end of file

As can be seen the 2nd curl call has my local path appended to the
URL, which of course can not work ($TMPFILE contains the full local
path).

Fixes: 9da32db08ba4 ("Clean up csd-wrapper.sh")
Signed-off-by: André Draszik <git@andred.net>
trojans/csd-wrapper.sh

index 1dbedb08e9a5cc4e7e0f861853d7bb14f5d0beb5..5a3608e682fba90c45a3ad61414dd14bd6504078 100755 (executable)
@@ -120,9 +120,9 @@ while read HASHTYPE FILE EQU HASHVAL; do
             fi
 
             echo "Failure on $FILE, trying gz"
-            FILE_GZ="${TMPFILE}.gz"
-            curl $PINNEDPUBKEY -s "${URL}/sdesktop/hostscan/$ARCH/$FILE_GZ" -o "${FILE_GZ}" &&
-               gunzip --verbose --decompress "${FILE_GZ}"
+            FILE_GZ="${FILE}.gz"
+            curl $PINNEDPUBKEY -s "${URL}/sdesktop/hostscan/$ARCH/$FILE_GZ" -o "${TMPFILE}.gz" &&
+               gunzip --verbose --decompress "${TMPFILE}.gz"
         fi
 
        if [ -r "${TMPFILE}" ]; then