mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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,
|
if (virAuthConfigLookup(state->config,
|
||||||
"libvirt",
|
"libvirt",
|
||||||
conn->uri->server,
|
VIR_URI_SERVER(conn->uri),
|
||||||
credname,
|
credname,
|
||||||
&value) < 0)
|
&value) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -130,7 +130,7 @@ virAuthGetCredential(virConnectPtr conn,
|
|||||||
|
|
||||||
if (virAuthConfigLookup(config,
|
if (virAuthConfigLookup(config,
|
||||||
servicename,
|
servicename,
|
||||||
conn->uri->server,
|
VIR_URI_SERVER(conn->uri),
|
||||||
credname,
|
credname,
|
||||||
&tmp) < 0)
|
&tmp) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -60,4 +60,6 @@ char *virURIFormatParams(virURIPtr uri);
|
|||||||
|
|
||||||
void virURIFree(virURIPtr uri);
|
void virURIFree(virURIPtr uri);
|
||||||
|
|
||||||
|
# define VIR_URI_SERVER(uri) ((uri) && (uri)->server ? (uri)->server : "localhost")
|
||||||
|
|
||||||
#endif /* __VIR_URI_H__ */
|
#endif /* __VIR_URI_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user