mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Use getpwuid(geteuid()) instead of getlogin()
This removes the dependency on a TTY and now does what is expected: gets the (possibly impersonated) username of the current process/thread. Implementation and tests updated, still uses reentrant versions where possible.
This commit is contained in:
1 parent
39174a0afb
commit
020a768c31
2 files changed
+33
-29
No files matched your search
@@ -7,6 +7,7 @@
|
||||
#include <unistd.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <unicode/unistr.h>
|
||||
#include <pwd.h>
|
||||
#include "getusername.h"
|
||||
|
||||
//! Test fixture for GetUserNameW
|
||||
@@ -19,7 +20,7 @@ protected:
|
||||
std::string expectedUsername;
|
||||
DWORD expectedSize;
|
||||
|
||||
GetUserNameTest(): expectedUsername(std::string(getlogin())),
|
||||
GetUserNameTest(): expectedUsername(std::string(getpwuid(geteuid())->pw_name)),
|
||||
expectedSize(expectedUsername.length()+1)
|
||||
{
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user