initialize-libgcrypt.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From 4674d4632b9ffc6779d9c9f79b8ebb53c12e29b2 Mon Sep 17 00:00:00 2001
  2. From: Floris Bos <bos@je-eigen-domein.nl>
  3. Date: Fri, 2 Jan 2015 16:36:05 +0100
  4. Subject: [PATCH] Initialize libgcrypt before use
  5. https://www.gnupg.org/documentation/manuals/gcrypt/Initializing-the-library.html
  6. "Before the library can be used, it must initialize itself.
  7. This is achieved by invoking the function gcry_check_version"
  8. Closes issue #45
  9. Tested with krdc + libgcrypt 1.6.1 (libgcrypt20-dev Ubunutu package)
  10. connecting to a Mac Mini.
  11. Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
  12. ---
  13. libvncclient/rfbproto.c | 10 ++++++++++
  14. 1 file changed, 10 insertions(+)
  15. diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c
  16. index f653850..aa74c23 100644
  17. --- a/libvncclient/rfbproto.c
  18. +++ b/libvncclient/rfbproto.c
  19. @@ -857,6 +857,16 @@ HandleARDAuth(rfbClient *client)
  20. rfbCredential *cred = NULL;
  21. rfbBool result = FALSE;
  22. + if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P))
  23. + {
  24. + /* Application did not initialize gcrypt, so we should */
  25. + if (!gcry_check_version(GCRYPT_VERSION))
  26. + {
  27. + /* Older version of libgcrypt is installed on system than compiled against */
  28. + rfbClientLog("libgcrypt version mismatch.\n");
  29. + }
  30. + }
  31. +
  32. while (1)
  33. {
  34. if (!ReadFromRFBServer(client, (char *)gen, 2))