mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 15:15:25 +00:00
VMware ESX: Don't warn on some query parameter
* src/esx/esx_util.c: esxUtil_ParseQuery() warns if a known query parameter should be ignored due to the corresponding char/int pointer being NULL, instead of silently ignoring it. Fix the control flow.
This commit is contained in:
parent
b6e747ec5a
commit
b8ee9810b0
@ -47,6 +47,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername,
|
esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername,
|
||||||
const char *server)
|
const char *server)
|
||||||
@ -160,7 +161,11 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
|
|||||||
for (i = 0; i < queryParamSet->n; i++) {
|
for (i = 0; i < queryParamSet->n; i++) {
|
||||||
queryParam = &queryParamSet->p[i];
|
queryParam = &queryParamSet->p[i];
|
||||||
|
|
||||||
if (STRCASEEQ(queryParam->name, "transport") && transport != NULL) {
|
if (STRCASEEQ(queryParam->name, "transport")) {
|
||||||
|
if (transport == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
*transport = strdup(queryParam->value);
|
*transport = strdup(queryParam->value);
|
||||||
|
|
||||||
if (*transport == NULL) {
|
if (*transport == NULL) {
|
||||||
@ -174,15 +179,22 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
|
|||||||
"'%s' (should be http|https)", *transport);
|
"'%s' (should be http|https)", *transport);
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
} else if (STRCASEEQ(queryParam->name, "vcenter") && vCenter != NULL) {
|
} else if (STRCASEEQ(queryParam->name, "vcenter")) {
|
||||||
|
if (vCenter == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
*vCenter = strdup(queryParam->value);
|
*vCenter = strdup(queryParam->value);
|
||||||
|
|
||||||
if (*vCenter == NULL) {
|
if (*vCenter == NULL) {
|
||||||
virReportOOMError(conn);
|
virReportOOMError(conn);
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
} else if (STRCASEEQ(queryParam->name, "no_verify") &&
|
} else if (STRCASEEQ(queryParam->name, "no_verify")) {
|
||||||
noVerify != NULL) {
|
if (noVerify == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (virStrToLong_i(queryParam->value, NULL, 10, noVerify) < 0 ||
|
if (virStrToLong_i(queryParam->value, NULL, 10, noVerify) < 0 ||
|
||||||
(*noVerify != 0 && *noVerify != 1)) {
|
(*noVerify != 0 && *noVerify != 1)) {
|
||||||
ESX_ERROR(conn, VIR_ERR_INVALID_ARG,
|
ESX_ERROR(conn, VIR_ERR_INVALID_ARG,
|
||||||
|
Loading…
Reference in New Issue
Block a user