Merge pull request #465 from aanderse/master

Set USER and LOGNAME environment variables when dropping privileges
This commit is contained in:
Joachim Wiberg authored and GitHub committed 2026-01-11 08:54:59 +01:00
commit bb111f98fc
1 file changed
+4 -1
+4 -1
View File
@@ -627,8 +627,11 @@ static pid_t service_fork(svc_t *svc)
set_uid(uid, svc); set_uid(uid, svc);
/* Set default path for regular users */ /* Set default path for regular users */
if (uid > 0) if (uid > 0) {
setenv("PATH", _PATH_DEFPATH, 1); setenv("PATH", _PATH_DEFPATH, 1);
setenv("USER", svc->username, 1);
setenv("LOGNAME", svc->username, 1);
}
if (home) { if (home) {
setenv("HOME", home, 1); setenv("HOME", home, 1);
if (chdir(home)) { if (chdir(home)) {