1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-29 15:21:50 +03:00

conf: Fix invalid condition when parsing storage owner

In commit d2632d60 we agreed taht we want the parsed uid to properly
overflow but only to -1, however the value was read into long and then
wrapped into uid_t.  That meaned it failed on 32-bit systems.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2014-12-16 17:38:59 +01:00
parent 18f03166fd
commit 57c008f860

View File

@ -734,7 +734,7 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
int defaultmode)
{
char *mode;
long val;
long long val;
int ret = -1;
xmlNodePtr relnode;
xmlNodePtr node;
@ -771,7 +771,7 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
if (virXPathNode("./owner", ctxt) == NULL) {
perms->uid = (uid_t) -1;
} else {
if (virXPathLong("number(./owner)", ctxt, &val) < 0 ||
if (virXPathLongLong("number(./owner)", ctxt, &val) < 0 ||
((uid_t)val != val &&
val != -1)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@ -785,7 +785,7 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
if (virXPathNode("./group", ctxt) == NULL) {
perms->gid = (gid_t) -1;
} else {
if (virXPathLong("number(./group)", ctxt, &val) < 0 ||
if (virXPathLongLong("number(./group)", ctxt, &val) < 0 ||
((gid_t) val != val &&
val != -1)) {
virReportError(VIR_ERR_XML_ERROR, "%s",