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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002
|
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' gcr-3.16.0.old/configure.ac gcr-3.16.0/configure.ac
--- gcr-3.16.0.old/configure.ac 2015-05-12 14:27:59 +0000
+++ gcr-3.16.0/configure.ac 2015-07-10 18:39:01 +0000
@@ -79,15 +79,42 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GET
AC_SUBST(GETTEXT_PACKAGE)
AM_GLIB_GNU_GETTEXT
+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 and GTK+ stuff
+GIO_PLAT=
+GTK_PLAT=
+if test "$os_win32" = "yes" ; then
+ GIO_PLAT=gio-windows-2.0
+ GTK_PLAT=gtk+-win32-3.0
+else
+ GIO_PLAT=gio-unix-2.0
+ GTK_PLAT=gtk+-x11-3.0
+fi
+
PKG_CHECK_MODULES(GLIB,
glib-2.0 >= $GLIB_REQ
gmodule-no-export-2.0
gthread-2.0
gobject-2.0
- gio-2.0 gio-unix-2.0)
+ gio-2.0 $GIO_PLAT)
GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=$GLIB_MIN"
GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=$GLIB_MAX"
AC_SUBST(GLIB_CFLAGS)
@@ -99,7 +126,7 @@ AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
GTK_DOC_CHECK(1.9)
-GOBJECT_INTROSPECTION_CHECK([1.34])
+dnl GOBJECT_INTROSPECTION_CHECK([1.34])
if test "$enable_introspection" = "yes"; then
AC_PATH_PROG(XSLTPROC, xsltproc,
AC_MSG_ERROR([Need xsltproc in order to build with gobject introspection])
@@ -116,7 +143,7 @@ AC_ARG_WITH(gtk, [
AM_CONDITIONAL(WITH_GTK, test "$with_gtk" != "no")
if test "x$with_gtk" != "xno"; then
- PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQ gtk+-x11-3.0 >= $GTK_REQ)
+ PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQ $GTK_PLAT >= $GTK_REQ)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
fi
@@ -132,7 +159,7 @@ fi
VALA_REQUIRED=0.18.0.22
-VAPIGEN_CHECK($VALA_REQUIRED)
+dnl VAPIGEN_CHECK($VALA_REQUIRED)
if test "$enable_vala" != "no"; then
AC_PATH_PROG([VALAC], [valac], [])
@@ -145,6 +172,8 @@ AM_CONDITIONAL(HAVE_VALAC, test "x$VALAC
AC_CHECK_FUNCS(timegm, AC_DEFINE(HAVE_TIMEGM,1,[Have timegm]))
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])
# --------------------------------------------------------------------
# p11-kit
@@ -383,6 +412,9 @@ else
valgrind_status="no"
fi
+AM_CONDITIONAL(HAVE_INTROSPECTION, test "yes" = "no")
+AM_CONDITIONAL(ENABLE_VAPIGEN, test "yes" = "no")
+
# ----------------------------------------------------------------------
GCK_LT_RELEASE=$GCK_CURRENT:$GCK_REVISION:$GCK_AGE
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' gcr-3.16.0.old/egg/Makefile.am gcr-3.16.0/egg/Makefile.am
--- gcr-3.16.0.old/egg/Makefile.am 2015-04-06 18:28:46 +0000
+++ gcr-3.16.0/egg/Makefile.am 2015-07-10 18:45:32 +0000
@@ -4,8 +4,7 @@ noinst_LTLIBRARIES += \
libegg.la \
libegg-asn1x.la \
libegg-hex.la \
- libegg-secmem.la \
- libegg-test.la
+ libegg-secmem.la
libegg_la_CFLAGS = \
$(GLIB_CFLAGS) \
@@ -58,15 +57,6 @@ libegg_hex_la_LIBADD = \
libegg_secmem_la_SOURCES = \
egg/egg-secure-memory.c egg/egg-secure-memory.h
-libegg_test_la_SOURCES = \
- egg/egg-testing.c egg/egg-testing.h
-
-libegg_test_la_CFLAGS = \
- $(GLIB_CFLAGS)
-
-libegg_test_la_LIBADD = \
- $(GLIB_LIBS)
-
# -------------------------------------------------------------------
egg_LDADD = \
@@ -74,63 +64,6 @@ egg_LDADD = \
$(LIBGCRYPT_LIBS) \
$(GLIB_LIBS)
-egg_TESTS = \
- test-asn1 \
- test-asn1x \
- test-dn \
- test-decimal \
- test-hex \
- test-hkdf \
- test-oid \
- test-secmem \
- test-padding \
- test-symkey \
- test-armor \
- test-openssl \
- test-dh
-
-test_armor_SOURCES = egg/test-armor.c
-test_armor_LDADD = $(egg_LDADD)
-
-test_asn1_SOURCES = egg/test-asn1.c egg/test.asn.h
-test_asn1_LDADD = $(egg_LDADD)
-
-test_asn1x_SOURCES = egg/test-asn1x.c
-test_asn1x_LDADD = $(egg_LDADD)
-
-test_decimal_SOURCES = egg/test-decimal.c
-test_decimal_LDADD = $(egg_LDADD)
-
-test_dh_SOURCES = egg/test-dh.c
-test_dh_LDADD = $(egg_LDADD)
-
-test_dn_SOURCES = egg/test-dn.c
-test_dn_LDADD = $(egg_LDADD)
-
-test_hex_SOURCES = egg/test-hex.c
-test_hex_LDADD = $(egg_LDADD)
-
-test_hkdf_SOURCES = egg/test-hkdf.c
-test_hkdf_LDADD = $(egg_LDADD)
-
-test_oid_SOURCES = egg/test-oid.c
-test_oid_LDADD = $(egg_LDADD)
-
-test_openssl_SOURCES = egg/test-openssl.c
-test_openssl_LDADD = $(egg_LDADD)
-
-test_padding_SOURCES = egg/test-padding.c
-test_padding_LDADD = $(egg_LDADD)
-
-test_secmem_SOURCES = egg/test-secmem.c
-test_secmem_LDADD = $(egg_LDADD)
-
-test_symkey_SOURCES = egg/test-symkey.c
-test_symkey_LDADD = $(egg_LDADD)
-
-check_PROGRAMS += $(egg_TESTS)
-TESTS += $(egg_TESTS)
-
ASN_SRCS = \
egg/pk.asn \
egg/pkix.asn \
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' gcr-3.16.0.old/egg/egg-armor.c gcr-3.16.0/egg/egg-armor.c
--- gcr-3.16.0.old/egg/egg-armor.c 2015-04-06 18:28:46 +0000
+++ gcr-3.16.0/egg/egg-armor.c 2015-07-10 18:39:01 +0000
@@ -59,6 +59,29 @@ EGG_SECURE_DECLARE (armor);
#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,
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' gcr-3.16.0.old/egg/egg-asn1x.c gcr-3.16.0/egg/egg-asn1x.c
--- gcr-3.16.0.old/egg/egg-asn1x.c 2015-04-06 18:28:46 +0000
+++ gcr-3.16.0/egg/egg-asn1x.c 2015-07-10 18:39:01 +0000
@@ -1928,7 +1928,7 @@ static int
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 @@ two_to_four_digit_year (int year)
/* 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
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' gcr-3.16.0.old/egg/egg-secure-memory.c gcr-3.16.0/egg/egg-secure-memory.c
--- gcr-3.16.0.old/egg/egg-secure-memory.c 2015-04-06 18:28:46 +0000
+++ gcr-3.16.0/egg/egg-secure-memory.c 2015-07-10 18:39:01 +0000
@@ -31,7 +31,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>
@@ -187,9 +189,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 */
@@ -253,7 +257,9 @@ pool_free (void* item)
VALGRIND_DESTROY_MEMPOOL (pool);
#endif
+#if !defined(_WIN32)
munmap (pool, pool->length);
+#endif
return;
}
@@ -859,11 +865,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)
@@ -901,9 +907,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));
@@ -913,7 +919,7 @@ sec_release_pages (void *pages, size_t s
DEBUG_ALLOC ("gkr-secure-memory: freed block ", sz);
#else
- ASSERT (FALSE);
+ ASSERT (0);
#endif
}
@@ -936,6 +942,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 -x .deps -x .libs -x '*.la' -x '*.lo' gcr-3.16.0.old/gck/Makefile.am gcr-3.16.0/gck/Makefile.am
--- gcr-3.16.0.old/gck/Makefile.am 2015-04-06 18:28:46 +0000
+++ gcr-3.16.0/gck/Makefile.am 2015-07-10 18:40:23 +0000
@@ -72,23 +72,6 @@ libgck_@GCK_MAJOR@_la_LIBADD = \
$(GIO_LIBS) \
$(GLIB_LIBS)
-noinst_LTLIBRARIES += libgck-testable.la
-libgck_testable_la_SOURCES = \
- gck/gck-mock.c gck/gck-mock.h \
- gck/gck-test.c gck/gck-test.h
-
-libgck_testable_la_CFLAGS = \
- $(libgck_@GCK_MAJOR@_la_CFLAGS)
-
-libgck_testable_la_LIBADD = \
- $(libgck_@GCK_MAJOR@_la_OBJECTS) \
- libegg-hex.la \
- libegg-secmem.la \
- $(P11_KIT_LIBS) \
- $(GIO_LIBS) \
- $(GLIB_LIBS)
-EXTRA_libgck_testable_la_DEPENDENCIES = $(libgck_@GCK_MAJOR@_la_OBJECTS)
-
gck/gck-marshal.h: gck/gck-marshal.list $(GLIB_GENMARSHAL)
$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=_gck_marshal > $@
@@ -187,78 +170,8 @@ gck_CFLAGS = \
$(GLIB_CFLAGS)
gck_LIBS = \
- libgck-testable.la \
libegg-test.la \
libegg-hex.la \
$(GLIB_LIBS) \
$(P11_KIT_LIBS) \
$(GIO_LIBS)
-
-gck_TESTS = \
- test-gck-attributes \
- test-gck-module \
- test-gck-slot \
- test-gck-session \
- test-gck-object \
- test-gck-crypto \
- test-gck-uri \
- test-gck-enumerator \
- test-gck-modules
-
-test_gck_attributes_SOURCES = gck/test-gck-attributes.c
-test_gck_attributes_CFLAGS = $(gck_CFLAGS)
-test_gck_attributes_LDADD = $(gck_LIBS)
-
-test_gck_crypto_SOURCES = gck/test-gck-crypto.c
-test_gck_crypto_CFLAGS = $(gck_CFLAGS)
-test_gck_crypto_LDADD = $(gck_LIBS)
-
-test_gck_enumerator_SOURCES = \
- gck/test-gck-enumerator.c \
- gck/mock-interaction.c gck/mock-interaction.h
-test_gck_enumerator_CFLAGS = $(gck_CFLAGS)
-test_gck_enumerator_LDADD = $(gck_LIBS)
-
-test_gck_object_SOURCES = gck/test-gck-object.c
-test_gck_object_CFLAGS = $(gck_CFLAGS)
-test_gck_object_LDADD = $(gck_LIBS)
-
-test_gck_module_SOURCES = gck/test-gck-module.c
-test_gck_module_CFLAGS = $(gck_CFLAGS)
-test_gck_module_LDADD = $(gck_LIBS)
-
-test_gck_modules_SOURCES = gck/test-gck-modules.c
-test_gck_modules_CFLAGS = $(gck_CFLAGS)
-test_gck_modules_LDADD = $(gck_LIBS)
-
-test_gck_session_SOURCES = \
- gck/test-gck-session.c \
- gck/mock-interaction.c gck/mock-interaction.h
-test_gck_session_CFLAGS = $(gck_CFLAGS)
-test_gck_session_LDADD = $(gck_LIBS)
-
-test_gck_slot_SOURCES = gck/test-gck-slot.c
-test_gck_slot_CFLAGS = $(gck_CFLAGS)
-test_gck_slot_LDADD = $(gck_LIBS)
-
-test_gck_uri_SOURCES = gck/test-gck-uri.c
-test_gck_uri_CFLAGS = $(gck_CFLAGS)
-test_gck_uri_LDADD = $(gck_LIBS)
-
-check_PROGRAMS += $(gck_TESTS)
-TESTS += $(gck_TESTS)
-
-check_LTLIBRARIES += libmock-test-module.la
-
-libmock_test_module_la_LDFLAGS = \
- -module -avoid-version -shared -rpath $(abs_builddir)
-
-libmock_test_module_la_CFLAGS = \
- -DGCK_API_SUBJECT_TO_CHANGE \
- $(gck_CFLAGS)
-
-libmock_test_module_la_SOURCES = \
- gck/mock-test-module.c
-
-libmock_test_module_la_LIBADD = \
- libgck-testable.la
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' gcr-3.16.0.old/gck/gck-slot.c gcr-3.16.0/gck/gck-slot.c
--- gcr-3.16.0.old/gck/gck-slot.c 2015-04-06 18:28:46 +0000
+++ gcr-3.16.0/gck/gck-slot.c 2015-07-10 18:39:01 +0000
@@ -605,7 +605,7 @@ _gck_token_info_from_pkcs11 (CK_TOKEN_IN
{
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 @@ _gck_token_info_from_pkcs11 (CK_TOKEN_IN
/* 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 @@ _gck_token_info_from_pkcs11 (CK_TOKEN_IN
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 @@ _gck_token_info_to_pkcs11 (GckTokenInfo
/* 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 {
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' gcr-3.16.0.old/gcr/Makefile.am gcr-3.16.0/gcr/Makefile.am
--- gcr-3.16.0.old/gcr/Makefile.am 2015-04-06 18:28:46 +0000
+++ gcr-3.16.0/gcr/Makefile.am 2015-07-10 18:39:01 +0000
@@ -267,136 +267,11 @@ gcr_CFLAGS = \
gcr_LIBS = \
libgcr-base-@GCR_MAJOR@.la \
libegg.la \
- libgck-testable.la \
$(GLIB_LIBS) \
$(LIBGCRYPT_LIBS) \
$(P11_KIT_LIBS)
-gcr_TESTS = \
- test-util \
- test-filter-collection \
- 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 \
- test-gnupg-key \
- test-gnupg-collection \
- test-gnupg-process \
- test-system-prompt
-
-test_certificate_SOURCES = gcr/test-certificate.c
-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)
-
-test_fingerprint_SOURCES = gcr/test-fingerprint.c
-test_fingerprint_CFLAGS = $(gcr_CFLAGS)
-test_fingerprint_LDADD = $(gcr_LIBS)
-
-test_gnupg_collection_SOURCES = gcr/test-gnupg-collection.c
-test_gnupg_collection_CFLAGS = $(gcr_CFLAGS)
-test_gnupg_collection_LDADD = $(gcr_LIBS)
-
-test_gnupg_key_SOURCES = gcr/test-gnupg-key.c
-test_gnupg_key_CFLAGS = $(gcr_CFLAGS)
-test_gnupg_key_LDADD = $(gcr_LIBS)
-
-test_gnupg_process_SOURCES = gcr/test-gnupg-process.c
-test_gnupg_process_CFLAGS = $(gcr_CFLAGS)
-test_gnupg_process_LDADD = $(gcr_LIBS)
-
-test_memory_icon_SOURCES = gcr/test-memory-icon.c
-test_memory_icon_CFLAGS = $(gcr_CFLAGS)
-test_memory_icon_LDADD = $(gcr_LIBS)
-
-test_openpgp_SOURCES = gcr/test-openpgp.c
-test_openpgp_CFLAGS = $(gcr_CFLAGS)
-test_openpgp_LDADD = $(gcr_LIBS)
-
-test_openssh_SOURCES = gcr/test-openssh.c
-test_openssh_CFLAGS = $(gcr_CFLAGS)
-test_openssh_LDADD = $(gcr_LIBS)
-
-test_parser_SOURCES = gcr/test-parser.c
-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)
-
-test_secret_exchange_SOURCES = gcr/test-secret-exchange.c
-test_secret_exchange_CFLAGS = $(gcr_CFLAGS)
-test_secret_exchange_LDADD = $(gcr_LIBS)
-
-test_secure_memory_SOURCES = gcr/test-secure-memory.c
-test_secure_memory_CFLAGS = $(gcr_CFLAGS)
-test_secure_memory_LDADD = $(gcr_LIBS)
-
-test_simple_certificate_SOURCES = gcr/test-simple-certificate.c
-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)
-
-check_PROGRAMS += $(gcr_TESTS)
-TESTS += $(gcr_TESTS)
+gcr_TESTS =
EXTRA_DIST += \
gcr/fixtures
-
-# ------------------------------------------------------------------
-
-noinst_PROGRAMS += \
- frob-openpgp \
- frob-certificate-request \
- frob-parser
-
-frob_certificate_request_SOURCES = \
- gcr/frob-certificate-request.c \
- gcr/console-interaction.c gcr/console-interaction.h
-frob_certificate_request_CFLAGS = $(gcr_CFLAGS)
-frob_certificate_request_LDADD = $(gcr_LIBS)
-
-frob_openpgp_SOURCES = gcr/frob-openpgp.c
-frob_openpgp_CFLAGS = $(gcr_CFLAGS)
-frob_openpgp_LDADD = $(gcr_LIBS)
-
-frob_parser_SOURCES = gcr/frob-parser.c
-frob_parser_CFLAGS = $(gcr_CFLAGS)
-frob_parser_LDADD = $(gcr_LIBS)
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' gcr-3.16.0.old/gcr/gcr-gnupg-collection.c gcr-3.16.0/gcr/gcr-gnupg-collection.c
--- gcr-3.16.0.old/gcr/gcr-gnupg-collection.c 2015-04-06 18:28:46 +0000
+++ gcr-3.16.0/gcr/gcr-gnupg-collection.c 2015-07-10 18:39:01 +0000
@@ -32,7 +32,9 @@
#include "gcr-record.h"
#include "gcr-util.h"
+#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
+#endif
#include <string.h>
enum {
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' gcr-3.16.0.old/gcr/gcr-gnupg-process.c gcr-3.16.0/gcr/gcr-gnupg-process.c
--- gcr-3.16.0.old/gcr/gcr-gnupg-process.c 2015-04-06 18:28:46 +0000
+++ gcr-3.16.0/gcr/gcr-gnupg-process.c 2015-07-10 18:39:01 +0000
@@ -28,7 +28,12 @@
#include <glib/gi18n-lib.h>
+#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
+#endif
+#ifdef G_OS_WIN32
+#include <windows.h>
+#endif
#include <fcntl.h>
#include <errno.h>
#include <string.h>
@@ -851,12 +856,18 @@ on_gnupg_process_child_exited (GPid pid,
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;
gnupg_source->child_sig = 0;
+#ifndef G_OS_WIN32
if (WIFEXITED (status)) {
code = WEXITSTATUS (status);
if (code != 0) {
@@ -870,6 +881,7 @@ on_gnupg_process_child_exited (GPid pid,
error = g_error_new (G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED,
_("Gnupg process was terminated with signal: %d"), code);
}
+#endif
/* Take this as the async result error */
if (error && !self->pv->error) {
@@ -888,11 +900,16 @@ on_gnupg_process_child_exited (GPid pid,
}
complete_source_is_done (gnupg_source);
+
+#ifdef G_OS_WIN32
+ g_spawn_close_pid (pid);
+#endif
}
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 +925,7 @@ on_gnupg_process_child_setup (gpointer u
fcntl (child_fds[i], F_SETFD, val & ~FD_CLOEXEC);
}
}
+#endif
}
static void
@@ -926,9 +944,16 @@ on_cancellable_cancelled (GCancellable *
/* 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);
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 (real_pid, 0);
+#endif
}
}
@@ -997,14 +1022,22 @@ _gcr_gnupg_process_run_async (GcrGnupgPr
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"));
@@ -1032,11 +1065,11 @@ _gcr_gnupg_process_run_async (GcrGnupgPr
g_ptr_array_add (envs, NULL);
gchar *command = g_strjoinv (" ", (gchar**)args->pdata);
- gchar *environ = g_strjoinv (", ", (gchar**)envs->pdata);
+ gchar *environment = g_strjoinv (", ", (gchar**)envs->pdata);
g_debug ("running command: %s", command);
- g_debug ("process environment: %s", environ);
+ g_debug ("process environment: %s", environment);
g_free (command);
- g_free (environ);
+ g_free (environment);
g_spawn_async_with_pipes (self->pv->directory, (gchar**)args->pdata,
(gchar**)envs->pdata, G_SPAWN_DO_NOT_REAP_CHILD,
@@ -1063,7 +1096,12 @@ _gcr_gnupg_process_run_async (GcrGnupgPr
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));
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' gcr-3.16.0.old/gcr/gcr-record.c gcr-3.16.0/gcr/gcr-record.c
--- gcr-3.16.0.old/gcr/gcr-record.c 2015-04-06 18:28:46 +0000
+++ gcr-3.16.0/gcr/gcr-record.c 2015-07-10 18:39:01 +0000
@@ -593,7 +593,9 @@ _gcr_record_get_date (GcrRecord *record,
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 @@ _gcr_record_get_date (GcrRecord *record,
}
/* 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 @@ _gcr_records_parse_colons (gconstpointer
g_free (lines);
return result;
-}
+}
\ No newline at end of file
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' gcr-3.16.0.old/ui/Makefile.am gcr-3.16.0/ui/Makefile.am
--- gcr-3.16.0.old/ui/Makefile.am 2015-04-06 18:28:46 +0000
+++ gcr-3.16.0/ui/Makefile.am 2015-07-10 18:39:01 +0000
@@ -36,11 +36,13 @@ libgcr_ui_@GCR_MAJOR@_la_LIBADD = \
$(GTK_LIBS) \
$(NULL)
+if !OS_WIN32
# 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
+endif
uidir = $(datadir)/gcr-@GCR_MAJOR@/ui/
@@ -285,61 +287,3 @@ ui_LIBS = \
$(GTK_LIBS)
# ------------------------------------------------------------------
-
-noinst_PROGRAMS += \
- frob-certificate \
- frob-combo-selector \
- frob-gnupg-selector \
- frob-import-button \
- frob-key \
- frob-tree-selector \
- frob-prompt \
- frob-request \
- frob-system-prompt \
- frob-unlock \
- frob-unlock-options
-
-frob_certificate_SOURCES = ui/frob-certificate.c
-frob_certificate_CFLAGS = $(ui_CFLAGS)
-frob_certificate_LDADD = $(ui_LIBS)
-
-frob_combo_selector_SOURCES = ui/frob-combo-selector.c
-frob_combo_selector_CFLAGS = $(ui_CFLAGS)
-frob_combo_selector_LDADD = $(ui_LIBS)
-
-frob_gnupg_selector_SOURCES = ui/frob-gnupg-selector.c
-frob_gnupg_selector_CFLAGS = $(ui_CFLAGS)
-frob_gnupg_selector_LDADD = $(ui_LIBS)
-
-frob_import_button_SOURCES = ui/frob-import-button.c
-frob_import_button_CFLAGS = $(ui_CFLAGS)
-frob_import_button_LDADD = $(ui_LIBS)
-
-frob_key_SOURCES = ui/frob-key.c
-frob_key_CFLAGS = $(ui_CFLAGS)
-frob_key_LDADD = $(ui_LIBS)
-
-frob_prompt_SOURCES = ui/frob-prompt.c
-frob_prompt_CFLAGS = $(ui_CFLAGS)
-frob_prompt_LDADD = $(ui_LIBS)
-
-frob_request_SOURCES = ui/frob-request.c
-frob_request_CFLAGS = $(ui_CFLAGS)
-frob_request_LDADD = $(ui_LIBS)
-
-frob_system_prompt_SOURCES = ui/frob-system-prompt.c
-frob_system_prompt_CFLAGS = $(ui_CFLAGS)
-frob_system_prompt_LDADD = $(ui_LIBS)
-
-frob_tree_selector_SOURCES = ui/frob-tree-selector.c
-frob_tree_selector_CFLAGS = $(ui_CFLAGS)
-frob_tree_selector_LDADD = $(ui_LIBS)
-
-frob_unlock_SOURCES = \
- ui/frob-unlock.c ui/gcr-viewer-window.c
-frob_unlock_CFLAGS = $(ui_CFLAGS)
-frob_unlock_LDADD = $(ui_LIBS)
-
-frob_unlock_options_SOURCES = ui/frob-unlock-options.c
-frob_unlock_options_CFLAGS = $(ui_CFLAGS)
-frob_unlock_options_LDADD = $(ui_LIBS)
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' gcr-3.16.0.old/ui/gcr-prompt-dialog.c gcr-3.16.0/ui/gcr-prompt-dialog.c
--- gcr-3.16.0.old/ui/gcr-prompt-dialog.c 2015-04-06 18:28:46 +0000
+++ gcr-3.16.0/ui/gcr-prompt-dialog.c 2015-07-10 18:39:01 +0000
@@ -27,7 +27,13 @@
#include "gcr-secure-entry-buffer.h"
#include <gtk/gtk.h>
+#if defined(GDK_WINDOWING_X11)
#include <gdk/gdkx.h>
+#endif
+#if defined(GDK_WINDOWING_WIN32)
+#include <gdk/gdkwin32.h>
+#include <windows.h>
+#endif
#include <glib/gi18n.h>
/**
@@ -148,12 +154,21 @@ update_transient_for (GcrPromptDialog *s
}
display = gtk_widget_get_display (GTK_WIDGET (self));
+#if defined(GDK_WINDOWING_X11)
transient_for = gdk_x11_window_foreign_new_for_display (display, (Window)handle);
+#elif defined(GDK_WINDOWING_WIN32)
+ transient_for = gdk_win32_window_foreign_new_for_display (display, (HWND)handle);
+#endif
if (transient_for == NULL) {
g_warning ("caller-window property doesn't represent a window on current display: %s",
self->pv->caller_window);
} else {
+#if defined(GDK_WINDOWING_X11)
gdk_window_set_transient_for (window, transient_for);
+#elif defined(GDK_WINDOWING_WIN32)
+ HWND chandle = gdk_win32_window_get_handle (window);
+ SetWindowLongPtr (chandle, GWLP_HWNDPARENT, (LONG_PTR)handle);
+#endif
g_object_unref (transient_for);
}
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' gcr-3.16.0.old/ui/gcr-prompter-tool.c gcr-3.16.0/ui/gcr-prompter-tool.c
--- gcr-3.16.0.old/ui/gcr-prompter-tool.c 2015-04-06 18:28:46 +0000
+++ gcr-3.16.0/ui/gcr-prompter-tool.c 2015-07-10 18:39:01 +0000
@@ -27,13 +27,17 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
+#endif
#include <pango/pango.h>
#include <locale.h>
#include <stdlib.h>
#include <string.h>
+#ifdef HAVE_SYSLOG_H
#include <syslog.h>
+#endif
#define QUIT_TIMEOUT 10
@@ -135,6 +139,7 @@ log_handler (const gchar *log_domain,
const gchar *message,
gpointer user_data)
{
+#ifdef HAVE_SYSLOG_H
int level;
/* Note that crit and err are the other way around in syslog */
@@ -168,6 +173,7 @@ log_handler (const gchar *log_domain,
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);
@@ -176,9 +182,11 @@ log_handler (const gchar *log_domain,
static void
printerr_handler (const gchar *string)
{
+#ifdef HAVE_SYSLOG_H
/* Print to syslog and stderr */
syslog (LOG_WARNING, "%s", string);
fprintf (stderr, "%s", string);
+#endif
}
static void
@@ -188,7 +196,9 @@ prepare_logging ()
G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING |
G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO;
+#ifdef HAVE_SYSLOG_H
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);
|