Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
libvirt.26629
07ddb4c6-qemuDomainSetLaunchSecurityState-check...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 07ddb4c6-qemuDomainSetLaunchSecurityState-check-params.patch of Package libvirt.26629
commit 07ddb4c6b30b053a8d281c338551acd00c815d8e Author: Ján Tomko <jtomko@redhat.com> Date: Thu Jan 27 19:41:24 2022 +0100 qemu: qemuDomainSetLaunchSecurityState: check for params presence We require the header and the secret to be present. Use a different approach to virParams to report an error if they are not present, instead of trying to pass empty arguments to QEMU via QMP. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Index: libvirt-8.0.0/src/qemu/qemu_driver.c =================================================================== --- libvirt-8.0.0.orig/src/qemu/qemu_driver.c +++ libvirt-8.0.0/src/qemu/qemu_driver.c @@ -19988,10 +19988,9 @@ qemuDomainSetLaunchSecurityState(virDoma virDomainObj *vm; int ret = -1; int rc; - size_t i; g_autoptr(virQEMUCaps) qemucaps = NULL; - g_autofree char *secrethdr = NULL; - g_autofree char *secret = NULL; + const char *secrethdr = NULL; + const char *secret = NULL; unsigned long long setaddr = 0; bool hasSetaddr = false; int state; @@ -20032,19 +20031,25 @@ qemuDomainSetLaunchSecurityState(virDoma goto cleanup; } - for (i = 0; i < nparams; i++) { - virTypedParameterPtr param = ¶ms[i]; - - if (STREQ(param->field, VIR_DOMAIN_LAUNCH_SECURITY_SEV_SECRET_HEADER)) { - secrethdr = g_strdup(param->value.s); - } else if (STREQ(param->field, VIR_DOMAIN_LAUNCH_SECURITY_SEV_SECRET)) { - secret = g_strdup(param->value.s); - } else if (STREQ(param->field, VIR_DOMAIN_LAUNCH_SECURITY_SEV_SECRET_SET_ADDRESS)) { - setaddr = param->value.ul; - hasSetaddr = true; - } + if (virTypedParamsGetString(params, nparams, + VIR_DOMAIN_LAUNCH_SECURITY_SEV_SECRET_HEADER, + &secrethdr) < 0 || + virTypedParamsGetString(params, nparams, + VIR_DOMAIN_LAUNCH_SECURITY_SEV_SECRET, + &secret) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", + _("Both secret and the secret header are required")); + goto cleanup; } + if ((rc = virTypedParamsGetULLong(params, nparams, + VIR_DOMAIN_LAUNCH_SECURITY_SEV_SECRET_SET_ADDRESS, + &setaddr)) < 0) + goto cleanup; + else if (rc == 1) + hasSetaddr = true; + if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) goto cleanup;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor