diff options
author | Robert Nagy <robert@cvs.openbsd.org> | 2023-04-14 11:17:50 +0000 |
---|---|---|
committer | Robert Nagy <robert@cvs.openbsd.org> | 2023-04-14 11:17:50 +0000 |
commit | b10c8004b7bc2a5503c6de3af544010809a61014 (patch) | |
tree | 24f95861d2332d96e8462667c037484c10998c38 | |
parent | 814de40c51576252449bc3394f25d7ca2708f91e (diff) |
make xenodm reload the environment variables after setusercontext(3)
so that environment variables configured in login.conf(5) are also
available
ok matthieu@, millert@
-rw-r--r-- | app/xenodm/greeter/verify.c | 2 | ||||
-rw-r--r-- | app/xenodm/include/dm.h | 2 | ||||
-rw-r--r-- | app/xenodm/xenodm/session.c | 12 |
3 files changed, 11 insertions, 5 deletions
diff --git a/app/xenodm/greeter/verify.c b/app/xenodm/greeter/verify.c index 2b95cc3d2..99dcdea16 100644 --- a/app/xenodm/greeter/verify.c +++ b/app/xenodm/greeter/verify.c @@ -60,7 +60,7 @@ userEnv (struct display *d, int useSystemPath, char *user, char *home, char *she const char **envvar; const char *str; - env = defaultEnv (); + env = defaultEnv (NULL); env = setEnv (env, "DISPLAY", d->name); env = setEnv (env, "HOME", home); env = setEnv (env, "LOGNAME", user); /* POSIX, System V */ diff --git a/app/xenodm/include/dm.h b/app/xenodm/include/dm.h index 4c58deb2b..9fe413a93 100644 --- a/app/xenodm/include/dm.h +++ b/app/xenodm/include/dm.h @@ -222,7 +222,7 @@ extern void LoadSessionResources (struct display *d); extern void ReinitResources (void); /* in session.c */ -extern char **defaultEnv (void); +extern char **defaultEnv (char **e); extern char **systemEnv (struct display *d, char *user, char *home); extern int source (char **environ, char *file); extern void ClearCloseOnFork (int fd); diff --git a/app/xenodm/xenodm/session.c b/app/xenodm/xenodm/session.c index ae4732ffa..3d31c163b 100644 --- a/app/xenodm/xenodm/session.c +++ b/app/xenodm/xenodm/session.c @@ -339,6 +339,12 @@ StartClient ( name, _SysErrorMsg (errno)); return (0); } + /* + * setusercontext(3) will update the environment based on + * the login class so update our idea about the environment + * as well + */ + vinfo->userEnviron = defaultEnv (vinfo->userEnviron); } else { LogError ("getpwnam for \"%s\" failed: %s\n", name, _SysErrorMsg (errno)); @@ -452,11 +458,11 @@ execute (char **argv, char **environ) } char ** -defaultEnv (void) +defaultEnv (char **e) { char **env, **exp, *value; - env = NULL; + env = e; for (exp = exportList; exp && *exp; ++exp) { value = getenv (*exp); if (value) @@ -470,7 +476,7 @@ systemEnv (struct display *d, char *user, char *home) { char **env; - env = defaultEnv (); + env = defaultEnv (NULL); env = setEnv (env, "DISPLAY", d->name); if (home) env = setEnv (env, "HOME", home); |