[PATCH 05/11] util: Alter virAuthGet*Path API to generate auth->cb error

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

 



Rather than forcing the caller to generate an error, let's
generate the Username or Password error message failure if
the auth->cb fails. This is the last error path that needs
a specific message for various callers.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/util/virauth.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/util/virauth.c b/src/util/virauth.c
index d706658135..5f1515e113 100644
--- a/src/util/virauth.c
+++ b/src/util/virauth.c
@@ -188,8 +188,11 @@ virAuthGetUsernamePath(const char *path,
         cred.result = NULL;
         cred.resultlen = 0;
 
-        if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0)
+        if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
+            virReportError(VIR_ERR_AUTH_FAILED, "%s",
+                           _("Username request failed"));
             VIR_FREE(cred.result);
+        }
 
         return cred.result;
     }
@@ -266,8 +269,11 @@ virAuthGetPasswordPath(const char *path,
         cred.result = NULL;
         cred.resultlen = 0;
 
-        if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0)
+        if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
+            virReportError(VIR_ERR_AUTH_FAILED, "%s",
+                           _("Password request failed"));
             VIR_FREE(cred.result);
+        }
 
         return cred.result;
     }
-- 
2.17.1

--
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