[libvirt] ESX [02/12]: Set challenge for auth callback to hostname

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

 



This enables the auth callback to automatically distinguish between
requests for ESX host and vCenter credentials.

* src/esx/esx_util.[ch]: set challenge for auth callback to hostname
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index 92af0ca..38014de 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -50,7 +50,7 @@
 
 char *
 esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername,
-                        const char *server)
+                        const char *hostname)
 {
     unsigned int ncred;
     virConnectCredential cred;
@@ -58,7 +58,7 @@ esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername,
 
     memset(&cred, 0, sizeof(virConnectCredential));
 
-    if (virAsprintf(&prompt, "Enter username for %s [%s]", server,
+    if (virAsprintf(&prompt, "Enter username for %s [%s]", hostname,
                     defaultUsername) < 0) {
         return NULL;
     }
@@ -70,7 +70,7 @@ esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername,
 
         cred.type = VIR_CRED_AUTHNAME;
         cred.prompt = prompt;
-        cred.challenge = NULL;
+        cred.challenge = hostname;
         cred.defresult = defaultUsername;
         cred.result = NULL;
         cred.resultlen = 0;
@@ -91,7 +91,7 @@ esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername,
 
 char *
 esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
-                        const char *server)
+                        const char *hostname)
 {
     unsigned int ncred;
     virConnectCredential cred;
@@ -100,7 +100,7 @@ esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
     memset(&cred, 0, sizeof(virConnectCredential));
 
     if (virAsprintf(&prompt, "Enter %s password for %s", username,
-                    server) < 0) {
+                    hostname) < 0) {
         return NULL;
     }
 
@@ -112,7 +112,7 @@ esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
 
         cred.type = auth->credtype[ncred];
         cred.prompt = prompt;
-        cred.challenge = NULL;
+        cred.challenge = hostname;
         cred.defresult = NULL;
         cred.result = NULL;
         cred.resultlen = 0;
diff --git a/src/esx/esx_util.h b/src/esx/esx_util.h
index 9c31715..476e004 100644
--- a/src/esx/esx_util.h
+++ b/src/esx/esx_util.h
@@ -30,10 +30,10 @@
 
 char *esxUtil_RequestUsername(virConnectAuthPtr auth,
                               const char *defaultUsername,
-                              const char *server);
+                              const char *hostname);
 
 char *esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
-                              const char *server);
+                              const char *hostname);
 
 int esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
                        int *noVerify);
--
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]