提交 39f0f3ae 编写于 作者: J John Ferlan

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: NJohn Ferlan <jferlan@redhat.com>
Reviewed-by: NMarcos Paulo de Souza <marcos.souza.org@gmail.com>
上级 5f0a9c45
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册