On a Thursday in 2022, Peter Krempa wrote:
Treat the 'protocolVer' field as a string so that e.g.
'4.1' can be
used.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/schemas/storagepool.rng | 4 +---
src/conf/storage_conf.c | 14 +++-----------
src/conf/storage_conf.h | 2 +-
src/storage/storage_util.c | 4 ++--
.../pool-netfs-protocol-ver-linux.argv | 2 +-
.../pool-netfs-protocol-ver.xml | 2 +-
.../pool-netfs-protocol-ver.xml | 2 +-
7 files changed, 10 insertions(+), 20 deletions(-)
@@ -643,12 +643,6 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
virStoragePoolFormatFileSystemNetTypeToString(source->format));
return -1;
}
- if (virStrToLong_uip(ver, NULL, 0, &source->protocolVer) < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("storage pool protocol ver '%s' is
malformed"),
- ver);
- return -1;
- }
This removes any validation of the field...
}
source->vendor = virXPathString("string(./vendor/@name)", ctxt);
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 6ed2078b65..3871718b09 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -4201,8 +4201,8 @@ virStorageBackendFileSystemMountCmd(const char *cmdstr,
virCommand *cmd = NULL;
g_autofree char *nfsVers = NULL;
- if (def->type == VIR_STORAGE_POOL_NETFS && def->source.protocolVer >
0)
- nfsVers = g_strdup_printf("nfsvers=%u", def->source.protocolVer);
+ if (def->type == VIR_STORAGE_POOL_NETFS && def->source.protocolVer)
+ nfsVers = g_strdup_printf("nfsvers=%s", def->source.protocolVer);
... so users can pass arbitrary arguments to mount here.
It would be nice to at least forbid commas.
Jano
cmd = virCommandNew(cmdstr);
if (netauto)