</data>
</attribute>
<data type="string">
- <param name="pattern">[!#$%&'()*+\-./0-9:>=<?@A-Z\^_`\[\]a-z|~]+</param>
+ <param name="pattern">"?[!#$%&'()*+\-./0-9:>=<?@A-Z\^_`\[\]a-z|~]+"?</param>
</data>
</element>
</oneOrMore>
static int
virStorageSourceNetCookieValidate(virStorageNetCookieDefPtr def)
{
+ g_autofree char *val = g_strdup(def->value);
+ const char *checkval = val;
+ size_t len = strlen(val);
+
/* name must have at least 1 character */
if (*(def->name) == '\0') {
virReportError(VIR_ERR_XML_ERROR, "%s",
return -1;
}
+ /* check for optional quotes around the cookie value string */
+ if (val[0] == '"') {
+ if (val[len - 1] != '"') {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("value of cookie '%s' contains invalid characters"),
+ def->name);
+ return -1;
+ }
+
+ val[len - 1] = '\0';
+ checkval++;
+ }
+
/* check invalid characters in value */
- if (virStringHasChars(def->value, virStorageSourceCookieValueInvalidChars)) {
+ if (virStringHasChars(checkval, virStorageSourceCookieValueInvalidChars)) {
virReportError(VIR_ERR_XML_ERROR,
_("value of cookie '%s' contains invalid characters"),
def->name);
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=libvirt-3-format,\
id=virtio-disk1 \
-object secret,id=libvirt-2-storage-httpcookie-secret0,\
-data=DrPR9NA6GKJb7qi1KbjHad3f3UIGTTDmAmOZHHv1F5w5T8rhnk3f+uSKStHe0J2O,\
+data=DrPR9NA6GKJb7qi1KbjHaealKEMVtOWUl2h3yvO5lgIh6cyLHemmlg+h9fcgwREA,\
keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
-blockdev '{"driver":"http","url":"http://example.org:1234/test3.img",\
"cookie-secret":"libvirt-2-storage-httpcookie-secret0",\
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=libvirt-2-format,\
id=virtio-disk2 \
-object secret,id=libvirt-1-storage-httpcookie-secret0,\
-data=DrPR9NA6GKJb7qi1KbjHad3f3UIGTTDmAmOZHHv1F5w5T8rhnk3f+uSKStHe0J2O,\
+data=DrPR9NA6GKJb7qi1KbjHaealKEMVtOWUl2h3yvO5lgIh6cyLHemmlg+h9fcgwREA,\
keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
-blockdev '{"driver":"https","url":"https://example.org:1234/test4.img",\
"sslverify":false,"cookie-secret":"libvirt-1-storage-httpcookie-secret0",\
<host name='example.org' port='1234'/>
<cookies>
<cookie name='test'>testcookievalue</cookie>
- <cookie name='test2'>blurb</cookie>
+ <cookie name='test2'>"blurb"</cookie>
</cookies>
</source>
<target dev='vdc' bus='virtio'/>
<ssl verify='no'/>
<cookies>
<cookie name='test'>testcookievalue</cookie>
- <cookie name='test2'>blurb</cookie>
+ <cookie name='test2'>"blurb"</cookie>
</cookies>
</source>
<target dev='vdd' bus='virtio'/>
<host name='example.org' port='1234'/>
<cookies>
<cookie name='test'>testcookievalue</cookie>
- <cookie name='test2'>blurb</cookie>
+ <cookie name='test2'>"blurb"</cookie>
</cookies>
</source>
<target dev='vdc' bus='virtio'/>
<ssl verify='no'/>
<cookies>
<cookie name='test'>testcookievalue</cookie>
- <cookie name='test2'>blurb</cookie>
+ <cookie name='test2'>"blurb"</cookie>
</cookies>
</source>
<target dev='vdd' bus='virtio'/>