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: Daniel P. Berrange <berrange@redhat.com>
if (virAuthConfigLookup(state->config,
"libvirt",
- conn->uri->server,
+ VIR_URI_SERVER(conn->uri),
credname,
&value) < 0)
goto cleanup;
if (virAuthConfigLookup(config,
servicename,
- conn->uri->server,
+ VIR_URI_SERVER(conn->uri),
credname,
&tmp) < 0)
goto cleanup;
void virURIFree(virURIPtr uri);
+# define VIR_URI_SERVER(uri) ((uri) && (uri)->server ? (uri)->server : "localhost")
+
#endif /* __VIR_URI_H__ */