]> xenbits.xensource.com Git - libvirt.git/commitdiff
interface_backend_netcf.c: use virConnectValidateURIPath()
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Thu, 26 Sep 2019 14:56:37 +0000 (11:56 -0300)
committerCole Robinson <crobinso@redhat.com>
Thu, 26 Sep 2019 21:25:19 +0000 (17:25 -0400)
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Suggested-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/interface/interface_backend_netcf.c

index 9659e9fcf192b881c1bcb8299b3a8cacefc23ef7..5ef8ac33db7f2dd6d05b980406dc43ec4ef5e7e2 100644 (file)
@@ -200,21 +200,10 @@ netcfConnectOpen(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;