1 $NetBSD: patch-ao,v 1.16 2010/06/11 20:41:42 martti Exp $
3 One more replacing 0 with ROOTUID is handled by using SUBST framework
4 because patch can't handle it when hpn-patch option is enabled.
5 So, don't simply update this file with mkpatch command.
7 --- session.c.orig 2011-02-16 01:25:58.000000000 +0000
9 @@ -1075,7 +1075,7 @@ read_etc_default_login(char ***env, u_in
15 var = child_get_env(tmpenv, "SUPATH");
17 var = child_get_env(tmpenv, "PATH");
18 @@ -1184,7 +1184,7 @@ do_setup_env(Session *s, const char *she
19 # endif /* HAVE_ETC_DEFAULT_LOGIN */
20 if (path == NULL || *path == '\0') {
21 child_set_env(&env, &envsize, "PATH",
22 - s->pw->pw_uid == 0 ?
23 + s->pw->pw_uid == ROOTUID ?
24 SUPERUSER_PATH : _PATH_STDPATH);
26 # endif /* HAVE_CYGWIN */
27 @@ -1298,6 +1298,18 @@ do_setup_env(Session *s, const char *she
28 strcmp(pw->pw_dir, "/") ? pw->pw_dir : "");
29 read_environment_file(&env, &envsize, buf);
34 + /* copy standard Windows environment, then apply changes */
35 + env_t *winenv = env_login(pw);
36 + env_putarray(winenv, env, ENV_OVERRIDE);
38 + /* swap over to altered environment as a traditional array */
39 + env = env_array(winenv);
44 /* dump the environment */
45 fprintf(stderr, "Environment:\n");
46 @@ -1488,11 +1500,13 @@ do_setusercontext(struct passwd *pw)
50 +# if !defined(HAVE_INTERIX)
51 /* Initialize the group list. */
52 if (initgroups(pw->pw_name, pw->pw_gid) < 0) {
56 +# endif /* !HAVE_INTERIX */
60 @@ -2305,7 +2319,7 @@ session_pty_cleanup2(Session *s)
61 record_logout(s->pid, s->tty, s->pw->pw_name);
63 /* Release the pseudo-tty. */
65 + if (getuid() == ROOTUID)