forked from lix-project/lix
* Sanity check.
This commit is contained in:
parent
6a8e60913a
commit
813a7c65c9
|
@ -406,7 +406,7 @@ void UserLock::acquire()
|
||||||
if (!pw)
|
if (!pw)
|
||||||
throw Error(format("the user `%1%' in the group `%2%' does not exist")
|
throw Error(format("the user `%1%' in the group `%2%' does not exist")
|
||||||
% *i % buildUsersGroup);
|
% *i % buildUsersGroup);
|
||||||
|
|
||||||
fnUserLock = (format("%1%/userpool/%2%") % nixStateDir % pw->pw_uid).str();
|
fnUserLock = (format("%1%/userpool/%2%") % nixStateDir % pw->pw_uid).str();
|
||||||
|
|
||||||
if (lockedPaths.find(fnUserLock) != lockedPaths.end())
|
if (lockedPaths.find(fnUserLock) != lockedPaths.end())
|
||||||
|
@ -421,6 +421,12 @@ void UserLock::acquire()
|
||||||
fdUserLock = fd.borrow();
|
fdUserLock = fd.borrow();
|
||||||
lockedPaths.insert(fnUserLock);
|
lockedPaths.insert(fnUserLock);
|
||||||
uid = pw->pw_uid;
|
uid = pw->pw_uid;
|
||||||
|
|
||||||
|
/* Sanity check... */
|
||||||
|
if (uid == getuid() || uid == geteuid())
|
||||||
|
throw Error(format("the Nix user should not be a member of `%1%'")
|
||||||
|
% buildUsersGroup);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue