]> xenbits.xensource.com Git - libvirt.git/commitdiff
secret_driver.c: use virConnectValidateURIPath()
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Thu, 26 Sep 2019 14:56:41 +0000 (11:56 -0300)
committerCole Robinson <crobinso@redhat.com>
Thu, 26 Sep 2019 21:25:20 +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/secret/secret_driver.c

index 7512a51c74069e31fd5d76d3570dffd68daa2d1c..ed3bd3c75198b0d6dd4bf9fe61ddd502a01cb529 100644 (file)
@@ -552,21 +552,10 @@ secretConnectOpen(virConnectPtr conn,
         return VIR_DRV_OPEN_ERROR;
     }
 
-    if (driver->privileged) {
-        if (STRNEQ(conn->uri->path, "/system")) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("unexpected secret URI path '%s', try secret:///system"),
-                           conn->uri->path);
-            return VIR_DRV_OPEN_ERROR;
-        }
-    } else {
-        if (STRNEQ(conn->uri->path, "/session")) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("unexpected secret URI path '%s', try secret:///session"),
-                           conn->uri->path);
-            return VIR_DRV_OPEN_ERROR;
-        }
-    }
+    if (!virConnectValidateURIPath(conn->uri->path,
+                                   "secret",
+                                   driver->privileged))
+        return VIR_DRV_OPEN_ERROR;
 
     if (virConnectOpenEnsureACL(conn) < 0)
         return VIR_DRV_OPEN_ERROR;