+++ /dev/null
---- gcr-3.12.2-orig/configure.ac 2014-05-13 21:03:55.000000000 +0200
-+++ gcr-3.12.2/configure.ac 2014-09-06 11:46:03.751895300 +0200
-@@ -75,6 +75,16 @@
- AC_SUBST(GETTEXT_PACKAGE)
- AM_GLIB_GNU_GETTEXT
-
-+# --------------------------------------------------------------------
-+# Check for gio-unix
-+#
-+
-+if test "$os_unix" = "yes"; then
-+ GIO_PACKAGE="gio-2.0 gio-unix-2.0"
-+else
-+ GIO_PACKAGE="gio-2.0"
-+fi
-+
- # -----------------------------------------------------------------------------
- # GLib and GTK+ stuff
-
-@@ -83,7 +93,7 @@
- gmodule-no-export-2.0
- gthread-2.0
- gobject-2.0
-- gio-2.0 gio-unix-2.0)
-+ $GIO_PACKAGE)
- GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=$GLIB_MIN"
- GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=$GLIB_MAX"
- AC_SUBST(GLIB_CFLAGS)
-@@ -140,7 +150,17 @@
- #
-
- AC_CHECK_FUNCS(timegm, AC_DEFINE(HAVE_TIMEGM,1,[Have timegm]))
--AC_CHECK_FUNCS(mlock)
-+AC_CHECK_FUNCS(memrchr, AC_DEFINE(HAVE_MEMRCHR,1,[Have memrchr]))
-+AC_CHECK_FUNCS(mlock, AC_DEFINE(HAVE_MLOCK,1,[Have mlock]))
-+
-+# --------------------------------------------------------------------
-+# Checks for headers
-+#
-+
-+AC_CHECK_HEADERS(err.h, AC_DEFINE(HAVE_ERR_H,1,[Have err.h]))
-+AC_CHECK_HEADERS(pwd.h, AC_DEFINE(HAVE_PWD_H,1,[Have pwd.h]))
-+AC_CHECK_HEADERS(syslog.h, AC_DEFINE(HAVE_SYSLOG_H,1,[Have syslog.h]))
-+AC_CHECK_HEADERS(sys/wait.h, AC_DEFINE(HAVE_SYS_WAIT_H,1,[Have wait.h]))
-
- # --------------------------------------------------------------------
- # p11-kit
---- gcr-3.12.2-orig/Makefile.am 2014-04-17 08:51:07.000000000 +0200
-+++ gcr-3.12.2/Makefile.am 2014-09-06 22:33:28.916978100 +0200
-@@ -164,6 +164,7 @@
- INTROSPECTION_GIRS =
- INTROSPECTION_SCANNER_ARGS = $(INTROSPECTION_FLAGS) --warn-all --add-include-path=.
- INTROSPECTION_COMPILER_ARGS = --includedir=.
-+INTROSPECTION_SCANNER_ENV = CC="$(CC)"
-
- girdir = $(datadir)/gir-1.0
- gir_DATA =
---- gcr-3.12.2-orig/egg/Makefile.am 2014-05-13 21:01:43.000000000 +0200
-+++ gcr-3.12.2/egg/Makefile.am 2014-09-06 12:50:02.014502900 +0200
-@@ -13,7 +13,8 @@
-
- libegg_la_LIBADD = \
- $(GLIB_LIBS) \
-- $(LIBGCRYPT_LIBS)
-+ $(LIBGCRYPT_LIBS) \
-+ -lmman
-
- libegg_la_SOURCES = \
- egg/egg-armor.c egg/egg-armor.h \
-@@ -72,7 +73,8 @@
- egg_LDADD = \
- libegg.la \
- $(LIBGCRYPT_LIBS) \
-- $(GLIB_LIBS)
-+ $(GLIB_LIBS) \
-+ -lmman
-
- egg_TESTS = \
- test-asn1 \
---- gcr-3.12.2-orig/egg/egg-armor.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/egg/egg-armor.c 2014-08-11 15:34:41.041658400 +0200
-@@ -59,6 +59,29 @@
- #define ARMOR_PREF_END "-----END "
- #define ARMOR_PREF_END_L 9
-
-+#ifndef HAVE_MEMRCHR
-+extern void* memrchr (const void *s, int c, size_t n);
-+
-+void*
-+memrchr (const void *s, int c, size_t n)
-+{
-+ if (n > 0) {
-+ const char* p = (const char*) s;
-+ const char* q = p + n;
-+
-+ while (1) {
-+ q--; if (q < p || q[0] == (char) c) break;
-+ q--; if (q < p || q[0] == (char) c) break;
-+ q--; if (q < p || q[0] == (char) c) break;
-+ q--; if (q < p || q[0] == (char) c) break;
-+ }
-+ if (q >= p)
-+ return (void*)q;
-+ }
-+ return NULL;
-+}
-+#endif
-+
- static void
- parse_header_lines (const gchar *hbeg,
- const gchar *hend,
---- gcr-3.12.2-orig/egg/egg-asn1x.c 2014-05-13 21:01:43.000000000 +0200
-+++ gcr-3.12.2/egg/egg-asn1x.c 2014-08-11 15:34:41.034658600 +0200
-@@ -1928,7 +1928,7 @@
- two_to_four_digit_year (int year)
- {
- time_t now;
-- struct tm tm;
-+ GDate *date;
- int century, current;
-
- g_return_val_if_fail (year >= 0 && year <= 99, -1);
-@@ -1936,11 +1936,15 @@
- /* Get the current year */
- now = time (NULL);
- g_return_val_if_fail (now >= 0, -1);
-- if (!gmtime_r (&now, &tm))
-+ date = g_date_new ();
-+ g_date_set_time_t (date, now);
-+ if (!g_date_valid (date))
- g_return_val_if_reached (-1);
-
-- current = (tm.tm_year % 100);
-- century = (tm.tm_year + 1900) - current;
-+ century = (g_date_get_year (date) / 100) * 100;
-+ current = g_date_get_year (date) - century;
-+
-+ g_date_free (date);
-
- /*
- * Check if it's within 40 years before the
---- gcr-3.12.2-orig/egg/egg-secure-memory.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/egg/egg-secure-memory.c 2014-09-06 11:11:19.489433700 +0200
-@@ -913,7 +913,7 @@
- DEBUG_ALLOC ("gkr-secure-memory: freed block ", sz);
-
- #else
-- ASSERT (FALSE);
-+ ASSERT (0);
- #endif
- }
-
---- gcr-3.12.2-orig/egg/test-asn1x.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/egg/test-asn1x.c 2014-08-11 15:34:41.047660400 +0200
-@@ -26,7 +26,9 @@
- #include "egg/egg-asn1-defs.h"
- #include "egg/egg-testing.h"
-
-+#ifdef HAVE_PWD_H
- #include <pwd.h>
-+#endif
- #include <stdlib.h>
- #include <unistd.h>
-
---- gcr-3.12.2-orig/gck/Makefile.am 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/gck/Makefile.am 2014-09-06 12:11:38.941793800 +0200
-@@ -71,7 +71,8 @@
- libegg-secmem.la \
- $(P11_KIT_LIBS) \
- $(GIO_LIBS) \
-- $(GLIB_LIBS)
-+ $(GLIB_LIBS) \
-+ -lmman
-
- noinst_LTLIBRARIES += libgck-testable.la
- libgck_testable_la_SOURCES = \
-@@ -193,7 +194,8 @@
- libegg-hex.la \
- $(GLIB_LIBS) \
- $(P11_KIT_LIBS) \
-- $(GIO_LIBS)
-+ $(GIO_LIBS) \
-+ -lmman
-
- gck_TESTS = \
- test-gck-attributes \
---- gcr-3.12.2-orig/gck/gck-attributes.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/gck/gck-attributes.c 2014-09-06 22:14:58.034848700 +0200
-@@ -44,7 +44,9 @@
- * this library will operate on such an attribute.
- */
-
-+#ifndef __MINGW64_VERSION_MAJOR
- G_STATIC_ASSERT (sizeof (GckAttribute) == sizeof (CK_ATTRIBUTE));
-+#endif
-
- #define STATE_LOCKED 1
- #define STATE_FLOATING 8
---- gcr-3.12.2-orig/gck/gck-debug.c 2014-03-02 09:05:22.000000000 +0100
-+++ gcr-3.12.2/gck/gck-debug.c 2014-08-11 15:34:41.096675100 +0200
-@@ -33,6 +33,11 @@
-
- #include <unistd.h>
-
-+#ifdef G_OS_WIN32
-+#define WINVER 0x0501
-+#include <windows.h>
-+#endif
-+
- #ifdef WITH_DEBUG
-
- static gsize initialized_flags = 0;
---- gcr-3.12.2-orig/gck/gck-slot.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/gck/gck-slot.c 2014-08-11 15:34:41.053657400 +0200
-@@ -605,7 +605,7 @@
- {
- GckTokenInfo *token_info;
- gchar *string;
-- struct tm tm;
-+ GTimeVal tv;
-
- token_info = g_new0 (GckTokenInfo, 1);
- token_info->label = gck_string_from_chars (info->label, sizeof (info->label));
-@@ -633,10 +633,12 @@
- /* Parse the time into seconds since epoch */
- if (info->flags & CKF_CLOCK_ON_TOKEN) {
- string = g_strndup ((gchar*)info->utcTime, MIN (14, sizeof (info->utcTime)));
-- if (!strptime (string, "%Y%m%d%H%M%S", &tm))
-+ /* Transform into an ISO-8601 string */
-+ string = g_strconcat (g_strndup (string,8), "T", g_strndup (string+8,6), "Z", NULL);
-+ if (!g_time_val_from_iso8601 (string, &tv))
- token_info->utc_time = -1;
- else
-- token_info->utc_time = timegm (&tm);
-+ token_info->utc_time = tv.tv_sec;
- g_free (string);
- } else {
- token_info->utc_time = -1;
-@@ -648,8 +650,8 @@
- void
- _gck_token_info_to_pkcs11 (GckTokenInfo *token_info, CK_TOKEN_INFO_PTR info)
- {
-- gchar buffer[64];
-- struct tm tm;
-+ gchar *buffer;
-+ GDateTime *datetime = NULL;
- time_t tim;
- gsize len;
-
-@@ -689,9 +691,12 @@
- /* Parse the time into seconds since epoch */
- if (token_info->flags & CKF_CLOCK_ON_TOKEN) {
- tim = token_info->utc_time;
-- if (!gmtime_r (&tim, &tm))
-+ datetime = g_date_time_new_from_unix_utc (tim);
-+ if (datetime == NULL)
- g_return_if_reached ();
-- len = strftime (buffer, sizeof (buffer), "%Y%m%d%H%M%S", &tm);
-+ buffer = g_date_time_format (datetime, "%Y%m%d%H%M%S");
-+ len = strlen (buffer);
-+ g_date_time_unref (datetime);
- g_return_if_fail (len == sizeof (info->utcTime));
- memcpy (info->utcTime, buffer, sizeof (info->utcTime));
- } else {
---- gcr-3.12.2-orig/gck/test-gck-crypto.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/gck/test-gck-crypto.c 2014-08-11 15:34:41.105662500 +0200
-@@ -56,7 +56,11 @@
- GckSlot *slot;
-
- /* Successful load */
-+#ifdef G_OS_WIN32
-+ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
-+#else
- test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
-+#endif
- g_assert_no_error (err);
- g_assert (GCK_IS_MODULE (test->module));
- g_object_add_weak_pointer (G_OBJECT (test->module), (gpointer *)&test->module);
---- gcr-3.12.2-orig/gck/test-gck-enumerator.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/gck/test-gck-enumerator.c 2014-08-11 15:34:41.110662100 +0200
-@@ -49,7 +49,11 @@
- GError *err = NULL;
-
- /* Successful load */
-+#ifdef G_OS_WIN32
-+ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
-+#else
- test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
-+#endif
- g_assert_no_error (err);
- g_assert (GCK_IS_MODULE (test->module));
- g_object_add_weak_pointer (G_OBJECT (test->module), (gpointer *)&test->module);
---- gcr-3.12.2-orig/gck/test-gck-module.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/gck/test-gck-module.c 2014-08-11 15:34:41.117663800 +0200
-@@ -41,7 +41,11 @@
- GError *err = NULL;
-
- /* Successful load */
-+#ifdef G_OS_WIN32
-+ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
-+#else
- test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
-+#endif
- g_assert_no_error (err);
- g_assert (test->module);
- g_object_add_weak_pointer (G_OBJECT (test->module), (gpointer *)&test->module);
-@@ -70,7 +74,11 @@
- GError *error = NULL;
-
- /* Shouldn't be able to load modules */
-+#ifdef G_OS_WIN32
-+ gck_module_initialize_async (BUILDDIR "/.libs/libmock-test-module.dll",
-+#else
- gck_module_initialize_async (BUILDDIR "/.libs/libmock-test-module.so",
-+#endif
- NULL, fetch_async_result, &result);
-
- egg_test_wait_until (500);
-@@ -100,7 +108,11 @@
- g_clear_error (&error);
-
- /* Shouldn't be able to load any file successfully */
-+#ifdef G_OS_WIN32
-+ invalid = gck_module_initialize ("c:\\windows\\system32\\shell32.dll", NULL, &error);
-+#else
- invalid = gck_module_initialize ("/usr/lib/libm.so", NULL, &error);
-+#endif
- g_assert_error (error, GCK_ERROR, (int)CKR_GCK_MODULE_PROBLEM);
- g_assert (invalid == NULL);
-
-@@ -138,7 +150,11 @@
-
- g_object_get (test->module, "path", &path, NULL);
- g_assert (path != NULL && "no module-path");
-+#ifdef G_OS_WIN32
-+ g_assert (strcmp (BUILDDIR "/.libs/libmock-test-module.dll", path) == 0 && "module path wrong");
-+#else
- g_assert (strcmp (BUILDDIR "/.libs/libmock-test-module.so", path) == 0 && "module path wrong");
-+#endif
- g_free (path);
- }
-
---- gcr-3.12.2-orig/gck/test-gck-modules.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/gck/test-gck-modules.c 2014-08-11 15:34:41.122663400 +0200
-@@ -47,7 +47,11 @@
- GError *err = NULL;
-
- /* Successful load */
-+#ifdef G_OS_WIN32
-+ module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
-+#else
- module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
-+#endif
- g_assert_no_error (err);
- g_assert (GCK_IS_MODULE (module));
-
---- gcr-3.12.2-orig/gck/test-gck-object.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/gck/test-gck-object.c 2014-08-11 15:34:41.129665100 +0200
-@@ -49,7 +49,11 @@
- GList *slots;
-
- /* Successful load */
-+#ifdef G_OS_WIN32
-+ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
-+#else
- test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
-+#endif
- g_assert_no_error (err);
- g_assert (GCK_IS_MODULE (test->module));
-
---- gcr-3.12.2-orig/gck/test-gck-session.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/gck/test-gck-session.c 2014-08-11 15:34:41.136677400 +0200
-@@ -49,7 +49,11 @@
- GList *slots;
-
- /* Successful load */
-+#ifdef G_OS_WIN32
-+ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
-+#else
- test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
-+#endif
- g_assert_no_error (err);
- g_assert (GCK_IS_MODULE (test->module));
- g_object_add_weak_pointer (G_OBJECT (test->module), (gpointer *)&test->module);
---- gcr-3.12.2-orig/gck/test-gck-slot.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/gck/test-gck-slot.c 2014-08-11 15:34:41.141664500 +0200
-@@ -42,7 +42,11 @@
- GList *slots;
-
- /* Successful load */
-+#ifdef G_OS_WIN32
-+ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
-+#else
- test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
-+#endif
- g_assert_no_error (err);
- g_assert (GCK_IS_MODULE (test->module));
-
---- gcr-3.12.2-orig/gcr/gcr-gnupg-collection.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/gcr/gcr-gnupg-collection.c 2014-08-11 15:34:41.058659700 +0200
-@@ -34,7 +34,9 @@
- #include "gcr-record.h"
- #include "gcr-util.h"
-
-+#ifdef HAVE_SYS_WAIT_H
- #include <sys/wait.h>
-+#endif
- #include <string.h>
-
- enum {
---- gcr-3.12.2-orig/gcr/gcr-gnupg-process.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/gcr/gcr-gnupg-process.c 2014-09-06 11:13:31.599364500 +0200
-@@ -30,12 +30,25 @@
-
- #include <glib/gi18n-lib.h>
-
-+#ifdef HAVE_SYS_WAIT_H
- #include <sys/wait.h>
-+#endif
-+#ifdef G_OS_WIN32
-+#define WINVER 0x0501
-+#include <windows.h>
-+#endif
- #include <fcntl.h>
- #include <errno.h>
- #include <string.h>
- #include <unistd.h>
-
-+#ifndef G_OS_UNIX
-+#define WIFEXITED(x) 1
-+#define WEXITSTATUS(x) (x)
-+#define WIFSIGNALED(x) 0
-+#define WTERMSIG(x) (x)
-+#endif
-+
- /**
- * GcrGnupgProcessFlags:
- * @GCR_GNUPG_PROCESS_NONE: No flags
-@@ -853,7 +866,12 @@
- gint code;
- guint i;
-
-+#if defined (G_OS_UNIX)
- _gcr_debug ("process exited: %d", (int)pid);
-+#elif defined (G_OS_WIN32)
-+ DWORD real_pid = GetProcessId (pid);
-+ _gcr_debug ("process exited: %d", (int)real_pid);
-+#endif
-
- g_spawn_close_pid (gnupg_source->child_pid);
- gnupg_source->child_pid = 0;
-@@ -890,11 +908,14 @@
- }
-
- complete_source_is_done (gnupg_source);
-+
-+ g_spawn_close_pid (pid);
- }
-
- static void
- on_gnupg_process_child_setup (gpointer user_data)
- {
-+#ifdef G_OS_UNIX
- int *child_fds = user_data;
- long val;
- guint i;
-@@ -910,6 +931,7 @@
- fcntl (child_fds[i], F_SETFD, val & ~FD_CLOEXEC);
- }
- }
-+#endif
- }
-
- static void
-@@ -928,9 +950,16 @@
-
- /* Try and kill the child process */
- if (gnupg_source->child_pid) {
-+#if defined(G_OS_UNIX)
- _gcr_debug ("sending term signal to process: %d",
- (int)gnupg_source->child_pid);
- kill (gnupg_source->child_pid, SIGTERM);
-+#elif defined(G_OS_WIN32)
-+ DWORD real_pid = GetProcessId (gnupg_source->child_pid);
-+ _gcr_debug ("sending term signal to process: %d",
-+ (int)real_pid);
-+ TerminateProcess (gnupg_source->child_pid, 0);
-+#endif
- }
- }
-
-@@ -999,14 +1028,22 @@
- child_fds[FD_ERROR] = 2;
-
- if (flags & GCR_GNUPG_PROCESS_WITH_STATUS) {
-+#if defined(G_OS_UNIX)
- if (pipe (status_fds) < 0)
-+#elif defined(G_OS_WIN32)
-+ if (_pipe (status_fds, 4096, _O_BINARY) < 0)
-+#endif
- g_return_if_reached ();
- child_fds[FD_STATUS] = status_fds[1];
- g_ptr_array_add (args, g_strdup ("--status-fd"));
- g_ptr_array_add (args, g_strdup_printf ("%d", child_fds[FD_STATUS]));
- }
- if (flags & GCR_GNUPG_PROCESS_WITH_ATTRIBUTES) {
-+#if defined(G_OS_UNIX)
- if (pipe (attribute_fds) < 0)
-+#elif defined(G_OS_WIN32)
-+ if (_pipe (attribute_fds, 4096, _O_BINARY) < 0)
-+#endif
- g_return_if_reached ();
- child_fds[FD_ATTRIBUTE] = attribute_fds[1];
- g_ptr_array_add (args, g_strdup ("--attribute-fd"));
-@@ -1067,7 +1104,12 @@
- return;
- }
-
-+#if defined (G_OS_UNIX)
- _gcr_debug ("process started: %d", (int)pid);
-+#elif defined (G_OS_WIN32)
-+ DWORD real_pid = GetProcessId (pid);
-+ _gcr_debug ("process started: %d", (int)real_pid);
-+#endif
-
- source = g_source_new (&gnupg_source_funcs, sizeof (GnupgSource));
-
---- gcr-3.12.2-orig/gcr/gcr-record.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/gcr/gcr-record.c 2014-08-11 15:34:41.077660800 +0200
-@@ -595,7 +595,9 @@
- const gchar *raw;
- gulong result;
- gchar *end = NULL;
-- struct tm tm;
-+ gchar **string;
-+ int year, month, day;
-+ GDateTime *dt = NULL;
-
- g_return_val_if_fail (record, NULL);
-
-@@ -613,14 +615,20 @@
- }
-
- /* Try to parse as a date */
-- memset (&tm, 0, sizeof (tm));
-- end = strptime (raw, "%Y-%m-%d", &tm);
-- if (!end || end[0]) {
-+ string = g_strsplit (raw, "-", 3);
-+ if ((string[0] != NULL) && (string[1] != NULL) && (string[2] != NULL)) {
-+ year = strtol (string[0], NULL, 10);
-+ month = strtol (string[1], NULL, 10);
-+ day = strtol (string[2], NULL, 10);
-+ dt = g_date_time_new_utc (year, month, day, 0, 0, 0);
-+ }
-+ g_strfreev (string);
-+ if (dt == NULL) {
- _gcr_debug ("invalid date value: %s", raw);
- return NULL;
- }
-
-- return g_date_time_new_utc (tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 0, 0, 0);
-+ return dt;
- }
-
- /**
-@@ -858,4 +866,4 @@
- g_free (lines);
-
- return result;
--}
-+}
-\ Manca newline alla fine del file
---- gcr-3.12.2-orig/gcr/Makefile.am 2014-04-17 08:51:07.000000000 +0200
-+++ gcr-3.12.2/gcr/Makefile.am 2014-09-06 13:20:31.506762300 +0200
-@@ -134,7 +134,8 @@
- libgck-@GCK_MAJOR@.la \
- $(GLIB_LIBS) \
- $(LIBGCRYPT_LIBS) \
-- $(P11_KIT_LIBS)
-+ $(P11_KIT_LIBS) \
-+ -lmman
-
- gcr/gcr-marshal.h: gcr/gcr-marshal.list $(GLIB_GENMARSHAL)
- $(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=_gcr_marshal > $@
-@@ -266,7 +267,8 @@
- libgck-testable.la \
- $(GLIB_LIBS) \
- $(LIBGCRYPT_LIBS) \
-- $(P11_KIT_LIBS)
-+ $(P11_KIT_LIBS) \
-+ -lmman
-
- gcr_TESTS = \
- test-util \
-@@ -274,14 +276,10 @@
- test-secret-exchange \
- test-simple-certificate \
- test-certificate \
-- test-certificate-chain \
-- test-subject-public-key \
- test-fingerprint \
-- test-pkcs11-certificate \
- test-openpgp \
- test-openssh \
- test-secure-memory \
-- test-trust \
- test-parser \
- test-record \
- test-memory-icon \
-@@ -294,10 +292,6 @@
- test_certificate_CFLAGS = $(gcr_CFLAGS)
- test_certificate_LDADD = $(gcr_LIBS)
-
--test_certificate_chain_SOURCES = gcr/test-certificate-chain.c
--test_certificate_chain_CFLAGS = $(gcr_CFLAGS)
--test_certificate_chain_LDADD = $(gcr_LIBS)
--
- test_filter_collection_SOURCES = gcr/test-filter-collection.c
- test_filter_collection_CFLAGS = $(gcr_CFLAGS)
- test_filter_collection_LDADD = $(gcr_LIBS)
-@@ -334,10 +328,6 @@
- test_parser_CFLAGS = $(gcr_CFLAGS)
- test_parser_LDADD = $(gcr_LIBS)
-
--test_pkcs11_certificate_SOURCES = gcr/test-pkcs11-certificate.c
--test_pkcs11_certificate_CFLAGS = $(gcr_CFLAGS)
--test_pkcs11_certificate_LDADD = $(gcr_LIBS)
--
- test_record_SOURCES = gcr/test-record.c
- test_record_CFLAGS = $(gcr_CFLAGS)
- test_record_LDADD = $(gcr_LIBS)
-@@ -354,18 +344,10 @@
- test_simple_certificate_CFLAGS = $(gcr_CFLAGS)
- test_simple_certificate_LDADD = $(gcr_LIBS)
-
--test_subject_public_key_SOURCES = gcr/test-subject-public-key.c
--test_subject_public_key_CFLAGS = $(gcr_CFLAGS)
--test_subject_public_key_LDADD = $(gcr_LIBS)
--
- test_system_prompt_SOURCES = gcr/test-system-prompt.c
- test_system_prompt_CFLAGS = $(gcr_CFLAGS)
- test_system_prompt_LDADD = $(gcr_LIBS)
-
--test_trust_SOURCES = gcr/test-trust.c
--test_trust_CFLAGS = $(gcr_CFLAGS)
--test_trust_LDADD = $(gcr_LIBS)
--
- test_util_SOURCES = gcr/test-util.c
- test_util_CFLAGS = $(gcr_CFLAGS)
- test_util_LDADD = $(gcr_LIBS)
---- gcr-3.12.2-orig/ui/frob-prompt.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/ui/frob-prompt.c 2014-08-11 16:52:11.692510200 +0200
-@@ -25,15 +25,45 @@
- #include "gcr/gcr-base.h"
-
- #include <gtk/gtk.h>
-+#ifdef GDK_WINDOWING_X11
- #include <gdk/gdkx.h>
--
-+#endif
-+#ifdef GDK_WINDOWING_WIN32
-+#include <gdk/gdkwin32.h>
-+#endif
-+
-+#if defined(HAVE_ERR_H)
- #include <err.h>
-+#else
-+#include <errno.h>
-+#endif
-+#include <stdlib.h>
-
- static const gchar *file_name = NULL;
- static gchar *prompt_type = NULL;
- static gint prompt_delay = 0;
- static gboolean prompt_window = FALSE;
-
-+#ifndef HAVE_ERR_H
-+extern void errx (int eval, char *format, ...);
-+
-+void errx (int eval, char *format, ...)
-+{
-+ gchar *err_s;
-+
-+ va_list ap;
-+ va_start (ap, format);
-+ vsprintf (err_s, format, ap);
-+ va_end (ap);
-+
-+ err_s = g_strconcat (g_get_prgname (), ": ", g_strdup (err_s), "\n", NULL);
-+ g_printerr (err_s);
-+ g_free (err_s);
-+
-+ exit (eval);
-+}
-+#endif
-+
- static gboolean
- on_delay_timeout (gpointer data)
- {
-@@ -78,7 +108,11 @@
- errx (1, "couldn't create prompt: %s", error->message);
-
- if (parent) {
-+#if defined(GDK_WINDOWING_X11)
- caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_XID (gtk_widget_get_window (parent)));
-+#elif defined(GDK_WINDOWING_WIN32)
-+ caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_HWND (gtk_widget_get_window (parent)));
-+#endif
- gcr_prompt_set_caller_window (GCR_PROMPT (prompt), caller_id);
- g_free (caller_id);
- }
---- gcr-3.12.2-orig/ui/frob-system-prompt.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/ui/frob-system-prompt.c 2014-08-11 16:52:28.435130400 +0200
-@@ -26,7 +26,12 @@
- #include "egg/egg-testing.h"
-
- #include <gtk/gtk.h>
-+#ifdef GDK_WINDOWING_X11
- #include <gdk/gdkx.h>
-+#endif
-+#ifdef GDK_WINDOWING_WIN32
-+#include <gdk/gdkwin32.h>
-+#endif
-
- #include <unistd.h>
- #include <string.h>
-@@ -54,7 +59,11 @@
- gcr_prompt_set_message (GCR_PROMPT (prompt), "This is the message");
- gcr_prompt_set_description (GCR_PROMPT (prompt), "This is the description");
-
-+#if defined(GDK_WINDOWING_X11)
- caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_XID (gtk_widget_get_window (parent)));
-+#elif defined(GDK_WINDOWING_WIN32)
-+ caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_HWND (gtk_widget_get_window (parent)));
-+#endif
- gcr_prompt_set_caller_window (GCR_PROMPT (prompt), caller_id);
- g_free (caller_id);
-
---- gcr-3.12.2-orig/ui/gcr-prompt-dialog.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/ui/gcr-prompt-dialog.c 2014-08-11 15:52:01.024449200 +0200
-@@ -29,7 +29,12 @@
- #include "gcr-secure-entry-buffer.h"
-
- #include <gtk/gtk.h>
-+#ifdef GDK_WINDOWING_X11
- #include <gdk/gdkx.h>
-+#endif
-+#ifdef GDK_WINDOWING_WIN32
-+#include <gdk/gdkwin32.h>
-+#endif
- #include <glib/gi18n.h>
-
- /**
-@@ -150,7 +155,9 @@
- }
-
- display = gtk_widget_get_display (GTK_WIDGET (self));
-+#ifndef GDK_WINDOWING_WIN32
- transient_for = gdk_x11_window_foreign_new_for_display (display, (Window)handle);
-+#endif
- if (transient_for == NULL) {
- g_warning ("caller-window property doesn't represent a window on current display: %s",
- self->pv->caller_window);
---- gcr-3.12.2-orig/ui/gcr-prompter-tool.c 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/ui/gcr-prompter-tool.c 2014-08-11 16:07:06.442588100 +0200
-@@ -29,13 +29,20 @@
-
- #include <glib/gi18n.h>
- #include <gtk/gtk.h>
-+#ifdef GDK_WINDOWING_X11
- #include <gdk/gdkx.h>
-+#endif
-+#ifdef GDK_WINDOWING_WIN32
-+#include <gdk/gdkwin32.h>
-+#endif
- #include <pango/pango.h>
-
- #include <locale.h>
- #include <stdlib.h>
- #include <string.h>
-+#ifndef G_OS_WIN32
- #include <syslog.h>
-+#endif
-
- #define QUIT_TIMEOUT 10
-
-@@ -141,6 +148,7 @@
-
- /* Note that crit and err are the other way around in syslog */
-
-+#ifndef G_OS_WIN32
- switch (G_LOG_LEVEL_MASK & log_level) {
- case G_LOG_LEVEL_ERROR:
- level = LOG_CRIT;
-@@ -170,6 +178,7 @@
- syslog (level, "%s: %s", log_domain, message);
- else
- syslog (level, "%s", message);
-+#endif
-
- /* And then to default handler for aborting and stuff like that */
- g_log_default_handler (log_domain, log_level, message, user_data);
-@@ -179,7 +188,9 @@
- printerr_handler (const gchar *string)
- {
- /* Print to syslog and stderr */
-+#ifndef G_OS_WIN32
- syslog (LOG_WARNING, "%s", string);
-+#endif
- fprintf (stderr, "%s", string);
- }
-
-@@ -190,7 +201,9 @@
- G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING |
- G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO;
-
-+#ifndef G_OS_WIN32
- openlog ("gcr-prompter", LOG_PID, LOG_AUTH);
-+#endif
-
- g_log_set_handler (NULL, flags, log_handler, NULL);
- g_log_set_handler ("Glib", flags, log_handler, NULL);
---- gcr-3.12.2-orig/ui/Makefile.am 2014-03-03 21:05:24.000000000 +0100
-+++ gcr-3.12.2/ui/Makefile.am 2014-08-11 17:11:21.038892800 +0200
-@@ -36,12 +36,6 @@
- $(GTK_LIBS) \
- $(NULL)
-
--# libgcr-3.so (and friends) symlink to libgcr-ui-3.so for compatibility raisons
--install-exec-hook:
-- $(LN_S) -f `readlink $(DESTDIR)$(libdir)/libgcr-ui-@GCR_MAJOR@.so` $(DESTDIR)$(libdir)/libgcr-@GCR_MAJOR@.so
-- $(LN_S) -f `readlink $(DESTDIR)$(libdir)/libgcr-ui-@GCR_MAJOR@.so` $(DESTDIR)$(libdir)/libgcr-@GCR_MAJOR@.so.@GCR_CURRENT@
-- $(LN_S) -f `readlink $(DESTDIR)$(libdir)/libgcr-ui-@GCR_MAJOR@.so` $(DESTDIR)$(libdir)/libgcr-@GCR_MAJOR@.so.@GCR_CURRENT@.0.0
--
- uidir = $(datadir)/gcr-@GCR_MAJOR@/ui/
-
- ui_DATA = \
--- /dev/null
+--- gcr-3.12.2-orig/configure.ac 2014-05-13 21:03:55.000000000 +0200
++++ gcr-3.12.2/configure.ac 2014-09-06 11:46:03.751895300 +0200
+@@ -75,6 +75,16 @@
+ AC_SUBST(GETTEXT_PACKAGE)
+ AM_GLIB_GNU_GETTEXT
+
++# --------------------------------------------------------------------
++# Check for gio-unix
++#
++
++if test "$os_unix" = "yes"; then
++ GIO_PACKAGE="gio-2.0 gio-unix-2.0"
++else
++ GIO_PACKAGE="gio-2.0"
++fi
++
+ # -----------------------------------------------------------------------------
+ # GLib and GTK+ stuff
+
+@@ -83,7 +93,7 @@
+ gmodule-no-export-2.0
+ gthread-2.0
+ gobject-2.0
+- gio-2.0 gio-unix-2.0)
++ $GIO_PACKAGE)
+ GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=$GLIB_MIN"
+ GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=$GLIB_MAX"
+ AC_SUBST(GLIB_CFLAGS)
+@@ -140,7 +150,17 @@
+ #
+
+ AC_CHECK_FUNCS(timegm, AC_DEFINE(HAVE_TIMEGM,1,[Have timegm]))
+-AC_CHECK_FUNCS(mlock)
++AC_CHECK_FUNCS(memrchr, AC_DEFINE(HAVE_MEMRCHR,1,[Have memrchr]))
++AC_CHECK_FUNCS(mlock, AC_DEFINE(HAVE_MLOCK,1,[Have mlock]))
++
++# --------------------------------------------------------------------
++# Checks for headers
++#
++
++AC_CHECK_HEADERS(err.h, AC_DEFINE(HAVE_ERR_H,1,[Have err.h]))
++AC_CHECK_HEADERS(pwd.h, AC_DEFINE(HAVE_PWD_H,1,[Have pwd.h]))
++AC_CHECK_HEADERS(syslog.h, AC_DEFINE(HAVE_SYSLOG_H,1,[Have syslog.h]))
++AC_CHECK_HEADERS(sys/wait.h, AC_DEFINE(HAVE_SYS_WAIT_H,1,[Have wait.h]))
+
+ # --------------------------------------------------------------------
+ # p11-kit
+--- gcr-3.12.2-orig/Makefile.am 2014-04-17 08:51:07.000000000 +0200
++++ gcr-3.12.2/Makefile.am 2014-09-06 22:33:28.916978100 +0200
+@@ -164,6 +164,7 @@
+ INTROSPECTION_GIRS =
+ INTROSPECTION_SCANNER_ARGS = $(INTROSPECTION_FLAGS) --warn-all --add-include-path=.
+ INTROSPECTION_COMPILER_ARGS = --includedir=.
++INTROSPECTION_SCANNER_ENV = CC="$(CC)"
+
+ girdir = $(datadir)/gir-1.0
+ gir_DATA =
+--- gcr-3.12.2-orig/egg/Makefile.am 2014-05-13 21:01:43.000000000 +0200
++++ gcr-3.12.2/egg/Makefile.am 2014-09-06 12:50:02.014502900 +0200
+@@ -13,7 +13,8 @@
+
+ libegg_la_LIBADD = \
+ $(GLIB_LIBS) \
+- $(LIBGCRYPT_LIBS)
++ $(LIBGCRYPT_LIBS) \
++ -lmman
+
+ libegg_la_SOURCES = \
+ egg/egg-armor.c egg/egg-armor.h \
+@@ -72,7 +73,8 @@
+ egg_LDADD = \
+ libegg.la \
+ $(LIBGCRYPT_LIBS) \
+- $(GLIB_LIBS)
++ $(GLIB_LIBS) \
++ -lmman
+
+ egg_TESTS = \
+ test-asn1 \
+--- gcr-3.12.2-orig/egg/egg-armor.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/egg/egg-armor.c 2014-08-11 15:34:41.041658400 +0200
+@@ -59,6 +59,29 @@
+ #define ARMOR_PREF_END "-----END "
+ #define ARMOR_PREF_END_L 9
+
++#ifndef HAVE_MEMRCHR
++extern void* memrchr (const void *s, int c, size_t n);
++
++void*
++memrchr (const void *s, int c, size_t n)
++{
++ if (n > 0) {
++ const char* p = (const char*) s;
++ const char* q = p + n;
++
++ while (1) {
++ q--; if (q < p || q[0] == (char) c) break;
++ q--; if (q < p || q[0] == (char) c) break;
++ q--; if (q < p || q[0] == (char) c) break;
++ q--; if (q < p || q[0] == (char) c) break;
++ }
++ if (q >= p)
++ return (void*)q;
++ }
++ return NULL;
++}
++#endif
++
+ static void
+ parse_header_lines (const gchar *hbeg,
+ const gchar *hend,
+--- gcr-3.12.2-orig/egg/egg-asn1x.c 2014-05-13 21:01:43.000000000 +0200
++++ gcr-3.12.2/egg/egg-asn1x.c 2014-08-11 15:34:41.034658600 +0200
+@@ -1928,7 +1928,7 @@
+ two_to_four_digit_year (int year)
+ {
+ time_t now;
+- struct tm tm;
++ GDate *date;
+ int century, current;
+
+ g_return_val_if_fail (year >= 0 && year <= 99, -1);
+@@ -1936,11 +1936,15 @@
+ /* Get the current year */
+ now = time (NULL);
+ g_return_val_if_fail (now >= 0, -1);
+- if (!gmtime_r (&now, &tm))
++ date = g_date_new ();
++ g_date_set_time_t (date, now);
++ if (!g_date_valid (date))
+ g_return_val_if_reached (-1);
+
+- current = (tm.tm_year % 100);
+- century = (tm.tm_year + 1900) - current;
++ century = (g_date_get_year (date) / 100) * 100;
++ current = g_date_get_year (date) - century;
++
++ g_date_free (date);
+
+ /*
+ * Check if it's within 40 years before the
+--- gcr-3.12.2-orig/egg/egg-secure-memory.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/egg/egg-secure-memory.c 2014-09-06 11:11:19.489433700 +0200
+@@ -913,7 +913,7 @@
+ DEBUG_ALLOC ("gkr-secure-memory: freed block ", sz);
+
+ #else
+- ASSERT (FALSE);
++ ASSERT (0);
+ #endif
+ }
+
+--- gcr-3.12.2-orig/egg/test-asn1x.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/egg/test-asn1x.c 2014-08-11 15:34:41.047660400 +0200
+@@ -26,7 +26,9 @@
+ #include "egg/egg-asn1-defs.h"
+ #include "egg/egg-testing.h"
+
++#ifdef HAVE_PWD_H
+ #include <pwd.h>
++#endif
+ #include <stdlib.h>
+ #include <unistd.h>
+
+--- gcr-3.12.2-orig/gck/Makefile.am 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/gck/Makefile.am 2014-09-06 12:11:38.941793800 +0200
+@@ -71,7 +71,8 @@
+ libegg-secmem.la \
+ $(P11_KIT_LIBS) \
+ $(GIO_LIBS) \
+- $(GLIB_LIBS)
++ $(GLIB_LIBS) \
++ -lmman
+
+ noinst_LTLIBRARIES += libgck-testable.la
+ libgck_testable_la_SOURCES = \
+@@ -193,7 +194,8 @@
+ libegg-hex.la \
+ $(GLIB_LIBS) \
+ $(P11_KIT_LIBS) \
+- $(GIO_LIBS)
++ $(GIO_LIBS) \
++ -lmman
+
+ gck_TESTS = \
+ test-gck-attributes \
+--- gcr-3.12.2-orig/gck/gck-attributes.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/gck/gck-attributes.c 2014-09-06 22:14:58.034848700 +0200
+@@ -44,7 +44,9 @@
+ * this library will operate on such an attribute.
+ */
+
++#ifndef __MINGW64_VERSION_MAJOR
+ G_STATIC_ASSERT (sizeof (GckAttribute) == sizeof (CK_ATTRIBUTE));
++#endif
+
+ #define STATE_LOCKED 1
+ #define STATE_FLOATING 8
+--- gcr-3.12.2-orig/gck/gck-slot.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/gck/gck-slot.c 2014-08-11 15:34:41.053657400 +0200
+@@ -605,7 +605,7 @@
+ {
+ GckTokenInfo *token_info;
+ gchar *string;
+- struct tm tm;
++ GTimeVal tv;
+
+ token_info = g_new0 (GckTokenInfo, 1);
+ token_info->label = gck_string_from_chars (info->label, sizeof (info->label));
+@@ -633,10 +633,12 @@
+ /* Parse the time into seconds since epoch */
+ if (info->flags & CKF_CLOCK_ON_TOKEN) {
+ string = g_strndup ((gchar*)info->utcTime, MIN (14, sizeof (info->utcTime)));
+- if (!strptime (string, "%Y%m%d%H%M%S", &tm))
++ /* Transform into an ISO-8601 string */
++ string = g_strconcat (g_strndup (string,8), "T", g_strndup (string+8,6), "Z", NULL);
++ if (!g_time_val_from_iso8601 (string, &tv))
+ token_info->utc_time = -1;
+ else
+- token_info->utc_time = timegm (&tm);
++ token_info->utc_time = tv.tv_sec;
+ g_free (string);
+ } else {
+ token_info->utc_time = -1;
+@@ -648,8 +650,8 @@
+ void
+ _gck_token_info_to_pkcs11 (GckTokenInfo *token_info, CK_TOKEN_INFO_PTR info)
+ {
+- gchar buffer[64];
+- struct tm tm;
++ gchar *buffer;
++ GDateTime *datetime = NULL;
+ time_t tim;
+ gsize len;
+
+@@ -689,9 +691,12 @@
+ /* Parse the time into seconds since epoch */
+ if (token_info->flags & CKF_CLOCK_ON_TOKEN) {
+ tim = token_info->utc_time;
+- if (!gmtime_r (&tim, &tm))
++ datetime = g_date_time_new_from_unix_utc (tim);
++ if (datetime == NULL)
+ g_return_if_reached ();
+- len = strftime (buffer, sizeof (buffer), "%Y%m%d%H%M%S", &tm);
++ buffer = g_date_time_format (datetime, "%Y%m%d%H%M%S");
++ len = strlen (buffer);
++ g_date_time_unref (datetime);
+ g_return_if_fail (len == sizeof (info->utcTime));
+ memcpy (info->utcTime, buffer, sizeof (info->utcTime));
+ } else {
+--- gcr-3.12.2-orig/gck/test-gck-crypto.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/gck/test-gck-crypto.c 2014-08-11 15:34:41.105662500 +0200
+@@ -56,7 +56,11 @@
+ GckSlot *slot;
+
+ /* Successful load */
++#ifdef G_OS_WIN32
++ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
++#else
+ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
++#endif
+ g_assert_no_error (err);
+ g_assert (GCK_IS_MODULE (test->module));
+ g_object_add_weak_pointer (G_OBJECT (test->module), (gpointer *)&test->module);
+--- gcr-3.12.2-orig/gck/test-gck-enumerator.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/gck/test-gck-enumerator.c 2014-08-11 15:34:41.110662100 +0200
+@@ -49,7 +49,11 @@
+ GError *err = NULL;
+
+ /* Successful load */
++#ifdef G_OS_WIN32
++ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
++#else
+ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
++#endif
+ g_assert_no_error (err);
+ g_assert (GCK_IS_MODULE (test->module));
+ g_object_add_weak_pointer (G_OBJECT (test->module), (gpointer *)&test->module);
+--- gcr-3.12.2-orig/gck/test-gck-module.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/gck/test-gck-module.c 2014-08-11 15:34:41.117663800 +0200
+@@ -41,7 +41,11 @@
+ GError *err = NULL;
+
+ /* Successful load */
++#ifdef G_OS_WIN32
++ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
++#else
+ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
++#endif
+ g_assert_no_error (err);
+ g_assert (test->module);
+ g_object_add_weak_pointer (G_OBJECT (test->module), (gpointer *)&test->module);
+@@ -70,7 +74,11 @@
+ GError *error = NULL;
+
+ /* Shouldn't be able to load modules */
++#ifdef G_OS_WIN32
++ gck_module_initialize_async (BUILDDIR "/.libs/libmock-test-module.dll",
++#else
+ gck_module_initialize_async (BUILDDIR "/.libs/libmock-test-module.so",
++#endif
+ NULL, fetch_async_result, &result);
+
+ egg_test_wait_until (500);
+@@ -100,7 +108,11 @@
+ g_clear_error (&error);
+
+ /* Shouldn't be able to load any file successfully */
++#ifdef G_OS_WIN32
++ invalid = gck_module_initialize ("c:\\windows\\system32\\shell32.dll", NULL, &error);
++#else
+ invalid = gck_module_initialize ("/usr/lib/libm.so", NULL, &error);
++#endif
+ g_assert_error (error, GCK_ERROR, (int)CKR_GCK_MODULE_PROBLEM);
+ g_assert (invalid == NULL);
+
+@@ -138,7 +150,11 @@
+
+ g_object_get (test->module, "path", &path, NULL);
+ g_assert (path != NULL && "no module-path");
++#ifdef G_OS_WIN32
++ g_assert (strcmp (BUILDDIR "/.libs/libmock-test-module.dll", path) == 0 && "module path wrong");
++#else
+ g_assert (strcmp (BUILDDIR "/.libs/libmock-test-module.so", path) == 0 && "module path wrong");
++#endif
+ g_free (path);
+ }
+
+--- gcr-3.12.2-orig/gck/test-gck-modules.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/gck/test-gck-modules.c 2014-08-11 15:34:41.122663400 +0200
+@@ -47,7 +47,11 @@
+ GError *err = NULL;
+
+ /* Successful load */
++#ifdef G_OS_WIN32
++ module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
++#else
+ module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
++#endif
+ g_assert_no_error (err);
+ g_assert (GCK_IS_MODULE (module));
+
+--- gcr-3.12.2-orig/gck/test-gck-object.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/gck/test-gck-object.c 2014-08-11 15:34:41.129665100 +0200
+@@ -49,7 +49,11 @@
+ GList *slots;
+
+ /* Successful load */
++#ifdef G_OS_WIN32
++ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
++#else
+ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
++#endif
+ g_assert_no_error (err);
+ g_assert (GCK_IS_MODULE (test->module));
+
+--- gcr-3.12.2-orig/gck/test-gck-session.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/gck/test-gck-session.c 2014-08-11 15:34:41.136677400 +0200
+@@ -49,7 +49,11 @@
+ GList *slots;
+
+ /* Successful load */
++#ifdef G_OS_WIN32
++ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
++#else
+ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
++#endif
+ g_assert_no_error (err);
+ g_assert (GCK_IS_MODULE (test->module));
+ g_object_add_weak_pointer (G_OBJECT (test->module), (gpointer *)&test->module);
+--- gcr-3.12.2-orig/gck/test-gck-slot.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/gck/test-gck-slot.c 2014-08-11 15:34:41.141664500 +0200
+@@ -42,7 +42,11 @@
+ GList *slots;
+
+ /* Successful load */
++#ifdef G_OS_WIN32
++ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err);
++#else
+ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err);
++#endif
+ g_assert_no_error (err);
+ g_assert (GCK_IS_MODULE (test->module));
+
+--- gcr-3.12.2-orig/gcr/gcr-gnupg-collection.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/gcr/gcr-gnupg-collection.c 2014-08-11 15:34:41.058659700 +0200
+@@ -34,7 +34,9 @@
+ #include "gcr-record.h"
+ #include "gcr-util.h"
+
++#ifdef HAVE_SYS_WAIT_H
+ #include <sys/wait.h>
++#endif
+ #include <string.h>
+
+ enum {
+--- gcr-3.14.0/gcr/gcr-gnupg-process.c.orig 2014-09-23 09:40:08.000000000 +0200
++++ gcr-3.14.0/gcr/gcr-gnupg-process.c 2014-10-04 10:03:24.930749400 +0200
+@@ -28,12 +28,25 @@
+
+ #include <glib/gi18n-lib.h>
+
++#ifdef HAVE_SYS_WAIT_H
+ #include <sys/wait.h>
++#endif
++#ifdef G_OS_WIN32
++#define WINVER 0x0501
++#include <windows.h>
++#endif
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <string.h>
+ #include <unistd.h>
+
++#ifndef G_OS_UNIX
++#define WIFEXITED(x) 1
++#define WEXITSTATUS(x) (x)
++#define WIFSIGNALED(x) 0
++#define WTERMSIG(x) (x)
++#endif
++
+ /**
+ * GcrGnupgProcessFlags:
+ * @GCR_GNUPG_PROCESS_NONE: No flags
+@@ -851,7 +864,12 @@
+ gint code;
+ guint i;
+
++#if defined (G_OS_UNIX)
+ g_debug ("process exited: %d", (int)pid);
++#elif defined (G_OS_WIN32)
++ DWORD real_pid = GetProcessId (pid);
++ g_debug ("process exited: %d", (int)real_pid);
++#endif
+
+ g_spawn_close_pid (gnupg_source->child_pid);
+ gnupg_source->child_pid = 0;
+@@ -888,11 +906,14 @@
+ }
+
+ complete_source_is_done (gnupg_source);
++
++ g_spawn_close_pid (pid);
+ }
+
+ static void
+ on_gnupg_process_child_setup (gpointer user_data)
+ {
++#ifdef G_OS_UNIX
+ int *child_fds = user_data;
+ long val;
+ guint i;
+@@ -908,6 +929,7 @@
+ fcntl (child_fds[i], F_SETFD, val & ~FD_CLOEXEC);
+ }
+ }
++#endif
+ }
+
+ static void
+@@ -926,9 +948,16 @@
+
+ /* Try and kill the child process */
+ if (gnupg_source->child_pid) {
++#if defined(G_OS_UNIX)
+ g_debug ("sending term signal to process: %d",
+- (int)gnupg_source->child_pid);
++ (int)gnupg_source->child_pid);
+ kill (gnupg_source->child_pid, SIGTERM);
++#elif defined(G_OS_WIN32)
++ DWORD real_pid = GetProcessId (gnupg_source->child_pid);
++ g_debug ("sending term signal to process: %d",
++ (int)real_pid);
++ TerminateProcess (gnupg_source->child_pid, 0);
++#endif
+ }
+ }
+
+@@ -997,14 +1026,22 @@
+ child_fds[FD_ERROR] = 2;
+
+ if (flags & GCR_GNUPG_PROCESS_WITH_STATUS) {
++#if defined(G_OS_UNIX)
+ if (pipe (status_fds) < 0)
++#elif defined(G_OS_WIN32)
++ if (_pipe (status_fds, 4096, _O_BINARY) < 0)
++#endif
+ g_return_if_reached ();
+ child_fds[FD_STATUS] = status_fds[1];
+ g_ptr_array_add (args, g_strdup ("--status-fd"));
+ g_ptr_array_add (args, g_strdup_printf ("%d", child_fds[FD_STATUS]));
+ }
+ if (flags & GCR_GNUPG_PROCESS_WITH_ATTRIBUTES) {
++#if defined(G_OS_UNIX)
+ if (pipe (attribute_fds) < 0)
++#elif defined(G_OS_WIN32)
++ if (_pipe (attribute_fds, 4096, _O_BINARY) < 0)
++#endif
+ g_return_if_reached ();
+ child_fds[FD_ATTRIBUTE] = attribute_fds[1];
+ g_ptr_array_add (args, g_strdup ("--attribute-fd"));
+@@ -1063,7 +1100,12 @@
+ return;
+ }
+
++#if defined (G_OS_UNIX)
+ g_debug ("process started: %d", (int)pid);
++#elif defined (G_OS_WIN32)
++ DWORD real_pid = GetProcessId (pid);
++ g_debug ("process started: %d", (int)real_pid);
++#endif
+
+ source = g_source_new (&gnupg_source_funcs, sizeof (GnupgSource));
+
+--- gcr-3.14.0/gcr/gcr-record.c.orig 2014-09-23 09:40:08.000000000 +0200
++++ gcr-3.14.0/gcr/gcr-record.c 2014-10-04 10:06:39.245627700 +0200
+@@ -593,7 +593,9 @@
+ const gchar *raw;
+ gulong result;
+ gchar *end = NULL;
+- struct tm tm;
++ gchar **string;
++ int year, month, day;
++ GDateTime *dt = NULL;
+
+ g_return_val_if_fail (record, NULL);
+
+@@ -611,14 +613,20 @@
+ }
+
+ /* Try to parse as a date */
+- memset (&tm, 0, sizeof (tm));
+- end = strptime (raw, "%Y-%m-%d", &tm);
+- if (!end || end[0]) {
++ string = g_strsplit (raw, "-", 3);
++ if ((string[0] != NULL) && (string[1] != NULL) && (string[2] != NULL)) {
++ year = strtol (string[0], NULL, 10);
++ month = strtol (string[1], NULL, 10);
++ day = strtol (string[2], NULL, 10);
++ dt = g_date_time_new_utc (year, month, day, 0, 0, 0);
++ }
++ g_strfreev (string);
++ if (dt == NULL) {
+ g_debug ("invalid date value: %s", raw);
+ return NULL;
+ }
+
+- return g_date_time_new_utc (tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 0, 0, 0);
++ return dt;
+ }
+
+ /**
+@@ -856,4 +864,4 @@
+ g_free (lines);
+
+ return result;
+-}
++}
+\ Manca newline alla fine del file
+--- gcr-3.12.2-orig/gcr/Makefile.am 2014-04-17 08:51:07.000000000 +0200
++++ gcr-3.12.2/gcr/Makefile.am 2014-09-06 13:20:31.506762300 +0200
+@@ -134,7 +134,8 @@
+ libgck-@GCK_MAJOR@.la \
+ $(GLIB_LIBS) \
+ $(LIBGCRYPT_LIBS) \
+- $(P11_KIT_LIBS)
++ $(P11_KIT_LIBS) \
++ -lmman
+
+ gcr/gcr-marshal.h: gcr/gcr-marshal.list $(GLIB_GENMARSHAL)
+ $(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=_gcr_marshal > $@
+@@ -266,7 +267,8 @@
+ libgck-testable.la \
+ $(GLIB_LIBS) \
+ $(LIBGCRYPT_LIBS) \
+- $(P11_KIT_LIBS)
++ $(P11_KIT_LIBS) \
++ -lmman
+
+ gcr_TESTS = \
+ test-util \
+@@ -274,14 +276,10 @@
+ test-secret-exchange \
+ test-simple-certificate \
+ test-certificate \
+- test-certificate-chain \
+- test-subject-public-key \
+ test-fingerprint \
+- test-pkcs11-certificate \
+ test-openpgp \
+ test-openssh \
+ test-secure-memory \
+- test-trust \
+ test-parser \
+ test-record \
+ test-memory-icon \
+@@ -294,10 +292,6 @@
+ test_certificate_CFLAGS = $(gcr_CFLAGS)
+ test_certificate_LDADD = $(gcr_LIBS)
+
+-test_certificate_chain_SOURCES = gcr/test-certificate-chain.c
+-test_certificate_chain_CFLAGS = $(gcr_CFLAGS)
+-test_certificate_chain_LDADD = $(gcr_LIBS)
+-
+ test_filter_collection_SOURCES = gcr/test-filter-collection.c
+ test_filter_collection_CFLAGS = $(gcr_CFLAGS)
+ test_filter_collection_LDADD = $(gcr_LIBS)
+@@ -334,10 +328,6 @@
+ test_parser_CFLAGS = $(gcr_CFLAGS)
+ test_parser_LDADD = $(gcr_LIBS)
+
+-test_pkcs11_certificate_SOURCES = gcr/test-pkcs11-certificate.c
+-test_pkcs11_certificate_CFLAGS = $(gcr_CFLAGS)
+-test_pkcs11_certificate_LDADD = $(gcr_LIBS)
+-
+ test_record_SOURCES = gcr/test-record.c
+ test_record_CFLAGS = $(gcr_CFLAGS)
+ test_record_LDADD = $(gcr_LIBS)
+@@ -354,18 +344,10 @@
+ test_simple_certificate_CFLAGS = $(gcr_CFLAGS)
+ test_simple_certificate_LDADD = $(gcr_LIBS)
+
+-test_subject_public_key_SOURCES = gcr/test-subject-public-key.c
+-test_subject_public_key_CFLAGS = $(gcr_CFLAGS)
+-test_subject_public_key_LDADD = $(gcr_LIBS)
+-
+ test_system_prompt_SOURCES = gcr/test-system-prompt.c
+ test_system_prompt_CFLAGS = $(gcr_CFLAGS)
+ test_system_prompt_LDADD = $(gcr_LIBS)
+
+-test_trust_SOURCES = gcr/test-trust.c
+-test_trust_CFLAGS = $(gcr_CFLAGS)
+-test_trust_LDADD = $(gcr_LIBS)
+-
+ test_util_SOURCES = gcr/test-util.c
+ test_util_CFLAGS = $(gcr_CFLAGS)
+ test_util_LDADD = $(gcr_LIBS)
+--- gcr-3.12.2-orig/ui/frob-prompt.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/ui/frob-prompt.c 2014-08-11 16:52:11.692510200 +0200
+@@ -25,15 +25,45 @@
+ #include "gcr/gcr-base.h"
+
+ #include <gtk/gtk.h>
++#ifdef GDK_WINDOWING_X11
+ #include <gdk/gdkx.h>
+-
++#endif
++#ifdef GDK_WINDOWING_WIN32
++#include <gdk/gdkwin32.h>
++#endif
++
++#if defined(HAVE_ERR_H)
+ #include <err.h>
++#else
++#include <errno.h>
++#endif
++#include <stdlib.h>
+
+ static const gchar *file_name = NULL;
+ static gchar *prompt_type = NULL;
+ static gint prompt_delay = 0;
+ static gboolean prompt_window = FALSE;
+
++#ifndef HAVE_ERR_H
++extern void errx (int eval, char *format, ...);
++
++void errx (int eval, char *format, ...)
++{
++ gchar *err_s;
++
++ va_list ap;
++ va_start (ap, format);
++ vsprintf (err_s, format, ap);
++ va_end (ap);
++
++ err_s = g_strconcat (g_get_prgname (), ": ", g_strdup (err_s), "\n", NULL);
++ g_printerr (err_s);
++ g_free (err_s);
++
++ exit (eval);
++}
++#endif
++
+ static gboolean
+ on_delay_timeout (gpointer data)
+ {
+@@ -78,7 +108,11 @@
+ errx (1, "couldn't create prompt: %s", error->message);
+
+ if (parent) {
++#if defined(GDK_WINDOWING_X11)
+ caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_XID (gtk_widget_get_window (parent)));
++#elif defined(GDK_WINDOWING_WIN32)
++ caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_HWND (gtk_widget_get_window (parent)));
++#endif
+ gcr_prompt_set_caller_window (GCR_PROMPT (prompt), caller_id);
+ g_free (caller_id);
+ }
+--- gcr-3.12.2-orig/ui/frob-system-prompt.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/ui/frob-system-prompt.c 2014-08-11 16:52:28.435130400 +0200
+@@ -26,7 +26,12 @@
+ #include "egg/egg-testing.h"
+
+ #include <gtk/gtk.h>
++#ifdef GDK_WINDOWING_X11
+ #include <gdk/gdkx.h>
++#endif
++#ifdef GDK_WINDOWING_WIN32
++#include <gdk/gdkwin32.h>
++#endif
+
+ #include <unistd.h>
+ #include <string.h>
+@@ -54,7 +59,11 @@
+ gcr_prompt_set_message (GCR_PROMPT (prompt), "This is the message");
+ gcr_prompt_set_description (GCR_PROMPT (prompt), "This is the description");
+
++#if defined(GDK_WINDOWING_X11)
+ caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_XID (gtk_widget_get_window (parent)));
++#elif defined(GDK_WINDOWING_WIN32)
++ caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_HWND (gtk_widget_get_window (parent)));
++#endif
+ gcr_prompt_set_caller_window (GCR_PROMPT (prompt), caller_id);
+ g_free (caller_id);
+
+--- gcr-3.12.2-orig/ui/gcr-prompt-dialog.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/ui/gcr-prompt-dialog.c 2014-08-11 15:52:01.024449200 +0200
+@@ -29,7 +29,12 @@
+ #include "gcr-secure-entry-buffer.h"
+
+ #include <gtk/gtk.h>
++#ifdef GDK_WINDOWING_X11
+ #include <gdk/gdkx.h>
++#endif
++#ifdef GDK_WINDOWING_WIN32
++#include <gdk/gdkwin32.h>
++#endif
+ #include <glib/gi18n.h>
+
+ /**
+@@ -150,7 +155,9 @@
+ }
+
+ display = gtk_widget_get_display (GTK_WIDGET (self));
++#ifndef GDK_WINDOWING_WIN32
+ transient_for = gdk_x11_window_foreign_new_for_display (display, (Window)handle);
++#endif
+ if (transient_for == NULL) {
+ g_warning ("caller-window property doesn't represent a window on current display: %s",
+ self->pv->caller_window);
+--- gcr-3.12.2-orig/ui/gcr-prompter-tool.c 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/ui/gcr-prompter-tool.c 2014-08-11 16:07:06.442588100 +0200
+@@ -29,13 +29,20 @@
+
+ #include <glib/gi18n.h>
+ #include <gtk/gtk.h>
++#ifdef GDK_WINDOWING_X11
+ #include <gdk/gdkx.h>
++#endif
++#ifdef GDK_WINDOWING_WIN32
++#include <gdk/gdkwin32.h>
++#endif
+ #include <pango/pango.h>
+
+ #include <locale.h>
+ #include <stdlib.h>
+ #include <string.h>
++#ifndef G_OS_WIN32
+ #include <syslog.h>
++#endif
+
+ #define QUIT_TIMEOUT 10
+
+@@ -141,6 +148,7 @@
+
+ /* Note that crit and err are the other way around in syslog */
+
++#ifndef G_OS_WIN32
+ switch (G_LOG_LEVEL_MASK & log_level) {
+ case G_LOG_LEVEL_ERROR:
+ level = LOG_CRIT;
+@@ -170,6 +178,7 @@
+ syslog (level, "%s: %s", log_domain, message);
+ else
+ syslog (level, "%s", message);
++#endif
+
+ /* And then to default handler for aborting and stuff like that */
+ g_log_default_handler (log_domain, log_level, message, user_data);
+@@ -179,7 +188,9 @@
+ printerr_handler (const gchar *string)
+ {
+ /* Print to syslog and stderr */
++#ifndef G_OS_WIN32
+ syslog (LOG_WARNING, "%s", string);
++#endif
+ fprintf (stderr, "%s", string);
+ }
+
+@@ -190,7 +201,9 @@
+ G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING |
+ G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO;
+
++#ifndef G_OS_WIN32
+ openlog ("gcr-prompter", LOG_PID, LOG_AUTH);
++#endif
+
+ g_log_set_handler (NULL, flags, log_handler, NULL);
+ g_log_set_handler ("Glib", flags, log_handler, NULL);
+--- gcr-3.12.2-orig/ui/Makefile.am 2014-03-03 21:05:24.000000000 +0100
++++ gcr-3.12.2/ui/Makefile.am 2014-08-11 17:11:21.038892800 +0200
+@@ -36,12 +36,6 @@
+ $(GTK_LIBS) \
+ $(NULL)
+
+-# libgcr-3.so (and friends) symlink to libgcr-ui-3.so for compatibility raisons
+-install-exec-hook:
+- $(LN_S) -f `readlink $(DESTDIR)$(libdir)/libgcr-ui-@GCR_MAJOR@.so` $(DESTDIR)$(libdir)/libgcr-@GCR_MAJOR@.so
+- $(LN_S) -f `readlink $(DESTDIR)$(libdir)/libgcr-ui-@GCR_MAJOR@.so` $(DESTDIR)$(libdir)/libgcr-@GCR_MAJOR@.so.@GCR_CURRENT@
+- $(LN_S) -f `readlink $(DESTDIR)$(libdir)/libgcr-ui-@GCR_MAJOR@.so` $(DESTDIR)$(libdir)/libgcr-@GCR_MAJOR@.so.@GCR_CURRENT@.0.0
+-
+ uidir = $(datadir)/gcr-@GCR_MAJOR@/ui/
+
+ ui_DATA = \
_realname=gcr
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
-pkgver=3.12.2
+pkgver=3.14.0
pkgrel=1
arch=('any')
pkgdesc="Library for Crypto UI related task (mingw-w64)"
"${MINGW_PACKAGE_PREFIX}-gtk-doc"
"${MINGW_PACKAGE_PREFIX}-vala"
"${MINGW_PACKAGE_PREFIX}-gobject-introspection"
+ "${MINGW_PACKAGE_PREFIX}-pkg-config"
"gnupg")
options=('strip' 'staticlibs')
license=("LGPL 2.1")
url="http://www.gnome.org/"
source=(http://ftp.gnome.org/pub/gnome/sources/${_realname}/${pkgver:0:4}/${_realname}-$pkgver.tar.xz
- 001-3.12.2.patch)
-sha256sums=('456e20615ab178aa92eeabdea64dcce535c10d5af189171d9375291a2447d21c'
- '0adafaa9626e16ac5a447058b0aa38a6f4f075b00b0a70e3f8ab6003ab5ef2e6')
+ 001-3.14.0.patch)
+sha256sums=('2a2231147a01e2061f57fa9ca77557ff97bc6ceab028cee5528079f4b2fca63d'
+ 'b861b72d7f11afd818c8adcb9da605238bb9c454e631c0583ad6bcad304f8d8d')
prepare() {
cd ${_realname}-${pkgver}
- patch -p1 -i ${srcdir}/001-3.12.2.patch
+ patch -p1 -i ${srcdir}/001-3.14.0.patch
autoreconf -fi
}
--target=${MINGW_CHOST} \
--build=${MINGW_CHOST} \
--prefix=${MINGW_PREFIX} \
- --libexecdir=${MINGW_PREFIX}/lib \
- --enable-introspection=no
+ --libexecdir=${MINGW_PREFIX}/lib
make
}