[PATCH] Support: Provide a function to get the home directory of an arbitrary user

Zachary Turner zturner at google.com
Fri Aug 1 10:49:58 PDT 2014


Talked about it with rnk some, I think maybe we can just delete the entire
windows implementation of this function and have it return false.  These
directories on Windows are going to be ACLed to the teeth and we won't be
able to read or even traverse an arbitrary user's home directory anyway, so
there's kind of no point in doing this.  So, proposal: Unix implementation
remains the same, Windows implementation is one line that returns false.

Thoughts?


On Fri, Aug 1, 2014 at 10:39 AM, Zachary Turner <zturner at google.com> wrote:

> The problem is that it requires TOKEN_IMPERSONATE, which will require you
> to provide login credentials.
>
>
> On Fri, Aug 1, 2014 at 10:33 AM, Aaron Ballman <aaron at aaronballman.com>
> wrote:
>
>> On Thu, Jul 31, 2014 at 8:42 PM, Zachary Turner <zturner at google.com>
>> wrote:
>> > Hi rnk,
>> >
>> > llvm::sys::path already provides a function home_directory() which
>> returns the current user's home directory.
>> >
>> > This patch extends this by implementing a function which returns the
>> home directory of an arbitrary user.  This satisfies a use case in LLDB
>> where we need to resolve paths of the form ~username/path, and since it is
>> similar in nature to the existing home_directory() function, seems
>> generally useful for llvm
>> >
>> > http://reviews.llvm.org/D4749
>> >
>> > Files:
>> >   include/llvm/Support/Path.h
>> >   lib/Support/Unix/Path.inc
>> >   lib/Support/Windows/Path.inc
>>
>> Instead of trawling the registry (which is fragile and subject to
>> change), I would feel *way* more comfortable using the designated API
>> for this sort of thing (SHGetKnownFolderPath). It accepts a token
>> which you can use to impersonate a particular user.
>>
>> http://msdn.microsoft.com/en-us/library/windows/desktop/bb762188.aspx
>>
>> ~Aaron
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140801/132389a6/attachment.html>


More information about the llvm-commits mailing list