Index: src/libvirt.c =================================================================== RCS file: /data/cvs/libvirt/src/libvirt.c,v retrieving revision 1.214 diff -u -p -u -r1.214 libvirt.c --- src/libvirt.c 12 Jun 2009 13:20:13 -0000 1.214 +++ src/libvirt.c 18 Jun 2009 11:14:44 -0000 @@ -4386,11 +4386,11 @@ error: * @domain: a domain object * @seclabel: pointer to a virSecurityLabel structure * - * Extract security label of an active domain. + * Extract security label of an active domain. The 'label' field + * in the @seclabel argument will be initialized to the empty + * string if the domain is not running under a security model. * - * Returns 0 in case of success, -1 in case of failure, and -2 - * if the operation is not supported (caller decides if that's - * an error). + * Returns 0 in case of success, -1 in case of failure */ int virDomainGetSecurityLabel(virDomainPtr domain, virSecurityLabelPtr seclabel) @@ -4421,10 +4421,11 @@ virDomainGetSecurityLabel(virDomainPtr d * @conn: a connection object * @secmodel: pointer to a virSecurityModel structure * - * Extract the security model of a hypervisor. + * Extract the security model of a hypervisor. The 'model' field + * in the @secmodel argument may be initialized to the empty + * string if the driver has not activated a security model. * - * Returns 0 in case of success, -1 in case of failure, and -2 if the - * operation is not supported (caller decides if that's an error). + * Returns 0 in case of success, -1 in case of failure */ int virNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr secmodel) Index: src/qemu_driver.c =================================================================== RCS file: /data/cvs/libvirt/src/qemu_driver.c,v retrieving revision 1.255 diff -u -p -u -r1.255 qemu_driver.c --- src/qemu_driver.c 2009-06-19 16:36:25.000000000 +0200 +++ src/qemu_driver.c 2009-06-19 16:45:56.000000000 +0200 @@ -3107,6 +3107,8 @@ static int qemudDomainGetSecurityLabel(v vm = virDomainFindByUUID(&driver->domains, dom->uuid); qemuDriverUnlock(driver); + memset(seclabel, 0, sizeof(*seclabel)); + if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); @@ -3163,7 +3165,7 @@ static int qemudNodeGetSecurityModel(vir qemuDriverLock(driver); if (!driver->securityDriver) { - ret = -2; + memset(secmodel, 0, sizeof (*secmodel)); goto cleanup; } Index: src/remote_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/remote_internal.c,v retrieving revision 1.157 diff -u -p -u -r1.157 remote_internal.c --- src/remote_internal.c 12 Jun 2009 13:20:13 -0000 1.157 +++ src/remote_internal.c 18 Jun 2009 11:14:44 -0000 @@ -2320,6 +2320,8 @@ remoteDomainGetSecurityLabel (virDomainP make_nonnull_domain (&args.dom, domain); memset (&ret, 0, sizeof ret); + memset (seclabel, 0, sizeof (*seclabel)); + if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL, (xdrproc_t) xdr_remote_domain_get_security_label_args, (char *)&args, (xdrproc_t) xdr_remote_domain_get_security_label_ret, (char *)&ret) == -1) { @@ -2353,6 +2355,8 @@ remoteNodeGetSecurityModel (virConnectPt remoteDriverLock(priv); memset (&ret, 0, sizeof ret); + memset (secmodel, 0, sizeof (*secmodel)); + if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_SECURITY_MODEL, (xdrproc_t) xdr_void, NULL, (xdrproc_t) xdr_remote_node_get_security_model_ret, (char *)&ret) == -1) { Index: src/virsh.c =================================================================== RCS file: /data/cvs/libvirt/src/virsh.c,v retrieving revision 1.210 diff -u -p -u -r1.210 virsh.c --- src/virsh.c 3 Jun 2009 12:13:52 -0000 1.210 +++ src/virsh.c 18 Jun 2009 11:14:44 -0000 @@ -1643,8 +1643,10 @@ cmdDominfo(vshControl *ctl, const vshCmd /* Security model and label information */ memset(&secmodel, 0, sizeof secmodel); if (virNodeGetSecurityModel(ctl->conn, &secmodel) == -1) { - virDomainFree(dom); - return FALSE; + if (last_error->code != VIR_ERR_NO_SUPPORT) { + virDomainFree(dom); + return FALSE; + } } else { /* Only print something if a security model is active */ if (secmodel.model[0] != '\0') {