util: Alter virAuthGet*Path API to check valid callback
Before trying to call @auth->cb, let's ensure it exists. 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
f707935abf
commit
3dc6b00f0d
@ -175,6 +175,12 @@ virAuthGetUsernamePath(const char *path,
|
|||||||
if (auth->credtype[ncred] != VIR_CRED_AUTHNAME)
|
if (auth->credtype[ncred] != VIR_CRED_AUTHNAME)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!auth->cb) {
|
||||||
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
|
_("Missing authentication callback"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
cred.type = VIR_CRED_AUTHNAME;
|
cred.type = VIR_CRED_AUTHNAME;
|
||||||
cred.prompt = prompt;
|
cred.prompt = prompt;
|
||||||
cred.challenge = hostname;
|
cred.challenge = hostname;
|
||||||
@ -251,6 +257,12 @@ virAuthGetPasswordPath(const char *path,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!auth->cb) {
|
||||||
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
|
_("Missing authentication callback"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
cred.type = auth->credtype[ncred];
|
cred.type = auth->credtype[ncred];
|
||||||
cred.prompt = prompt;
|
cred.prompt = prompt;
|
||||||
cred.challenge = hostname;
|
cred.challenge = hostname;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user