diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-08-05 14:56:22 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-08-05 15:16:41 +0200 |
commit | 76cb4dd02a372adebf0db4e03a8c87029c464487 (patch) | |
tree | 9e6bca460eaaa56420bb2b3afd3e912da28d995b | |
parent | dab19eac2c6b4c1ca66d9c4c22c0c1b7ac193310 (diff) | |
download | gnutls-76cb4dd02a372adebf0db4e03a8c87029c464487.tar.gz |
included programs no longer depend on GPL/LGPLv3 elements of gnulib to prevent their accidental inclusion in the library.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | lib/gnutls_errors.c | 1 | ||||
-rw-r--r-- | lib/gnutls_str.c | 1 | ||||
-rw-r--r-- | lib/vasprintf.c | 32 | ||||
-rw-r--r-- | lib/vasprintf.h | 12 | ||||
-rw-r--r-- | lib/xssl.c | 1 | ||||
-rw-r--r-- | src/certtool.c | 1 | ||||
-rw-r--r-- | src/cli-debug.c | 1 | ||||
-rw-r--r-- | src/cli.c | 1 | ||||
-rw-r--r-- | src/crywrap/Makefile.am | 5 | ||||
-rw-r--r-- | src/crywrap/crywrap.c | 15 | ||||
-rw-r--r-- | src/danetool.c | 1 | ||||
-rw-r--r-- | src/ocsptool.c | 2 | ||||
-rw-r--r-- | src/p11tool.c | 1 | ||||
-rw-r--r-- | src/psk.c | 2 | ||||
-rw-r--r-- | src/serv.c | 1 | ||||
-rw-r--r-- | src/srptool.c | 2 | ||||
-rw-r--r-- | src/tpmtool.c | 1 |
20 files changed, 58 insertions, 31 deletions
@@ -7,6 +7,8 @@ See the end for copying conditions. ** libgnutls: Added the PFS priority string option. +** libgnutls: Gnulib included files are strictly LGPLv2. + ** API and ABI modifications: No changes since last version. diff --git a/configure.ac b/configure.ac index 21b76fced9..e8660370b6 100644 --- a/configure.ac +++ b/configure.ac @@ -206,7 +206,7 @@ AC_PROG_LIBTOOL dnl No fork on MinGW, disable some self-tests until we fix them. dnl Check clock_gettime and pthread_mutex_lock in libc (avoid linking to other libs) -AC_CHECK_FUNCS([fork getrusage getpwuid_r nanosleep daemon getpid clock_gettime pthread_mutex_lock iconv localtime],,) +AC_CHECK_FUNCS([fork getrusage getpwuid_r nanosleep daemon getpid clock_gettime pthread_mutex_lock iconv localtime vasprintf],,) AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no") if test "$ac_cv_func_pthread_mutex_lock" != "yes";then @@ -568,9 +568,10 @@ AC_ARG_ENABLE(crywrap, if test "x$enable_crywrap" != "xno" ; then PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no]) + AC_CHECK_FUNCS([argp_usage],[ac_argp=yes],[ac_argp=no]) fi - if test "x$libidn" != "xno" && test "$ac_cv_func_daemon" != "no";then + if test "x$libidn" != "xno" && test "$ac_cv_func_daemon" != "no" && test "$ac_argp" != "no";then crywrap=yes fi diff --git a/lib/Makefile.am b/lib/Makefile.am index 400b3cfd7e..451185945f 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -72,7 +72,7 @@ COBJECTS = gnutls_range.c gnutls_record.c \ gnutls_global.c gnutls_constate.c gnutls_anon_cred.c \ $(srcdir)/pkix_asn1_tab.c \ $(srcdir)/gnutls_asn1_tab.c \ - gnutls_mem.c gnutls_ui.c \ + gnutls_mem.c gnutls_ui.c vasprintf.c vasprintf.h \ gnutls_sig.c gnutls_ecc.c gnutls_dh_primes.c gnutls_alert.c \ system.c gnutls_str.c gnutls_state.c gnutls_x509.c \ gnutls_rsa_export.c gnutls_helper.c gnutls_supplemental.c \ diff --git a/lib/gnutls_errors.c b/lib/gnutls_errors.c index 25bd0ca2ff..2870e466c6 100644 --- a/lib/gnutls_errors.c +++ b/lib/gnutls_errors.c @@ -26,6 +26,7 @@ #ifdef STDC_HEADERS #include <stdarg.h> #endif +#include "vasprintf.h" /* I18n of error codes. */ #include "gettext.h" diff --git a/lib/gnutls_str.c b/lib/gnutls_str.c index 41722fc62e..fb7451a0d2 100644 --- a/lib/gnutls_str.c +++ b/lib/gnutls_str.c @@ -26,6 +26,7 @@ #include <gnutls_str.h> #include <stdarg.h> #include <c-ctype.h> +#include "vasprintf.h" /* These function are like strcat, strcpy. They only * do bound checking (they shouldn't cause buffer overruns), diff --git a/lib/vasprintf.c b/lib/vasprintf.c new file mode 100644 index 0000000000..dcc3061966 --- /dev/null +++ b/lib/vasprintf.c @@ -0,0 +1,32 @@ +#include <config.h> +#include <stdio.h> +#include "vasprintf.h" + +#ifndef HAVE_VASPRINTF + +#define MAX_BSIZE 1024 +#define NO_MORE_MAX (16*MAX_BSIZE) + +int _gnutls_vasprintf(char **strp, const char *fmt, va_list ap) +{ +char * buf; +int ret, max; + + max = MAX_BSIZE/2; + + do + { + max *= 2; + + buf = malloc(max); + if (buf == NULL) + return -1; + + ret = vsnprintf(buf, max, fmt, ap); + } + while (ret > max && max < NO_MORE_MAX); + + return ret; +} + +#endif diff --git a/lib/vasprintf.h b/lib/vasprintf.h new file mode 100644 index 0000000000..6e0090c2d6 --- /dev/null +++ b/lib/vasprintf.h @@ -0,0 +1,12 @@ +#ifndef VASPRINTF_H +# define VASPRINTF_H +#include <config.h> + +#ifndef HAVE_VASPRINTF + +int _gnutls_vasprintf(char **strp, const char *fmt, va_list ap); +#define vasprintf _gnutls_vasprintf + +#endif + +#endif diff --git a/lib/xssl.c b/lib/xssl.c index 0c897d492b..ca2f2530be 100644 --- a/lib/xssl.c +++ b/lib/xssl.c @@ -25,6 +25,7 @@ #include <gnutls_num.h> #include <gnutls/xssl.h> #include <auth/cert.h> +#include "vasprintf.h" #include <xssl.h> diff --git a/src/certtool.c b/src/certtool.c index 06ed505351..2a1a6689a5 100644 --- a/src/certtool.c +++ b/src/certtool.c @@ -93,7 +93,6 @@ tls_log_func (int level, const char *str) int main (int argc, char **argv) { - set_program_name (argv[0]); cfg_init (); cmd_parser (argc, argv); diff --git a/src/cli-debug.c b/src/cli-debug.c index f2759bbf8c..a32a75519b 100644 --- a/src/cli-debug.c +++ b/src/cli-debug.c @@ -176,7 +176,6 @@ main (int argc, char **argv) char portname[6]; struct addrinfo hints, *res, *ptr; - set_program_name (argv[0]); cmd_parser(argc, argv); #ifndef _WIN32 @@ -855,7 +855,6 @@ main (int argc, char **argv) struct sigaction new_action; #endif - set_program_name (argv[0]); cmd_parser (argc, argv); gnutls_global_set_log_function (tls_log_func); diff --git a/src/crywrap/Makefile.am b/src/crywrap/Makefile.am index 9f42db3e79..ca412595e9 100644 --- a/src/crywrap/Makefile.am +++ b/src/crywrap/Makefile.am @@ -17,14 +17,15 @@ AM_CFLAGS = $(WARN_CFLAGS) $(LIBIDN_CFLAGS) AM_CPPFLAGS = \ - -I$(srcdir)/../../gl \ -I$(builddir)/../../lib/includes \ -I$(srcdir)/../../lib/includes \ -DSYSCONFDIR=\"${sysconfdir}\" \ -DCRYWRAP_PATCHLEVEL=\"${CRYWRAP_PATCHLEVEL}\" +# -I$(srcdir)/../../gl + EXTRA_DIST = README bin_PROGRAMS = crywrap crywrap_SOURCES = crywrap.c primes.h crywrap.h -crywrap_LDADD = ../../lib/libgnutls.la ../../gl/libgnu.la $(LIBIDN_LIBS) +crywrap_LDADD = ../../lib/libgnutls.la $(LIBIDN_LIBS) #../../gl/libgnu.la diff --git a/src/crywrap/crywrap.c b/src/crywrap/crywrap.c index 8338d073a9..b0b0799a22 100644 --- a/src/crywrap/crywrap.c +++ b/src/crywrap/crywrap.c @@ -25,9 +25,7 @@ #include <config.h> -#ifdef HAVE_ARGP_H #include <argp.h> -#endif #include <arpa/inet.h> #include <errno.h> #include <fcntl.h> @@ -51,11 +49,6 @@ #include <stdarg.h> #include <unistd.h> -/* Gnulib portability files. */ -#include "progname.h" -#include "argp.h" -#include <read-file.h> - #include "crywrap.h" #include "primes.h" @@ -201,13 +194,10 @@ static gnutls_datum_t load_file (const char *file) { gnutls_datum_t loaded_file = { NULL, 0 }; - size_t length; - loaded_file.data = (void*)read_binary_file (file, &length); - if (loaded_file.data) - loaded_file.size = (unsigned int) length; + gnutls_load_file(file, &loaded_file); - return loaded_file; + return loaded_file; } /** Generic signal handler. @@ -1010,7 +1000,6 @@ main (int argc, char **argv, char **envp) stringprep_locale_charset (); config = _crywrap_config_parse (argc, argv); - set_program_name(__CRYWRAP__); _crywrap_tls_init (); diff --git a/src/danetool.c b/src/danetool.c index fe381f668f..5c2732176f 100644 --- a/src/danetool.c +++ b/src/danetool.c @@ -75,7 +75,6 @@ tls_log_func (int level, const char *str) int main (int argc, char **argv) { - set_program_name (argv[0]); cmd_parser (argc, argv); return 0; diff --git a/src/ocsptool.c b/src/ocsptool.c index 8f9812ca9e..ffbb051672 100644 --- a/src/ocsptool.c +++ b/src/ocsptool.c @@ -380,8 +380,6 @@ main (int argc, char **argv) { int ret; - set_program_name (argv[0]); - if ((ret = gnutls_global_init ()) < 0) error (EXIT_FAILURE, 0, "global_init: %s", gnutls_strerror (ret)); diff --git a/src/p11tool.c b/src/p11tool.c index d54a40807d..924f6bb836 100644 --- a/src/p11tool.c +++ b/src/p11tool.c @@ -63,7 +63,6 @@ tls_log_func (int level, const char *str) int main (int argc, char **argv) { - set_program_name (argv[0]); cmd_parser (argc, argv); return 0; @@ -76,8 +76,6 @@ main (int argc, char **argv) const char* passwd, *username; size_t hex_key_size = sizeof (hex_key); - set_program_name (argv[0]); - if ((ret = gnutls_global_init ()) < 0) { fprintf (stderr, "global_init: %s\n", gnutls_strerror (ret)); diff --git a/src/serv.c b/src/serv.c index 15bb856d95..591ae64869 100644 --- a/src/serv.c +++ b/src/serv.c @@ -946,7 +946,6 @@ main (int argc, char **argv) char name[256]; int cert_set = 0; - set_program_name (argv[0]); cmd_parser (argc, argv); #ifndef _WIN32 diff --git a/src/srptool.c b/src/srptool.c index 76d9692bb7..49a62cf296 100644 --- a/src/srptool.c +++ b/src/srptool.c @@ -424,8 +424,6 @@ int main (int argc, char **argv) struct passwd *pwd; #endif - set_program_name (argv[0]); - if ((ret = gnutls_global_init ()) < 0) { fprintf (stderr, "global_init: %s\n", gnutls_strerror (ret)); diff --git a/src/tpmtool.c b/src/tpmtool.c index fe48563f2b..0c81d3418a 100644 --- a/src/tpmtool.c +++ b/src/tpmtool.c @@ -70,7 +70,6 @@ tls_log_func (int level, const char *str) int main (int argc, char **argv) { - set_program_name (argv[0]); cmd_parser (argc, argv); return 0; |