Re: [PATCH 1/2] Remove uid param from directory lookup APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/24/2012 07:44 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> Remove the uid param from virGetUserConfigDirectory,
> virGetUserCacheDirectory, virGetUserRuntimeDirectory,
> and virGetUserDirectory
> 
> These functions were universally called with the
> results of getuid() or geteuid(). To make it practical
> to port to Win32, remove the uid parameter and hardcode
> geteuid()

Confirmed that we were universally using a current id, and that blindly
using geteuid() is the best approach.

ACK.

> +++ b/src/remote/remote_driver.c
> @@ -578,7 +578,7 @@ doRemoteOpen (virConnectPtr conn,
>      case trans_unix:
>          if (!sockname) {
>              if (flags & VIR_DRV_OPEN_REMOTE_USER) {
> -                char *userdir = virGetUserRuntimeDirectory(getuid());
> +                char *userdir = virGetUserRuntimeDirectory();

There's probably a subtle difference for the effects if getuid() and
geteuid() differed in value if you ever got here while linking to
libvirt.so from a setuid binary, but I think that is unlikely enough and
that our switch to geteuid() feels safer anyways.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]