mirror of
https://github.com/NixOS/nix.git
synced 2025-11-27 04:30:59 +01:00
Fixed a lot of remote store issues. But there is still a bug with 32bit unsigned integers: 'implementation cannot deal with > 32-bit integers'
This commit is contained in:
parent
2e7539bd27
commit
627afcc1aa
16 changed files with 144 additions and 54 deletions
|
|
@ -28,8 +28,8 @@ bool readOnlyMode = false;
|
|||
string thisSystem = "unset";
|
||||
unsigned int maxSilentTime = 0;
|
||||
static bool settingsRead = false;
|
||||
uid_t callingUID = 0;
|
||||
bool debugWorker = true;
|
||||
uid_t callingUID = 0; //A root user will not set this value, so the default uid is 0
|
||||
bool debugWorker = false; //TODO still experimental
|
||||
|
||||
static std::map<string, Strings> settings;
|
||||
|
||||
|
|
@ -132,16 +132,23 @@ void setCallingUID(uid_t uid, bool reset)
|
|||
callingUID = uid;
|
||||
}
|
||||
|
||||
string queryCallingUsername()
|
||||
string uidToUsername(uid_t uid)
|
||||
{
|
||||
uid_t uid = queryCallingUID();
|
||||
|
||||
passwd *pwd = getpwuid(uid);
|
||||
char *pw_name = pwd->pw_name;
|
||||
|
||||
return (string)pw_name;
|
||||
}
|
||||
|
||||
string queryCallingUsername()
|
||||
{
|
||||
uid_t uid = queryCallingUID();
|
||||
return uidToUsername(uid);
|
||||
}
|
||||
|
||||
string queryCurrentUsername()
|
||||
{
|
||||
return uidToUsername(geteuid());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue