提交 3dc6b00f 编写于 作者: J John Ferlan

util: Alter virAuthGet*Path API to check valid callback

Before trying to call @auth->cb, let's ensure it exists.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
Reviewed-by: NMarcos Paulo de Souza <marcos.souza.org@gmail.com>
上级 f707935a
......@@ -175,6 +175,12 @@ virAuthGetUsernamePath(const char *path,
if (auth->credtype[ncred] != VIR_CRED_AUTHNAME)
continue;
if (!auth->cb) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("Missing authentication callback"));
return NULL;
}
cred.type = VIR_CRED_AUTHNAME;
cred.prompt = prompt;
cred.challenge = hostname;
......@@ -251,6 +257,12 @@ virAuthGetPasswordPath(const char *path,
continue;
}
if (!auth->cb) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("Missing authentication callback"));
return NULL;
}
cred.type = auth->credtype[ncred];
cred.prompt = prompt;
cred.challenge = hostname;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册