diff options
author | Florian Smeets <flo@FreeBSD.org> | 2011-10-21 16:18:56 +0000 |
---|---|---|
committer | Florian Smeets <flo@FreeBSD.org> | 2011-10-21 16:18:56 +0000 |
commit | 9b3fe7c2f48a356eaf0e7273e66023d4ae597cfd (patch) | |
tree | 36a2e3b758da540f13f821ec14f92b80c0adb4ca /security/openssh-portable/files/patch-session.c | |
parent | Fix build with gcc 4.6 (diff) |
- update to 5.8p2 [1]
- fix Kerberos knob [2]
- fix build on 9.0 [3]
- fix deinstall with various knobs [4]
- fix LPK knob [5]
PR: ports/161818 [1], ports/144597 [2], ports/160389 [3]
ports/150493, ports/156926 [4], ports/155456 [5]
Submitted by: "Grzegorz Blach" <magik@roorback.net> [1], [2], [4], [5]
pluknet [3]
Reported by: Jonathan <lordsith49@hotmail.com> [2]
Kevin Thompson <antiduh@csh.rit.edu> [4]
Alexey Remizov <alexey@remizov.org> [5]
Notes
Notes:
svn path=/head/; revision=284070
Diffstat (limited to 'security/openssh-portable/files/patch-session.c')
-rw-r--r-- | security/openssh-portable/files/patch-session.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/security/openssh-portable/files/patch-session.c b/security/openssh-portable/files/patch-session.c index 6717dcd35104..4c7d773de54c 100644 --- a/security/openssh-portable/files/patch-session.c +++ b/security/openssh-portable/files/patch-session.c @@ -1,6 +1,6 @@ ---- session.c.orig 2008-11-07 09:06:00.463747629 +0800 -+++ session.c 2008-11-07 23:35:15.063890103 +0800 -@@ -884,6 +884,24 @@ +--- session.c.orig 2011-07-21 18:55:33.883559116 +0200 ++++ session.c 2011-07-21 19:02:17.789294035 +0200 +@@ -896,6 +896,24 @@ { FILE *f; char buf[256]; @@ -25,9 +25,9 @@ if (options.print_motd) { #ifdef HAVE_LOGIN_CAP -@@ -1113,6 +1131,9 @@ +@@ -1125,6 +1143,9 @@ struct passwd *pw = s->pw; - #ifndef HAVE_LOGIN_CAP + #if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN) char *path = NULL; +#else + extern char **environ; @@ -35,7 +35,7 @@ #endif /* Initialize the environment. */ -@@ -1134,6 +1155,9 @@ +@@ -1146,6 +1167,9 @@ } #endif @@ -45,7 +45,7 @@ #ifdef GSSAPI /* Allow any GSSAPI methods that we've used to alter * the childs environment as they see fit -@@ -1153,11 +1177,22 @@ +@@ -1165,11 +1189,22 @@ child_set_env(&env, &envsize, "LOGIN", pw->pw_name); #endif child_set_env(&env, &envsize, "HOME", pw->pw_dir); @@ -72,7 +72,7 @@ #else /* HAVE_LOGIN_CAP */ # ifndef HAVE_CYGWIN /* -@@ -1178,15 +1213,9 @@ +@@ -1190,15 +1225,9 @@ # endif /* HAVE_CYGWIN */ #endif /* HAVE_LOGIN_CAP */ @@ -88,7 +88,7 @@ /* Set custom environment options from RSA authentication. */ if (!options.use_login) { -@@ -1452,6 +1481,9 @@ +@@ -1470,14 +1499,35 @@ void do_setusercontext(struct passwd *pw) { @@ -97,35 +97,35 @@ +#endif /* CHROOT */ char *chroot_path, *tmp; - #ifdef WITH_SELINUX -@@ -1477,8 +1509,25 @@ - do_pam_setcred(use_privsep); - } - # endif /* USE_PAM */ -+#ifdef CHROOT -+ user_dir = xstrdup(pw->pw_dir); -+ new_root = user_dir + 1; -+ -+ while((new_root = strchr(new_root, '.')) != NULL) { -+ new_root--; -+ if(strncmp(new_root, "/./", 3) == 0) { -+ *new_root = '\0'; -+ new_root += 2; -+ if(chroot(user_dir) != 0) -+ fatal("Couldn't chroot to user directory %s. %s", user_dir, strerror(errno)); -+ pw->pw_dir = new_root; -+ break; -+ } ++ #ifdef CHROOT ++ user_dir = xstrdup(pw->pw_dir); ++ new_root = user_dir + 1; ++ ++ while((new_root = strchr(new_root, '.')) != NULL) { ++ new_root--; ++ if(strncmp(new_root, "/./", 3) == 0) { ++ *new_root = '\0'; + new_root += 2; -+ } -+#endif /* CHROOT */ ++ if(chroot(user_dir) != 0) ++ fatal("Couldn't chroot to user directory %s. %s", user_dir, strerror(errno)); ++ pw->pw_dir = new_root; ++ break; ++ } ++ new_root += 2; ++ } ++ #endif /* CHROOT */ ++ + platform_setusercontext(pw); + + if (platform_privileged_uidswap()) { + #ifdef HAVE_LOGIN_CAP if (setusercontext(lc, pw, pw->pw_uid, - (LOGIN_SETALL & ~(LOGIN_SETPATH|LOGIN_SETUSER))) < 0) { -+ (LOGIN_SETALL & ~(LOGIN_SETPATH|LOGIN_SETUSER|LOGIN_SETENV))) < 0) { ++ (LOGIN_SETALL & ~(LOGIN_SETPATH|LOGIN_SETUSER|LOGIN_SETENV))) < 0) { perror("unable to set user context"); exit(1); } -@@ -1736,6 +1785,10 @@ +@@ -1700,6 +1750,10 @@ */ environ = env; @@ -136,13 +136,13 @@ #if defined(KRB5) && defined(USE_AFS) /* * At this point, we check to see if AFS is active and if we have -@@ -1765,9 +1818,6 @@ +@@ -1729,9 +1783,6 @@ /* Change current directory to the user's home directory. */ if (chdir(pw->pw_dir) < 0) { /* Suppress missing homedir warning for chroot case */ -#ifdef HAVE_LOGIN_CAP - r = login_getcapbool(lc, "requirehome", 0); -#endif - if (r || options.chroot_directory == NULL) + if (r || options.chroot_directory == NULL || + strcasecmp(options.chroot_directory, "none") == 0) fprintf(stderr, "Could not chdir to home " - "directory %s: %s\n", pw->pw_dir, |