render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
9c6c51
From 6af885a53e425b88c7d9c123f64bbc4f8517b8a8 Mon Sep 17 00:00:00 2001
9c6c51
Message-Id: <6af885a53e425b88c7d9c123f64bbc4f8517b8a8@dist-git>
9c6c51
From: John Ferlan <jferlan@redhat.com>
9c6c51
Date: Thu, 15 Nov 2018 06:43:58 -0500
9c6c51
Subject: [PATCH] Revert "access: Modify the VIR_ERR_ACCESS_DENIED to include
9c6c51
 driverName"
9c6c51
9c6c51
https://bugzilla.redhat.com/show_bug.cgi?id=1631608 (RHEL8)
9c6c51
https://bugzilla.redhat.com/show_bug.cgi?id=1631606 (RHEL7)
9c6c51
9c6c51
This reverts commit ccc72d5cbdd85f66cb737134b3be40aac1df03ef.
9c6c51
9c6c51
Based on upstream comment to a follow-up patch, this didn't take the
9c6c51
right approach and the right thing to do is revert and rework.
9c6c51
9c6c51
Signed-off-by: John Ferlan <jferlan@redhat.com>
9c6c51
(cherry picked from commit b08396a5feab02fb3bb595603c888ee733aa178e)
9c6c51
Reviewed-by: Erik Skultety <eskultet@redhat.com>
9c6c51
---
9c6c51
 src/access/viraccessmanager.c | 25 ++++++++++++-------------
9c6c51
 src/rpc/gendispatch.pl        |  2 +-
9c6c51
 src/util/virerror.c           |  4 ++--
9c6c51
 3 files changed, 15 insertions(+), 16 deletions(-)
9c6c51
9c6c51
diff --git a/src/access/viraccessmanager.c b/src/access/viraccessmanager.c
9c6c51
index 1dfff32b9d..e7b5bf38da 100644
9c6c51
--- a/src/access/viraccessmanager.c
9c6c51
+++ b/src/access/viraccessmanager.c
9c6c51
@@ -196,12 +196,11 @@ static void virAccessManagerDispose(void *object)
9c6c51
  * should the admin need to debug things
9c6c51
  */
9c6c51
 static int
