[PATCH v2 1/3] Revert "access: Modify the VIR_ERR_ACCESS_DENIED to include driverName"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This reverts commit ccc72d5cbdd85f66cb737134b3be40aac1df03ef.

Based on upstream comment to a follow-up patch, this didn't take the
right approach and the right thing to do is revert and rework.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/access/viraccessmanager.c | 25 ++++++++++++-------------
 src/rpc/gendispatch.pl        |  2 +-
 src/util/virerror.c           |  4 ++--
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/src/access/viraccessmanager.c b/src/access/viraccessmanager.c
index 1dfff32b9d..e7b5bf38da 100644
--- a/src/access/viraccessmanager.c
+++ b/src/access/viraccessmanager.c
@@ -196,12 +196,11 @@ static void virAccessManagerDispose(void *object)
  * should the admin need to debug things
  */
 static int
-virAccessManagerSanitizeError(int ret,
-                              const char *driverName)
+virAccessManagerSanitizeError(int ret)
 {
     if (ret < 0) {
         virResetLastError();
-        virAccessError(VIR_ERR_ACCESS_DENIED, driverName, NULL);
+        virAccessError(VIR_ERR_ACCESS_DENIED, NULL);
     }
 
     return ret;
@@ -218,7 +217,7 @@ int virAccessManagerCheckConnect(virAccessManagerPtr manager,
     if (manager->drv->checkConnect)
         ret = manager->drv->checkConnect(manager, driverName, perm);
 
-    return virAccessManagerSanitizeError(ret, driverName);
+    return virAccessManagerSanitizeError(ret);
 }
 
 
@@ -234,7 +233,7 @@ int virAccessManagerCheckDomain(virAccessManagerPtr manager,
     if (manager->drv->checkDomain)
         ret = manager->drv->checkDomain(manager, driverName, domain, perm);
 
-    return virAccessManagerSanitizeError(ret, driverName);
+    return virAccessManagerSanitizeError(ret);
 }
 
 int virAccessManagerCheckInterface(virAccessManagerPtr manager,
@@ -249,7 +248,7 @@ int virAccessManagerCheckInterface(virAccessManagerPtr manager,
     if (manager->drv->checkInterface)
         ret = manager->drv->checkInterface(manager, driverName, iface, perm);
 
-    return virAccessManagerSanitizeError(ret, driverName);
+    return virAccessManagerSanitizeError(ret);
 }
 
 int virAccessManagerCheckNetwork(virAccessManagerPtr manager,
@@ -264,7 +263,7 @@ int virAccessManagerCheckNetwork(virAccessManagerPtr manager,
     if (manager->drv->checkNetwork)
         ret = manager->drv->checkNetwork(manager, driverName, network, perm);
 
-    return virAccessManagerSanitizeError(ret, driverName);
+    return virAccessManagerSanitizeError(ret);
 }
 
 int virAccessManagerCheckNodeDevice(virAccessManagerPtr manager,
@@ -279,7 +278,7 @@ int virAccessManagerCheckNodeDevice(virAccessManagerPtr manager,
     if (manager->drv->checkNodeDevice)
         ret = manager->drv->checkNodeDevice(manager, driverName, nodedev, perm);
 
-    return virAccessManagerSanitizeError(ret, driverName);
+    return virAccessManagerSanitizeError(ret);
 }
 
 int virAccessManagerCheckNWFilter(virAccessManagerPtr manager,
@@ -294,7 +293,7 @@ int virAccessManagerCheckNWFilter(virAccessManagerPtr manager,
     if (manager->drv->checkNWFilter)
         ret = manager->drv->checkNWFilter(manager, driverName, nwfilter, perm);
 
-    return virAccessManagerSanitizeError(ret, driverName);
+    return virAccessManagerSanitizeError(ret);
 }
 
 int virAccessManagerCheckNWFilterBinding(virAccessManagerPtr manager,
@@ -309,7 +308,7 @@ int virAccessManagerCheckNWFilterBinding(virAccessManagerPtr manager,
     if (manager->drv->checkNWFilterBinding)
         ret = manager->drv->checkNWFilterBinding(manager, driverName, binding, perm);
 
-    return virAccessManagerSanitizeError(ret, driverName);
+    return virAccessManagerSanitizeError(ret);
 }
 
 int virAccessManagerCheckSecret(virAccessManagerPtr manager,
@@ -324,7 +323,7 @@ int virAccessManagerCheckSecret(virAccessManagerPtr manager,
     if (manager->drv->checkSecret)
         ret = manager->drv->checkSecret(manager, driverName, secret, perm);
 
-    return virAccessManagerSanitizeError(ret, driverName);
+    return virAccessManagerSanitizeError(ret);
 }
 
 int virAccessManagerCheckStoragePool(virAccessManagerPtr manager,
@@ -339,7 +338,7 @@ int virAccessManagerCheckStoragePool(virAccessManagerPtr manager,
     if (manager->drv->checkStoragePool)
         ret = manager->drv->checkStoragePool(manager, driverName, pool, perm);
 
-    return virAccessManagerSanitizeError(ret, driverName);
+    return virAccessManagerSanitizeError(ret);
 }
 
 int virAccessManagerCheckStorageVol(virAccessManagerPtr manager,
@@ -355,5 +354,5 @@ int virAccessManagerCheckStorageVol(virAccessManagerPtr manager,
     if (manager->drv->checkStorageVol)
         ret = manager->drv->checkStorageVol(manager, driverName, pool, vol, perm);
 
-    return virAccessManagerSanitizeError(ret, driverName);
+    return virAccessManagerSanitizeError(ret);
 }
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index f599002056..0c4648c0fb 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -2199,7 +2199,7 @@ elsif ($mode eq "client") {
                     print "        virObjectUnref(mgr);\n";
                     if ($action eq "Ensure") {
                         print "        if (rv == 0)\n";
-                        print "            virReportError(VIR_ERR_ACCESS_DENIED, conn->driver->name, NULL);\n";
+                        print "            virReportError(VIR_ERR_ACCESS_DENIED, NULL);\n";
                         print "        return $fail;\n";
                     } else {
                         print "        virResetLastError();\n";
diff --git a/src/util/virerror.c b/src/util/virerror.c
index 10f1b55c5f..683e51aa19 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -1442,9 +1442,9 @@ virErrorMsg(virErrorNumber error, const char *info)
             break;
         case VIR_ERR_ACCESS_DENIED:
             if (info == NULL)
-                errmsg = _("access denied from '%s'");
+                errmsg = _("access denied");
             else
-                errmsg = _("access denied from '%s': %s");
+                errmsg = _("access denied: %s");
             break;
         case VIR_ERR_DBUS_SERVICE:
             if (info == NULL)
-- 
2.17.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux