[pve-devel] [PATCH v2 qemu 1/1] fix #2190: URI encode SMBIOS value strings in order to allow more characters
Christian Ebner
c.ebner at proxmox.com
Fri May 10 13:08:04 CEST 2019
On some occasions e.g. license checking, the manufacturer string in the
SMBIOS settings edit has to allow characters such as whitespaces.
https://forum.proxmox.com/threads/proxmox-and-windows-rok-license-for-dell.53236/
Use URI encoding for format string in order to allow for such cases.
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
Version 2:
- Changed format verification to url encoded
PVE/QemuServer.pm | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 9d560ec..8b2fd49 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2369,43 +2369,43 @@ my $smbios1_fmt = {
},
version => {
type => 'string',
- pattern => '\S+',
- format_description => 'string',
+ format => 'urlencoded',
+ format_description => 'URI encoded string',
description => "Set SMBIOS1 version.",
optional => 1,
},
serial => {
type => 'string',
- pattern => '\S+',
- format_description => 'string',
+ format => 'urlencoded',
+ format_description => 'URI encoded string',
description => "Set SMBIOS1 serial number.",
optional => 1,
},
manufacturer => {
type => 'string',
- pattern => '\S+',
- format_description => 'string',
+ format => 'urlencoded',
+ format_description => 'URI encoded string',
description => "Set SMBIOS1 manufacturer.",
optional => 1,
},
product => {
type => 'string',
- pattern => '\S+',
- format_description => 'string',
+ format => 'urlencoded',
+ format_description => 'URI encoded string',
description => "Set SMBIOS1 product ID.",
optional => 1,
},
sku => {
type => 'string',
- pattern => '\S+',
- format_description => 'string',
+ format => 'urlencoded',
+ format_description => 'URI encoded string',
description => "Set SMBIOS1 SKU string.",
optional => 1,
},
family => {
type => 'string',
- pattern => '\S+',
- format_description => 'string',
+ format => 'urlencoded',
+ format_description => 'URI encoded string',
description => "Set SMBIOS1 family string.",
optional => 1,
},
@@ -3524,7 +3524,13 @@ sub config_to_command {
push @$cmd, '-daemonize';
if ($conf->{smbios1}) {
- push @$cmd, '-smbios', "type=1,$conf->{smbios1}";
+ my $smbios_conf = parse_smbios1($conf->{smbios1});
+ my $smbios_string = "";
+ foreach my $key (keys %$smbios_conf) {
+ my $value = uri_unescape($smbios_conf->{$key});
+ $smbios_string .= "," . $key . "=" . $value if $value;
+ }
+ push @$cmd, '-smbios', "type=1" . $smbios_string;
}
if ($conf->{vmgenid}) {
--
2.11.0
More information about the pve-devel
mailing list