mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
util: storagefile: Flag backing store strings with authentication
Using inline authentication for storage volumes will not work properly as libvirt requires use of the secret driver for the auth data and thus would not be able to represent the passwords stored in the backing store string. Make sure that the backing store parsers return 1 which is a sign for the caller to not use the file in certain cases. The test data include iscsi via a json pseudo-protocol string and URIs with the userinfo part being present. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
@@ -1260,6 +1260,10 @@ mymain(void)
|
||||
"<source protocol='http' name='file'>\n"
|
||||
" <host name='example.com' port='80'/>\n"
|
||||
"</source>\n");
|
||||
TEST_BACKING_PARSE_FULL("http://user:pass@example.com/file",
|
||||
"<source protocol='http' name='file'>\n"
|
||||
" <host name='example.com' port='80'/>\n"
|
||||
"</source>\n", 1);
|
||||
TEST_BACKING_PARSE("rbd:testshare:id=asdf:mon_host=example.com",
|
||||
"<source protocol='rbd' name='testshare'>\n"
|
||||
" <host name='example.com'/>\n"
|
||||
@@ -1288,6 +1292,10 @@ mymain(void)
|
||||
"<source protocol='nbd' name='exportname'>\n"
|
||||
" <host name='example.org' port='1234'/>\n"
|
||||
"</source>\n");
|
||||
TEST_BACKING_PARSE_FULL("iscsi://testuser:testpass@example.org:1234/exportname",
|
||||
"<source protocol='iscsi' name='exportname'>\n"
|
||||
" <host name='example.org' port='1234'/>\n"
|
||||
"</source>\n", 1);
|
||||
|
||||
#ifdef WITH_YAJL
|
||||
TEST_BACKING_PARSE("json:", NULL);
|
||||
@@ -1492,6 +1500,26 @@ mymain(void)
|
||||
"<source protocol='iscsi' name='iqn.2016-12.com.virttest:emulated-iscsi-noauth.target/0'>\n"
|
||||
" <host name='test.org' port='3260'/>\n"
|
||||
"</source>\n");
|
||||
TEST_BACKING_PARSE_FULL("json:{\"file\":{\"driver\":\"iscsi\","
|
||||
"\"transport\":\"tcp\","
|
||||
"\"portal\":\"test.org\","
|
||||
"\"user\":\"testuser\","
|
||||
"\"target\":\"iqn.2016-12.com.virttest:emulated-iscsi-auth.target\""
|
||||
"}"
|
||||
"}",
|
||||
"<source protocol='iscsi' name='iqn.2016-12.com.virttest:emulated-iscsi-auth.target/0'>\n"
|
||||
" <host name='test.org' port='3260'/>\n"
|
||||
"</source>\n", 1);
|
||||
TEST_BACKING_PARSE_FULL("json:{\"file\":{\"driver\":\"iscsi\","
|
||||
"\"transport\":\"tcp\","
|
||||
"\"portal\":\"test.org\","
|
||||
"\"password\":\"testpass\","
|
||||
"\"target\":\"iqn.2016-12.com.virttest:emulated-iscsi-auth.target\""
|
||||
"}"
|
||||
"}",
|
||||
"<source protocol='iscsi' name='iqn.2016-12.com.virttest:emulated-iscsi-auth.target/0'>\n"
|
||||
" <host name='test.org' port='3260'/>\n"
|
||||
"</source>\n", 1);
|
||||
TEST_BACKING_PARSE("json:{\"file\":{\"driver\":\"iscsi\","
|
||||
"\"transport\":\"tcp\","
|
||||
"\"portal\":\"test.org:1234\","
|
||||
|
||||
Reference in New Issue
Block a user