提交 ab42772a 编写于 作者: D Daniel P. Berrange

Fix crash accessing a NULL URI when looking up auth credentials

When auto-probing hypervisor drivers, the conn->uri field will
initially be NULL. Care must be taken not to access members
when doing auth lookups in the config file
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 1437ea6f
......@@ -3726,7 +3726,7 @@ static int remoteAuthFillFromConfig(virConnectPtr conn,
if (virAuthConfigLookup(state->config,
"libvirt",
conn->uri->server,
VIR_URI_SERVER(conn->uri),
credname,
&value) < 0)
goto cleanup;
......
......@@ -130,7 +130,7 @@ virAuthGetCredential(virConnectPtr conn,
if (virAuthConfigLookup(config,
servicename,
conn->uri->server,
VIR_URI_SERVER(conn->uri),
credname,
&tmp) < 0)
goto cleanup;
......
......@@ -60,4 +60,6 @@ char *virURIFormatParams(virURIPtr uri);
void virURIFree(virURIPtr uri);
# define VIR_URI_SERVER(uri) ((uri) && (uri)->server ? (uri)->server : "localhost")
#endif /* __VIR_URI_H__ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册