Re: [libvirt] VMware ESX: Don't warn if a known query parameter should be ignored

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 08, 2009 at 11:57:25PM +0200, Matthias Bolte wrote:
> 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.
> 
> The attached patch changes the if/else structure to fix this.
> 
> Matthias

> diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
> index 5e7c62a..38e9d17 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,

ACK

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]