PageRenderTime 28ms CodeModel.GetById 8ms RepoModel.GetById 7ms app.codeStats 0ms

/external/bsd/blacklist/diff/ssh.diff

http://www.minix3.org/
diff | 177 lines | 166 code | 11 blank | 0 comment | 0 complexity | 70ffb5493dfda764be43648896f0503e MD5 | raw file
Possible License(s): MIT, WTFPL, AGPL-1.0, BSD-3-Clause, GPL-3.0, LGPL-2.0, JSON, 0BSD
  1. --- /dev/null 2015-01-22 23:10:33.000000000 -0500
  2. +++ dist/pfilter.c 2015-01-22 23:46:03.000000000 -0500
  3. @@ -0,0 +1,27 @@
  4. +#include "namespace.h"
  5. +#include "ssh.h"
  6. +#include "packet.h"
  7. +#include "log.h"
  8. +#include "pfilter.h"
  9. +#include <blacklist.h>
  10. +
  11. +static struct blacklist *blstate;
  12. +
  13. +void
  14. +pfilter_init(void)
  15. +{
  16. + blstate = blacklist_open();
  17. +}
  18. +
  19. +void
  20. +pfilter_notify(int a)
  21. +{
  22. + int fd;
  23. + if (blstate == NULL)
  24. + pfilter_init();
  25. + if (blstate == NULL)
  26. + return;
  27. + // XXX: 3?
  28. + fd = packet_connection_is_on_socket() ? packet_get_connection_in() : 3;
  29. + (void)blacklist_r(blstate, a, fd, "ssh");
  30. +}
  31. --- /dev/null 2015-01-20 21:14:44.000000000 -0500
  32. +++ dist/pfilter.h 2015-01-20 20:16:20.000000000 -0500
  33. @@ -0,0 +1,3 @@
  34. +
  35. +void pfilter_notify(int);
  36. +void pfilter_init(void);
  37. Index: bin/sshd/Makefile
  38. ===================================================================
  39. RCS file: /cvsroot/src/crypto/external/bsd/openssh/bin/sshd/Makefile,v
  40. retrieving revision 1.10
  41. diff -u -u -r1.10 Makefile
  42. --- bin/sshd/Makefile 19 Oct 2014 16:30:58 -0000 1.10
  43. +++ bin/sshd/Makefile 22 Jan 2015 21:39:21 -0000
  44. @@ -15,7 +15,7 @@
  45. auth2-none.c auth2-passwd.c auth2-pubkey.c \
  46. monitor_mm.c monitor.c monitor_wrap.c \
  47. kexdhs.c kexgexs.c kexecdhs.c sftp-server.c sftp-common.c \
  48. - roaming_common.c roaming_serv.c sandbox-rlimit.c
  49. + roaming_common.c roaming_serv.c sandbox-rlimit.c pfilter.c
  50. COPTS.auth-options.c= -Wno-pointer-sign
  51. COPTS.ldapauth.c= -Wno-format-nonliteral # XXX: should fix
  52. @@ -68,3 +68,6 @@
  53. LDADD+= -lwrap
  54. DPADD+= ${LIBWRAP}
  55. +
  56. +LDADD+= -lblacklist
  57. +DPADD+= ${LIBBLACKLIST}
  58. Index: dist/auth.c
  59. ===================================================================
  60. RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth.c,v
  61. retrieving revision 1.10
  62. diff -u -u -r1.10 auth.c
  63. --- dist/auth.c 19 Oct 2014 16:30:58 -0000 1.10
  64. +++ dist/auth.c 22 Jan 2015 21:39:22 -0000
  65. @@ -62,6 +62,7 @@
  66. #include "monitor_wrap.h"
  67. #include "krl.h"
  68. #include "compat.h"
  69. +#include "pfilter.h"
  70. #ifdef HAVE_LOGIN_CAP
  71. #include <login_cap.h>
  72. @@ -362,6 +363,8 @@
  73. compat20 ? "ssh2" : "ssh1",
  74. authctxt->info != NULL ? ": " : "",
  75. authctxt->info != NULL ? authctxt->info : "");
  76. + if (!authctxt->postponed)
  77. + pfilter_notify(!authenticated);
  78. free(authctxt->info);
  79. authctxt->info = NULL;
  80. }
  81. Index: dist/sshd.c
  82. ===================================================================
  83. RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/sshd.c,v
  84. retrieving revision 1.15
  85. diff -u -u -r1.15 sshd.c
  86. --- dist/sshd.c 28 Oct 2014 21:36:16 -0000 1.15
  87. +++ dist/sshd.c 22 Jan 2015 21:39:22 -0000
  88. @@ -109,6 +109,7 @@
  89. #include "roaming.h"
  90. #include "ssh-sandbox.h"
  91. #include "version.h"
  92. +#include "pfilter.h"
  93. #ifdef LIBWRAP
  94. #include <tcpd.h>
  95. @@ -364,6 +365,7 @@
  96. killpg(0, SIGTERM);
  97. }
  98. + pfilter_notify(1);
  99. /* Log error and exit. */
  100. sigdie("Timeout before authentication for %s", get_remote_ipaddr());
  101. }
  102. @@ -1160,6 +1162,7 @@
  103. for (i = 0; i < options.max_startups; i++)
  104. startup_pipes[i] = -1;
  105. + pfilter_init();
  106. /*
  107. * Stay listening for connections until the system crashes or
  108. * the daemon is killed with a signal.
  109. Index: auth1.c
  110. ===================================================================
  111. RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth1.c,v
  112. retrieving revision 1.9
  113. diff -u -u -r1.9 auth1.c
  114. --- auth1.c 19 Oct 2014 16:30:58 -0000 1.9
  115. +++ auth1.c 14 Feb 2015 15:40:51 -0000
  116. @@ -41,6 +41,7 @@
  117. #endif
  118. #include "monitor_wrap.h"
  119. #include "buffer.h"
  120. +#include "pfilter.h"
  121. /* import */
  122. extern ServerOptions options;
  123. @@ -445,6 +446,7 @@
  124. else {
  125. debug("do_authentication: invalid user %s", user);
  126. authctxt->pw = fakepw();
  127. + pfilter_notify(1);
  128. }
  129. /* Configuration may have changed as a result of Match */
  130. Index: auth2.c
  131. ===================================================================
  132. RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth2.c,v
  133. retrieving revision 1.9
  134. diff -u -u -r1.9 auth2.c
  135. --- auth2.c 19 Oct 2014 16:30:58 -0000 1.9
  136. +++ auth2.c 14 Feb 2015 15:40:51 -0000
  137. @@ -52,6 +52,7 @@
  138. #include "pathnames.h"
  139. #include "buffer.h"
  140. #include "canohost.h"
  141. +#include "pfilter.h"
  142. #ifdef GSSAPI
  143. #include "ssh-gss.h"
  144. @@ -256,6 +257,7 @@
  145. } else {
  146. logit("input_userauth_request: invalid user %s", user);
  147. authctxt->pw = fakepw();
  148. + pfilter_notify(1);
  149. }
  150. #ifdef USE_PAM
  151. if (options.use_pam)
  152. Index: sshd.c
  153. ===================================================================
  154. RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/sshd.c,v
  155. retrieving revision 1.16
  156. diff -u -r1.16 sshd.c
  157. --- sshd.c 25 Jan 2015 15:52:44 -0000 1.16
  158. +++ sshd.c 14 Feb 2015 09:55:06 -0000
  159. @@ -628,6 +628,8 @@
  160. explicit_bzero(pw->pw_passwd, strlen(pw->pw_passwd));
  161. endpwent();
  162. + pfilter_init();
  163. +
  164. /* Change our root directory */
  165. if (chroot(_PATH_PRIVSEP_CHROOT_DIR) == -1)
  166. fatal("chroot(\"%s\"): %s", _PATH_PRIVSEP_CHROOT_DIR,