From: Matthias Bolte Date: Wed, 2 Sep 2009 14:32:30 +0000 (+0200) Subject: VMware ESX: Don't warn on some query parameter X-Git-Tag: v0.7.1~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8ee9810b03441b4f731302da808625e6f741278;p=thirdparty%2Flibvirt.git 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. --- diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c index 5e7c62aa56..38e9d171bd 100644 --- a/src/esx/esx_util.c +++ b/src/esx/esx_util.c @@ -47,6 +47,7 @@ #endif + char * esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername, const char *server) @@ -160,7 +161,11 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter, for (i = 0; i < queryParamSet->n; 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); if (*transport == NULL) { @@ -174,15 +179,22 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter, "'%s' (should be http|https)", *transport); goto failure; } - } else if (STRCASEEQ(queryParam->name, "vcenter") && vCenter != NULL) { + } else if (STRCASEEQ(queryParam->name, "vcenter")) { + if (vCenter == NULL) { + continue; + } + *vCenter = strdup(queryParam->value); if (*vCenter == NULL) { virReportOOMError(conn); goto failure; } - } else if (STRCASEEQ(queryParam->name, "no_verify") && - noVerify != NULL) { + } else if (STRCASEEQ(queryParam->name, "no_verify")) { + if (noVerify == NULL) { + continue; + } + if (virStrToLong_i(queryParam->value, NULL, 10, noVerify) < 0 || (*noVerify != 0 && *noVerify != 1)) { ESX_ERROR(conn, VIR_ERR_INVALID_ARG,