aboutsummaryrefslogblamecommitdiffstats
path: root/win32/patches/libsecret.patch
blob: 5e6c70e7ff0e481be28e0dadb58272c47a7af06b (plain) (tree)




























































































































































                                                                                             
diff -upr libsecret-0.16.old/Makefile.am libsecret-0.16/Makefile.am
--- libsecret-0.16.old/Makefile.am  2013-03-25 12:10:12 +0000
+++ libsecret-0.16/Makefile.am  2014-04-20 18:49:09 +0000
@@ -3,7 +3,7 @@ include $(top_srcdir)/Makefile.decl
 
 ACLOCAL_AMFLAGS = -I build/m4 ${ACLOCAL_FLAGS}
 
-SUBDIRS = build egg libsecret tool po docs .
+SUBDIRS = build egg libsecret po docs .
 
 DISTCHECK_CONFIGURE_FLAGS = \
    --enable-debug=yes \
diff -upr libsecret-0.16.old/configure.ac libsecret-0.16/configure.ac
--- libsecret-0.16.old/configure.ac 2013-06-21 13:11:14 +0000
+++ libsecret-0.16/configure.ac 2014-04-20 18:42:09 +0000
@@ -55,20 +55,48 @@ AM_GLIB_GNU_GETTEXT
 # Checks for functions
 
 AC_CHECK_FUNCS(mlock)
+AC_CHECK_FUNCS(gmtime_r strptime memrchr)
+AC_CHECK_HEADERS([err.h pwd.h syslog.h sys/mman.h sys/wait.h])
+
+dnl ******************************
+dnl Check for Win32
+dnl ******************************
+AC_MSG_CHECKING([for Win32])
+case "$host" in
+*-mingw*)
+   os_win32='yes'
+   AC_CACHE_VAL(ac_cv_have_addrinfo, [ac_cv_have_addrinfo=yes])
+   AC_DEFINE(_WIN32_WINNT, 0x501, [To get getaddrinfo etc declarations])
+   ;;
+*)
+   os_win32='no'
+   ;;
+esac
+AC_MSG_RESULT([$os_win32])
+AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
 
 # --------------------------------------------------------------------
 # GLib
 
+GIO_PLAT=
+if test "$os_win32" = "yes" ; then
+   GIO_PLAT=gio-windows-2.0
+else
+   GIO_PLAT=gio-unix-2.0
+fi
+
 PKG_CHECK_MODULES(GLIB,
    glib-2.0 >= 2.32.0
    gio-2.0 >= 2.32.0
-   gio-unix-2.0)
+   $GIO_PLAT)
 LIBS="$LIBS $GLIB_LIBS"
 CFLAGS="$CFLAGS $GLIB_CFLAGS"
 
 GTK_DOC_CHECK(1.9)
 
-GOBJECT_INTROSPECTION_CHECK([1.29])
+AM_CONDITIONAL(HAVE_INTROSPECTION, test "yes" = "no")
+
+dnl GOBJECT_INTROSPECTION_CHECK([1.29])
 AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
 
 # --------------------------------------------------------------------
diff -upr libsecret-0.16.old/egg/egg-secure-memory.c libsecret-0.16/egg/egg-secure-memory.c
--- libsecret-0.16.old/egg/egg-secure-memory.c  2012-10-27 10:23:32 +0000
+++ libsecret-0.16/egg/egg-secure-memory.c  2014-04-20 18:43:03 +0000
@@ -32,7 +32,9 @@
 #include "egg-secure-memory.h"
 
 #include <sys/types.h>
+#ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
+#endif
 #include <stddef.h>
 #include <string.h>
 #include <stdio.h>
@@ -188,9 +190,11 @@ pool_alloc (void)
 
    /* Create a new pool */
    if (pool == NULL) {
+#if !defined(_WIN32)
        len = getpagesize () * 2;
        pages = mmap (0, len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
        if (pages == MAP_FAILED)
+#endif
            return NULL;
 
        /* Fill in the block header, and inlude in block list */
@@ -254,7 +258,9 @@ pool_free (void* item)
        VALGRIND_DESTROY_MEMPOOL (pool);
 #endif
 
+#if !defined(_WIN32)
        munmap (pool, pool->length);
+#endif
        return;
    }
 
@@ -860,11 +866,11 @@ sec_acquire_pages (size_t *sz,
    ASSERT (*sz);
    ASSERT (during_tag);
 
+#if defined(HAVE_MLOCK)
    /* Make sure sz is a multiple of the page size */
    pgsize = getpagesize ();
    *sz = (*sz + pgsize -1) & ~(pgsize - 1);
 
-#if defined(HAVE_MLOCK)
    pages = mmap (0, *sz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
    if (pages == MAP_FAILED) {
        if (show_warning && egg_secure_warnings)
@@ -902,9 +908,9 @@ static void
 sec_release_pages (void *pages, size_t sz)
 {
    ASSERT (pages);
-   ASSERT (sz % getpagesize () == 0);
 
 #if defined(HAVE_MLOCK)
+   ASSERT (sz % getpagesize () == 0);
    if (munlock (pages, sz) < 0 && egg_secure_warnings)
        fprintf (stderr, "couldn't unlock private memory: %s\n", strerror (errno));
 
@@ -914,7 +920,7 @@ sec_release_pages (void *pages, size_t s
    DEBUG_ALLOC ("gkr-secure-memory: freed block ", sz);
 
 #else
-   ASSERT (FALSE);
+   ASSERT (0);
 #endif
 }
 
@@ -937,6 +943,11 @@ sec_block_create (size_t size,
    if (getenv ("SECMEM_FORCE_FALLBACK"))
        return NULL;
 
+#ifdef _WIN32
+   /* win32 does not have mlock(), so just fail in that case */
+   return NULL;
+#endif
+
    block = pool_alloc ();
    if (!block)
        return NULL;
diff -upr libsecret-0.16.old/libsecret/Makefile.am libsecret-0.16/libsecret/Makefile.am
--- libsecret-0.16.old/libsecret/Makefile.am    2013-06-21 13:11:15 +0000
+++ libsecret-0.16/libsecret/Makefile.am    2014-04-20 18:45:31 +0000
@@ -1,6 +1,6 @@
 include $(top_srcdir)/Makefile.decl
 
-SUBDIRS = . tests
+SUBDIRS = .
 
 AM_CPPFLAGS = \
    -I$(top_srcdir) \