openssh.patch 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. Index: Makefile.in
  2. --- Makefile.in.orig 2004-02-18 04:35:11.000000000 +0100
  3. +++ Makefile.in 2004-02-24 20:25:23.000000000 +0100
  4. @@ -226,7 +226,7 @@
  5. -rm -rf autom4te.cache
  6. (cd scard && $(MAKE) -f Makefile.in distprep)
  7. -install: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS) install-files host-key check-config
  8. +install: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS) install-files host-key
  9. install-nokeys: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS) install-files
  10. check-config:
  11. Index: auth-pam.h
  12. --- auth-pam.h.orig 2004-02-10 03:23:29.000000000 +0100
  13. +++ auth-pam.h 2004-02-24 20:25:23.000000000 +0100
  14. @@ -28,7 +28,7 @@
  15. #ifdef USE_PAM
  16. #if !defined(SSHD_PAM_SERVICE)
  17. -# define SSHD_PAM_SERVICE __progname
  18. +# define SSHD_PAM_SERVICE "openssh"
  19. #endif
  20. void start_pam(const char *);
  21. Index: session.c
  22. --- session.c.orig 2004-02-23 14:01:27.000000000 +0100
  23. +++ session.c 2004-02-24 20:25:23.000000000 +0100
  24. @@ -1270,6 +1270,26 @@
  25. exit(1);
  26. }
  27. endgrent();
  28. +# ifdef USE_CHROOT
  29. + {
  30. + char *user_dir;
  31. + char *new_root;
  32. + user_dir = xstrdup(pw->pw_dir);
  33. + new_root = user_dir + 1;
  34. + while ((new_root = strchr(new_root, '.')) != NULL) {
  35. + new_root--;
  36. + if (strncmp(new_root, "/./", 3) == 0) {
  37. + *new_root = '\0';
  38. + new_root += 2;
  39. + if (chroot(user_dir) == -1)
  40. + fatal("Couldn't chroot to user directory \"%s\"", user_dir);
  41. + pw->pw_dir = new_root;
  42. + break;
  43. + }
  44. + new_root += 2;
  45. + }
  46. + }
  47. +# endif /* USE_CHROOT */
  48. # ifdef USE_PAM
  49. /*
  50. * PAM credentials may take the form of supplementary groups.
  51. Index: sftp-server.c
  52. --- sftp-server.c.orig 2004-02-23 23:19:15.000000000 +0100
  53. +++ sftp-server.c 2004-02-24 20:25:23.000000000 +0100
  54. @@ -1029,6 +1029,38 @@
  55. log_init("sftp-server", SYSLOG_LEVEL_DEBUG1, SYSLOG_FACILITY_AUTH, 0);
  56. #endif
  57. +#ifdef USE_CHROOT
  58. +{
  59. + char *user_dir;
  60. + char *new_root;
  61. + user_dir = getenv("HOME");
  62. + if (user_dir == NULL)
  63. + fatal("HOME variable not found in environment");
  64. + new_root = user_dir + 1;
  65. + while ((new_root = strchr(new_root, '.')) != NULL) {
  66. + new_root--;
  67. + if (strncmp(new_root, "/./", 3) == 0) {
  68. + *new_root = '\0';
  69. + new_root += 2;
  70. + if (geteuid() == 0) {
  71. + /* chroot to subdir and adjust HOME for remaining path */
  72. + if (chroot(user_dir) == -1)
  73. + fatal("Couldn't chroot to user directory \"%s\": %s", user_dir, strerror(errno));
  74. + if (setuid(getuid()) == -1)
  75. + fatal("Couldn't drop privileges: %s", strerror(errno));
  76. + setenv("HOME", new_root, 1);
  77. + }
  78. + else {
  79. + /* ignore chroot request and adjust HOME for preceeding path */
  80. + setenv("HOME", user_dir, 1);
  81. + }
  82. + break;
  83. + }
  84. + new_root += 2;
  85. + }
  86. +}
  87. +#endif /* USE_CHROOT */
  88. +
  89. in = dup(STDIN_FILENO);
  90. out = dup(STDOUT_FILENO);
  91. Index: version.h
  92. --- version.h.orig 2004-02-23 23:24:02.000000000 +0100
  93. +++ version.h 2004-02-24 20:25:23.000000000 +0100
  94. @@ -1,3 +1,3 @@
  95. /* $OpenBSD: version.h,v 1.40 2004/02/23 15:16:46 markus Exp $ */
  96. -#define SSH_VERSION "OpenSSH_3.8p1"
  97. +#define SSH_VERSION "OpenSSH_3.8p1 @l_openpkg_release@"