Blame SOURCES/libvirt-Revert-access-Modify-the-VIR_ERR_ACCESS_DENIED-to-include-driverName.patch

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