diff --git a/src/util/virauth.c b/src/util/virauth.c index 759b8f0cd3..1b9e4b6704 100644 --- a/src/util/virauth.c +++ b/src/util/virauth.c @@ -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,