libcryptui-3.12.2-use-gcr.patch 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. From 728aceb6defd4e6e4f07fa49ca76f5e745230fee Mon Sep 17 00:00:00 2001
  2. From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
  3. Date: Fri, 16 Sep 2016 11:46:55 +0200
  4. Subject: [PATCH] daemon: port to gcr-3
  5. This removes the dependency on libgnome-keyring and adds a dependency
  6. on libgcr instead.
  7. Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
  8. Signed-off-by: Stef Walter <stefw@redhat.com>
  9. * Updated commit message
  10. https://bugzilla.gnome.org/show_bug.cgi?id=771522
  11. ---
  12. configure.ac | 14 +++++++-------
  13. daemon/seahorse-secure-buffer.c | 7 ++++---
  14. daemon/seahorse-secure-memory.c | 21 +++++++++++----------
  15. 3 files changed, 22 insertions(+), 20 deletions(-)
  16. diff --git a/configure.ac b/configure.ac
  17. index b621b236..4486e7b2 100644
  18. --- a/configure.ac
  19. +++ b/configure.ac
  20. @@ -252,18 +252,18 @@ if test "$enable_fatal_messages" = "yes" && test "$enable_debug" = "yes"; then
  21. fi
  22. dnl ****************************************************************************
  23. -dnl GNOME-KEYRING
  24. +dnl GCR
  25. dnl ****************************************************************************
  26. -PKG_CHECK_MODULES([GNOME_KEYRING], gnome-keyring-1 >= 2.25.5,
  27. - [enable_gnome_keyring=yes],[enable_gnome_keyring=no])
  28. +PKG_CHECK_MODULES([GCR], gcr-3,
  29. + [enable_gcr=yes],[enable_gcr=no])
  30. -if test "$enable_gnome_keyring" = "no"; then
  31. - AC_MSG_ERROR([gnome-keyring library or headers not found.])
  32. +if test "$enable_gcr" = "no"; then
  33. + AC_MSG_ERROR([gcr library or headers not found.])
  34. fi
  35. -SEAHORSE_CFLAGS="$SEAHORSE_CFLAGS $GNOME_KEYRING_CFLAGS"
  36. -SEAHORSE_LIBS="$SEAHORSE_LIBS $GNOME_KEYRING_LIBS"
  37. +SEAHORSE_CFLAGS="$SEAHORSE_CFLAGS $GCR_CFLAGS"
  38. +SEAHORSE_LIBS="$SEAHORSE_LIBS $GCR_LIBS"
  39. dnl ****************************************************************************
  40. dnl LIBCRYPTUI
  41. diff --git a/daemon/seahorse-secure-buffer.c b/daemon/seahorse-secure-buffer.c
  42. index 0db87961..63f87cd3 100644
  43. --- a/daemon/seahorse-secure-buffer.c
  44. +++ b/daemon/seahorse-secure-buffer.c
  45. @@ -20,7 +20,8 @@
  46. #include "config.h"
  47. #include "seahorse-secure-buffer.h"
  48. -#include <gnome-keyring-memory.h>
  49. +#define GCR_API_SUBJECT_TO_CHANGE 1
  50. +#include <gcr/gcr.h>
  51. #include <string.h>
  52. @@ -92,7 +93,7 @@ seahorse_secure_buffer_real_insert_text (GtkEntryBuffer *buffer, guint position,
  53. }
  54. }
  55. - pv->text = gnome_keyring_memory_realloc (pv->text, pv->text_size);
  56. + pv->text = gcr_secure_memory_realloc (pv->text, pv->text_size);
  57. }
  58. /* Actual text insertion */
  59. @@ -158,7 +159,7 @@ seahorse_secure_buffer_finalize (GObject *obj)
  60. SeahorseSecureBufferPrivate *pv = self->priv;
  61. if (pv->text) {
  62. - gnome_keyring_memory_free (pv->text);
  63. + gcr_secure_memory_free (pv->text);
  64. pv->text = NULL;
  65. pv->text_bytes = pv->text_size = 0;
  66. pv->text_chars = 0;
  67. diff --git a/daemon/seahorse-secure-memory.c b/daemon/seahorse-secure-memory.c
  68. index 3d94a674..f201d1df 100644
  69. --- a/daemon/seahorse-secure-memory.c
  70. +++ b/daemon/seahorse-secure-memory.c
  71. @@ -23,7 +23,8 @@
  72. #include <glib.h>
  73. -#include <gnome-keyring-memory.h>
  74. +#define GCR_API_SUBJECT_TO_CHANGE 1
  75. +#include <gcr/gcr.h>
  76. #include "seahorse-secure-memory.h"
  77. @@ -47,7 +48,7 @@ switch_malloc (gsize size)
  78. if (size == 0)
  79. return NULL;
  80. if (seahorse_use_secure_mem)
  81. - p = gnome_keyring_memory_try_alloc (size);
  82. + p = gcr_secure_memory_try_alloc (size);
  83. else
  84. p = malloc (size);
  85. return p;
  86. @@ -71,7 +72,7 @@ switch_calloc (gsize num, gsize size)
  87. if (size == 0 || num == 0)
  88. return NULL;
  89. if (seahorse_use_secure_mem)
  90. - p = gnome_keyring_memory_try_alloc (size * num);
  91. + p = gcr_secure_memory_try_alloc (size * num);
  92. else
  93. p = calloc (num, size);
  94. return p;
  95. @@ -99,11 +100,11 @@ switch_realloc (gpointer mem, gsize size)
  96. if (!mem) {
  97. if (seahorse_use_secure_mem)
  98. - p = gnome_keyring_memory_alloc (size);
  99. + p = gcr_secure_memory_alloc (size);
  100. else
  101. p = malloc (size);
  102. - } else if (gnome_keyring_memory_is_secure (mem))
  103. - p = gnome_keyring_memory_try_realloc (mem, size);
  104. + } else if (gcr_secure_memory_is_secure (mem))
  105. + p = gcr_secure_memory_try_realloc (mem, size);
  106. else
  107. p = realloc (mem, size);
  108. return p;
  109. @@ -120,8 +121,8 @@ static void
  110. switch_free (gpointer mem)
  111. {
  112. if (mem) {
  113. - if (gnome_keyring_memory_is_secure (mem))
  114. - gnome_keyring_memory_free (mem);
  115. + if (gcr_secure_memory_is_secure (mem))
  116. + gcr_secure_memory_free (mem);
  117. else
  118. free (mem);
  119. }
  120. @@ -138,9 +139,9 @@ seahorse_try_gk_secure_memory ()
  121. {
  122. gpointer p;
  123. - p = gnome_keyring_memory_try_alloc (10);
  124. + p = gcr_secure_memory_try_alloc (10);
  125. if (p != NULL) {
  126. - gnome_keyring_memory_free (p);
  127. + gcr_secure_memory_free (p);
  128. return TRUE;
  129. }
  130. --
  131. 2.21.0