9c6c51
-virAccessManagerSanitizeError(int ret,
9c6c51
-                              const char *driverName)
9c6c51
+virAccessManagerSanitizeError(int ret)
9c6c51
 {
9c6c51
     if (ret < 0) {
9c6c51
         virResetLastError();
9c6c51
-        virAccessError(VIR_ERR_ACCESS_DENIED, driverName, NULL);
9c6c51
+        virAccessError(VIR_ERR_ACCESS_DENIED, NULL);
9c6c51
     }
9c6c51
 
9c6c51
     return ret;
9c6c51
@@ -218,7 +217,7 @@ int virAccessManagerCheckConnect(virAccessManagerPtr manager,
9c6c51
     if (manager->drv->checkConnect)
9c6c51
         ret = manager->drv->checkConnect(manager, driverName, perm);
9c6c51
 
9c6c51
-    return virAccessManagerSanitizeError(ret, driverName);
9c6c51
+    return virAccessManagerSanitizeError(ret);
9c6c51
 }
9c6c51
 
9c6c51
 
9c6c51
@@ -234,7 +233,7 @@ int virAccessManagerCheckDomain(virAccessManagerPtr manager,
9c6c51
     if (manager->drv->checkDomain)
9c6c51
         ret = manager->drv->checkDomain(manager, driverName, domain, perm);
9c6c51
 
9c6c51
-    return virAccessManagerSanitizeError(ret, driverName);
9c6c51
+    return virAccessManagerSanitizeError(ret);
9c6c51
 }
9c6c51
 
9c6c51
 int virAccessManagerCheckInterface(virAccessManagerPtr manager,
9c6c51
@@ -249,7 +248,7 @@ int virAccessManagerCheckInterface(virAccessManagerPtr manager,
9c6c51
     if (manager->drv->checkInterface)
9c6c51
         ret = manager->drv->checkInterface(manager, driverName, iface, perm);
9c6c51
 
9c6c51
-    return virAccessManagerSanitizeError(ret, driverName);
9c6c51
+    return virAccessManagerSanitizeError(ret);
9c6c51
 }
9c6c51
 
9c6c51
 int virAccessManagerCheckNetwork(virAccessManagerPtr manager,
9c6c51
@@ -264,7 +263,7 @@ int virAccessManagerCheckNetwork(virAccessManagerPtr manager,
9c6c51
     if (manager->drv->checkNetwork)
9c6c51
         ret = manager->drv->checkNetwork(manager, driverName, network, perm);
9c6c51
 
9c6c51
-    return virAccessManagerSanitizeError(ret, driverName);
9c6c51
+    return virAccessManagerSanitizeError(ret);
9c6c51
 }
9c6c51
 
9c6c51
 int virAccessManagerCheckNodeDevice(virAccessManagerPtr manager,
9c6c51
@@ -279,7 +278,7 @@ int virAccessManagerCheckNodeDevice(virAccessManagerPtr manager,
9c6c51
     if (manager->drv->checkNodeDevice)
9c6c51
         ret = manager->drv->checkNodeDevice(manager, driverName, nodedev, perm);
9c6c51
 
9c6c51
-    return virAccessManagerSanitizeError(ret, driverName);
9c6c51
+    return virAccessManagerSanitizeError(ret);
9c6c51
 }
9c6c51
 
9c6c51
 int virAccessManagerCheckNWFilter(virAccessManagerPtr manager,
9c6c51
@@ -294,7 +293,7 @@ int virAccessManagerCheckNWFilter(virAccessManagerPtr manager,
9c6c51
     if (manager->drv->checkNWFilter)
9c6c51
         ret = manager->drv->checkNWFilter(manager, driverName, nwfilter, perm);
9c6c51
 
9c6c51
-    return virAccessManagerSanitizeError(ret, driverName);
9c6c51
+    return virAccessManagerSanitizeError(ret);
9c6c51
 }
9c6c51
 
9c6c51
 int virAccessManagerCheckNWFilterBinding(virAccessManagerPtr manager,
9c6c51
@@ -309,7 +308,7 @@ int virAccessManagerCheckNWFilterBinding(virAccessManagerPtr manager,
9c6c51
     if (manager->drv->checkNWFilterBinding)
9c6c51
         ret = manager->drv->checkNWFilterBinding(manager, driverName, binding, perm);
9c6c51
 
9c6c51
-    return virAccessManagerSanitizeError(ret, driverName);
9c6c51
+    return virAccessManagerSanitizeError(ret);
9c6c51
 }
9c6c51
 
9c6c51
 int virAccessManagerCheckSecret(virAccessManagerPtr manager,
9c6c51
@@ -324,7 +323,7 @@ int virAccessManagerCheckSecret(virAccessManagerPtr manager,
9c6c51
     if (manager->drv->checkSecret)
9c6c51
         ret = manager->drv->checkSecret(manager, driverName, secret, perm);
9c6c51
 
9c6c51
-    return virAccessManagerSanitizeError(ret, driverName);
9c6c51
+    return virAccessManagerSanitizeError(ret);
9c6c51
 }
9c6c51
 
9c6c51
 int virAccessManagerCheckStoragePool(virAccessManagerPtr manager,
9c6c51
@@ -339,7 +338,7 @@ int virAccessManagerCheckStoragePool(virAccessManagerPtr manager,
9c6c51
     if (manager->drv->checkStoragePool)
9c6c51
         ret = manager->drv->checkStoragePool(manager, driverName, pool, perm);
9c6c51
 
9c6c51
-    return virAccessManagerSanitizeError(ret, driverName);
9c6c51
+    return virAccessManagerSanitizeError(ret);
9c6c51
 }
9c6c51
 
9c6c51
 int virAccessManagerCheckStorageVol(virAccessManagerPtr manager,
9c6c51
@@ -355,5 +354,5 @@ int virAccessManagerCheckStorageVol(virAccessManagerPtr manager,
9c6c51
     if (manager->drv->checkStorageVol)
9c6c51
         ret = manager->drv->checkStorageVol(manager, driverName, pool, vol, perm);
9c6c51
 
9c6c51
-    return virAccessManagerSanitizeError(ret, driverName);
9c6c51
+    return virAccessManagerSanitizeError(ret);
9c6c51
 }
9c6c51
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
9c6c51
index f599002056..0c4648c0fb 100755
9c6c51
--- a/src/rpc/gendispatch.pl
9c6c51
+++ b/src/rpc/gendispatch.pl
9c6c51
@@ -2199,7 +2199,7 @@ elsif ($mode eq "client") {
9c6c51
                     print "        virObjectUnref(mgr);\n";
9c6c51
                     if ($action eq "Ensure") {
9c6c51
                         print "        if (rv == 0)\n";
9c6c51
-                        print "            virReportError(VIR_ERR_ACCESS_DENIED, conn->driver->name, NULL);\n";
9c6c51
+                        print "            virReportError(VIR_ERR_ACCESS_DENIED, NULL);\n";
9c6c51
                         print "        return $fail;\n";
9c6c51
                     } else {
9c6c51
                         print "        virResetLastError();\n";
9c6c51
diff --git a/src/util/virerror.c b/src/util/virerror.c
9c6c51
index 5f50fa0349..f198f27957 100644
9c6c51
--- a/src/util/virerror.c
9c6c51
+++ b/src/util/virerror.c
9c6c51
@@ -1439,9 +1439,9 @@ virErrorMsg(virErrorNumber error, const char *info)
9c6c51
             break;
9c6c51
         case VIR_ERR_ACCESS_DENIED:
9c6c51
             if (info == NULL)
9c6c51
-                errmsg = _("access denied from '%s'");
9c6c51
+                errmsg = _("access denied");
9c6c51
             else
9c6c51
-                errmsg = _("access denied from '%s': %s");
9c6c51
+                errmsg = _("access denied: %s");
9c6c51
             break;
9c6c51
         case VIR_ERR_DBUS_SERVICE:
9c6c51
             if (info == NULL)
9c6c51
-- 
9c6c51
2.19.2
9c6c51