[PATCH] libxkutil: Handle vnc password when retrieving domain XML

# HG changeset patch # User Eduardo Lima (Etrunko) <eblima@br.ibm.com> # Date 1310998420 10800 # Node ID 3c90a88a5199a4ed931a4a76097cff8f55deae41 # Parent 3ac0556ffdf12015839ebafe035547cea5b715f5 libxkutil: Handle vnc password when retrieving domain XML Whenever a call for ModifyResourceSettings was issued, the XML for the domain was requested, parsed, the property had its value changed and then XML was updated with the new value. It occurs that we need to specify the VIR_DOMAIN_XML_SECURE flag to retrieve full domain info, including sensitive fields, such as passwords. This patch fixes the problem for vnc password, which was not handled in the XML parsing code. Signed-off-by: Eduardo Lima (Etrunko) <eblima@br.ibm.com> diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c +++ b/libxkutil/device_parsing.c @@ -525,6 +525,7 @@ gdev->port = get_attr_value(node, "port"); gdev->host = get_attr_value(node, "listen"); gdev->keymap = get_attr_value(node, "keymap"); + gdev->passwd = get_attr_value(node, "passwd"); if (gdev->port == NULL || gdev->host == NULL) goto err; @@ -1127,7 +1128,7 @@ char *xml; int ret; int start; - xml = virDomainGetXMLDesc(dom, 0); + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE); if (xml == NULL) return 0;

+1 and pushed. BTW - Prior to this change, libvirt-cim was using the info store (has_vnc_passwd) for persisting the fact the password was set. It appears we can now remove that logic since the XML contains this data. For reference: Virt_VirtualSystemManagementService.c ~1548 sets has_vnc_passwd Virt_RASD.c ~457 fetches has_vnc_passwd Objections? On 07/18/2011 10:13 AM, Eduardo Lima (Etrunko) wrote:
# HG changeset patch # User Eduardo Lima (Etrunko)<eblima@br.ibm.com> # Date 1310998420 10800 # Node ID 3c90a88a5199a4ed931a4a76097cff8f55deae41 # Parent 3ac0556ffdf12015839ebafe035547cea5b715f5 libxkutil: Handle vnc password when retrieving domain XML
Whenever a call for ModifyResourceSettings was issued, the XML for the domain was requested, parsed, the property had its value changed and then XML was updated with the new value.
It occurs that we need to specify the VIR_DOMAIN_XML_SECURE flag to retrieve full domain info, including sensitive fields, such as passwords. This patch fixes the problem for vnc password, which was not handled in the XML parsing code.
Signed-off-by: Eduardo Lima (Etrunko)<eblima@br.ibm.com>
diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c +++ b/libxkutil/device_parsing.c @@ -525,6 +525,7 @@ gdev->port = get_attr_value(node, "port"); gdev->host = get_attr_value(node, "listen"); gdev->keymap = get_attr_value(node, "keymap"); + gdev->passwd = get_attr_value(node, "passwd");
if (gdev->port == NULL || gdev->host == NULL) goto err; @@ -1127,7 +1128,7 @@ char *xml; int ret; int start; - xml = virDomainGetXMLDesc(dom, 0); + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE);
if (xml == NULL) return 0;
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent@linux.vnet.ibm.com

On 07/18/2011 11:41 AM, Chip Vincent wrote:
+1 and pushed.
BTW - Prior to this change, libvirt-cim was using the info store (has_vnc_passwd) for persisting the fact the password was set. It appears we can now remove that logic since the XML contains this data.
For reference: Virt_VirtualSystemManagementService.c ~1548 sets has_vnc_passwd Virt_RASD.c ~457 fetches has_vnc_passwd
Objections?
Code cleanups are always good. I had the impression that code was used by something else. Best regards, -- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima@br.ibm.com

Sharad Mishra Open Virtualization Linux Technology Center IBM libvirt-cim-bounces@redhat.com wrote on 07/18/2011 07:41:51 AM:
Chip Vincent <cvincent@linux.vnet.ibm.com> Sent by: libvirt-cim-bounces@redhat.com
07/18/11 07:41 AM
Please respond to cvincent@linux.vnet.ibm.com; Please respond to List for discussion and development of libvirt CIM <libvirt-cim@redhat.com>
To
libvirt-cim@redhat.com
cc
Subject
Re: [Libvirt-cim] [PATCH] libxkutil: Handle vnc password when retrieving domain XML
+1 and pushed.
BTW - Prior to this change, libvirt-cim was using the info store (has_vnc_passwd) for persisting the fact the password was set. It appears we can now remove that logic since the XML contains this data.
Please remove the logic.
For reference: Virt_VirtualSystemManagementService.c ~1548 sets has_vnc_passwd Virt_RASD.c ~457 fetches has_vnc_passwd
Objections?
I don't see any.
On 07/18/2011 10:13 AM, Eduardo Lima (Etrunko) wrote:
# HG changeset patch # User Eduardo Lima (Etrunko)<eblima@br.ibm.com> # Date 1310998420 10800 # Node ID 3c90a88a5199a4ed931a4a76097cff8f55deae41 # Parent 3ac0556ffdf12015839ebafe035547cea5b715f5 libxkutil: Handle vnc password when retrieving domain XML
Whenever a call for ModifyResourceSettings was issued, the XML for the domain was requested, parsed, the property had its value changed and
XML was updated with the new value.
It occurs that we need to specify the VIR_DOMAIN_XML_SECURE flag to retrieve full domain info, including sensitive fields, such as passwords. This
fixes the problem for vnc password, which was not handled in the XML
then patch parsing
code.
Signed-off-by: Eduardo Lima (Etrunko)<eblima@br.ibm.com>
diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c +++ b/libxkutil/device_parsing.c @@ -525,6 +525,7 @@ gdev->port = get_attr_value(node, "port"); gdev->host = get_attr_value(node, "listen"); gdev->keymap = get_attr_value(node, "keymap"); + gdev->passwd = get_attr_value(node, "passwd");
if (gdev->port == NULL || gdev->host == NULL) goto err; @@ -1127,7 +1128,7 @@ char *xml; int ret; int start; - xml = virDomainGetXMLDesc(dom, 0); + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE);
if (xml == NULL) return 0;
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent@linux.vnet.ibm.com
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
participants (3)
-
Chip Vincent
-
Eduardo Lima (Etrunko)
-
Sharad Mishra