diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 019065fd0286b64d2e058821d33ec6f6d54467f3..ab2f0ead5f35eab82c138a437b4fd7db5723eb5f 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -3278,16 +3278,23 @@ virStorageSourceParseBackingJSONUri(virStorageSourcePtr src, if (protocol == VIR_STORAGE_NET_PROTOCOL_HTTPS || protocol == VIR_STORAGE_NET_PROTOCOL_FTPS) { if (virJSONValueObjectHasKey(json, "sslverify")) { + const char *tmpstr; bool tmp; - if (virJSONValueObjectGetBoolean(json, "sslverify", &tmp) < 0) { - virReportError(VIR_ERR_INVALID_ARG, - _("malformed 'sslverify' field in backing store definition '%s'"), - jsonstr); - return -1; - } + /* libguestfs still uses undocumented legacy value of 'off' */ + if ((tmpstr = virJSONValueObjectGetString(json, "sslverify")) && + STREQ(tmpstr, "off")) { + src->sslverify = VIR_TRISTATE_BOOL_NO; + } else { + if (virJSONValueObjectGetBoolean(json, "sslverify", &tmp) < 0) { + virReportError(VIR_ERR_INVALID_ARG, + _("malformed 'sslverify' field in backing store definition '%s'"), + jsonstr); + return -1; + } - src->sslverify = virTristateBoolFromBool(tmp); + src->sslverify = virTristateBoolFromBool(tmp); + } } } diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index b49dfd25980dccc26b838312558a7727b8b57bba..c59511114d96c6f5c94a36da76c8c2a151829cea 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -1622,6 +1622,21 @@ mymain(void) " \n" "\n", 0); + TEST_BACKING_PARSE_FULL("json:{ \"file.cookie\": \"vmware_soap_session=\\\"0c8db85112873a79b7ef74f294cb70ef7f\\\"\"," + "\"file.sslverify\": \"off\"," + "\"file.driver\": \"https\"," + "\"file.url\": \"https://host/folder/esx6.5-rhel7.7-x86%5f64/esx6.5-rhel7.7-x86%5f64-flat.vmdk?dcPath=data&dsName=esx6.5-matrix\"," + "\"file.timeout\": 2000" + "}", + "\n" + " \n" + " \n" + " \n" + " "0c8db85112873a79b7ef74f294cb70ef7f"\n" + " \n" + " \n" + "\n", 0); + #endif /* WITH_YAJL */ cleanup: