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>
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;
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;