提交 a9a476e3 编写于 作者: J John Ferlan

test: Don't overwrite virAuthGet{Username|Password} errors

Now that the virAuthGet*Path API's generate all the error messages
we can remove them from the callers.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
Reviewed-by: NMarcos Paulo de Souza <marcos.souza.org@gmail.com>
上级 e456575e
......@@ -1374,12 +1374,9 @@ testConnectAuthenticate(virConnectPtr conn,
/* Authentication is required because the test XML contains a
* non-empty <auth/> section. First we must ask for a username.
*/
username = virAuthGetUsername(conn, auth, "test", NULL, "localhost"/*?*/);
if (!username) {
virReportError(VIR_ERR_AUTH_FAILED, "%s",
_("authentication failed when asking for username"));
if (!(username = virAuthGetUsername(conn, auth, "test", NULL,
"localhost"/*?*/)))
goto cleanup;
}
/* Does the username exist? */
for (i = 0; i < privconn->numAuths; ++i) {
......@@ -1391,14 +1388,10 @@ testConnectAuthenticate(virConnectPtr conn,
found_user:
/* Even if we didn't find the user, we still ask for a password. */
if (i == -1 || privconn->auths[i].password != NULL) {
password = virAuthGetPassword(conn, auth, "test",
username, "localhost");
if (password == NULL) {
virReportError(VIR_ERR_AUTH_FAILED, "%s",
_("authentication failed when asking for password"));
if (!(password = virAuthGetPassword(conn, auth, "test", username,
"localhost")))
goto cleanup;
}
}
if (i == -1 ||
(password && STRNEQ(privconn->auths[i].password, password))) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册