You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.0 KiB

  1. From 5ae2a70a135062a025d8fabc104eeae3a2c53a7a Mon Sep 17 00:00:00 2001
  2. From: Arran Cudbard-Bell <a.cudbardb@freeradius.org>
  3. Date: Tue, 17 Jun 2014 10:09:24 +0100
  4. Subject: [PATCH] Relax libssl checks
  5. ---
  6. src/main/version.c | 35 ++++++++++++++++++++++++++++-------
  7. 1 file changed, 28 insertions(+), 7 deletions(-)
  8. --- a/src/main/version.c
  9. +++ b/src/main/version.c
  10. @@ -34,7 +34,12 @@ RCSID("$Id: af82d4126a65d94929c22f44da2b
  11. static long ssl_built = OPENSSL_VERSION_NUMBER;
  12. -/** Check build and linked versions of OpenSSL match
  13. +/** Check built and linked versions of OpenSSL match
  14. + *
  15. + * OpenSSL version number consists of:
  16. + * MMNNFFPPS: major minor fix patch status
  17. + *
  18. + * Where status >= 0 && < 10 means beta, and status 10 means release.
  19. *
  20. * Startup check for whether the linked version of OpenSSL matches the
  21. * version the server was built against.
  22. @@ -54,14 +59,30 @@ int ssl_check_version(int allow_vulnerab
  23. ssl_linked = SSLeay();
  24. - if (ssl_linked != ssl_built) {
  25. - radlog(L_ERR, "libssl version mismatch."
  26. - " Built with: %lx\n Linked: %lx",
  27. - (unsigned long) ssl_built,
  28. - (unsigned long) ssl_linked);
  29. + /*
  30. + * Status mismatch always triggers error.
  31. + */
  32. + if ((ssl_linked & 0x00000000f) != (ssl_built & 0x00000000f)) {
  33. + mismatch:
  34. + radlog(L_ERR, "libssl version mismatch. built: %lx linked: %lx",
  35. + (unsigned long) ssl_built, (unsigned long) ssl_linked);
  36. return -1;
  37. - };
  38. + }
  39. +
  40. + /*
  41. + * Use the OpenSSH approach and relax fix checks after version
  42. + * 1.0.0 and only allow moving backwards within a patch
  43. + * series.
  44. + */
  45. + if (ssl_built & 0xff) {
  46. + if ((ssl_built & 0xffff) != (ssl_linked & 0xffff) ||
  47. + (ssl_built & 0x0000ff) > (ssl_linked & 0x0000ff)) goto mismatch;
  48. + /*
  49. + * Before 1.0.0 we require the same major minor and fix version
  50. + * and ignore the patch number.
  51. + */
  52. + } else if ((ssl_built & 0xffffff) != (ssl_linked & 0xffffff)) goto mismatch;
  53. if (!allow_vulnerable) {
  54. /* Check for bad versions */