On 01/14/2011 05:29 AM, Daniel P. Berrange wrote:
> + case VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES:
> + i = 0;
> + for (cur = node->children;
> + cur && cur->type == XML_ELEMENT_NODE &&
> + xmlStrEqual(cur->name, BAD_CAST "certificate");
> + cur = cur->next) {
> + def->data.cert.file[i++] = (char *)xmlNodeGetContent(cur);
> + }
I think xmlNodeGetContent can return NULL. We should likely also
validate that it starts with a '/', so people can't just supply
whitespace or random garbage.
Will make that change. Also, given the qemu command line constraints,
the file cannot contain ',' (any other character can be parsed fine), so
I'm updating patch 5/5 to reject unusable filenames (while keeping the
overall domain_conf generic in allowing any filename).
> + case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH:
> + type = virXMLPropString(node, "type");
> + if (type == NULL)
> + def->data.passthru.type = VIR_DOMAIN_CHR_TYPE_TCP;
I'm not sure that we should be defaulting to TCP here,
rather than making 'type' compulsory.
Hmm. My v1 proposal had the type attribute be mandatory for
mode='passthrough', and I had changed it to be optional in v2; but it's
easy enough to go back to having type be mandatory for v3.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org