]> git.proxmox.com Git - pve-manager.git/commitdiff
doc: spice-example-sh: fix ticket/csrf extraction
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 25 Sep 2017 08:56:02 +0000 (10:56 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 5 Oct 2017 11:57:27 +0000 (13:57 +0200)
We extract them from the json data by first deleting all
quotes, then deleting everything up to their entries, then
everything after the next comma. If the entry is at the end
there's no comma, instead there are closing braces, so we
need to strip away these as well.

spice-example-sh

index 1d8bdc499780720cd7d579025f2b7c8a7f120f7c..cc7c6b7f57eb4a1b42153ab3f4c4b945314e5b98 100755 (executable)
@@ -66,10 +66,12 @@ echo "AUTH OK"
 TICKET="${DATA//\"/}"
 TICKET="${TICKET##*ticket:}"
 TICKET="${TICKET%%,*}"
+TICKET="${TICKET%%\}*}"
 
 CSRF="${DATA//\"/}"
 CSRF="${CSRF##*CSRFPreventionToken:}"
 CSRF="${CSRF%%,*}"
+CSRF="${CSRF%%\}*}"
 
 curl -f -s -S -k -b "PVEAuthCookie=$TICKET" -H "CSRFPreventionToken: $CSRF" "https://$PROXY:8006/api2/spiceconfig/nodes/$NODE/qemu/$VMID/spiceproxy" -d "proxy=$PROXY" > spiceproxy