mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
virauth: Verify virConnectAuth::cb is set in virAuthGetPasswordPath()
Simirarly to virAuthGetUsernamePath() check whether callback used
to collect credentials is actually set before calling it. This
bug is easily reproducible, for instance as:
int credtype[] = { VIR_CRED_PASSPHRASE };
virConnectPtr conn = virConnectOpenAuth("esx://root@example.com/",
&(virConnectAuth){
.credtype = credtype,
.ncredtype = 1,
.cb = NULL
},
0);
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
1 parent
f8511b6417
commit
4817d1003b
1 file changed
+6
@@ -229,6 +229,12 @@ virAuthGetPasswordPath(const char *path,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!auth->cb) {
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("Missing authentication callback"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
prompt = g_strdup_printf(_("Enter %1$s's password for %2$s"), username, hostname);
|
||||
|
||||
if (!(cred = virAuthAskCredential(auth, prompt, false)))
|
||||
|
||||
Reference in new issue
Block a user