mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
fixed SegFault in virauth
No check for conn->uri being NULL in virAuthGetConfigFilePath (valid state) made the client segfault. This happens for example with these settings: - no virtualbox driver installed (modifies conn->uri) - no default URI set (VIRSH_DEFAULT_CONNECT_URI="", LIBVIRT_DEFAULT_URI="", uri_default="") - auth_sock_rw="sasl" - virsh run as root That are unfortunately the settings with fresh Fedora 17 installation with VDSM. The check ought to be enough as conn->uri being NULL is valid in later code and is handled properly. (cherry picked from commit 5eef74320b0bb9e604400168e0896c5ac527abef)
This commit is contained in:
parent
9a7bbc246b
commit
b9964013c3
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* virauth.c: authentication related utility functions
|
* virauth.c: authentication related utility functions
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 2012 Red Hat, Inc.
|
||||||
* Copyright (C) 2010 Matthias Bolte <matthias.bolte@googlemail.com>
|
* Copyright (C) 2010 Matthias Bolte <matthias.bolte@googlemail.com>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -54,6 +55,7 @@ int virAuthGetConfigFilePath(virConnectPtr conn,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (conn && conn->uri) {
|
||||||
for (i = 0 ; i < conn->uri->paramsCount ; i++) {
|
for (i = 0 ; i < conn->uri->paramsCount ; i++) {
|
||||||
if (STREQ_NULLABLE(conn->uri->params[i].name, "authfile") &&
|
if (STREQ_NULLABLE(conn->uri->params[i].name, "authfile") &&
|
||||||
conn->uri->params[i].value) {
|
conn->uri->params[i].value) {
|
||||||
@ -64,6 +66,7 @@ int virAuthGetConfigFilePath(virConnectPtr conn,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(userdir = virGetUserDirectory(geteuid())))
|
if (!(userdir = virGetUserDirectory(geteuid())))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user