mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
util: Alter virAuthGet*Path API to generate auth->cb error
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@redhat.com> Reviewed-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
This commit is contained in:
parent
5f0a9c45b3
commit
39f0f3ae65
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user