aboutsummaryrefslogtreecommitdiffstats
path: root/win32/patches/libsecret.patch
blob: 5e6c70e7ff0e481be28e0dadb58272c47a7af06b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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) \