[PATCH 02/11] util: Alter virAuthGet*Path API to check valid callback

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

 



Before trying to call @auth->cb, let's ensure it exists.

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

diff --git a/src/util/virauth.c b/src/util/virauth.c
index 1b9e4b6704..7e7098317d 100644
--- a/src/util/virauth.c
+++ b/src/util/virauth.c
@@ -175,6 +175,12 @@ virAuthGetUsernamePath(const char *path,
         if (auth->credtype[ncred] != VIR_CRED_AUTHNAME)
             continue;
 
+        if (!auth->cb) {
+            virReportError(VIR_ERR_INVALID_ARG, "%s",
+                           _("Missing authentication callback"));
+            return NULL;
+        }
+
         cred.type = VIR_CRED_AUTHNAME;
         cred.prompt = prompt;
         cred.challenge = hostname;
@@ -251,6 +257,12 @@ virAuthGetPasswordPath(const char *path,
             continue;
         }
 
+        if (!auth->cb) {
+            virReportError(VIR_ERR_INVALID_ARG, "%s",
+                           _("Missing authentication callback"));
+            return NULL;
+        }
+
         cred.type = auth->credtype[ncred];
         cred.prompt = prompt;
         cred.challenge = hostname;
-- 
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