提交 6f9d8bdb 编写于 作者: M Matthias Bolte 提交者: Daniel Veillard

ESX Set challenge for auth callback to hostname

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
上级 ecd93b75
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
char * char *
esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername, esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername,
const char *server) const char *hostname)
{ {
unsigned int ncred; unsigned int ncred;
virConnectCredential cred; virConnectCredential cred;
...@@ -58,7 +58,7 @@ esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername, ...@@ -58,7 +58,7 @@ esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername,
memset(&cred, 0, sizeof(virConnectCredential)); 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) { defaultUsername) < 0) {
return NULL; return NULL;
} }
...@@ -70,7 +70,7 @@ esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername, ...@@ -70,7 +70,7 @@ esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername,
cred.type = VIR_CRED_AUTHNAME; cred.type = VIR_CRED_AUTHNAME;
cred.prompt = prompt; cred.prompt = prompt;
cred.challenge = NULL; cred.challenge = hostname;
cred.defresult = defaultUsername; cred.defresult = defaultUsername;
cred.result = NULL; cred.result = NULL;
cred.resultlen = 0; cred.resultlen = 0;
...@@ -91,7 +91,7 @@ esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername, ...@@ -91,7 +91,7 @@ esxUtil_RequestUsername(virConnectAuthPtr auth, const char *defaultUsername,
char * char *
esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username, esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
const char *server) const char *hostname)
{ {
unsigned int ncred; unsigned int ncred;
virConnectCredential cred; virConnectCredential cred;
...@@ -100,7 +100,7 @@ esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username, ...@@ -100,7 +100,7 @@ esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
memset(&cred, 0, sizeof(virConnectCredential)); memset(&cred, 0, sizeof(virConnectCredential));
if (virAsprintf(&prompt, "Enter %s password for %s", username, if (virAsprintf(&prompt, "Enter %s password for %s", username,
server) < 0) { hostname) < 0) {
return NULL; return NULL;
} }
...@@ -112,7 +112,7 @@ esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username, ...@@ -112,7 +112,7 @@ esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
cred.type = auth->credtype[ncred]; cred.type = auth->credtype[ncred];
cred.prompt = prompt; cred.prompt = prompt;
cred.challenge = NULL; cred.challenge = hostname;
cred.defresult = NULL; cred.defresult = NULL;
cred.result = NULL; cred.result = NULL;
cred.resultlen = 0; cred.resultlen = 0;
......
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
char *esxUtil_RequestUsername(virConnectAuthPtr auth, char *esxUtil_RequestUsername(virConnectAuthPtr auth,
const char *defaultUsername, const char *defaultUsername,
const char *server); const char *hostname);
char *esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username, char *esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
const char *server); const char *hostname);
int esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter, int esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
int *noVerify); int *noVerify);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册