mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 04:55:18 +00:00
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: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
1437ea6f48
commit
ab42772a46
@ -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__ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user