mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
util: Alter virAuthGet*Path API to check valid parameters
Before trying to dereference @auth, let's ensure it's valid. 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
bfd91dc0c4
commit
f707935abf
@ -153,6 +153,12 @@ virAuthGetUsernamePath(const char *path,
|
||||
if (ret != NULL)
|
||||
return ret;
|
||||
|
||||
if (!auth) {
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("Missing authentication credentials"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(&cred, 0, sizeof(virConnectCredential));
|
||||
|
||||
if (defaultUsername != NULL) {
|
||||
@ -226,6 +232,12 @@ virAuthGetPasswordPath(const char *path,
|
||||
if (ret != NULL)
|
||||
return ret;
|
||||
|
||||
if (!auth) {
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("Missing authentication credentials"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(&cred, 0, sizeof(virConnectCredential));
|
||||
|
||||
if (virAsprintf(&prompt, _("Enter %s's password for %s"), username,
|
||||
|
Loading…
x
Reference in New Issue
Block a user