[Libvirt-cim] [PATCH] Fix VSMS instance code to refuse to return an instance if ref is invalid
Heidi Eckhart
heidieck at linux.vnet.ibm.com
Tue Oct 30 09:01:25 UTC 2007
Dan Smith wrote:
> DS> +static int compare_prop(const CMPIObjectPath *ref,
> DS> + const CMPIInstance *inst,
> DS> + const char *name,
> DS> + int mandatory)
> DS> +{
> DS> + char *prop = NULL;
> DS> + char *key = NULL;
> DS> + int rc = 0;
> DS> +
> DS> + key = cu_get_str_path(ref, name);
> DS> + if (key == NULL) {
> DS> + rc = !mandatory;
> DS> + goto out;
> DS> + }
> DS> +
> DS> + if (cu_get_str_prop(inst, name, &prop) != CMPI_RC_OK)
> DS> + goto out;
> DS> +
> DS> + rc = STREQ(key, prop);
> DS> + out:
> DS> + free(prop);
> DS> + free(key);
> DS> +
> DS> + return rc;
> DS> +}
>
> I think that some variation of the above function probably deserves to
> be in libcmpiutil. The act of comparing an instance with a reference
> and make sure that all keys are either correct or unspecified seems
> like a common thing. There are probably other places where we need
> such a filter anyway. Thoughts?
>
I absolutely agree. Such a function should become part of libcmpiutil.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
--
Regards
Heidi Eckhart
Software Engineer
Linux Technology Center - Open Hypervisor
heidieck at linux.vnet.ibm.com
**************************************************
IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Herbert Kircher
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
More information about the Libvirt-cim
mailing list