interface_backend_udev.c: use virConnectValidateURIPath()

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Suggested-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Daniel Henrique Barboza 2019-09-26 11:56:38 -03:00 committed by Cole Robinson
parent 143ef3d023
commit fac2f08bdd

View File

@ -1250,21 +1250,10 @@ udevConnectOpen(virConnectPtr conn,
return VIR_DRV_OPEN_ERROR;
}
if (driver->privileged) {
if (STRNEQ(conn->uri->path, "/system")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected interface URI path '%s', try interface:///system"),
conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
} else {
if (STRNEQ(conn->uri->path, "/session")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected interface URI path '%s', try interface:///session"),
conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
}
if (!virConnectValidateURIPath(conn->uri->path,
"interface",
driver->privileged))
return VIR_DRV_OPEN_ERROR;
if (virConnectOpenEnsureACL(conn) < 0)
return VIR_DRV_OPEN_ERROR;