diff options
author | Nikos Mavrogiannopoulos <nmav@crystal.(none)> | 2008-10-16 21:26:29 +0300 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@crystal.(none)> | 2008-10-16 21:26:29 +0300 |
commit | ab62625b71a54138839b203189212cad25c37b91 (patch) | |
tree | 08f600c48e67aa1b9dda57c008bea1f3383eb03c | |
parent | 6fe72f5b13eda85f708ea9612b92789848fbfc5a (diff) | |
parent | a1c1da1939efe571f427a6323a8bb5311d933061 (diff) | |
download | gnutls-ab62625b71a54138839b203189212cad25c37b91.tar.gz |
Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/gnutls
-rw-r--r-- | ChangeLog | 318 | ||||
-rw-r--r-- | GNUmakefile | 8 | ||||
-rw-r--r-- | NEWS | 11 | ||||
-rw-r--r-- | THANKS | 2 | ||||
-rw-r--r-- | configure.in | 1 | ||||
-rw-r--r-- | doc/TODO | 3 | ||||
-rw-r--r-- | gl/Makefile.am | 7 | ||||
-rw-r--r-- | gl/getaddrinfo.c | 16 | ||||
-rw-r--r-- | gl/m4/getaddrinfo.m4 | 5 | ||||
-rw-r--r-- | lgl/Makefile.am | 31 | ||||
-rw-r--r-- | lgl/m4/gnulib-cache.m4 | 3 | ||||
-rw-r--r-- | lgl/m4/gnulib-comp.m4 | 6 | ||||
-rw-r--r-- | lgl/m4/netdb_h.m4 | 32 | ||||
-rw-r--r-- | lgl/m4/stdio_h.m4 | 4 | ||||
-rw-r--r-- | lgl/m4/sys_ioctl_h.m4 | 60 | ||||
-rw-r--r-- | lgl/m4/sys_socket_h.m4 | 8 | ||||
-rw-r--r-- | lgl/m4/unistd_h.m4 | 5 | ||||
-rw-r--r-- | lgl/netdb.in.h | 51 | ||||
-rw-r--r-- | lgl/stdio-write.c | 148 | ||||
-rw-r--r-- | lgl/stdio.in.h | 15 | ||||
-rw-r--r-- | lgl/sys_socket.in.h | 34 | ||||
-rw-r--r-- | lgl/tests/Makefile.am | 9 | ||||
-rw-r--r-- | lgl/tests/test-netdb.c | 29 | ||||
-rw-r--r-- | lgl/unistd.in.h | 27 | ||||
-rw-r--r-- | lgl/winsock.c | 348 | ||||
-rw-r--r-- | lib/gnutls_errors.c | 3 | ||||
-rw-r--r-- | lib/gnutlsxx.cpp | 8 | ||||
-rw-r--r-- | libextra/fipsmd5.c | 4 | ||||
-rw-r--r-- | src/common.h | 4 | ||||
-rw-r--r-- | tests/Makefile.am | 2 |
30 files changed, 1169 insertions, 33 deletions
@@ -1,3 +1,321 @@ +2008-10-16 Simon Josefsson <simon@josefsson.org> + + * NEWS: Version 2.7.0. + +2008-10-16 Simon Josefsson <simon@josefsson.org> + + * configure.in: Drop netdb.h check. + +2008-10-16 Simon Josefsson <simon@josefsson.org> + + * lgl/Makefile.am, lgl/m4/gnulib-cache.m4, lgl/m4/gnulib-comp.m4, + lgl/m4/netdb_h.m4, lgl/netdb.in.h, lgl/tests/Makefile.am, + lgl/tests/test-netdb.c, src/common.h: Add netdb gnulib module. Use + it. + +2008-10-16 Simon Josefsson <simon@josefsson.org> + + * NEWS: Add. + +2008-10-16 Simon Josefsson <simon@josefsson.org> + + * NEWS: Add. + +2008-10-16 Simon Josefsson <simon@josefsson.org> + + * gl/Makefile.am: Upgrade. + +2008-10-16 Simon Josefsson <simon@josefsson.org> + + * GNUmakefile, gl/getaddrinfo.c, gl/m4/getaddrinfo.m4, + lgl/Makefile.am, lgl/m4/gnulib-comp.m4, lgl/m4/stdio_h.m4, + lgl/m4/sys_ioctl_h.m4, lgl/m4/sys_socket_h.m4, lgl/m4/unistd_h.m4, + lgl/stdio-write.c, lgl/stdio.in.h, lgl/sys_socket.in.h, + lgl/unistd.in.h, lgl/winsock.c: Update gnulib files. + +2008-10-15 Simon Josefsson <simon@josefsson.org> + + * tests/Makefile.am: Need to build libutils.la before recursing into + e.g. pkcs12-decode. + +2008-10-14 Simon Josefsson <simon@josefsson.org> + + * lib/gnutlsxx.cpp: Minimize ABI changes. + +2008-10-13 Simon Josefsson <simon@josefsson.org> + + * THANKS: Add. + +2008-10-13 Simon Josefsson <simon@josefsson.org> + + * lib/gnutls_errors.c: Improve GNUTLS_E_AGAIN explanation. + Suggested by "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" + <lavr@ncbi.nlm.nih.gov>. + +2008-10-12 Simon Josefsson <simon@josefsson.org> + + * doc/TODO: Add. + +2008-10-11 Simon Josefsson <simon@josefsson.org> + + * NEWS: Add. + +2008-10-11 Simon Josefsson <simon@josefsson.org> + + * THANKS, libextra/fipsmd5.c: Add static qualifiers on internal + symbols. Tiny patch from Aaron Ucko <ucko@ncbi.nlm.nih.gov>. + +2008-10-09 Simon Josefsson <simon@josefsson.org> + + * doc/reference/Makefile.am: Sync with upstream. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * lib/gnutls_cert.h, lib/opencdk/armor.c, lib/opencdk/hash.c, + lib/opencdk/kbnode.c, lib/opencdk/new-packet.c, + lib/opencdk/seskey.c, lib/opencdk/verify.c, lib/x509/x509_int.h, + src/cfg/platon/str/strplus.c: Fix syntax-check warnings. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * lib/opencdk/opencdk.h: Indent. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * lib/debug.c, lib/opencdk/seskey.c, lib/opencdk/sig-check.c: Drop + gcrypt.h includes. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * NEWS: Mention libgcrypt dependency. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * configure.in, lib/Makefile.am, lib/opencdk/Makefile.am, + lib/openpgp/Makefile.am, lib/x509/Makefile.am, libextra/Makefile.am: + More libgcrypt fixes. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * configure.in, lib/Makefile.am, src/Makefile.am, tests/Makefile.am: + More libgcrypt fixes. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * configure.in, lib/gnutls_global.c, m4/libgcrypt.m4: Modernize + libgcrypt detection. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * doc/reference/gnutls-docs.sgml, includes/gnutls/x509.h, + lib/x509/crl.c, lib/x509/crl_write.c, lib/x509/crq.c, + lib/x509/output.c, lib/x509/x509_write.c: Doc fixes. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * doc/manpages/Makefile.am: Generated. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * NEWS: Sync with real list. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * lib/x509/x509_int.h: Need libtasn1.h here. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * lib/auth_rsa.c, lib/auth_rsa_export.c, lib/gnutls_cert.c, + lib/gnutls_cert.h, lib/gnutls_mpi.h, lib/gnutls_sig.c, + lib/gnutls_x509.c, lib/mpi-libgcrypt.c, lib/rnd-libgcrypt.c: Reduce + libtasn1.h includes. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * configure.in: Drop obsolete libtasn1 flags. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * lib/Makefile.am, libextra/Makefile.am, src/Makefile.am: Update + libtasn1 linker flags. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * GNUmakefile, configure.in, gl/arpa_inet.in.h, gl/c-ctype.h, + gl/gnulib.mk, gl/m4/arpa_inet_h.m4, gl/m4/gnulib-cache.m4, + gl/m4/gnulib-comp.m4, gl/m4/inet_ntop.m4, gl/m4/inet_pton.m4, + gl/strerror.c, lgl/Makefile.am, lgl/c-ctype.h, lgl/errno.in.h, + lgl/m4/gnulib-cache.m4, lgl/m4/gnulib-comp.m4, lgl/m4/memcmp.m4, + lgl/m4/stdio_h.m4, lgl/m4/string_h.m4, lgl/m4/sys_socket_h.m4, + lgl/m4/unistd_h.m4, lgl/m4/wchar.m4, lgl/stdio.in.h, + lgl/string.in.h, lgl/sys_socket.in.h, lgl/unistd.in.h, + libextra/gl/Makefile.am, libextra/gl/m4/gnulib-cache.m4, + libextra/gl/md5.c: Update gnulib files. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * configure.in: Remove obsolete stuff. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * lib/auth_cert.c, lib/gnutls_constate.c, lib/gnutls_mpi.c, + lib/gnutls_pk.c, lib/opencdk/armor.c, lib/opencdk/hash.c, + lib/opencdk/kbnode.c, lib/opencdk/keydb.c, lib/opencdk/pubkey.c, + lib/opencdk/stream.c, lib/openpgp/privkey.c, lib/x509/common.c, + lib/x509/crl.c, lib/x509/crl_write.c, lib/x509/crq.c, + lib/x509/extensions.c, lib/x509/mpi.c, lib/x509/output.c, + lib/x509/privkey.c, lib/x509/x509.c, lib/x509/x509_write.c, + libextra/fipsmd5.c, libextra/gl/md5.c, src/certtool-cfg.c, + src/certtool.c, src/cli.c, src/serv.c: Indent. + +2008-10-08 Simon Josefsson <simon@josefsson.org> + + * NEWS, configure.in, lib/gnutls_global.c, m4/libtasn1.m4: Detect + libtasn1 via AC_LIB_HAVE_LINKFLAGS. + +2008-10-07 Simon Josefsson <simon@josefsson.org> + + * NEWS: Fix. + +2008-10-07 Ludovic Courtès <ludo@gnu.org> + + * tests/Makefile.am: More test compilation fixes with minitasn1. * tests/Makefile.am (AM_CPPFLAGS)[ENABLE_MINITASN1]: Add minitasn1 directory. Signed-off-by: Simon Josefsson <simon@josefsson.org> + +2008-10-07 Simon Josefsson <simon@josefsson.org> + + * NEWS: Add. + +2008-10-07 Ludovic Courtès <ludo@gnu.org> + + * tests/pkcs12-decode/Makefile.am: Fix compilation of + `pkcs12-decode' test when using minitasn1. * tests/pkcs12-decode/Makefile.am (AM_CPPFLAGS)[ENABLE_MINITASN1]: + Add `minitasn1' include directory. Signed-off-by: Simon Josefsson <simon@josefsson.org> + +2008-10-06 Simon Josefsson <simon@josefsson.org> + + * THANKS: Add. + +2008-10-06 Simon Josefsson <simon@josefsson.org> + + * libextra/gnutls_openssl.c: Get issuer dn in X509_get_issuer_name, + correct last patch. + +2008-10-06 Simon Josefsson <simon@josefsson.org> + + * NEWS: Add 2.6.0 entries. + +2008-10-05 Simon Josefsson <simon@josefsson.org> + + * NEWS, configure.in: Bump versions. + +2008-10-05 Simon Josefsson <simon@josefsson.org> + + * NEWS: Add. + +2008-10-05 Simon Josefsson <simon@josefsson.org> + + * libextra/gnutls_openssl.c: Fix out-of-bounds access. Similar to + debian #499945 lynx-cur problem. libextra/gnutls_openssl.c: fix + X509_get_issuer_name to return issuer name of given certificate and + not try to get the subject dn of the issuer certificate wich may or + may not exist. (Checked how openssl does this, too.) This fixes a + accessing an array outside its bounds. Debian bug #499945 is + instructive about the problem. While lynx-cur credits Thomas Dickey + for the bug, the code and implications are essentially the same for + the gnutls openssl-compat libary. Tiny patch from Thomas Viehmann + <tv@beamnet.de>. + +2008-10-04 Nikos Mavrogiannopoulos <nmav@crystal.(none)> + + * src/certtool-cfg.c, src/certtool-cfg.h, src/certtool-common.h, + src/certtool-gaa.c, src/certtool-gaa.h, src/certtool.c, + src/certtool.gaa: reduced warnings in compilation of certtool. + +2008-10-04 Nikos Mavrogiannopoulos <nmav@crystal.(none)> + + * lib/x509/output.c: use union to avoid wrong type issues. + +2008-10-04 Nikos Mavrogiannopoulos <nmav@crystal.(none)> + + * lib/x509/output.c: corrected print order. + +2008-10-04 Nikos Mavrogiannopoulos <nmav@crystal.(none)> + + * NEWS, doc/certtool.cfg, includes/gnutls/x509.h, + lib/gnutls_errors.h, lib/gnutls_handshake.c, lib/x509/common.c, + lib/x509/crl.c, lib/x509/crq.c, lib/x509/dn.c, + lib/x509/extensions.c, lib/x509/mpi.c, lib/x509/output.c, + lib/x509/pkcs12.c, lib/x509/pkcs7.c, lib/x509/x509.c, + lib/x509/x509_int.h, lib/x509/x509_write.c, src/certtool-cfg.c, + src/certtool-cfg.h, src/certtool.c: Added function to copy + extensions from a CRL to a certificate. Reduced many warnings (and + added more by defining gnutls_log as printf like function --gcc + only) + +2008-10-04 Nikos Mavrogiannopoulos <nmav@crystal.(none)> + + * configure.in: Disable certain warnings that do not work with my + compiler. + +2008-10-04 Nikos Mavrogiannopoulos <nmav@crystal.(none)> + + * NEWS, includes/gnutls/x509.h, lib/x509/crq.c, + lib/x509/extensions.c, lib/x509/output.c, src/certtool.c: Added + gnutls_x509_crq_set_key_purpose_oid and + gnutls_x509_crq_get_key_purpose_oid. + +2008-10-04 Nikos Mavrogiannopoulos <nmav@crystal.(none)> + + * NEWS: documentation added functions + +2008-10-04 Nikos Mavrogiannopoulos <nmav@crystal.(none)> + + * NEWS: updated + +2008-10-04 Nikos Mavrogiannopoulos <nmav@crystal.(none)> + + * lib/x509/crq.c, lib/x509/extensions.c, lib/x509/x509_int.h: set + global maximum size for certificate requests' extensions size. + +2008-10-04 Nikos Mavrogiannopoulos <nmav@crystal.(none)> + + * src/Makefile.am: added missing file + +2008-10-04 Nikos Mavrogiannopoulos <nmav@crystal.(none)> + + * includes/gnutls/x509.h, lib/x509/crl.c, lib/x509/crq.c, + lib/x509/extensions.c, lib/x509/mpi.c, lib/x509/output.c, + lib/x509/x509.c, lib/x509/x509_int.h, src/certtool-cfg.c, + src/certtool-cfg.h, src/certtool-common.h, src/certtool-gaa.c, + src/certtool-gaa.h, src/certtool.c, src/certtool.gaa: Added initial + support for certificate requests handling of X.509 extensions. + Added support to certtool to handle these extensions (add/read) + +2008-10-03 Nikos Mavrogiannopoulos <nmav@crystal.(none)> + + * NEWS, doc/certtool.cfg, includes/gnutls/x509.h, lib/x509/crl.c, + lib/x509/crl_write.c, lib/x509/extensions.c, lib/x509/output.c, + lib/x509/x509_int.h, src/certtool-cfg.c, src/certtool-cfg.h, + src/certtool.c: Added functions to handle and set CRL extensions. + +2008-10-01 Simon Josefsson <simon@josefsson.org> + + * po/nl.po.in, po/vi.po.in: Sync with TP. + +2008-10-01 Simon Josefsson <simon@josefsson.org> + + * NEWS, configure.in: Bump versions. + +2008-09-29 Nikos Mavrogiannopoulos <nmav@crystal.(none)> + + * : commit c357933a30801a82e484bed8fbc4bd5b2b34d5e0 Author: Nikos + Mavrogiannopoulos <nmav@crystal.(none)> Date: Mon Sep 29 15:08:02 + 2008 +0300 + +2008-09-29 Simon Josefsson <simon@josefsson.org> + + * ChangeLog: Generated. + 2008-09-29 Simon Josefsson <simon@josefsson.org> * NEWS: Version 2.5.9. diff --git a/GNUmakefile b/GNUmakefile index 7816416eec..0fdd3fa735 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -72,18 +72,18 @@ ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL)) # should run 'autoreconf' (or something like 'make distcheck') to # fix the version, 'make all' to propagate it, then 'make install'. $(info WARNING: version string $(VERSION) is out of date;) - $(info run '$(MAKE) version' to fix it) + $(info run '$(MAKE) _version' to fix it) else $(info INFO: running autoreconf for new version string: $(_curr-ver)) - _dummy := $(shell $(MAKE) $(AM_MAKEFLAGS) version) + _dummy := $(shell $(MAKE) $(AM_MAKEFLAGS) _version) endif endif endif endif endif -.PHONY: version -version: +.PHONY: _version +_version: cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf) else @@ -3,19 +3,28 @@ Copyright (C) 2004, 2005, 2006, 2007, 2008 Simon Josefsson Copyright (C) 2000, 2001, 2002, 2003, 2004 Nikos Mavrogiannopoulos See the end for copying conditions. -* Version 2.7.0 (unreleased) +* Version 2.7.0 (released 2008-10-16) ** libgnutls: Added functions to handle CRL extensions. ** libgnutls: Added functions to handle X.509 extensions in Certificate Requests. +** libgnutls: Improved error string for GNUTLS_E_AGAIN. +Suggested by "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" <lavr@ncbi.nlm.nih.gov>. + ** certtool: Print and set CRL and CRQ extensions. +** libgnutls-extra: Protect internal symbols with static. +Fixes problem when linking certtool statically. Tiny patch from Aaron +Ucko <ucko@ncbi.nlm.nih.gov>. + ** libgnutls-openssl: fix out of bounds access. Problem in X509_get_subject_name and X509_get_issuer_name. Tiny patch from Thomas Viehmann <tv@beamnet.de>. +** libgnutlsxx: Define server_session::get_srp_username even if no SRP. + ** tests: Make tests compile when using internal libtasn1. Patch by ludo@gnu.org (Ludovic Courtès). @@ -91,6 +91,8 @@ Kevin Quick <quick@sparq.org> Arfrever Frehtes Taifersar Arahesis <arfrever.fta@gmail.com> Jonathan Manktelow <jonathan@dyalog.com> Thomas Viehmann <tv@beamnet.de> +Aaron Ucko <ucko@ncbi.nlm.nih.gov> +Anton Lavrentiev <lavr@ncbi.nlm.nih.gov> ---------------------------------------------------------------------- Copying and distribution of this file, with or without modification, diff --git a/configure.in b/configure.in index 2ad1964ed9..9cc33c6d34 100644 --- a/configure.in +++ b/configure.in @@ -207,7 +207,6 @@ AC_MSG_RESULT([*** ]) AC_HEADER_STDC -AC_CHECK_HEADERS(netdb.h) AC_CHECK_FUNCS(fork,,) AC_DEFINE([HAVE_STRINGS_H], 1, [Hard-code for src/cfg/.]) AC_DEFINE([HAVE_FLOAT_H], 1, [Hard-code for src/cfg/.]) @@ -94,6 +94,9 @@ Current list: - Investigate why failed client authentication results in weird error messages. See http://permalink.gmane.org/gmane.network.gnutls.general/875 - Print X.509 DN in the proper order. +- Debug why connections to smtp.hispeed.ch fails (Debian #429183). + Most likely the server is buggy, but it would be useful to document + the problem better. (+) Means high priority (*) Means medium priority diff --git a/gl/Makefile.am b/gl/Makefile.am index 74fa185663..5f75a80e85 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -# Copyright (C) 2006, 2007 Free Software Foundation +# Copyright (C) 2006, 2007, 2008 Free Software Foundation # # Author: Simon Josefsson # @@ -21,17 +21,20 @@ AUTOMAKE_OPTIONS = 1.5 gnits +SUBDIRS = noinst_HEADERS = noinst_LIBRARIES = noinst_LTLIBRARIES = EXTRA_DIST = BUILT_SOURCES = SUFFIXES = -MOSTLYCLEANFILES = +MOSTLYCLEANFILES = core *.stackdump MOSTLYCLEANDIRS = CLEANFILES = DISTCLEANFILES = MAINTAINERCLEANFILES = +SUBDIRS += tests +EXTRA_DIST += m4/gnulib-cache.m4 AM_CPPFLAGS = -I$(top_srcdir)/lgl -I$(top_builddir)/lgl diff --git a/gl/getaddrinfo.c b/gl/getaddrinfo.c index 8c6a9d1026..3016c93f20 100644 --- a/gl/getaddrinfo.c +++ b/gl/getaddrinfo.c @@ -301,6 +301,22 @@ getaddrinfo (const char *restrict nodename, tmp->ai_addr->sa_family = he->h_addrtype; tmp->ai_family = he->h_addrtype; +#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN + switch (he->h_addrtype) + { +#if HAVE_IPV4 + case AF_INET: + tmp->ai_addr->sa_len = sizeof (struct sockaddr_in); + break; +#endif +#if HAVE_IPV6 + case AF_INET6: + tmp->ai_addr->sa_len = sizeof (struct sockaddr_in6); + break; +#endif + } +#endif + /* FIXME: If more than one address, create linked list of addrinfo's. */ *res = tmp; diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4 index 5d36c19505..52135ba947 100644 --- a/gl/m4/getaddrinfo.m4 +++ b/gl/m4/getaddrinfo.m4 @@ -99,6 +99,11 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ AC_REQUIRE([gl_HEADER_SYS_SOCKET]) AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + dnl Including sys/socket.h is wrong for Windows, but Windows does not + dnl have sa_len so the result is correct anyway. + AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [#include <sys/socket.h>]) + AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h) AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[ /* sys/types.h is not needed according to POSIX, but the diff --git a/lgl/Makefile.am b/lgl/Makefile.am index 4908e84784..9e5b8d06df 100644 --- a/lgl/Makefile.am +++ b/lgl/Makefile.am @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --local-dir=lgl/override --lib=liblgnu --source-base=lgl --m4-base=lgl/m4 --doc-base=doc --tests-base=lgl/tests --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=lgl --no-vc-files byteswap c-ctype fseeko func gettext memmem-simple memmove minmax read-file snprintf socklen stdint strcase strverscmp sys_socket sys_stat time_r unistd vasprintf +# Reproduce by: gnulib-tool --import --dir=. --local-dir=lgl/override --lib=liblgnu --source-base=lgl --m4-base=lgl/m4 --doc-base=doc --tests-base=lgl/tests --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=lgl --no-vc-files byteswap c-ctype fseeko func gettext memmem-simple memmove minmax netdb read-file snprintf socklen stdint strcase strverscmp sys_socket sys_stat time_r unistd vasprintf AUTOMAKE_OPTIONS = 1.5 gnits @@ -223,6 +223,28 @@ liblgnu_la_SOURCES += minmax.h ## end gnulib module minmax +## begin gnulib module netdb + +BUILT_SOURCES += $(NETDB_H) + +# We need the following in order to create <netdb.h> when the system +# doesn't have one that works with the given compiler. +netdb.h: netdb.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \ + -e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \ + < $(srcdir)/netdb.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += netdb.h netdb.h-t + +EXTRA_DIST += netdb.in.h + +## end gnulib module netdb + ## begin gnulib module read-file @@ -349,6 +371,7 @@ stdio.h: stdio.in.h -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \ -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \ + -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \ -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \ -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \ -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \ @@ -381,6 +404,7 @@ stdio.h: stdio.in.h -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ + -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ @@ -576,6 +600,7 @@ sys/socket.h: sys_socket.in.h -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \ -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \ + -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ -e 's|@''GNULIB_SOCKET''@|$(GNULIB_SOCKET)|g' \ -e 's|@''GNULIB_CONNECT''@|$(GNULIB_CONNECT)|g' \ -e 's|@''GNULIB_ACCEPT''@|$(GNULIB_ACCEPT)|g' \ @@ -589,6 +614,7 @@ sys/socket.h: sys_socket.in.h -e 's|@''GNULIB_RECVFROM''@|$(GNULIB_RECVFROM)|g' \ -e 's|@''GNULIB_SENDTO''@|$(GNULIB_SENDTO)|g' \ -e 's|@''GNULIB_SETSOCKOPT''@|$(GNULIB_SETSOCKOPT)|g' \ + -e 's|@''GNULIB_SHUTDOWN''@|$(GNULIB_SHUTDOWN)|g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ @@ -679,6 +705,7 @@ unistd.h: unistd.in.h -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ + -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \ -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ @@ -706,12 +733,14 @@ unistd.h: unistd.in.h -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ + -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \ + -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/unistd.in.h; \ } > $@-t diff --git a/lgl/m4/gnulib-cache.m4 b/lgl/m4/gnulib-cache.m4 index 631c5215c3..53904df27b 100644 --- a/lgl/m4/gnulib-cache.m4 +++ b/lgl/m4/gnulib-cache.m4 @@ -15,7 +15,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --local-dir=lgl/override --lib=liblgnu --source-base=lgl --m4-base=lgl/m4 --doc-base=doc --tests-base=lgl/tests --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=lgl --no-vc-files byteswap c-ctype fseeko func gettext memmem-simple memmove minmax read-file snprintf socklen stdint strcase strverscmp sys_socket sys_stat time_r unistd vasprintf +# gnulib-tool --import --dir=. --local-dir=lgl/override --lib=liblgnu --source-base=lgl --m4-base=lgl/m4 --doc-base=doc --tests-base=lgl/tests --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=lgl --no-vc-files byteswap c-ctype fseeko func gettext memmem-simple memmove minmax netdb read-file snprintf socklen stdint strcase strverscmp sys_socket sys_stat time_r unistd vasprintf # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([lgl/override]) @@ -28,6 +28,7 @@ gl_MODULES([ memmem-simple memmove minmax + netdb read-file snprintf socklen diff --git a/lgl/m4/gnulib-comp.m4 b/lgl/m4/gnulib-comp.m4 index d383e12b09..f03b508745 100644 --- a/lgl/m4/gnulib-comp.m4 +++ b/lgl/m4/gnulib-comp.m4 @@ -62,6 +62,7 @@ AC_DEFUN([lgl_INIT], gl_STRING_MODULE_INDICATOR([memmem]) gl_FUNC_MEMMOVE gl_MINMAX + gl_HEADER_NETDB gl_FUNC_READ_FILE gl_FUNC_REALLOC_POSIX gl_STDLIB_MODULE_INDICATOR([realloc-posix]) @@ -79,6 +80,7 @@ AC_DEFUN([lgl_INIT], gl_FUNC_STRVERSCMP gl_STRING_MODULE_INDICATOR([strverscmp]) gl_HEADER_SYS_SOCKET + gl_MODULE_INDICATOR([sys_socket]) AC_PROG_MKDIR_P gl_HEADER_SYS_STAT_H AC_PROG_MKDIR_P @@ -245,6 +247,7 @@ AC_DEFUN([lgl_FILE_LIST], [ lib/memmem.c lib/memmove.c lib/minmax.h + lib/netdb.in.h lib/printf-args.c lib/printf-args.h lib/printf-parse.c @@ -312,6 +315,7 @@ AC_DEFUN([lgl_FILE_LIST], [ m4/memmem.m4 m4/memmove.m4 m4/minmax.m4 + m4/netdb_h.m4 m4/nls.m4 m4/po.m4 m4/printf-posix.m4 @@ -332,6 +336,7 @@ AC_DEFUN([lgl_FILE_LIST], [ m4/string_h.m4 m4/strings_h.m4 m4/strverscmp.m4 + m4/sys_ioctl_h.m4 m4/sys_socket_h.m4 m4/sys_stat_h.m4 m4/threadlib.m4 @@ -357,6 +362,7 @@ AC_DEFUN([lgl_FILE_LIST], [ tests/test-lseek.sh tests/test-memchr.c tests/test-memcmp.c + tests/test-netdb.c tests/test-read-file.c tests/test-snprintf.c tests/test-stdbool.c diff --git a/lgl/m4/netdb_h.m4 b/lgl/m4/netdb_h.m4 new file mode 100644 index 0000000000..8e8ff4aa72 --- /dev/null +++ b/lgl/m4/netdb_h.m4 @@ -0,0 +1,32 @@ +# netdb_h.m4 serial 2 +dnl Copyright (C) 2008 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. + +AC_DEFUN([gl_HEADER_NETDB], +[ + AC_REQUIRE([gl_NETDB_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([netdb.h]) + if test $ac_cv_header_netdb_h = yes; then + NETDB_H='' + HAVE_NETDB_H=1 + else + NETDB_H='netdb.h' + HAVE_NETDB_H=0 + fi + AC_SUBST([HAVE_NETDB_H]) + AC_SUBST([NETDB_H]) +]) + +AC_DEFUN([gl_NETDB_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_NETDB_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_NETDB_H_DEFAULTS], +[ + : +]) diff --git a/lgl/m4/stdio_h.m4 b/lgl/m4/stdio_h.m4 index dea81e3aa5..60b4bd791a 100644 --- a/lgl/m4/stdio_h.m4 +++ b/lgl/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 13 +# stdio_h.m4 serial 14 dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -63,6 +63,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) + GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC]) GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR]) @@ -98,6 +99,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO]) REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL]) REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) + REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE]) HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) diff --git a/lgl/m4/sys_ioctl_h.m4 b/lgl/m4/sys_ioctl_h.m4 new file mode 100644 index 0000000000..5488039b6c --- /dev/null +++ b/lgl/m4/sys_ioctl_h.m4 @@ -0,0 +1,60 @@ +# sys_ioctl_h.m4 serial 1 +dnl Copyright (C) 2008 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 Written by Bruno Haible. + +AC_DEFUN([gl_SYS_IOCTL_H], +[ + dnl Use AC_REQUIRE here, so that the default behavior below is expanded + dnl once only, before all statements that occur in other macros. + AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) + + AC_CHECK_HEADERS_ONCE([sys/ioctl.h]) + if test $ac_cv_header_sys_ioctl_h = yes; then + HAVE_SYS_IOCTL_H=1 + dnl Test whether <sys/ioctl.h> declares ioctl(), or whether some other + dnl header file, such as <unistd.h> or <stropts.h>, is needed for that. + AC_CACHE_CHECK([whether <sys/ioctl.h> declares ioctl], + [gl_cv_decl_ioctl_in_sys_ioctl_h], + [AC_CHECK_DECL([ioctl], + [gl_cv_decl_ioctl_in_sys_ioctl_h=yes], + [gl_cv_decl_ioctl_in_sys_ioctl_h=no], + [#include <sys/ioctl.h>]) + ]) + if test $gl_cv_decl_ioctl_in_sys_ioctl_h != yes; then + SYS_IOCTL_H='sys/ioctl.h' + fi + else + HAVE_SYS_IOCTL_H=0 + SYS_IOCTL_H='sys/ioctl.h' + fi + AC_SUBST([HAVE_SYS_IOCTL_H]) + dnl Execute this unconditionally, because SYS_IOCTL_H may be set by other + dnl modules, after this code is executed. + gl_CHECK_NEXT_HEADERS([sys/ioctl.h]) +]) + +dnl Unconditionally enables the replacement of <sys/ioctl.h>. +AC_DEFUN([gl_REPLACE_SYS_IOCTL_H], +[ + AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) + SYS_IOCTL_H='sys/ioctl.h' +]) + +AC_DEFUN([gl_SYS_IOCTL_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_SYS_IOCTL_H_DEFAULTS], +[ + GNULIB_IOCTL=0; AC_SUBST([GNULIB_IOCTL]) + dnl Assume proper GNU behavior unless another module says otherwise. + SYS_IOCTL_H_HAVE_WINSOCK2_H=0; AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H]) + SYS_IOCTL_H=''; AC_SUBST([SYS_IOCTL_H]) +]) diff --git a/lgl/m4/sys_socket_h.m4 b/lgl/m4/sys_socket_h.m4 index 1e38ee3a9e..fc43d5c5c0 100644 --- a/lgl/m4/sys_socket_h.m4 +++ b/lgl/m4/sys_socket_h.m4 @@ -1,4 +1,4 @@ -# sys_socket_h.m4 serial 8 +# sys_socket_h.m4 serial 11 dnl Copyright (C) 2005-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -71,6 +71,8 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], # Sets and substitutes HAVE_WINSOCK2_H. AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], [ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) AC_CHECK_HEADERS_ONCE([sys/socket.h]) if test $ac_cv_header_sys_socket_h != yes; then dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make @@ -81,6 +83,8 @@ AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], fi if test "$ac_cv_header_winsock2_h" = yes; then HAVE_WINSOCK2_H=1 + UNISTD_H_HAVE_WINSOCK2_H=1 + SYS_IOCTL_H_HAVE_WINSOCK2_H=1 else HAVE_WINSOCK2_H=0 fi @@ -97,6 +101,7 @@ AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], [ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for GNULIB_CLOSE GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET]) GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT]) GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT]) @@ -110,4 +115,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM]) GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) + GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) ]) diff --git a/lgl/m4/unistd_h.m4 b/lgl/m4/unistd_h.m4 index e6eb045cad..e9f7a7d58b 100644 --- a/lgl/m4/unistd_h.m4 +++ b/lgl/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 13 +# unistd_h.m4 serial 14 dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -33,6 +33,7 @@ AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], AC_DEFUN([gl_UNISTD_H_DEFAULTS], [ GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) + GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) @@ -61,10 +62,12 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) + REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE]) + UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H]) ]) diff --git a/lgl/netdb.in.h b/lgl/netdb.in.h new file mode 100644 index 0000000000..aa9e276bf0 --- /dev/null +++ b/lgl/netdb.in.h @@ -0,0 +1,51 @@ +/* Provide a netdb.h header file for systems lacking it (read: MinGW). + Copyright (C) 2008 Free Software Foundation, Inc. + Written by Simon Josefsson. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* This file is supposed to be used on platforms that lack <netdb.h>. + It is intended to provide definitions and prototypes needed by an + application. */ + +#ifndef _GL_NETDB_H + +#if @HAVE_NETDB_H@ + +@PRAGMA_SYSTEM_HEADER@ + +/* The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_NETDB_H@ + +#endif + +#ifndef _GL_NETDB_H +#define _GL_NETDB_H + +#if @HAVE_NETDB_H@ + +/* Declarations for a platform that has <netdb.h>. */ + +#else + +/* Get netdb.h definitions such as struct hostent for MinGW. */ +#include <sys/socket.h> + +/* Declarations for a platform that lacks <netdb.h>. */ + +#endif /* HAVE_NETDB_H */ + +#endif /* _GL_NETDB_H */ +#endif /* _GL_NETDB_H */ diff --git a/lgl/stdio-write.c b/lgl/stdio-write.c new file mode 100644 index 0000000000..0abcfc4088 --- /dev/null +++ b/lgl/stdio-write.c @@ -0,0 +1,148 @@ +/* POSIX compatible FILE stream write function. + Copyright (C) 2008 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2008. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include <stdio.h> + +/* Replace these functions only if module 'sigpipe' is requested. */ +#if GNULIB_SIGPIPE + +/* On native Windows platforms, SIGPIPE does not exist. When write() is + called on a pipe with no readers, WriteFile() fails with error + GetLastError() = ERROR_NO_DATA, and write() in consequence fails with + error EINVAL. This write() function is at the basis of the function + which flushes the buffer of a FILE stream. */ + +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + +# include <errno.h> +# include <signal.h> +# include <io.h> + +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ +# include <windows.h> + +# define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \ + if (ferror (stream)) \ + return (EXPRESSION); \ + else \ + { \ + RETTYPE ret; \ + SetLastError (0); \ + ret = (EXPRESSION); \ + if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream)) \ + { \ + int fd = fileno (stream); \ + if (fd >= 0 \ + && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\ + { \ + /* Try to raise signal SIGPIPE. */ \ + raise (SIGPIPE); \ + /* If it is currently blocked or ignored, change errno from \ + EINVAL to EPIPE. */ \ + errno = EPIPE; \ + } \ + } \ + return ret; \ + } + +# if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */ +int +printf (const char *format, ...) +{ + int retval; + va_list args; + + va_start (args, format); + retval = vfprintf (stdout, format, args); + va_end (args); + + return retval; +} +# endif + +# if !REPLACE_FPRINTF_POSIX /* avoid collision with fprintf.c */ +int +fprintf (FILE *stream, const char *format, ...) +{ + int retval; + va_list args; + + va_start (args, format); + retval = vfprintf (stream, format, args); + va_end (args); + + return retval; +} +# endif + +# if !REPLACE_VFPRINTF_POSIX /* avoid collision with vprintf.c */ +int +vprintf (const char *format, va_list args) +{ + return vfprintf (stdout, format, args); +} +# endif + +# if !REPLACE_VPRINTF_POSIX /* avoid collision with vfprintf.c */ +int +vfprintf (FILE *stream, const char *format, va_list args) +#undef vfprintf +{ + CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF) +} +# endif + +int +putchar (int c) +{ + return fputc (c, stdout); +} + +int +fputc (int c, FILE *stream) +#undef fputc +{ + CALL_WITH_SIGPIPE_EMULATION (int, fputc (c, stream), ret == EOF) +} + +int +fputs (const char *string, FILE *stream) +#undef fputs +{ + CALL_WITH_SIGPIPE_EMULATION (int, fputs (string, stream), ret == EOF) +} + +int +puts (const char *string) +#undef puts +{ + FILE *stream = stdout; + CALL_WITH_SIGPIPE_EMULATION (int, puts (string), ret == EOF) +} + +size_t +fwrite (const void *ptr, size_t s, size_t n, FILE *stream) +#undef fwrite +{ + CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n) +} + +# endif +#endif diff --git a/lgl/stdio.in.h b/lgl/stdio.in.h index 202c3cc6f8..297780111d 100644 --- a/lgl/stdio.in.h +++ b/lgl/stdio.in.h @@ -373,6 +373,21 @@ extern long rpl_ftell (FILE *fp); fflush (f)) #endif +#if @GNULIB_FCLOSE@ +# if @REPLACE_FCLOSE@ +# define fclose rpl_fclose + /* Close STREAM and its underlying file descriptor. */ +extern int fclose (FILE *stream); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fclose +# define fclose(f) \ + (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \ + "use gnulib module fclose for portable " \ + "POSIX compliance"), \ + fclose (f)) +#endif + #if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ # undef fputc # define fputc rpl_fputc diff --git a/lgl/sys_socket.in.h b/lgl/sys_socket.in.h index 4d24d5fc69..980dd59710 100644 --- a/lgl/sys_socket.in.h +++ b/lgl/sys_socket.in.h @@ -138,10 +138,9 @@ rpl_fd_isset (int fd, fd_set * set) /* Wrap everything else to use libc file descriptors for sockets. */ -# if @HAVE_WINSOCK2_H@ +# if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H # undef close -# define close rpl_close -extern int rpl_close(int); +# define close close_used_without_including_unistd_h # endif # if @GNULIB_SOCKET@ @@ -280,12 +279,6 @@ extern int rpl_listen (int, int); listen (s, b)) # endif -# if @HAVE_WINSOCK2_H@ -# undef ioctl -# define ioctl rpl_ioctl -extern int rpl_ioctl (int, unsigned long, char *); -# endif - # if @GNULIB_RECV@ # if @HAVE_WINSOCK2_H@ # undef recv @@ -371,11 +364,34 @@ extern int rpl_setsockopt (int, int, int, const void *, int); setsockopt (s, lvl, o, v, l)) # endif +# if @GNULIB_SHUTDOWN@ +# if @HAVE_WINSOCK2_H@ +# undef shutdown +# define shutdown rpl_shutdown +extern int rpl_shutdown (int, int); +# endif +# elif @HAVE_WINSOCK2_H@ +# undef shutdown +# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown +# elif defined GNULIB_POSIXCHECK +# undef shutdown +# define shutdown(s,h) \ + (GL_LINK_WARNING ("shutdown is not always POSIX compliant - " \ + "use gnulib module shutdown for portability"), \ + shutdown (s, h)) +# endif + # if @HAVE_WINSOCK2_H@ # undef select # define select select_used_without_including_sys_select_h # endif +# if @GNULIB_CLOSE@ && @HAVE_WINSOCK2_H@ +/* gnulib internal function. */ +# define HAVE__GL_CLOSE_FD_MAYBE_SOCKET 1 +extern int _gl_close_fd_maybe_socket (int fd); +# endif + # ifdef __cplusplus } # endif diff --git a/lgl/tests/Makefile.am b/lgl/tests/Makefile.am index 34132030fd..4746df57fc 100644 --- a/lgl/tests/Makefile.am +++ b/lgl/tests/Makefile.am @@ -127,6 +127,15 @@ EXTRA_DIST += test-memcmp.c ## end gnulib module memcmp-tests +## begin gnulib module netdb-tests + +TESTS += test-netdb +check_PROGRAMS += test-netdb + +EXTRA_DIST += test-netdb.c + +## end gnulib module netdb-tests + ## begin gnulib module read-file-tests TESTS += test-read-file diff --git a/lgl/tests/test-netdb.c b/lgl/tests/test-netdb.c new file mode 100644 index 0000000000..cde9105fde --- /dev/null +++ b/lgl/tests/test-netdb.c @@ -0,0 +1,29 @@ +/* Test of <netdb.h> substitute. + Copyright (C) 2007-2008 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Simon Josefsson <simon@josefsson.org>, 2008. */ + +#include <config.h> +#include <netdb.h> + +/* Check that the 'struct hostent' type is defined. */ +struct hostent t1; + +int +main (void) +{ + return 0; +} diff --git a/lgl/unistd.in.h b/lgl/unistd.in.h index 017c4e2146..ddf5c11c17 100644 --- a/lgl/unistd.in.h +++ b/lgl/unistd.in.h @@ -75,6 +75,25 @@ extern int chown (const char *file, uid_t uid, gid_t gid); #endif +#if @GNULIB_CLOSE@ +# if @REPLACE_CLOSE@ +/* Automatically included by modules that need a replacement for close. */ +# undef close +# define close rpl_close +extern int close (int); +# endif +#elif @UNISTD_H_HAVE_WINSOCK2_H@ +# undef close +# define close close_used_without_requesting_gnulib_module_close +#elif defined GNULIB_POSIXCHECK +# undef close +# define close(f) \ + (GL_LINK_WARNING ("close does not portably work on sockets - " \ + "use gnulib module close for portability"), \ + close (f)) +#endif + + #if @GNULIB_DUP2@ # if !@HAVE_DUP2@ /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if @@ -123,8 +142,6 @@ extern char **environ; <http://www.opengroup.org/susv3xsh/fchdir.html>. */ extern int fchdir (int /*fd*/); -# define close rpl_close -extern int close (int); # define dup rpl_dup extern int dup (int); # define dup2 rpl_dup2 @@ -379,6 +396,12 @@ extern ssize_t write (int fd, const void *buf, size_t count); #endif +#ifdef FCHDIR_REPLACEMENT +/* gnulib internal function. */ +extern void _gl_unregister_fd (int fd); +#endif + + #ifdef __cplusplus } #endif diff --git a/lgl/winsock.c b/lgl/winsock.c new file mode 100644 index 0000000000..44654439f6 --- /dev/null +++ b/lgl/winsock.c @@ -0,0 +1,348 @@ +/* winsock.c --- wrappers for Windows socket functions + + Copyright (C) 2008 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Paolo Bonzini */ + +#include <config.h> +#include <stdarg.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <fcntl.h> +#include <io.h> +#include <sys/socket.h> +#if GNULIB_IOCTL +#include <sys/ioctl.h> +#endif + +#undef socket +#undef connect +#undef accept +#undef bind +#undef getpeername +#undef getsockname +#undef getsockopt +#undef listen +#undef recv +#undef send +#undef recvfrom +#undef sendto +#undef setsockopt +#undef shutdown + +#define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd))) +#define SOCKET_TO_FD(fh) (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY)) + + +static inline void +set_winsock_errno (void) +{ + int err = WSAGetLastError (); + WSASetLastError (0); + + /* Map some WSAE* errors to the runtime library's error codes. */ + switch (err) + { + case WSA_INVALID_HANDLE: + errno = EBADF; + break; + case WSA_NOT_ENOUGH_MEMORY: + errno = ENOMEM; + break; + case WSA_INVALID_PARAMETER: + errno = EINVAL; + break; + case WSAEWOULDBLOCK: + errno = EWOULDBLOCK; + break; + case WSAENAMETOOLONG: + errno = ENAMETOOLONG; + break; + case WSAENOTEMPTY: + errno = ENOTEMPTY; + break; + default: + errno = (err > 10000 && err < 10025) ? err - 10000 : err; + break; + } +} + + +/* Hook for gnulib module close. */ + +#if HAVE__GL_CLOSE_FD_MAYBE_SOCKET +int +_gl_close_fd_maybe_socket (int fd) +{ + SOCKET sock = FD_TO_SOCKET (fd); + WSANETWORKEVENTS ev; + + ev.lNetworkEvents = 0xDEADBEEF; + WSAEnumNetworkEvents (sock, NULL, &ev); + if (ev.lNetworkEvents != 0xDEADBEEF) + { + /* FIXME: other applications, like squid, use an undocumented + _free_osfhnd free function. But this is not enough: The 'osfile' + flags for fd also needs to be cleared, but it is hard to access it. + Instead, here we just close twice the file descriptor. */ + if (closesocket (sock)) + { + set_winsock_errno (); + return -1; + } + else + { + /* This call frees the file descriptor and does a + CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails. */ + _close (fd); + return 0; + } + } + else + return _close (fd); +} +#endif + + +/* Wrappers for WinSock functions. */ + +#if GNULIB_SOCKET +int +rpl_socket (int domain, int type, int protocol) +{ + /* We have to use WSASocket() to create non-overlapped IO sockets. + Overlapped IO sockets cannot be used with read/write. */ + SOCKET fh = WSASocket (domain, type, protocol, NULL, 0, 0); + + if (fh == INVALID_SOCKET) + { + set_winsock_errno (); + return -1; + } + else + return SOCKET_TO_FD (fh); +} +#endif + +#if GNULIB_CONNECT +int +rpl_connect (int fd, struct sockaddr *sockaddr, int len) +{ + SOCKET sock = FD_TO_SOCKET (fd); + int r = connect (sock, sockaddr, len); + if (r < 0) + { + /* EINPROGRESS is not returned by WinSock 2.0; for backwards + compatibility, connect(2) uses EWOULDBLOCK. */ + if (WSAGetLastError () == WSAEWOULDBLOCK) + WSASetLastError (WSAEINPROGRESS); + + set_winsock_errno (); + } + + return r; +} +#endif + +#if GNULIB_ACCEPT +int +rpl_accept (int fd, struct sockaddr *addr, int *addrlen) +{ + SOCKET fh = accept (FD_TO_SOCKET (fd), addr, addrlen); + if (fh == INVALID_SOCKET) + { + set_winsock_errno (); + return -1; + } + else + return SOCKET_TO_FD (fh); +} +#endif + +#if GNULIB_BIND +int +rpl_bind (int fd, struct sockaddr *sockaddr, int len) +{ + SOCKET sock = FD_TO_SOCKET (fd); + int r = bind (sock, sockaddr, len); + if (r < 0) + set_winsock_errno (); + + return r; +} +#endif + +#if GNULIB_GETPEERNAME +int +rpl_getpeername (int fd, struct sockaddr *addr, int *addrlen) +{ + SOCKET sock = FD_TO_SOCKET (fd); + int r = getpeername (sock, addr, addrlen); + if (r < 0) + set_winsock_errno (); + + return r; +} +#endif + +#if GNULIB_GETSOCKNAME +int +rpl_getsockname (int fd, struct sockaddr *addr, int *addrlen) +{ + SOCKET sock = FD_TO_SOCKET (fd); + int r = getsockname (sock, addr, addrlen); + if (r < 0) + set_winsock_errno (); + + return r; +} +#endif + +#if GNULIB_GETSOCKOPT +int +rpl_getsockopt (int fd, int level, int optname, void *optval, int *optlen) +{ + SOCKET sock = FD_TO_SOCKET (fd); + int r = getsockopt (sock, level, optname, optval, optlen); + if (r < 0) + set_winsock_errno (); + + return r; +} +#endif + +#if GNULIB_LISTEN +int +rpl_listen (int fd, int backlog) +{ + SOCKET sock = FD_TO_SOCKET (fd); + int r = listen (sock, backlog); + if (r < 0) + set_winsock_errno (); + + return r; +} +#endif + +#if GNULIB_IOCTL +int +rpl_ioctl (int fd, int req, ...) +{ + void *buf; + va_list args; + SOCKET sock; + int r; + + va_start (args, req); + buf = va_arg (args, void *); + va_end (args); + + sock = FD_TO_SOCKET (fd); + r = ioctlsocket (sock, req, buf); + if (r < 0) + set_winsock_errno (); + + return r; +} +#endif + +#if GNULIB_RECV +int +rpl_recv (int fd, void *buf, int len, int flags) +{ + SOCKET sock = FD_TO_SOCKET (fd); + int r = recv (sock, buf, len, flags); + if (r < 0) + set_winsock_errno (); + + return r; +} +#endif + +#if GNULIB_SEND +int +rpl_send (int fd, const void *buf, int len, int flags) +{ + SOCKET sock = FD_TO_SOCKET (fd); + int r = send (sock, buf, len, flags); + if (r < 0) + set_winsock_errno (); + + return r; +} +#endif + +#if GNULIB_RECVFROM +int +rpl_recvfrom (int fd, void *buf, int len, int flags, struct sockaddr *from, + int *fromlen) +{ + int frombufsize = *fromlen; + SOCKET sock = FD_TO_SOCKET (fd); + int r = recvfrom (sock, buf, len, flags, from, fromlen); + + if (r < 0) + set_winsock_errno (); + + /* Winsock recvfrom() only returns a valid 'from' when the socket is + connectionless. POSIX gives a valid 'from' for all types of sockets. */ + else if (*fromlen == frombufsize) + rpl_getpeername (fd, from, fromlen); + + return r; +} +#endif + +#if GNULIB_SENDTO +int +rpl_sendto (int fd, const void *buf, int len, int flags, + struct sockaddr *to, int tolen) +{ + SOCKET sock = FD_TO_SOCKET (fd); + int r = sendto (sock, buf, len, flags, to, tolen); + if (r < 0) + set_winsock_errno (); + + return r; +} +#endif + +#if GNULIB_SETSOCKOPT +int +rpl_setsockopt (int fd, int level, int optname, const void *optval, int optlen) +{ + SOCKET sock = FD_TO_SOCKET (fd); + int r = setsockopt (sock, level, optname, optval, optlen); + if (r < 0) + set_winsock_errno (); + + return r; +} +#endif + +#if GNULIB_SHUTDOWN +int +rpl_shutdown (int fd, int how) +{ + SOCKET sock = FD_TO_SOCKET (fd); + int r = shutdown (sock, how); + if (r < 0) + set_winsock_errno (); + + return r; +} +#endif diff --git a/lib/gnutls_errors.c b/lib/gnutls_errors.c index f95dcb4b88..5a1f71ac33 100644 --- a/lib/gnutls_errors.c +++ b/lib/gnutls_errors.c @@ -156,7 +156,8 @@ static const gnutls_error_entry error_algorithms[] = { GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION, 1), ERROR_ENTRY (N_("Key usage violation in certificate has been detected."), GNUTLS_E_KEY_USAGE_VIOLATION, 1), - ERROR_ENTRY (N_("Function was interrupted."), GNUTLS_E_AGAIN, 0), + ERROR_ENTRY (N_("Resource temporarily unavailable, try again."), + GNUTLS_E_AGAIN, 0), ERROR_ENTRY (N_("Function was interrupted."), GNUTLS_E_INTERRUPTED, 0), ERROR_ENTRY (N_("Rehandshake was requested by the peer."), GNUTLS_E_REHANDSHAKE, 0), diff --git a/lib/gnutlsxx.cpp b/lib/gnutlsxx.cpp index e3745a312c..e7dc163792 100644 --- a/lib/gnutlsxx.cpp +++ b/lib/gnutlsxx.cpp @@ -396,12 +396,14 @@ void session::set_credentials( credentials &cred) RETWRAP(gnutls_credentials_set( s, cred.get_type(), cred.ptr())); } -#ifdef ENABLE_SRP const char* server_session::get_srp_username() const { - return gnutls_srp_server_get_username( s); -} +#ifdef ENABLE_SRP + return gnutls_srp_server_get_username( s); +#else + return NULL; #endif +} const char* server_session::get_psk_username() const { diff --git a/libextra/fipsmd5.c b/libextra/fipsmd5.c index 3edc3f46d9..114c396fd5 100644 --- a/libextra/fipsmd5.c +++ b/libextra/fipsmd5.c @@ -194,7 +194,7 @@ hmacmd5deinit (void *ctx) gnutls_free (p); } -gnutls_crypto_single_digest_st dig = { +static gnutls_crypto_single_digest_st dig = { md5init, NULL, md5hash, @@ -203,7 +203,7 @@ gnutls_crypto_single_digest_st dig = { md5deinit }; -gnutls_crypto_single_mac_st mac = { +static gnutls_crypto_single_mac_st mac = { hmacmd5init, hmacmd5setkey, hmacmd5hash, diff --git a/src/common.h b/src/common.h index 89d22ce944..4d600e2eaf 100644 --- a/src/common.h +++ b/src/common.h @@ -6,14 +6,14 @@ #include <sys/socket.h> #include <arpa/inet.h> +#include <netdb.h> +#include <unistd.h> #ifdef _WIN32 # include <io.h> # include <winbase.h> # define close closesocket #else # include <netinet/in.h> -# include <unistd.h> -# include <netdb.h> # include <signal.h> #endif diff --git a/tests/Makefile.am b/tests/Makefile.am index 9dec41ad2d..3c864b3d86 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,7 +19,7 @@ # along with this file; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -SUBDIRS = rsa-md5-collision pkcs1-padding pkcs8-decode pkcs12-decode \ +SUBDIRS = . rsa-md5-collision pkcs1-padding pkcs8-decode pkcs12-decode \ userid pathlen key-id sha2 hostname-check if ENABLE_OPENPGP |