openssh.patch 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. Index: version.h
  2. --- version.h.orig 2003-09-23 11:26:51.000000000 +0200
  3. +++ version.h 2003-09-27 12:30:35.000000000 +0200
  4. @@ -1,3 +1,3 @@
  5. /* $OpenBSD: version.h,v 1.39 2003/09/16 21:02:40 markus Exp $ */
  6. -#define SSH_VERSION "OpenSSH_3.7.1p2"
  7. +#define SSH_VERSION "OpenSSH_3.7.1p2 @l_openpkg_release@"
  8. Index: session.c
  9. --- session.c.orig 2003-09-23 10:59:08.000000000 +0200
  10. +++ session.c 2003-09-27 12:29:28.000000000 +0200
  11. @@ -1268,6 +1268,26 @@
  12. exit(1);
  13. }
  14. endgrent();
  15. +# ifdef USE_CHROOT
  16. + {
  17. + char *user_dir;
  18. + char *new_root;
  19. + user_dir = xstrdup(pw->pw_dir);
  20. + new_root = user_dir + 1;
  21. + while ((new_root = strchr(new_root, '.')) != NULL) {
  22. + new_root--;
  23. + if (strncmp(new_root, "/./", 3) == 0) {
  24. + *new_root = '\0';
  25. + new_root += 2;
  26. + if (chroot(user_dir) == -1)
  27. + fatal("Couldn't chroot to user directory \"%s\"", user_dir);
  28. + pw->pw_dir = new_root;
  29. + break;
  30. + }
  31. + new_root += 2;
  32. + }
  33. + }
  34. +# endif /* USE_CHROOT */
  35. # ifdef USE_PAM
  36. /*
  37. * PAM credentials may take the form of supplementary groups.
  38. Index: sftp-server.c
  39. --- sftp-server.c.orig 2003-08-22 01:34:41.000000000 +0200
  40. +++ sftp-server.c 2003-12-23 22:02:33.000000000 +0100
  41. @@ -1037,6 +1037,38 @@
  42. log_init("sftp-server", SYSLOG_LEVEL_DEBUG1, SYSLOG_FACILITY_AUTH, 0);
  43. #endif
  44. +#ifdef USE_CHROOT
  45. +{
  46. + char *user_dir;
  47. + char *new_root;
  48. + user_dir = getenv("HOME");
  49. + if (user_dir == NULL)
  50. + fatal("HOME variable not found in environment");
  51. + new_root = user_dir + 1;
  52. + while ((new_root = strchr(new_root, '.')) != NULL) {
  53. + new_root--;
  54. + if (strncmp(new_root, "/./", 3) == 0) {
  55. + *new_root = '\0';
  56. + new_root += 2;
  57. + if (geteuid() == 0) {
  58. + /* chroot to subdir and adjust HOME for remaining path */
  59. + if (chroot(user_dir) == -1)
  60. + fatal("Couldn't chroot to user directory \"%s\": %s", user_dir, strerror(errno));
  61. + if (setuid(getuid()) == -1)
  62. + fatal("Couldn't drop privileges: %s", strerror(errno));
  63. + setenv("HOME", new_root, 1);
  64. + }
  65. + else {
  66. + /* ignore chroot request and adjust HOME for preceeding path */
  67. + setenv("HOME", user_dir, 1);
  68. + }
  69. + break;
  70. + }
  71. + new_root += 2;
  72. + }
  73. +}
  74. +#endif /* USE_CHROOT */
  75. +
  76. in = dup(STDIN_FILENO);
  77. out = dup(STDOUT_FILENO);
  78. Index: auth-pam.h
  79. --- auth-pam.h.orig 2003-09-02 15:18:53.000000000 +0200
  80. +++ auth-pam.h 2003-09-27 12:29:28.000000000 +0200
  81. @@ -28,7 +28,7 @@
  82. #ifdef USE_PAM
  83. #if !defined(SSHD_PAM_SERVICE)
  84. -# define SSHD_PAM_SERVICE __progname
  85. +# define SSHD_PAM_SERVICE "openssh"
  86. #endif
  87. void start_pam(const char *);
  88. Index: Makefile.in
  89. --- Makefile.in.orig 2003-09-22 03:00:12.000000000 +0200
  90. +++ Makefile.in 2003-09-27 12:29:28.000000000 +0200
  91. @@ -224,7 +224,7 @@
  92. $(AUTORECONF)
  93. (cd scard && $(MAKE) -f Makefile.in distprep)
  94. -install: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS) install-files host-key check-config
  95. +install: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS) install-files host-key
  96. install-nokeys: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS) install-files
  97. check-config:
  98. Index: configure
  99. --- configure.orig 2003-12-03 18:30:30.000000000 +0100
  100. +++ configure 2003-12-03 18:29:05.000000000 +0100
  101. @@ -6452,92 +6452,6 @@
  102. fi;
  103. -# Check whether user wants TCP wrappers support
  104. -TCPW_MSG="no"
  105. -
  106. -# Check whether --with-tcp-wrappers or --without-tcp-wrappers was given.
  107. -if test "${with_tcp_wrappers+set}" = set; then
  108. - withval="$with_tcp_wrappers"
  109. -
  110. - if test "x$withval" != "xno" ; then
  111. - saved_LIBS="$LIBS"
  112. - saved_LDFLAGS="$LDFLAGS"
  113. - saved_CPPFLAGS="$CPPFLAGS"
  114. - if test -n "${withval}" -a "${withval}" != "yes"; then
  115. - if test -d "${withval}/lib"; then
  116. - if test -n "${need_dash_r}"; then
  117. - LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
  118. - else
  119. - LDFLAGS="-L${withval}/lib ${LDFLAGS}"
  120. - fi
  121. - else
  122. - if test -n "${need_dash_r}"; then
  123. - LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
  124. - else
  125. - LDFLAGS="-L${withval} ${LDFLAGS}"
  126. - fi
  127. - fi
  128. - if test -d "${withval}/include"; then
  129. - CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
  130. - else
  131. - CPPFLAGS="-I${withval} ${CPPFLAGS}"
  132. - fi
  133. - fi
  134. - LIBWRAP="-lwrap"
  135. - LIBS="$LIBWRAP $LIBS"
  136. - echo "$as_me:6488: checking for libwrap" >&5
  137. -echo $ECHO_N "checking for libwrap... $ECHO_C" >&6
  138. - cat >conftest.$ac_ext <<_ACEOF
  139. -#line 6491 "configure"
  140. -#include "confdefs.h"
  141. -
  142. -#include <tcpd.h>
  143. - int deny_severity = 0, allow_severity = 0;
  144. -
  145. -int
  146. -main ()
  147. -{
  148. -hosts_access(0);
  149. - ;
  150. - return 0;
  151. -}
  152. -_ACEOF
  153. -rm -f conftest.$ac_objext conftest$ac_exeext
  154. -if { (eval echo "$as_me:6506: \"$ac_link\"") >&5
  155. - (eval $ac_link) 2>&5
  156. - ac_status=$?
  157. - echo "$as_me:6509: \$? = $ac_status" >&5
  158. - (exit $ac_status); } &&
  159. - { ac_try='test -s conftest$ac_exeext'
  160. - { (eval echo "$as_me:6512: \"$ac_try\"") >&5
  161. - (eval $ac_try) 2>&5
  162. - ac_status=$?
  163. - echo "$as_me:6515: \$? = $ac_status" >&5
  164. - (exit $ac_status); }; }; then
  165. -
  166. - echo "$as_me:6518: result: yes" >&5
  167. -echo "${ECHO_T}yes" >&6
  168. - cat >>confdefs.h <<\EOF
  169. -#define LIBWRAP 1
  170. -EOF
  171. -
  172. - TCPW_MSG="yes"
  173. -
  174. -else
  175. - echo "$as_me: failed program was:" >&5
  176. -cat conftest.$ac_ext >&5
  177. -
  178. - { { echo "$as_me:6530: error: *** libwrap missing" >&5
  179. -echo "$as_me: error: *** libwrap missing" >&2;}
  180. - { (exit 1); exit 1; }; }
  181. -
  182. -fi
  183. -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  184. - LIBS="$saved_LIBS"
  185. - fi
  186. -
  187. -fi;
  188. -
  189. for ac_func in \
  190. arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
  191. bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
  192. @@ -15674,6 +15588,96 @@
  193. fi;
  194. +#---------------------------------------------------
  195. +
  196. +# Check whether user wants TCP wrappers support
  197. +TCPW_MSG="no"
  198. +
  199. +# Check whether --with-tcp-wrappers or --without-tcp-wrappers was given.
  200. +if test "${with_tcp_wrappers+set}" = set; then
  201. + withval="$with_tcp_wrappers"
  202. +
  203. + if test "x$withval" != "xno" ; then
  204. + saved_LIBS="$LIBS"
  205. + saved_LDFLAGS="$LDFLAGS"
  206. + saved_CPPFLAGS="$CPPFLAGS"
  207. + if test -n "${withval}" -a "${withval}" != "yes"; then
  208. + if test -d "${withval}/lib"; then
  209. + if test -n "${need_dash_r}"; then
  210. + LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
  211. + else
  212. + LDFLAGS="-L${withval}/lib ${LDFLAGS}"
  213. + fi
  214. + else
  215. + if test -n "${need_dash_r}"; then
  216. + LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
  217. + else
  218. + LDFLAGS="-L${withval} ${LDFLAGS}"
  219. + fi
  220. + fi
  221. + if test -d "${withval}/include"; then
  222. + CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
  223. + else
  224. + CPPFLAGS="-I${withval} ${CPPFLAGS}"
  225. + fi
  226. + fi
  227. + LIBWRAP="-lwrap"
  228. + LIBS="$LIBWRAP $LIBS"
  229. + echo "$as_me:6488: checking for libwrap" >&5
  230. +echo $ECHO_N "checking for libwrap... $ECHO_C" >&6
  231. + cat >conftest.$ac_ext <<_ACEOF
  232. +#line 6491 "configure"
  233. +#include "confdefs.h"
  234. +
  235. +#include <tcpd.h>
  236. + int deny_severity = 0, allow_severity = 0;
  237. +
  238. +int
  239. +main ()
  240. +{
  241. +hosts_access(0);
  242. + ;
  243. + return 0;
  244. +}
  245. +_ACEOF
  246. +rm -f conftest.$ac_objext conftest$ac_exeext
  247. +if { (eval echo "$as_me:6506: \"$ac_link\"") >&5
  248. + (eval $ac_link) 2>&5
  249. + ac_status=$?
  250. + echo "$as_me:6509: \$? = $ac_status" >&5
  251. + (exit $ac_status); } &&
  252. + { ac_try='test -s conftest$ac_exeext'
  253. + { (eval echo "$as_me:6512: \"$ac_try\"") >&5
  254. + (eval $ac_try) 2>&5
  255. + ac_status=$?
  256. + echo "$as_me:6515: \$? = $ac_status" >&5
  257. + (exit $ac_status); }; }; then
  258. +
  259. + echo "$as_me:6518: result: yes" >&5
  260. +echo "${ECHO_T}yes" >&6
  261. + cat >>confdefs.h <<\EOF
  262. +#define LIBWRAP 1
  263. +EOF
  264. +
  265. + TCPW_MSG="yes"
  266. +
  267. +else
  268. + echo "$as_me: failed program was:" >&5
  269. +cat conftest.$ac_ext >&5
  270. +
  271. + { { echo "$as_me:6530: error: *** libwrap missing" >&5
  272. +echo "$as_me: error: *** libwrap missing" >&2;}
  273. + { (exit 1); exit 1; }; }
  274. +
  275. +fi
  276. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  277. + LIBS="$saved_LIBS"
  278. + fi
  279. +
  280. +fi;
  281. +
  282. +#---------------------------------------------------
  283. +
  284. echo "$as_me:15677: checking if we need to convert IPv4 in IPv6-mapped addresses" >&5
  285. echo $ECHO_N "checking if we need to convert IPv4 in IPv6-mapped addresses... $ECHO_C" >&6
  286. IPV4_IN6_HACK_MSG="no"