[git] KSBA - branch, master, updated. libksba-1.3.0-19-g4486cb8
by Dmitry Eremin-Solenikov
cvs at cvs.gnupg.org
Tue Jul 22 09:28:35 CEST 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "KSBA is a library to access X.509 certificates and CMS data.".
The branch, master has been updated
via 4486cb8228eeaefccc800e550cae4cd4701967c1 (commit)
via 64902148236af8f39397bfaf6b5494b342027948 (commit)
via 42aca4c9e575d44436e82e2e6bad6c967f12f21b (commit)
via 21cf824e1547d94f898946715b525e7d41de5899 (commit)
via 70bb73e5da9be83ec170829d7cdab5a1da89d408 (commit)
via ce85db73a9330371d456ccd6a49a8682c31d0ed4 (commit)
via 7f9e09611fce8466a98f53c5dfe4bebb398c708f (commit)
from 5b79ad34ea2d7a86cfe465c81ff6bcd7fc1c06fc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4486cb8228eeaefccc800e550cae4cd4701967c1
Author: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
Date: Sat Jul 12 15:11:19 2014 +0400
Fix two memory leaks in cert-basic test
* tests/cert-basic.c (one_file): always free public key and der2.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
diff --git a/tests/cert-basic.c b/tests/cert-basic.c
index 1a89cd9..91b394e 100644
--- a/tests/cert-basic.c
+++ b/tests/cert-basic.c
@@ -520,11 +520,15 @@ one_file (const char *fname)
__FILE__, __LINE__);
errorcount++;
xfree (der2);
+ } else {
+ /* Don't leak memory if everything is ok. */
+ xfree (der2);
}
xfree (tmp);
}
xfree (der);
}
+ ksba_free (public);
}
}
#endif
commit 64902148236af8f39397bfaf6b5494b342027948
Author: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
Date: Sat Jul 12 15:11:18 2014 +0400
Enable optional valgrind for testsuite
* configure.ac: Enable gnulib valgrind module.
* gl/m4/gnulib.m4: Enable valgrind module.
* tests/Makefile.am: Enable valgrind as LOG_COMPILER.
* gl/m4/valgrind-tests.m4: New
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
diff --git a/configure.ac b/configure.ac
index cc24bbf..372c20c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -362,7 +362,7 @@ AC_CHECK_FUNCS([memmove strchr strtol strtoul stpcpy gmtime_r getenv])
# GNUlib checks
gl_SOURCE_BASE(gl)
gl_M4_BASE(gl/m4)
-gl_MODULES(alloca)
+gl_MODULES(alloca valgrind-tests)
gl_INIT
# To be used in ksba-config
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 3e407d1..f3b46e0 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -9,7 +9,7 @@
#
# Generated by gnulib-tool.
# Invoked as: gnulib-tool --import
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --aux-dir=. --libtool alloca alloca-opt
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --aux-dir=. --libtool alloca alloca-opt valgrind-tests
AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies
diff --git a/gl/m4/gnulib.m4 b/gl/m4/gnulib.m4
index 074e76e..7a975be 100644
--- a/gl/m4/gnulib.m4
+++ b/gl/m4/gnulib.m4
@@ -21,6 +21,7 @@ LTALLOCA=`echo "$ALLOCA" | sed 's/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'`
changequote([, ])dnl
AC_SUBST(LTALLOCA)
gl_FUNC_ALLOCA
+ gl_VALGRIND_TESTS
])
dnl Usage: gl_MODULES(module1 module2 ...)
diff --git a/gl/m4/valgrind-tests.m4 b/gl/m4/valgrind-tests.m4
new file mode 100644
index 0000000..66f81fb
--- /dev/null
+++ b/gl/m4/valgrind-tests.m4
@@ -0,0 +1,37 @@
+# valgrind-tests.m4 serial 3
+dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson
+
+# gl_VALGRIND_TESTS()
+# -------------------
+# Check if valgrind is available, and set VALGRIND to it if available.
+AC_DEFUN([gl_VALGRIND_TESTS],
+[
+ AC_ARG_ENABLE(valgrind-tests,
+ AS_HELP_STRING([--enable-valgrind-tests],
+ [run self tests under valgrind]),
+ [opt_valgrind_tests=$enableval], [opt_valgrind_tests=yes])
+
+ # Run self-tests under valgrind?
+ if test "$opt_valgrind_tests" = "yes" && test "$cross_compiling" = no; then
+ AC_CHECK_PROGS(VALGRIND, valgrind)
+ fi
+
+ OPTS="-q --error-exitcode=1 --leak-check=full"
+
+ if test -n "$VALGRIND" \
+ && $VALGRIND $OPTS $SHELL -c 'exit 0' > /dev/null 2>&1; then
+ opt_valgrind_tests=yes
+ VALGRIND="$VALGRIND $OPTS"
+ else
+ opt_valgrind_tests=no
+ VALGRIND=
+ fi
+
+ AC_MSG_CHECKING([whether self tests are run under valgrind])
+ AC_MSG_RESULT($opt_valgrind_tests)
+])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 013fb84..ae2ad4e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -60,3 +60,5 @@ oidtranstbl.h: Makefile mkoidtbl.awk
/usr/share ; do \
if test -f $$i/dumpasn1.cfg; then f=$$i/dumpasn1.cfg; break; fi; \
done; $(AWK) -f $(srcdir)/mkoidtbl.awk $$f >$@
+
+LOG_COMPILER = $(VALGRIND)
commit 42aca4c9e575d44436e82e2e6bad6c967f12f21b
Author: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
Date: Sat Jul 12 15:11:17 2014 +0400
Fix memory leak in crl parsing code.
* src/crl.c (store_one_entry_extension): Free memory at oid variable -
otherwise libksba leaks memory on crl parsing.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
diff --git a/src/crl.c b/src/crl.c
index a4b1776..87a3fa3 100644
--- a/src/crl.c
+++ b/src/crl.c
@@ -1150,6 +1150,8 @@ store_one_entry_extension (ksba_crl_t crl,
else if (critical)
err = gpg_error (GPG_ERR_UNKNOWN_CRIT_EXTN);
+ xfree (oid);
+
return err;
}
commit 21cf824e1547d94f898946715b525e7d41de5899
Author: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
Date: Sat Jul 12 15:11:16 2014 +0400
Adapt mkoidtbl script to newer dumpasn1 database format
* tests/mkoidtbl.awk: optionally parse oid at OID line.
--
Debian jessie currently has dumpasn1 version 20130608-1. It uses
dumpasn1.cfg with slightly different format:
OID = 0 2 262 1 10
Comment = Deutsche Telekom
Description = Telesec
Adapted mkoidtbl to work on both types of files.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
diff --git a/tests/mkoidtbl.awk b/tests/mkoidtbl.awk
index 70aae33..f6f827f 100644
--- a/tests/mkoidtbl.awk
+++ b/tests/mkoidtbl.awk
@@ -28,11 +28,15 @@ BEGIN {
}
/^[ \t]*#/ { next }
-/^OID/ { flush() }
+/^OID/ { flush()
+ oid = substr($0, index($0, "=") + 2)
+ gsub (/[ \t]+/, ".", oid)
+}
/^Comment/ { comment = substr($0, index($0, "=") + 2 )
gsub(/\r/, "", comment)
gsub (/\\/, "\\\\", comment)
gsub (/"/, "\\\"", comment)
+ gsub (/\(\?\?\?\)/, "(?)", comment)
}
/^Description/ {
desc = substr($0, index($0, "=") + 2)
@@ -40,11 +44,11 @@ BEGIN {
if (match (desc, /\([0-9 \t]+\)/) > 2) {
oid = substr(desc, RSTART+1, RLENGTH-2 )
desc = substr(desc, 1, RSTART-1);
- gsub (/[ \t]+/, ".", oid)
- gsub (/\\/, "\\\\", desc)
- gsub (/"/, "\\\"", desc)
- sub (/[ \t]*$/, "", desc)
}
+ gsub (/[ \t]+/, ".", oid)
+ gsub (/\\/, "\\\\", desc)
+ gsub (/"/, "\\\"", desc)
+ sub (/[ \t]*$/, "", desc)
}
END { flush(); print " { NULL, NULL, NULL }\n};" }
commit 70bb73e5da9be83ec170829d7cdab5a1da89d408
Author: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
Date: Sat Jul 12 15:11:15 2014 +0400
Reuse common test functions in cert-basic test
* tests/cert-basic.c (xmalloc, print_hex, print_sexp, print_time,
print_dn): Drop.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
diff --git a/tests/cert-basic.c b/tests/cert-basic.c
index a70867f..1a89cd9 100644
--- a/tests/cert-basic.c
+++ b/tests/cert-basic.c
@@ -28,6 +28,7 @@
#include "../src/keyinfo.h"
#include "oidtranstbl.h"
+#include "t-common.h"
#ifdef __MINGW32CE__
#define getenv(a) (NULL)
@@ -54,127 +55,6 @@ static int verbose;
static int errorcount = 0;
-static void *
-xmalloc (size_t n)
-{
- char *p = ksba_malloc (n);
- if (!p)
- {
- fprintf (stderr, "out of core\n");
- exit (1);
- }
- return p;
-}
-
-
-void
-print_hex (const unsigned char *p, size_t n)
-{
- if (!p)
- fputs ("none", stdout);
- else
- {
- for (; n; n--, p++)
- printf ("%02X", *p);
- }
-}
-
-
-
-static void
-print_sexp (ksba_const_sexp_t p)
-{
- int level = 0;
-
- if (!p)
- fputs ("[none]", stdout);
- else
- {
- for (;;)
- {
- if (*p == '(')
- {
- putchar (*p);
- p++;
- level++;
- }
- else if (*p == ')')
- {
- putchar (*p);
- p++;
- if (--level <= 0 )
- return;
- }
- else if (!digitp (p))
- {
- fputs ("[invalid s-exp]", stdout);
- return;
- }
- else
- {
- char *endp;
- unsigned long n, i;
- int need_hex;
-
- n = strtoul (p, &endp, 10);
- p = endp;
- if (*p != ':')
- {
- fputs ("[invalid s-exp]", stdout);
- return;
- }
- p++;
- for (i=0; i < n; i++)
- if ( !((p[i] >='A' && p[i] <= 'Z')
- || (p[i] >='a' && p[i] <='z')
- || (p[i] >='0' && p[i] <='9')
- || p[i] == '-'
- || p[i] == '.'))
- break;
- need_hex = (i<n);
- if (!n /* n==0 is not allowed, but anyway. */
- || (!need_hex
- && !((*p >='A' && *p <= 'Z') || (*p >='a' && *p <='z'))))
- printf ("%lu:", n);
-
- if (need_hex)
- {
- putchar('#');
- for (; n; n--, p++)
- printf ("%02X", *p);
- putchar('#');
- }
- else
- {
- for (; n; n--, p++)
- putchar (*p);
- }
- putchar(' ');
- }
- }
- }
-}
-
-static void
-print_time (ksba_isotime_t t)
-{
- if (!t || !*t)
- fputs ("none", stdout);
- else
- printf ("%.4s-%.2s-%.2s %.2s:%.2s:%s", t, t+4, t+6, t+9, t+11, t+13);
-}
-
-static void
-print_dn (char *p)
-{
-
- if (!p)
- fputs ("error", stdout);
- else
- printf ("`%s'", p);
-}
-
-
static void
print_names (int indent, ksba_name_t name)
{
commit ce85db73a9330371d456ccd6a49a8682c31d0ed4
Author: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
Date: Sat Jul 12 15:11:14 2014 +0400
tests: fix print_sexp and print_sexp_hex functions
* tests/t-common.h (print_sexp, print_sexp_hex): advance pointer on
closing brace.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
diff --git a/tests/t-common.h b/tests/t-common.h
index 71512a9..cf82f3e 100644
--- a/tests/t-common.h
+++ b/tests/t-common.h
@@ -110,6 +110,7 @@ print_sexp (ksba_const_sexp_t p)
else if (*p == ')')
{
putchar (*p);
+ p++;
if (--level <= 0 )
return;
}
@@ -176,6 +177,7 @@ print_sexp_hex (ksba_const_sexp_t p)
else if (*p == ')')
{
putchar (*p);
+ p++;
if (--level <= 0 )
return;
}
commit 7f9e09611fce8466a98f53c5dfe4bebb398c708f
Author: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
Date: Sat Jul 12 15:11:13 2014 +0400
tests: Pass -no-install to libtool
* tests/Makefile.am: add AM_LDFLAGS = -no-install
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3680049..013fb84 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -42,6 +42,7 @@ CLEANFILES = oidtranstbl.h
TESTS = cert-basic t-crl-parser t-dnparser
AM_CFLAGS = $(GPG_ERROR_CFLAGS)
+AM_LDFLAGS = -no-install
noinst_HEADERS = t-common.h
noinst_PROGRAMS = $(TESTS) t-cms-parser t-crl-parser t-dnparser t-ocsp t-oid
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 2 +-
gl/Makefile.am | 2 +-
gl/m4/gnulib.m4 | 1 +
gl/m4/valgrind-tests.m4 | 37 ++++++++++++++
src/crl.c | 2 +
tests/Makefile.am | 3 ++
tests/cert-basic.c | 126 ++---------------------------------------------
tests/mkoidtbl.awk | 14 ++++--
tests/t-common.h | 2 +
9 files changed, 61 insertions(+), 128 deletions(-)
create mode 100644 gl/m4/valgrind-tests.m4
hooks/post-receive
--
KSBA is a library to access X.509 certificates and CMS data.
http://git.gnupg.org
More information about the Gnupg-commits
mailing list