]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virt-admin: Properly fix the default session daemon URI to admin server
authorErik Skultety <eskultet@redhat.com>
Tue, 9 Aug 2016 11:57:41 +0000 (13:57 +0200)
committerErik Skultety <eskultet@redhat.com>
Tue, 9 Aug 2016 13:24:19 +0000 (15:24 +0200)
commit9e5e7f3a5b7a9a7325ad4ac719abd469cd7f8a45
treed93d9d92d1726dcc6258c5df94d895ddd972b1fe
parent30ce2f0e2ad1335df6e4c9053eae822963531f97
virt-admin: Properly fix the default session daemon URI to admin server

Commit 30ce2f0e tried to fix the issue with an incorrect session URI to admin
server but it messed up the checks:

    if (geteuid == 0 && VIR_STRDUP(*uristr, "libvirtd:///system") < 0)
        return -1;
    else if (VIR_STRDUP(*uristr, "libvirtd:///session") < 0)
        return -1;

So if a client executed with root privileges tries to connect, its euid is
checked (true) and the correct URI is successfully copied to @uristr (false),
therefore the 'else' branch is taken and @uristr is replaced by the session URI
which for root results in:
    Failed to connect socket to '/root/.cache/libvirt/libvirt-admin-sock':
    No such file or directory

Signed-off-by: Erik Skultety <eskultet@redhat.com>
src/libvirt-admin.c