debian/0000775000000000000000000000000013162217643007175 5ustar debian/control0000664000000000000000000000526612757104616010615 0ustar Source: libidn Section: libs Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian Libidn Team Uploaders: Anibal Monsalve Salazar , Simon Josefsson Standards-Version: 3.9.4 Build-Depends: debhelper (>= 8.1.3), gcj-jdk [!arm !hppa !hurd-i386], fastjar [!arm !hppa !hurd-i386], dh-autoreconf, help2man, texinfo Vcs-Cvs: :pserver:anonymous@cvs.savannah.gnu.org:/sources/libidn Vcs-Browser: http://cvs.savannah.gnu.org/viewvc/debian-libidn/?root=libidn Homepage: https://www.gnu.org/software/libidn/ Package: idn Section: misc Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: Command line and Emacs interface to GNU Libidn GNU Libidn is a fully documented implementation of the Stringprep, Punycode and IDNA specifications. Libidn's purpose is to encode and decode internationalized domain names. The Nameprep, XMPP, SASLprep, and iSCSI profiles are supported. . This package contains the idn command-line tool and its Emacs lisp interface. Package: libidn11-dev Section: libdevel Architecture: any Depends: libidn11 (= ${binary:Version}), pkg-config, ${misc:Depends} Conflicts: libidn9-dev Description: Development files for GNU Libidn, an IDN library GNU Libidn is a fully documented implementation of the Stringprep, Punycode and IDNA specifications. Libidn's purpose is to encode and decode internationalized domain names. The Nameprep, XMPP, SASLprep, and iSCSI profiles are supported. . This package contains the header files, static library, pkg-config information, API man pages, and the Libidn manual. Package: libidn11 Priority: standard Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Conflicts: libidn9-dev Replaces: libidn11-dev Pre-Depends: ${misc:Pre-Depends} Multi-Arch: same Description: GNU Libidn library, implementation of IETF IDN specifications GNU Libidn is a fully documented implementation of the Stringprep, Punycode and IDNA specifications. Libidn's purpose is to encode and decode internationalized domain names. The Nameprep, XMPP, SASLprep, and iSCSI profiles are supported. . This package contains the shared library. Package: libidn11-java Section: java Architecture: all Depends: ${misc:Depends} Description: Java port of the GNU Libidn library, an IDN implementation GNU Libidn is an implementation of the Stringprep, Punycode and IDNA specifications defined by the IETF Internationalized Domain Names (IDN) working group, used for internationalized domain names. Currently the Nameprep, Kerberos 5 and XMPP Stringprep profiles are supported. . This package contains the native Java port of the library. debian/README.source0000664000000000000000000000172012167261112011346 0ustar We describe here one way to work with the package sources. Initialize cowbuilder: sudo cowbuilder --create --distribution sid --mirror http://http.debian.net/debian --debootstrapopts "--keyring=/usr/share/keyrings/debian-archive-keyring.gpg" --basepath /var/cache/pbuilder/base-debian-sid.cow Optionally update cowbuilder: sudo cowbuilder --update --basepath /var/cache/pbuilder/base-debian-sid.cow Clone the repository: cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/libidn co debian-libidn Get upstream source and setup build directory: wget ftp://ftp.gnu.org/gnu/libidn/libidn-X.tar.gz ln -s libidn-X.tar.gz libidn_X.orig.tar.gz tar xfa libidn-X.tar.gz cp -a debian-libidn/ libidn-X/debian rm -rf libidn-X/debian/CVS libidn-X/debian/source/CVS Build the package: pdebuild --auto-debsign --pbuilder cowbuilder -- --basepath /var/cache/pbuilder/base-debian-sid.cow If all goes well, you should have newly built packages in /var/cache/pbuilder/result/. debian/changelog0000664000000000000000000004052313162217167011054 0ustar libidn (1.28-1ubuntu2.2) trusty-security; urgency=medium * SECURITY UPDATE: Integer overflow - debian/patches/CVE-2017-14062.patch: fix integer overflow in punycode.c. - CVE-2017-14062 -- Marc Deslauriers Mon, 25 Sep 2017 11:19:19 -0400 libidn (1.28-1ubuntu2.1) trusty-security; urgency=medium * SECURITY UPDATE: out-of-bounds read when reading one zero byte - debian/patches/CVE-2015-8948.patch: use getline instead of fgets with fixed-size buffer in gl/Makefile.am, gl/getdelim.c, gl/getline.c, gl/m4/getdelim.m4, gl/m4/getline.m4, gl/m4/gnulib-cache.m4, gl/m4/gnulib-comp.m4, gl/m4/realloc.m4, gl/realloc.c, gl/stdint.in.h, gl/stdlib.in.h, gltests/Makefile.am, gltests/test-getdelim.c, gltests/test-getline.c, src/idn.c. - debian/patches/CVE-2016-6262.patch: add extra check in src/idn.c. - CVE-2015-8948 - CVE-2016-6262 * SECURITY UPDATE: out-of-bounds stack read in idna_to_ascii_4i - debian/patches/CVE-2016-6261-1.patch: fix out of bounds read in lib/idna.c. - debian/patches/CVE-2016-6261-2.patch: fix memory leak in lib/idna.c. - debian/patches/CVE-2016-6261-3.patch: add test to tests/Makefile.am, tests/tst_toascii64oob.c. - CVE-2016-6261 * SECURITY UPDATE: invalid UTF-8 DoS in stringprep_utf8_nfkc_normalize - debian/patches/CVE-2016-6263.patch: reject invalid UTF-8 in lib/nfkc.c, tests/Makefile.am, tests/tst_badutf8nfkc.c. - CVE-2016-6263 * Fix FTBFS caused by docs regeneration - debian/patches/fix_gdoc.patch: fix gdoc script. - debian/control: added help2man and texinfo to Build-Depends. * debian/patches/fix_broken_test.patch: fix broken encoding in test. -- Marc Deslauriers Tue, 23 Aug 2016 13:36:58 -0400 libidn (1.28-1ubuntu2) trusty; urgency=low * Don't run the testsuite on cross builds * Use dh-autoreconf * link-pthread.diff: Fix to use LDFLAGS instead of LDADD -- Adam Conrad Thu, 05 Dec 2013 01:00:24 -0700 libidn (1.28-1ubuntu1) saucy; urgency=low * Build the test-lock and test-thread_create tests with --no-as-needed to fix the test failures. -- Matthias Klose Thu, 26 Sep 2013 16:03:05 +0200 libidn (1.28-1) unstable; urgency=low * New upstream release. * Drop obsolete XS-Dm-Upload-Allowed. * Bump Standards-Version to 3.9.4. -- Simon Josefsson Tue, 09 Jul 2013 21:58:35 +0200 libidn (1.25-2) unstable; urgency=low * Fix copyright format. Use https for upstream homepage. * Use dpkg-buildflags to provide, e.g., hardening flags. -- Simon Josefsson Wed, 30 May 2012 13:27:25 +0200 libidn (1.25-1) unstable; urgency=low * New upstream release. * Disable silent rules (to get more info in build logs). -- Simon Josefsson Thu, 24 May 2012 15:52:07 +0200 libidn (1.24-2) unstable; urgency=low * Moved from experimental to unstable after testing. * Bump Standards-Version to 3.9.3. -- Simon Josefsson Tue, 06 Mar 2012 20:06:11 +0100 libidn (1.24-1) experimental; urgency=low * New upstream release. - License changes, see updated copyright file. -- Simon Josefsson Tue, 10 Jan 2012 22:26:22 +0100 libidn (1.23-2) unstable; urgency=low * Change Maintainer: field to point at mailing list. * Use dh_prep instead of dh_clean -k. -- Simon Josefsson Tue, 06 Dec 2011 18:38:35 +0100 libidn (1.23-1) unstable; urgency=low * New upstream release. -- Simon Josefsson Fri, 25 Nov 2011 12:10:04 +0100 libidn (1.22-3) unstable; urgency=low * Really bump Standards-Version to 3.9.2 this time. * Provide 'build-arch' and 'build-indep' rules to silence lintian. -- Simon Josefsson Mon, 15 Aug 2011 21:05:49 +0200 libidn (1.22-2) unstable; urgency=low [ Steve Langasek ] * Multiarch support. -- Simon Josefsson Tue, 19 Jul 2011 10:06:09 +0200 libidn (1.22-1) unstable; urgency=low * New upstream release. - Handles uppercase XN--. (Closes: #610617) - Be less verbose. (Closes: #615947) * Standards-Version: 3.9.2 -- Simon Josefsson Mon, 20 Jun 2011 10:31:01 +0200 libidn (1.20-1) unstable; urgency=low * New upstream release. * Moved from experimental to unstable after testing. -- Simon Josefsson Tue, 01 Mar 2011 16:14:24 +0100 libidn (1.19-3) experimental; urgency=low * Re-enable self checks on mips(el) since #519006 has been fixed. -- Simon Josefsson Tue, 07 Dec 2010 12:53:07 +0100 libidn (1.19-2) experimental; urgency=low * Upgrade to standards version 3.9.1. -- Simon Josefsson Tue, 07 Dec 2010 08:35:12 +0100 libidn (1.19-1) experimental; urgency=low * New upstream version. * Switch to dpkg-source 3.0 (quilt) format. * Disable self checks on mips(el) due to #519006. * Upload to experimental to test mips(el) patch pending Anibal approval. -- Simon Josefsson Tue, 25 May 2010 07:43:14 +0200 libidn (1.18-1) unstable; urgency=low [ Simon Josefsson ] * New upstream version. * libidn11.symbols: Fix based on upstream changes. * Moved from experimental to unstable after testing. -- Simon Josefsson Mon, 15 Feb 2010 13:36:58 +0100 libidn (1.17-1) experimental; urgency=low [ Simon Josefsson ] * New upstream version. * Upgrade to standards version 3.8.4. * Run 'make check' when building libidn to make sure the build is sane. * Use 'gcj-jdk' instead of 'jdk' as build-depends. [ Marco d'Itri ] * Added a .symbols file. (Closes: #561291) * Don't build-depend on fastjar on architectures without gcj. -- Simon Josefsson Fri, 22 Jan 2010 08:28:34 +0100 libidn (1.15-2) unstable; urgency=low [ Simon Josefsson ] * Bump shlibs to 1.13 because later versions introduced symbol versioning; closes: #550650. * Fix debhelper-but-no-misc-depends for libidn11-java and libidn11-dev. * Add doc-base file to register PDF manual. * Upgrade to standards version 3.8.3. * Remove libidn11-dev's postinst/prerm, as invoking install-info is now handled by debhelper. -- Simon Josefsson Tue, 13 Oct 2009 12:16:12 +0200 libidn (1.15-1) unstable; urgency=low [ Simon Josefsson ] * Let install-info decide where to put libidn.info. * New upstream version. * Build with new --with-packager* variables to make 'idn --help' and 'idn --version' print Debian specific information. -- Simon Josefsson Mon, 08 Jun 2009 11:59:06 +0200 libidn (1.14-3) unstable; urgency=low [ Simon Josefsson ] * Don't use autotools-dev, the config.* files in libidn are newer than what's in autotools-dev. * Use more idiomatatic code to filter out platforms without gcj. Thanks to Adeodato Simó . * Upload to unstable after testing in experimental. -- Simon Josefsson Fri, 17 Apr 2009 00:22:30 +0200 libidn (1.14-2) experimental; urgency=low [ Simon Josefsson ] * Don't build java package on platforms that lack gcj; closes: #518673. * Put libidn11-java package in section java, silences lintian wrong-section-according-to-package-name. -- Simon Josefsson Thu, 16 Apr 2009 09:07:32 +0200 libidn (1.14-1) experimental; urgency=low [ Simon Josefsson ] * New upstream version. - Uses version linker script. * Upgraded to debian policy 3.8.1. -- Simon Josefsson Wed, 08 Apr 2009 18:03:54 +0200 libidn (1.12-2) experimental; urgency=low [ Simon Josefsson ] * Add libidn11-java package; closes: #445302. * Update URL in watch file to point at ftp.gnu.org instead of alpha.gnu.org. * Use "set -e" in postinst/prerm scripts to silence lintian warning maintainer-script-without-set-e. -- Simon Josefsson Tue, 24 Feb 2009 11:16:27 +0100 libidn (1.12-1) unstable; urgency=low [ Simon Josefsson ] * New upstream version. - The manual is now licensed under GFDLv1.3+. * Update and improve information in copyright file. -- Simon Josefsson Tue, 24 Feb 2009 10:19:44 +0100 libidn (1.11-1) experimental; urgency=low [ Simon Josefsson ] * Improve data in copyright file. * Improve package descriptions in control file. * Fix lintian binary-control-field-duplicates-source warning. * New upstream version. - Fixes lintian warning hyphen-used-as-minus-sign in man pages. - Uses DFSG free license for man pages. -- Simon Josefsson Wed, 07 Jan 2009 00:07:14 +0100 libidn (1.10-3) unstable; urgency=low [ Simon Josefsson ] * Add XS-Dm-Upload-Allowed header and Simon as uploader. * Add Vcs-Cvs and Vcs-Browser headers to control. * Bump watch file version to 3 from 2. * Use machine-interpretable copyright file. The information is also significantly improved. * Drop Build-Depends on gengetopt. -- Simon Josefsson Wed, 22 Oct 2008 11:03:59 +0200 libidn (1.10-2.1) unstable; urgency=low * Non-maintainer upload. * Reintroduce libidn11-dev.postinst, do .prerm like debhelper would, just with section Development. Pass -n to dh_installinfo because we do the scripting ourselves. Remove bogus idn.info. Fix wrong order of arguments in install-info call compared to 1.10-1. really Closes: #499201 -- Thomas Viehmann Thu, 18 Sep 2008 18:24:10 +0200 libidn (1.10-2) unstable; urgency=low * Remove libidn11-dev.postinst; closes: #499201 -- Anibal Monsalve Salazar Wed, 17 Sep 2008 14:35:10 +1000 libidn (1.10-1) unstable; urgency=low * New upstream release * Standards-Version is 3.8.0 * Fix info-document-missing-dir-section * Fix info-document-has-wrong-extension -- Anibal Monsalve Salazar Tue, 16 Sep 2008 17:26:02 +1000 libidn (1.9-1) unstable; urgency=low * New upstream release -- Anibal Monsalve Salazar Wed, 09 Jul 2008 20:55:25 +1000 libidn (1.8+20080606-1) unstable; urgency=low * New source from upstream's git tree - Include libidn.pdf libidn.ps libidn.html generated with the new libidn.texi license; closes: #484093 -- Anibal Monsalve Salazar Sat, 07 Jun 2008 09:12:00 +1000 libidn (1.8+20080602-1) unstable; urgency=low * New source from upstream's git tree - Relicense libidn.texi; closes: #484093 * Don't run "$(MAKE) -C doc pdf" (which was introduced in 1.8-1.1 see #424522) and don't remove libidn.pdf libidn.ps libidn.html -- Anibal Monsalve Salazar Mon, 02 Jun 2008 23:38:51 +1000 libidn (1.8-2) unstable; urgency=low * Include info manual image in libidn11-dev; closes: #438150 -- Anibal Monsalve Salazar Sun, 01 Jun 2008 16:06:44 +1000 libidn (1.8-1.1) unstable; urgency=low * Non-maintainer upload. * Rebuild pdf in build rule to fix FTBFS if built twice in a row, closes: #424522. -- Peter Eisentraut Sun, 01 Jun 2008 00:09:22 +0200 libidn (1.8-1) unstable; urgency=low * New upstream release * Get rid of cdbs -- Anibal Monsalve Salazar Wed, 30 Apr 2008 20:17:00 +1000 libidn (1.7-1) unstable; urgency=low * New upstream release -- Anibal Monsalve Salazar Thu, 17 Apr 2008 20:17:34 +1000 libidn (1.6-1) unstable; urgency=low * New upstream release -- Anibal Monsalve Salazar Sun, 06 Apr 2008 10:16:50 +1000 libidn (1.4-1) unstable; urgency=low * New upstream release * Set Standards-Version to 3.7.3 * Set debhelper compatibility to 6 * Updated debian/copyright -- Anibal Monsalve Salazar Sun, 10 Feb 2008 14:15:33 +1100 libidn (1.2-1) unstable; urgency=low * New upstream release. -- Anibal Monsalve Salazar Thu, 04 Oct 2007 23:26:24 +1000 libidn (1.1-1) unstable; urgency=low * New upstream release. -- Anibal Monsalve Salazar Fri, 14 Sep 2007 09:08:52 +1000 libidn (1.0-0) unstable; urgency=low * New upstream release. * Fixed the following lintian message: - W: libidn source: substvar-source-version-is-deprecated libidn11-dev * libidn11, idn: added {misc:Depends} as a dependency. * source package: added priority. -- Anibal Monsalve Salazar Tue, 07 Aug 2007 21:29:54 +1000 libidn (0.6.5-1) unstable; urgency=low * New upstream release. -- Anibal Monsalve Salazar Thu, 13 Jul 2006 22:11:01 +1000 libidn (0.6.3-1) unstable; urgency=low * New upstream release, closes: #333621. * Set Standards-Version to 3.7.2. * Set debian/compat to 5. * Added debian/watch. -- Anibal Monsalve Salazar Fri, 23 Jun 2006 16:10:52 +1000 libidn (0.5.18-2) unstable; urgency=low * New maintainer, closes: #354183. * Set Standards-Version to 3.6.2. * Added homepage in debian/control. -- Anibal Monsalve Salazar Fri, 24 Feb 2006 14:57:39 +1100 libidn (0.5.18-1) unstable; urgency=low * New upstream release -- Ryan M. Golbeck Wed, 20 Jul 2005 08:42:22 -0400 libidn (0.5.13-1.0) unstable; urgency=low * Ack NMU bugs - (Closes: #280171) - (Closes: #283920) * Fixed shlibs (Closes: #299319) -- Ryan M. Golbeck Sun, 13 Mar 2005 22:23:24 -0500 libidn (0.5.13-0.1) unstable; urgency=low * Non-Maintainer Upload, with maintainer consent. * New upstream release (Closes: #280171). + Fixes segfault on powerpc (Closes: #283920). -- Julien BLACHE Fri, 25 Feb 2005 22:45:30 +0100 libidn (0.5.2-3) unstable; urgency=high * Fixed shlib in libidn11 to point to current version (Closes: #267096) -- Ryan M. Golbeck Fri, 20 Aug 2004 23:56:00 -0500 libidn (0.5.2-2) unstable; urgency=low * Fixed conflict with libidn9-dev (Closes: #263977) -- Ryan M. Golbeck Fri, 06 Aug 2004 12:47:00 -0500 libidn (0.5.2-1) unstable; urgency=low * New upstream (Closes: #245758) + Fixes rpath issue (Closes: #244525) * Move .la file from -dev to library package to allow dlopening (Closes: #235889) * Include pdf format of manual and example files (Closes: #233537) -- Ryan M. Golbeck Tue, 03 Aug 2004 23:09:41 -0500 libidn (0.4.1-1) unstable; urgency=low * New upstream (Closes: #231670) * Fixed build dependancy problem (Closes: #233776) * Documentation changes (Closes: #226867) + Reverted to real manpage for idn (Closes: #237766) + libidn11-dev now includes libidn.info and the API manpages -- Ryan M. Golbeck Sun, 14 Mar 2004 10:30:54 -0500 libidn (0.3.4-1) unstable; urgency=low * New upstream release (Closes: #222626) + bumped SO version (dependancy changes, new packages) + fixed output CHARSET (Closes: #202739) * Converted to cdbs * Fixed dependancy of idn package * Increased standards version to 3.6.1 -- Ryan M. Golbeck Thu, 18 Dec 2003 11:17:25 -0500 libidn (0.1.14-2) unstable; urgency=low * Fixed priorities of other binary packages * Changed section of libidn9-dev to libdevel -- Ryan M. Golbeck Fri, 23 May 2003 00:00:00 -0400 libidn (0.1.14-1) unstable; urgency=low * New upstream release * elisp fixes (closes: #192608) * libidn9 made priority standard -- Ryan M. Golbeck Tue, 20 May 2003 22:04:18 -0400 libidn (0.1.11-3) unstable; urgency=low * Fixed section of libidn9-dev package. -- Ryan M. Golbeck Sat, 29 Mar 2003 11:11:12 -0500 libidn (0.1.11-2) unstable; urgency=low * Edited manpage to point to the info page properly. * Added pkg-config dependancy. -- Ryan M. Golbeck Mon, 17 Mar 2003 11:11:11 -0500 libidn (0.1.11-1) unstable; urgency=low * New upstream release (closes: #183378) * Added rules to build idn_cmd.? * Added new binary package to house new upstream commandline and emacs utilities. * Added NEWS and README to libidn9. -- Ryan M. Golbeck Tue, 4 Mar 2003 08:39:29 -0500 libidn (0.1.8-1) unstable; urgency=low * Initial packaging (closes: #181538) -- Ryan M. Golbeck Tue, 18 Feb 2003 00:11:11 -0500 debian/libidn11.postrm0000664000000000000000000000011311151533133012030 0ustar #! /bin/sh set -e if [ "$1" = "remove" ]; then ldconfig fi #DEBHELPER# debian/libidn11.install0000664000000000000000000000003711611235171012161 0ustar debian/tmp/usr/lib/*/lib*.so.* debian/source/0000775000000000000000000000000012167261142010472 5ustar debian/source/format0000664000000000000000000000001411376025747011712 0ustar 3.0 (quilt) debian/compat0000664000000000000000000000000211077565771010406 0ustar 5 debian/libidn11-java.install0000664000000000000000000000004611150744446013110 0ustar debian/tmp/usr/share/java/libidn*.jar debian/patches/0000775000000000000000000000000013162217165010623 5ustar debian/patches/CVE-2016-6262.patch0000664000000000000000000000132512756643516013260 0ustar From 5e3cb9c7b5bf0ce665b9d68f5ddf095af5c9ba60 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Thu, 14 Jan 2016 14:59:19 +0100 Subject: Really fix bug when reading \00 inputs. --- src/idn.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/idn.c b/src/idn.c index b40ed62..be1c7d1 100644 --- a/src/idn.c +++ b/src/idn.c @@ -200,8 +200,9 @@ main (int argc, char *argv[]) error (EXIT_FAILURE, errno, _("input error")); } - if (line[strlen (line) - 1] == '\n') - line[strlen (line) - 1] = '\0'; + if (strlen (line) > 0) + if (line[strlen (line) - 1] == '\n') + line[strlen (line) - 1] = '\0'; if (args_info.stringprep_given) { -- cgit v1.0 debian/patches/CVE-2015-8948.patch0000664000000000000000000032144712756651064013303 0ustar Backport of: From 570e68886c41c2e765e6218cb317d9a9a447a041 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Mon, 10 Aug 2015 10:23:30 +0200 Subject: idn: Use getline instead of fgets with fixed-size buffer. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes out-of-bounds read, reported by Hanno Böck. --- .gitignore | 1 + gl/Makefile.am | 196 +++++++++- gl/getdelim.c | 135 +++++++ gl/getline.c | 27 ++ gl/m4/getdelim.m4 | 88 +++++ gl/m4/getline.m4 | 96 +++++ gl/m4/gnulib-cache.m4 | 3 +- gl/m4/gnulib-comp.m4 | 40 +- gl/m4/realloc.m4 | 76 ++++ gl/realloc.c | 79 ++++ gl/stdint.in.h | 635 +++++++++++++++++++++++++++++++ gl/stdlib.in.h | 977 ++++++++++++++++++++++++++++++++++++++++++++++++ gltests/Makefile.am | 173 +-------- gltests/stdint.in.h | 635 ------------------------------- gltests/stdlib.in.h | 977 ------------------------------------------------ gltests/test-getdelim.c | 94 +++++ gltests/test-getline.c | 94 +++++ src/idn.c | 35 +- 18 files changed, 2570 insertions(+), 1791 deletions(-) create mode 100644 gl/getdelim.c create mode 100644 gl/getline.c create mode 100644 gl/m4/getdelim.m4 create mode 100644 gl/m4/getline.m4 create mode 100644 gl/m4/realloc.m4 create mode 100644 gl/realloc.c create mode 100644 gl/stdint.in.h create mode 100644 gl/stdlib.in.h delete mode 100644 gltests/stdint.in.h delete mode 100644 gltests/stdlib.in.h create mode 100644 gltests/test-getdelim.c create mode 100644 gltests/test-getline.c Index: libidn-1.28/gl/Makefile.am =================================================================== --- libidn-1.28.orig/gl/Makefile.am 2016-08-22 15:25:24.923902343 -0400 +++ libidn-1.28/gl/Makefile.am 2016-08-22 15:25:24.919902304 -0400 @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gltests --aux-dir=build-aux --with-tests --avoid=fcntl-h-tests --avoid=stdlib-tests --avoid=string-tests --avoid=sys_stat-tests --avoid=time-tests --avoid=unistd-tests --avoid=update-copyright-tests --avoid=wchar-tests --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files autobuild csharpcomp-script csharpexec-script error fdl-1.3 gendocs getopt-gnu gnupload maintainer-makefile manywarnings pmccabe2html progname update-copyright useless-if-before-free valgrind-tests vc-list-files version-etc warnings +# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gltests --aux-dir=build-aux --with-tests --avoid=fcntl-h-tests --avoid=stdlib-tests --avoid=string-tests --avoid=sys_stat-tests --avoid=time-tests --avoid=unistd-tests --avoid=update-copyright-tests --avoid=wchar-tests --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files autobuild csharpcomp-script csharpexec-script error fdl-1.3 gendocs getline getopt-gnu gnupload maintainer-makefile manywarnings pmccabe2html progname update-copyright useless-if-before-free valgrind-tests vc-list-files version-etc warnings AUTOMAKE_OPTIONS = 1.9.6 gnits @@ -116,6 +116,24 @@ ## end gnulib module gendocs +## begin gnulib module getdelim + + +EXTRA_DIST += getdelim.c + +EXTRA_libgnu_la_SOURCES += getdelim.c + +## end gnulib module getdelim + +## begin gnulib module getline + + +EXTRA_DIST += getline.c + +EXTRA_libgnu_la_SOURCES += getline.c + +## end gnulib module getline + ## begin gnulib module getopt-posix BUILT_SOURCES += $(GETOPT_H) @@ -210,6 +228,27 @@ ## end gnulib module progname +## begin gnulib module realloc-posix + + +EXTRA_DIST += realloc.c + +EXTRA_libgnu_la_SOURCES += realloc.c + +## end gnulib module realloc-posix + +## begin gnulib module snippet/_Noreturn + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all Makefile.am that +# need it. This is ensured by the applicability 'all' defined above. + +_NORETURN_H=$(top_srcdir)/build-aux/snippet/_Noreturn.h + +EXTRA_DIST += $(top_srcdir)/build-aux/snippet/_Noreturn.h + +## end gnulib module snippet/_Noreturn + ## begin gnulib module snippet/arg-nonnull # The BUILT_SOURCES created by this Makefile snippet are not used via #include @@ -337,6 +376,161 @@ ## end gnulib module stddef +## begin gnulib module stdint + +BUILT_SOURCES += $(STDINT_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +if GL_GENERATE_STDINT_H +stdint.h: stdint.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ + -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ + -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ + -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ + -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ + -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ + -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ + -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ + -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ + -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ + -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ + -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ + -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ + -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ + -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ + < $(srcdir)/stdint.in.h; \ + } > $@-t && \ + mv $@-t $@ +else +stdint.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += stdint.h stdint.h-t + +EXTRA_DIST += stdint.in.h + +## end gnulib module stdint + +## begin gnulib module stdlib + +BUILT_SOURCES += stdlib.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ + $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ + -e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \ + -e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \ + -e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \ + -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \ + -e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \ + -e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \ + -e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \ + -e 's/@''GNULIB_MALLOC_POSIX''@/$(GNULIB_MALLOC_POSIX)/g' \ + -e 's/@''GNULIB_MBTOWC''@/$(GNULIB_MBTOWC)/g' \ + -e 's/@''GNULIB_MKDTEMP''@/$(GNULIB_MKDTEMP)/g' \ + -e 's/@''GNULIB_MKOSTEMP''@/$(GNULIB_MKOSTEMP)/g' \ + -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \ + -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \ + -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \ + -e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \ + -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \ + -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \ + -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \ + -e 's/@''GNULIB_QSORT_R''@/$(GNULIB_QSORT_R)/g' \ + -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \ + -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ + -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ + -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ + -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ + -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \ + -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \ + -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \ + -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \ + -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \ + -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \ + -e 's/@''GNULIB_UNLOCKPT''@/$(GNULIB_UNLOCKPT)/g' \ + -e 's/@''GNULIB_UNSETENV''@/$(GNULIB_UNSETENV)/g' \ + -e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \ + < $(srcdir)/stdlib.in.h | \ + sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ + -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ + -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ + -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ + -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ + -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ + -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ + -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ + -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ + -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \ + -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \ + -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \ + -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \ + -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \ + -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \ + -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ + -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ + -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ + -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ + -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \ + -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ + -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ + -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ + -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ + -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ + -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ + -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \ + -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ + -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ + -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ + -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ + -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ + -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ + -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \ + -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ + -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ + -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \ + -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ + -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ + -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ + -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ + -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ + -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ + -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _Noreturn/r $(_NORETURN_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += stdlib.h stdlib.h-t + +EXTRA_DIST += stdlib.in.h + +## end gnulib module stdlib + ## begin gnulib module strerror Index: libidn-1.28/gl/getdelim.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/gl/getdelim.c 2016-08-22 15:25:24.919902304 -0400 @@ -0,0 +1,135 @@ +/* getdelim.c --- Implementation of replacement getdelim function. + Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2015 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, 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 . */ + +/* Ported from glibc by Simon Josefsson. */ + +/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc + optimizes away the lineptr == NULL || n == NULL || fp == NULL tests below. */ +#define _GL_ARG_NONNULL(params) + +#include + +#include + +#include +#include +#include +#include + +#ifndef SSIZE_MAX +# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) +#endif + +#if USE_UNLOCKED_IO +# include "unlocked-io.h" +# define getc_maybe_unlocked(fp) getc(fp) +#elif !HAVE_FLOCKFILE || !HAVE_FUNLOCKFILE || !HAVE_DECL_GETC_UNLOCKED +# undef flockfile +# undef funlockfile +# define flockfile(x) ((void) 0) +# define funlockfile(x) ((void) 0) +# define getc_maybe_unlocked(fp) getc(fp) +#else +# define getc_maybe_unlocked(fp) getc_unlocked(fp) +#endif + +/* Read up to (and including) a DELIMITER from FP into *LINEPTR (and + NUL-terminate it). *LINEPTR is a pointer returned from malloc (or + NULL), pointing to *N characters of space. It is realloc'ed as + necessary. Returns the number of characters read (not including + the null terminator), or -1 on error or EOF. */ + +ssize_t +getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp) +{ + ssize_t result; + size_t cur_len = 0; + + if (lineptr == NULL || n == NULL || fp == NULL) + { + errno = EINVAL; + return -1; + } + + flockfile (fp); + + if (*lineptr == NULL || *n == 0) + { + char *new_lineptr; + *n = 120; + new_lineptr = (char *) realloc (*lineptr, *n); + if (new_lineptr == NULL) + { + result = -1; + goto unlock_return; + } + *lineptr = new_lineptr; + } + + for (;;) + { + int i; + + i = getc_maybe_unlocked (fp); + if (i == EOF) + { + result = -1; + break; + } + + /* Make enough space for len+1 (for final NUL) bytes. */ + if (cur_len + 1 >= *n) + { + size_t needed_max = + SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX; + size_t needed = 2 * *n + 1; /* Be generous. */ + char *new_lineptr; + + if (needed_max < needed) + needed = needed_max; + if (cur_len + 1 >= needed) + { + result = -1; + errno = EOVERFLOW; + goto unlock_return; + } + + new_lineptr = (char *) realloc (*lineptr, needed); + if (new_lineptr == NULL) + { + result = -1; + goto unlock_return; + } + + *lineptr = new_lineptr; + *n = needed; + } + + (*lineptr)[cur_len] = i; + cur_len++; + + if (i == delimiter) + break; + } + (*lineptr)[cur_len] = '\0'; + result = cur_len ? cur_len : result; + + unlock_return: + funlockfile (fp); /* doesn't set errno */ + + return result; +} Index: libidn-1.28/gl/getline.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/gl/getline.c 2016-08-22 15:25:24.919902304 -0400 @@ -0,0 +1,27 @@ +/* getline.c --- Implementation of replacement getline function. + Copyright (C) 2005-2007, 2009-2015 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, 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 . */ + +/* Written by Simon Josefsson. */ + +#include + +#include + +ssize_t +getline (char **lineptr, size_t *n, FILE *stream) +{ + return getdelim (lineptr, n, '\n', stream); +} Index: libidn-1.28/gl/m4/getdelim.m4 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/gl/m4/getdelim.m4 2016-08-22 15:25:24.919902304 -0400 @@ -0,0 +1,88 @@ +# getdelim.m4 serial 10 + +dnl Copyright (C) 2005-2007, 2009-2015 Free Software Foundation, Inc. +dnl +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_PREREQ([2.59]) + +AC_DEFUN([gl_FUNC_GETDELIM], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + + dnl Persuade glibc to declare getdelim(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_CHECK_DECLS_ONCE([getdelim]) + + AC_CHECK_FUNCS_ONCE([getdelim]) + if test $ac_cv_func_getdelim = yes; then + HAVE_GETDELIM=1 + dnl Found it in some library. Verify that it works. + AC_CACHE_CHECK([for working getdelim function], [gl_cv_func_working_getdelim], + [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +# include +# include +# include + int main () + { + FILE *in = fopen ("./conftest.data", "r"); + if (!in) + return 1; + { + /* Test result for a NULL buffer and a zero size. + Based on a test program from Karl Heuer. */ + char *line = NULL; + size_t siz = 0; + int len = getdelim (&line, &siz, '\n', in); + if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) + return 2; + } + { + /* Test result for a NULL buffer and a non-zero size. + This crashes on FreeBSD 8.0. */ + char *line = NULL; + size_t siz = (size_t)(~0) / 4; + if (getdelim (&line, &siz, '\n', in) == -1) + return 3; + } + return 0; + } + ]])], [gl_cv_func_working_getdelim=yes] dnl The library version works. + , [gl_cv_func_working_getdelim=no] dnl The library version does NOT work. + , dnl We're cross compiling. Assume it works on glibc2 systems. + [AC_EGREP_CPP([Lucky GNU user], + [ +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ + Lucky GNU user + #endif +#endif + ], + [gl_cv_func_working_getdelim="guessing yes"], + [gl_cv_func_working_getdelim="guessing no"])] + )]) + case "$gl_cv_func_working_getdelim" in + *no) + REPLACE_GETDELIM=1 + ;; + esac + else + HAVE_GETDELIM=0 + fi + + if test $ac_cv_have_decl_getdelim = no; then + HAVE_DECL_GETDELIM=0 + fi +]) + +# Prerequisites of lib/getdelim.c. +AC_DEFUN([gl_PREREQ_GETDELIM], +[ + AC_CHECK_FUNCS([flockfile funlockfile]) + AC_CHECK_DECLS([getc_unlocked]) +]) Index: libidn-1.28/gl/m4/getline.m4 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/gl/m4/getline.m4 2016-08-22 15:25:24.919902304 -0400 @@ -0,0 +1,96 @@ +# getline.m4 serial 26 + +dnl Copyright (C) 1998-2003, 2005-2007, 2009-2015 Free Software Foundation, +dnl Inc. +dnl +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_PREREQ([2.59]) + +dnl See if there's a working, system-supplied version of the getline function. +dnl We can't just do AC_REPLACE_FUNCS([getline]) because some systems +dnl have a function by that name in -linet that doesn't have anything +dnl to do with the function we need. +AC_DEFUN([gl_FUNC_GETLINE], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + + dnl Persuade glibc to declare getline(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_CHECK_DECLS_ONCE([getline]) + + gl_getline_needs_run_time_check=no + AC_CHECK_FUNC([getline], + [dnl Found it in some library. Verify that it works. + gl_getline_needs_run_time_check=yes], + [am_cv_func_working_getline=no]) + if test $gl_getline_needs_run_time_check = yes; then + AC_CACHE_CHECK([for working getline function], [am_cv_func_working_getline], + [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +# include +# include +# include + int main () + { + FILE *in = fopen ("./conftest.data", "r"); + if (!in) + return 1; + { + /* Test result for a NULL buffer and a zero size. + Based on a test program from Karl Heuer. */ + char *line = NULL; + size_t siz = 0; + int len = getline (&line, &siz, in); + if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) + return 2; + } + { + /* Test result for a NULL buffer and a non-zero size. + This crashes on FreeBSD 8.0. */ + char *line = NULL; + size_t siz = (size_t)(~0) / 4; + if (getline (&line, &siz, in) == -1) + return 3; + } + return 0; + } + ]])], [am_cv_func_working_getline=yes] dnl The library version works. + , [am_cv_func_working_getline=no] dnl The library version does NOT work. + , dnl We're cross compiling. Assume it works on glibc2 systems. + [AC_EGREP_CPP([Lucky GNU user], + [ +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ + Lucky GNU user + #endif +#endif + ], + [am_cv_func_working_getline="guessing yes"], + [am_cv_func_working_getline="guessing no"])] + )]) + fi + + if test $ac_cv_have_decl_getline = no; then + HAVE_DECL_GETLINE=0 + fi + + case "$am_cv_func_working_getline" in + *no) + dnl Set REPLACE_GETLINE always: Even if we have not found the broken + dnl getline function among $LIBS, it may exist in libinet and the + dnl executable may be linked with -linet. + REPLACE_GETLINE=1 + ;; + esac +]) + +# Prerequisites of lib/getline.c. +AC_DEFUN([gl_PREREQ_GETLINE], +[ + : +]) Index: libidn-1.28/gl/m4/gnulib-cache.m4 =================================================================== --- libidn-1.28.orig/gl/m4/gnulib-cache.m4 2016-08-22 15:25:24.923902343 -0400 +++ libidn-1.28/gl/m4/gnulib-cache.m4 2016-08-22 15:25:24.919902304 -0400 @@ -27,7 +27,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gltests --aux-dir=build-aux --with-tests --avoid=fcntl-h-tests --avoid=stdlib-tests --avoid=string-tests --avoid=sys_stat-tests --avoid=time-tests --avoid=unistd-tests --avoid=update-copyright-tests --avoid=wchar-tests --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files autobuild csharpcomp-script csharpexec-script error fdl-1.3 gendocs getopt-gnu gnupload maintainer-makefile manywarnings pmccabe2html progname update-copyright useless-if-before-free valgrind-tests vc-list-files version-etc warnings +# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gltests --aux-dir=build-aux --with-tests --avoid=fcntl-h-tests --avoid=stdlib-tests --avoid=string-tests --avoid=sys_stat-tests --avoid=time-tests --avoid=unistd-tests --avoid=update-copyright-tests --avoid=wchar-tests --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files autobuild csharpcomp-script csharpexec-script error fdl-1.3 gendocs getline getopt-gnu gnupload maintainer-makefile manywarnings pmccabe2html progname update-copyright useless-if-before-free valgrind-tests vc-list-files version-etc warnings # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([gl/override]) @@ -38,6 +38,7 @@ error fdl-1.3 gendocs + getline getopt-gnu gnupload maintainer-makefile Index: libidn-1.28/gl/m4/gnulib-comp.m4 =================================================================== --- libidn-1.28.orig/gl/m4/gnulib-comp.m4 2016-08-22 15:25:24.923902343 -0400 +++ libidn-1.28/gl/m4/gnulib-comp.m4 2016-08-22 15:25:24.919902304 -0400 @@ -73,8 +73,12 @@ # Code from module gendocs: # Code from module getcwd-lgpl: # Code from module getcwd-lgpl-tests: + # Code from module getdelim: + # Code from module getdelim-tests: # Code from module getdtablesize: # Code from module getdtablesize-tests: + # Code from module getline: + # Code from module getline-tests: # Code from module getopt-gnu: # Code from module getopt-posix: # Code from module getopt-posix-tests: @@ -109,6 +113,7 @@ # Code from module pmccabe2html: # Code from module progname: # Code from module putenv: + # Code from module realloc-posix: # Code from module same-inode: # Code from module setenv: # Code from module setenv-tests: @@ -191,6 +196,18 @@ [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) AC_REQUIRE([gl_EXTERN_INLINE]) + gl_FUNC_GETDELIM + if test $HAVE_GETDELIM = 0 || test $REPLACE_GETDELIM = 1; then + AC_LIBOBJ([getdelim]) + gl_PREREQ_GETDELIM + fi + gl_STDIO_MODULE_INDICATOR([getdelim]) + gl_FUNC_GETLINE + if test $REPLACE_GETLINE = 1; then + AC_LIBOBJ([getline]) + gl_PREREQ_GETLINE + fi + gl_STDIO_MODULE_INDICATOR([getline]) gl_FUNC_GETOPT_GNU if test $REPLACE_GETOPT = 1; then AC_LIBOBJ([getopt]) @@ -232,12 +249,20 @@ if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then AC_LIBOBJ([msvc-nothrow]) fi + gl_MULTIARCH AC_PATH_PROG([PMCCABE], [pmccabe], [false]) AC_CHECK_DECLS([program_invocation_name], [], [], [#include ]) AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include ]) + gl_FUNC_REALLOC_POSIX + if test $REPLACE_REALLOC = 1; then + AC_LIBOBJ([realloc]) + fi + gl_STDLIB_MODULE_INDICATOR([realloc-posix]) gt_TYPE_SSIZE_T gl_STDARG_H gl_STDDEF_H + gl_STDINT_H + gl_STDLIB_H gl_FUNC_STRERROR if test $REPLACE_STRERROR = 1; then AC_LIBOBJ([strerror]) @@ -355,7 +380,6 @@ fi gl_STDLIB_MODULE_INDICATOR([malloc-posix]) gl_MALLOCA - gl_MULTIARCH gl_FUNC_OPEN if test $REPLACE_OPEN = 1; then AC_LIBOBJ([open]) @@ -381,11 +405,9 @@ fi gl_SYS_STAT_MODULE_INDICATOR([stat]) AM_STDBOOL_H - gl_STDINT_H AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) gl_STDIO_H - gl_STDLIB_H gl_FUNC_SYMLINK if test $HAVE_SYMLINK = 0 || test $REPLACE_SYMLINK = 1; then AC_LIBOBJ([symlink]) @@ -514,6 +536,8 @@ lib/errno.in.h lib/error.c lib/error.h + lib/getdelim.c + lib/getline.c lib/getopt.c lib/getopt.in.h lib/getopt1.c @@ -526,8 +550,11 @@ lib/msvc-nothrow.h lib/progname.c lib/progname.h + lib/realloc.c lib/stdarg.in.h lib/stddef.in.h + lib/stdint.in.h + lib/stdlib.in.h lib/strerror-override.c lib/strerror-override.h lib/strerror.c @@ -557,7 +584,9 @@ m4/fdopen.m4 m4/fstat.m4 m4/getcwd.m4 + m4/getdelim.m4 m4/getdtablesize.m4 + m4/getline.m4 m4/getopt.m4 m4/gnulib-common.m4 m4/include_next.m4 @@ -578,6 +607,7 @@ m4/open.m4 m4/pathmax.m4 m4/putenv.m4 + m4/realloc.m4 m4/setenv.m4 m4/ssize_t.m4 m4/stat.m4 @@ -619,7 +649,9 @@ tests/test-fstat.c tests/test-fwrite.c tests/test-getcwd-lgpl.c + tests/test-getdelim.c tests/test-getdtablesize.c + tests/test-getline.c tests/test-getopt.c tests/test-getopt.h tests/test-getopt_long.h @@ -678,9 +710,7 @@ tests=lib/setenv.c tests=lib/stat.c tests=lib/stdbool.in.h - tests=lib/stdint.in.h tests=lib/stdio.in.h - tests=lib/stdlib.in.h tests=lib/symlink.c tests=lib/sys_stat.in.h tests=lib/time.in.h Index: libidn-1.28/gl/m4/realloc.m4 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/gl/m4/realloc.m4 2016-08-22 15:25:24.919902304 -0400 @@ -0,0 +1,76 @@ +# realloc.m4 serial 13 +dnl Copyright (C) 2007, 2009-2015 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. + +m4_version_prereq([2.70], [] ,[ + +# This is taken from the following Autoconf patch: +# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9 +AC_DEFUN([_AC_FUNC_REALLOC_IF], +[ + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles + AC_CHECK_HEADERS([stdlib.h]) + AC_CACHE_CHECK([for GNU libc compatible realloc], + [ac_cv_func_realloc_0_nonnull], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#if defined STDC_HEADERS || defined HAVE_STDLIB_H + # include + #else + char *realloc (); + #endif + ]], + [[return ! realloc (0, 0);]]) + ], + [ac_cv_func_realloc_0_nonnull=yes], + [ac_cv_func_realloc_0_nonnull=no], + [case "$host_os" in + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* \ + | hpux* | solaris* | cygwin* | mingw*) + ac_cv_func_realloc_0_nonnull=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_realloc_0_nonnull=no ;; + esac + ]) + ]) + AS_IF([test $ac_cv_func_realloc_0_nonnull = yes], [$1], [$2]) +])# AC_FUNC_REALLOC + +]) + +# gl_FUNC_REALLOC_GNU +# ------------------- +# Test whether 'realloc (0, 0)' is handled like in GNU libc, and replace +# realloc if it is not. +AC_DEFUN([gl_FUNC_REALLOC_GNU], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + dnl _AC_FUNC_REALLOC_IF is defined in Autoconf. + _AC_FUNC_REALLOC_IF( + [AC_DEFINE([HAVE_REALLOC_GNU], [1], + [Define to 1 if your system has a GNU libc compatible 'realloc' + function, and to 0 otherwise.])], + [AC_DEFINE([HAVE_REALLOC_GNU], [0]) + REPLACE_REALLOC=1 + ]) +])# gl_FUNC_REALLOC_GNU + +# gl_FUNC_REALLOC_POSIX +# --------------------- +# Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it +# fails), and replace realloc if it is not. +AC_DEFUN([gl_FUNC_REALLOC_POSIX], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) + if test $gl_cv_func_malloc_posix = yes; then + AC_DEFINE([HAVE_REALLOC_POSIX], [1], + [Define if the 'realloc' function is POSIX compliant.]) + else + REPLACE_REALLOC=1 + fi +]) Index: libidn-1.28/gl/realloc.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/gl/realloc.c 2016-08-22 15:25:24.919902304 -0400 @@ -0,0 +1,79 @@ +/* realloc() function that is glibc compatible. + + Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2015 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 . */ + +/* written by Jim Meyering and Bruno Haible */ + +#define _GL_USE_STDLIB_ALLOC 1 +#include + +/* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */ +#ifdef realloc +# define NEED_REALLOC_GNU 1 +/* Whereas the gnulib module 'realloc-gnu' defines HAVE_REALLOC_GNU. */ +#elif GNULIB_REALLOC_GNU && !HAVE_REALLOC_GNU +# define NEED_REALLOC_GNU 1 +#endif + +/* Infer the properties of the system's malloc function. + The gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */ +#if GNULIB_MALLOC_GNU && HAVE_MALLOC_GNU +# define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1 +#endif + +#include + +#include + +/* Change the size of an allocated block of memory P to N bytes, + with error checking. If N is zero, change it to 1. If P is NULL, + use malloc. */ + +void * +rpl_realloc (void *p, size_t n) +{ + void *result; + +#if NEED_REALLOC_GNU + if (n == 0) + { + n = 1; + + /* In theory realloc might fail, so don't rely on it to free. */ + free (p); + p = NULL; + } +#endif + + if (p == NULL) + { +#if GNULIB_REALLOC_GNU && !NEED_REALLOC_GNU && !SYSTEM_MALLOC_GLIBC_COMPATIBLE + if (n == 0) + n = 1; +#endif + result = malloc (n); + } + else + result = realloc (p, n); + +#if !HAVE_REALLOC_POSIX + if (result == NULL) + errno = ENOMEM; +#endif + + return result; +} Index: libidn-1.28/gl/stdint.in.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/gl/stdint.in.h 2016-08-22 15:27:44.817280934 -0400 @@ -0,0 +1,636 @@ +/* Copyright (C) 2001-2002, 2004-2013 Free Software Foundation, Inc. + Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. + This file is part of gnulib. + + 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, 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 . */ + +/* + * ISO C 99 for platforms that lack it. + * + */ + +#ifndef _@GUARD_PREFIX@_STDINT_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* When including a system file that in turn includes , + use the system , not our substitute. This avoids + problems with (for example) VMS, whose includes + . */ +#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H + +/* On Android (Bionic libc), includes this file before + having defined 'time_t'. Therefore in this case avoid including + other system header files; just include the system's . + Ideally we should test __BIONIC__ here, but it is only defined after + has been included; hence test __ANDROID__ instead. */ +#if defined __ANDROID__ \ + && defined _SYS_TYPES_H_ && !defined __need_size_t +# @INCLUDE_NEXT@ @NEXT_STDINT_H@ +#else + +/* Get those types that are already defined in other system include + files, so that we can "#define int8_t signed char" below without + worrying about a later system include file containing a "typedef + signed char int8_t;" that will get messed up by our macro. Our + macros should all be consistent with the system versions, except + for the "fast" types and macros, which we recommend against using + in public interfaces due to compiler differences. */ + +#if @HAVE_STDINT_H@ +# if defined __sgi && ! defined __c99 + /* Bypass IRIX's if in C89 mode, since it merely annoys users + with "This header file is to be used only for c99 mode compilations" + diagnostics. */ +# define __STDINT_H__ +# endif + + /* Some pre-C++11 implementations need this. */ +# ifdef __cplusplus +# ifndef __STDC_CONSTANT_MACROS +# define __STDC_CONSTANT_MACROS 1 +# endif +# ifndef __STDC_LIMIT_MACROS +# define __STDC_LIMIT_MACROS 1 +# endif +# endif + + /* Other systems may have an incomplete or buggy . + Include it before , since any "#include " + in would reinclude us, skipping our contents because + _@GUARD_PREFIX@_STDINT_H is defined. + The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_STDINT_H@ +#endif + +#if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H +#define _@GUARD_PREFIX@_STDINT_H + +/* defines some of the stdint.h types as well, on glibc, + IRIX 6.5, and OpenBSD 3.8 (via ). + AIX 5.2 isn't needed and causes troubles. + Mac OS X 10.4.6 includes (which is us), but + relies on the system definitions, so include + after @NEXT_STDINT_H@. */ +#if @HAVE_SYS_TYPES_H@ && ! defined _AIX +# include +#endif + +/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, + LONG_MIN, LONG_MAX, ULONG_MAX. */ +#include + +#if @HAVE_INTTYPES_H@ + /* In OpenBSD 3.8, includes , which defines + int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. + also defines intptr_t and uintptr_t. */ +# include +#elif @HAVE_SYS_INTTYPES_H@ + /* Solaris 7 has the types except the *_fast*_t types, and + the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ +# include +#endif + +#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ + /* Linux libc4 >= 4.6.7 and libc5 have a that defines + int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is + included by . */ +# include +#endif + +#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H + +/* Minimum and maximum values for an integer type under the usual assumption. + Return an unspecified value if BITS == 0, adding a check to pacify + picky compilers. */ + +#define _STDINT_MIN(signed, bits, zero) \ + ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero)) + +#define _STDINT_MAX(signed, bits, zero) \ + ((signed) \ + ? ~ _STDINT_MIN (signed, bits, zero) \ + : /* The expression for the unsigned case. The subtraction of (signed) \ + is a nop in the unsigned case and avoids "signed integer overflow" \ + warnings in the signed case. */ \ + ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) + +#if !GNULIB_defined_stdint_types + +/* 7.18.1.1. Exact-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. */ + +#undef int8_t +#undef uint8_t +typedef signed char gl_int8_t; +typedef unsigned char gl_uint8_t; +#define int8_t gl_int8_t +#define uint8_t gl_uint8_t + +#undef int16_t +#undef uint16_t +typedef short int gl_int16_t; +typedef unsigned short int gl_uint16_t; +#define int16_t gl_int16_t +#define uint16_t gl_uint16_t + +#undef int32_t +#undef uint32_t +typedef int gl_int32_t; +typedef unsigned int gl_uint32_t; +#define int32_t gl_int32_t +#define uint32_t gl_uint32_t + +/* If the system defines INT64_MAX, assume int64_t works. That way, + if the underlying platform defines int64_t to be a 64-bit long long + int, the code below won't mistakenly define it to be a 64-bit long + int, which would mess up C++ name mangling. We must use #ifdef + rather than #if, to avoid an error with HP-UX 10.20 cc. */ + +#ifdef INT64_MAX +# define GL_INT64_T +#else +/* Do not undefine int64_t if gnulib is not being used with 64-bit + types, since otherwise it breaks platforms like Tandem/NSK. */ +# if LONG_MAX >> 31 >> 31 == 1 +# undef int64_t +typedef long int gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +# elif defined _MSC_VER +# undef int64_t +typedef __int64 gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +# elif @HAVE_LONG_LONG_INT@ +# undef int64_t +typedef long long int gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +# endif +#endif + +#ifdef UINT64_MAX +# define GL_UINT64_T +#else +# if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# undef uint64_t +typedef unsigned long int gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# elif defined _MSC_VER +# undef uint64_t +typedef unsigned __int64 gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# undef uint64_t +typedef unsigned long long int gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# endif +#endif + +/* Avoid collision with Solaris 2.5.1 etc. */ +#define _UINT8_T +#define _UINT32_T +#define _UINT64_T + + +/* 7.18.1.2. Minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types + are the same as the corresponding N_t types. */ + +#undef int_least8_t +#undef uint_least8_t +#undef int_least16_t +#undef uint_least16_t +#undef int_least32_t +#undef uint_least32_t +#undef int_least64_t +#undef uint_least64_t +#define int_least8_t int8_t +#define uint_least8_t uint8_t +#define int_least16_t int16_t +#define uint_least16_t uint16_t +#define int_least32_t int32_t +#define uint_least32_t uint32_t +#ifdef GL_INT64_T +# define int_least64_t int64_t +#endif +#ifdef GL_UINT64_T +# define uint_least64_t uint64_t +#endif + +/* 7.18.1.3. Fastest minimum-width integer types */ + +/* Note: Other substitutes may define these types differently. + It is not recommended to use these types in public header files. */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types + are taken from the same list of types. The following code normally + uses types consistent with glibc, as that lessens the chance of + incompatibility with older GNU hosts. */ + +#undef int_fast8_t +#undef uint_fast8_t +#undef int_fast16_t +#undef uint_fast16_t +#undef int_fast32_t +#undef uint_fast32_t +#undef int_fast64_t +#undef uint_fast64_t +typedef signed char gl_int_fast8_t; +typedef unsigned char gl_uint_fast8_t; + +#ifdef __sun +/* Define types compatible with SunOS 5.10, so that code compiled under + earlier SunOS versions works with code compiled under SunOS 5.10. */ +typedef int gl_int_fast32_t; +typedef unsigned int gl_uint_fast32_t; +#else +typedef long int gl_int_fast32_t; +typedef unsigned long int gl_uint_fast32_t; +#endif +typedef gl_int_fast32_t gl_int_fast16_t; +typedef gl_uint_fast32_t gl_uint_fast16_t; + +#define int_fast8_t gl_int_fast8_t +#define uint_fast8_t gl_uint_fast8_t +#define int_fast16_t gl_int_fast16_t +#define uint_fast16_t gl_uint_fast16_t +#define int_fast32_t gl_int_fast32_t +#define uint_fast32_t gl_uint_fast32_t +#ifdef GL_INT64_T +# define int_fast64_t int64_t +#endif +#ifdef GL_UINT64_T +# define uint_fast64_t uint64_t +#endif + +/* 7.18.1.4. Integer types capable of holding object pointers */ + +#undef intptr_t +#undef uintptr_t +typedef long int gl_intptr_t; +typedef unsigned long int gl_uintptr_t; +#define intptr_t gl_intptr_t +#define uintptr_t gl_uintptr_t + +/* 7.18.1.5. Greatest-width integer types */ + +/* Note: These types are compiler dependent. It may be unwise to use them in + public header files. */ + +/* If the system defines INTMAX_MAX, assume that intmax_t works, and + similarly for UINTMAX_MAX and uintmax_t. This avoids problems with + assuming one type where another is used by the system. */ + +#ifndef INTMAX_MAX +# undef INTMAX_C +# undef intmax_t +# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +typedef long long int gl_intmax_t; +# define intmax_t gl_intmax_t +# elif defined GL_INT64_T +# define intmax_t int64_t +# else +typedef long int gl_intmax_t; +# define intmax_t gl_intmax_t +# endif +#endif + +#ifndef UINTMAX_MAX +# undef UINTMAX_C +# undef uintmax_t +# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +typedef unsigned long long int gl_uintmax_t; +# define uintmax_t gl_uintmax_t +# elif defined GL_UINT64_T +# define uintmax_t uint64_t +# else +typedef unsigned long int gl_uintmax_t; +# define uintmax_t gl_uintmax_t +# endif +#endif + +/* Verify that intmax_t and uintmax_t have the same size. Too much code + breaks if this is not the case. If this check fails, the reason is likely + to be found in the autoconf macros. */ +typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) + ? 1 : -1]; + +#define GNULIB_defined_stdint_types 1 +#endif /* !GNULIB_defined_stdint_types */ + +/* 7.18.2. Limits of specified-width integer types */ + +/* 7.18.2.1. Limits of exact-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. */ + +#undef INT8_MIN +#undef INT8_MAX +#undef UINT8_MAX +#define INT8_MIN (~ INT8_MAX) +#define INT8_MAX 127 +#define UINT8_MAX 255 + +#undef INT16_MIN +#undef INT16_MAX +#undef UINT16_MAX +#define INT16_MIN (~ INT16_MAX) +#define INT16_MAX 32767 +#define UINT16_MAX 65535 + +#undef INT32_MIN +#undef INT32_MAX +#undef UINT32_MAX +#define INT32_MIN (~ INT32_MAX) +#define INT32_MAX 2147483647 +#define UINT32_MAX 4294967295U + +#if defined GL_INT64_T && ! defined INT64_MAX +/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 + evaluates the latter incorrectly in preprocessor expressions. */ +# define INT64_MIN (- INTMAX_C (1) << 63) +# define INT64_MAX INTMAX_C (9223372036854775807) +#endif + +#if defined GL_UINT64_T && ! defined UINT64_MAX +# define UINT64_MAX UINTMAX_C (18446744073709551615) +#endif + +/* 7.18.2.2. Limits of minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types + are the same as the corresponding N_t types. */ + +#undef INT_LEAST8_MIN +#undef INT_LEAST8_MAX +#undef UINT_LEAST8_MAX +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define UINT_LEAST8_MAX UINT8_MAX + +#undef INT_LEAST16_MIN +#undef INT_LEAST16_MAX +#undef UINT_LEAST16_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define UINT_LEAST16_MAX UINT16_MAX + +#undef INT_LEAST32_MIN +#undef INT_LEAST32_MAX +#undef UINT_LEAST32_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define UINT_LEAST32_MAX UINT32_MAX + +#undef INT_LEAST64_MIN +#undef INT_LEAST64_MAX +#ifdef GL_INT64_T +# define INT_LEAST64_MIN INT64_MIN +# define INT_LEAST64_MAX INT64_MAX +#endif + +#undef UINT_LEAST64_MAX +#ifdef GL_UINT64_T +# define UINT_LEAST64_MAX UINT64_MAX +#endif + +/* 7.18.2.3. Limits of fastest minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types + are taken from the same list of types. */ + +#undef INT_FAST8_MIN +#undef INT_FAST8_MAX +#undef UINT_FAST8_MAX +#define INT_FAST8_MIN SCHAR_MIN +#define INT_FAST8_MAX SCHAR_MAX +#define UINT_FAST8_MAX UCHAR_MAX + +#undef INT_FAST16_MIN +#undef INT_FAST16_MAX +#undef UINT_FAST16_MAX +#define INT_FAST16_MIN INT_FAST32_MIN +#define INT_FAST16_MAX INT_FAST32_MAX +#define UINT_FAST16_MAX UINT_FAST32_MAX + +#undef INT_FAST32_MIN +#undef INT_FAST32_MAX +#undef UINT_FAST32_MAX +#ifdef __sun +# define INT_FAST32_MIN INT_MIN +# define INT_FAST32_MAX INT_MAX +# define UINT_FAST32_MAX UINT_MAX +#else +# define INT_FAST32_MIN LONG_MIN +# define INT_FAST32_MAX LONG_MAX +# define UINT_FAST32_MAX ULONG_MAX +#endif + +#undef INT_FAST64_MIN +#undef INT_FAST64_MAX +#ifdef GL_INT64_T +# define INT_FAST64_MIN INT64_MIN +# define INT_FAST64_MAX INT64_MAX +#endif + +#undef UINT_FAST64_MAX +#ifdef GL_UINT64_T +# define UINT_FAST64_MAX UINT64_MAX +#endif + +/* 7.18.2.4. Limits of integer types capable of holding object pointers */ + +#undef INTPTR_MIN +#undef INTPTR_MAX +#undef UINTPTR_MAX +#define INTPTR_MIN LONG_MIN +#define INTPTR_MAX LONG_MAX +#define UINTPTR_MAX ULONG_MAX + +/* 7.18.2.5. Limits of greatest-width integer types */ + +#ifndef INTMAX_MAX +# undef INTMAX_MIN +# ifdef INT64_MAX +# define INTMAX_MIN INT64_MIN +# define INTMAX_MAX INT64_MAX +# else +# define INTMAX_MIN INT32_MIN +# define INTMAX_MAX INT32_MAX +# endif +#endif + +#ifndef UINTMAX_MAX +# ifdef UINT64_MAX +# define UINTMAX_MAX UINT64_MAX +# else +# define UINTMAX_MAX UINT32_MAX +# endif +#endif + +/* 7.18.3. Limits of other integer types */ + +/* ptrdiff_t limits */ +#undef PTRDIFF_MIN +#undef PTRDIFF_MAX +#if @APPLE_UNIVERSAL_BUILD@ +# ifdef _LP64 +# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) +# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) +# else +# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) +# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) +# endif +#else +# define PTRDIFF_MIN \ + _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) +# define PTRDIFF_MAX \ + _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) +#endif + +/* sig_atomic_t limits */ +#undef SIG_ATOMIC_MIN +#undef SIG_ATOMIC_MAX +#define SIG_ATOMIC_MIN \ + _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ + 0@SIG_ATOMIC_T_SUFFIX@) +#define SIG_ATOMIC_MAX \ + _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ + 0@SIG_ATOMIC_T_SUFFIX@) + + +/* size_t limit */ +#undef SIZE_MAX +#if @APPLE_UNIVERSAL_BUILD@ +# ifdef _LP64 +# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) +# else +# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) +# endif +#else +# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) +#endif + +/* wchar_t limits */ +/* Get WCHAR_MIN, WCHAR_MAX. + This include is not on the top, above, because on OSF/1 4.0 we have a + sequence of nested includes + -> -> -> , and the latter includes + and assumes its types are already defined. */ +#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ +# include +# include +# include +# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H +# include +# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H +#endif +#undef WCHAR_MIN +#undef WCHAR_MAX +#define WCHAR_MIN \ + _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) +#define WCHAR_MAX \ + _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) + +/* wint_t limits */ +#undef WINT_MIN +#undef WINT_MAX +#define WINT_MIN \ + _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +#define WINT_MAX \ + _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) + +/* 7.18.4. Macros for integer constants */ + +/* 7.18.4.1. Macros for minimum-width integer constants */ +/* According to ISO C 99 Technical Corrigendum 1 */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ + +#undef INT8_C +#undef UINT8_C +#define INT8_C(x) x +#define UINT8_C(x) x + +#undef INT16_C +#undef UINT16_C +#define INT16_C(x) x +#define UINT16_C(x) x + +#undef INT32_C +#undef UINT32_C +#define INT32_C(x) x +#define UINT32_C(x) x ## U + +#undef INT64_C +#undef UINT64_C +#if LONG_MAX >> 31 >> 31 == 1 +# define INT64_C(x) x##L +#elif defined _MSC_VER +# define INT64_C(x) x##i64 +#elif @HAVE_LONG_LONG_INT@ +# define INT64_C(x) x##LL +#endif +#if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# define UINT64_C(x) x##UL +#elif defined _MSC_VER +# define UINT64_C(x) x##ui64 +#elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# define UINT64_C(x) x##ULL +#endif + +/* 7.18.4.2. Macros for greatest-width integer constants */ + +#ifndef INTMAX_C +# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +# define INTMAX_C(x) x##LL +# elif defined GL_INT64_T +# define INTMAX_C(x) INT64_C(x) +# else +# define INTMAX_C(x) x##L +# endif +#endif + +#ifndef UINTMAX_C +# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# define UINTMAX_C(x) x##ULL +# elif defined GL_UINT64_T +# define UINTMAX_C(x) UINT64_C(x) +# else +# define UINTMAX_C(x) x##UL +# endif +#endif + +#endif /* _@GUARD_PREFIX@_STDINT_H */ +#endif /* !(defined __ANDROID__ && ...) */ +#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ Index: libidn-1.28/gl/stdlib.in.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/gl/stdlib.in.h 2016-08-22 15:27:34.721180875 -0400 @@ -0,0 +1,954 @@ +/* A GNU-like . + + Copyright (C) 1995, 2001-2004, 2006-2013 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 . */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc +/* Special invocation conventions inside some gnulib header files, + and inside some glibc header files, respectively. */ + +#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_STDLIB_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ + +#ifndef _@GUARD_PREFIX@_STDLIB_H +#define _@GUARD_PREFIX@_STDLIB_H + +/* NetBSD 5.0 mis-defines NULL. */ +#include + +/* MirBSD 10 defines WEXITSTATUS in , not in . */ +#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS +# include +#endif + +/* Solaris declares getloadavg() in . */ +#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ +# include +#endif + +/* Native Windows platforms declare mktemp() in . */ +#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) +# include +#endif + +#if @GNULIB_RANDOM_R@ + +/* OSF/1 5.1 declares 'struct random_data' in , which is included + from if _REENTRANT is defined. Include it whenever we need + 'struct random_data'. */ +# if @HAVE_RANDOM_H@ +# include +# endif + +# if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@ +# include +# endif + +# if !@HAVE_STRUCT_RANDOM_DATA@ +/* Define 'struct random_data'. + But allow multiple gnulib generated replacements to coexist. */ +# if !GNULIB_defined_struct_random_data +struct random_data +{ + int32_t *fptr; /* Front pointer. */ + int32_t *rptr; /* Rear pointer. */ + int32_t *state; /* Array of state values. */ + int rand_type; /* Type of random number generator. */ + int rand_deg; /* Degree of random number generator. */ + int rand_sep; /* Distance between front and rear. */ + int32_t *end_ptr; /* Pointer behind state table. */ +}; +# define GNULIB_defined_struct_random_data 1 +# endif +# endif +#endif + +#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) +/* On Mac OS X 10.3, only declares mkstemp. */ +/* On Mac OS X 10.5, only declares mkstemps. */ +/* On Cygwin 1.7.1, only declares getsubopt. */ +/* But avoid namespace pollution on glibc systems and native Windows. */ +# include +#endif + +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The attribute __pure__ was added in gcc 2.96. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + +/* The definition of _Noreturn is copied here. */ + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + +/* Some systems do not define EXIT_*, despite otherwise supporting C89. */ +#ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +#endif +/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere + with proper operation of xargs. */ +#ifndef EXIT_FAILURE +# define EXIT_FAILURE 1 +#elif EXIT_FAILURE != 1 +# undef EXIT_FAILURE +# define EXIT_FAILURE 1 +#endif + + +#if @GNULIB__EXIT@ +/* Terminate the current process with the given return code, without running + the 'atexit' handlers. */ +# if !@HAVE__EXIT@ +_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); +# endif +_GL_CXXALIAS_SYS (_Exit, void, (int status)); +_GL_CXXALIASWARN (_Exit); +#elif defined GNULIB_POSIXCHECK +# undef _Exit +# if HAVE_RAW_DECL__EXIT +_GL_WARN_ON_USE (_Exit, "_Exit is unportable - " + "use gnulib module _Exit for portability"); +# endif +#endif + + +#if @GNULIB_ATOLL@ +/* Parse a signed decimal integer. + Returns the value of the integer. Errors are not detected. */ +# if !@HAVE_ATOLL@ +_GL_FUNCDECL_SYS (atoll, long long, (const char *string) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (atoll, long long, (const char *string)); +_GL_CXXALIASWARN (atoll); +#elif defined GNULIB_POSIXCHECK +# undef atoll +# if HAVE_RAW_DECL_ATOLL +_GL_WARN_ON_USE (atoll, "atoll is unportable - " + "use gnulib module atoll for portability"); +# endif +#endif + +#if @GNULIB_CALLOC_POSIX@ +# if @REPLACE_CALLOC@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef calloc +# define calloc rpl_calloc +# endif +_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size)); +_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); +# else +_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); +# endif +_GL_CXXALIASWARN (calloc); +#elif defined GNULIB_POSIXCHECK +# undef calloc +/* Assume calloc is always declared. */ +_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " + "use gnulib module calloc-posix for portability"); +#endif + +#if @GNULIB_CANONICALIZE_FILE_NAME@ +# if @REPLACE_CANONICALIZE_FILE_NAME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define canonicalize_file_name rpl_canonicalize_file_name +# endif +_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); +# else +# if !@HAVE_CANONICALIZE_FILE_NAME@ +_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); +# endif +_GL_CXXALIASWARN (canonicalize_file_name); +#elif defined GNULIB_POSIXCHECK +# undef canonicalize_file_name +# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME +_GL_WARN_ON_USE (canonicalize_file_name, + "canonicalize_file_name is unportable - " + "use gnulib module canonicalize-lgpl for portability"); +# endif +#endif + +#if @GNULIB_GETLOADAVG@ +/* Store max(NELEM,3) load average numbers in LOADAVG[]. + The three numbers are the load average of the last 1 minute, the last 5 + minutes, and the last 15 minutes, respectively. + LOADAVG is an array of NELEM numbers. */ +# if !@HAVE_DECL_GETLOADAVG@ +_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); +_GL_CXXALIASWARN (getloadavg); +#elif defined GNULIB_POSIXCHECK +# undef getloadavg +# if HAVE_RAW_DECL_GETLOADAVG +_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " + "use gnulib module getloadavg for portability"); +# endif +#endif + +#if @GNULIB_GETSUBOPT@ +/* Assuming *OPTIONP is a comma separated list of elements of the form + "token" or "token=value", getsubopt parses the first of these elements. + If the first element refers to a "token" that is member of the given + NULL-terminated array of tokens: + - It replaces the comma with a NUL byte, updates *OPTIONP to point past + the first option and the comma, sets *VALUEP to the value of the + element (or NULL if it doesn't contain an "=" sign), + - It returns the index of the "token" in the given array of tokens. + Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. + For more details see the POSIX:2001 specification. + http://www.opengroup.org/susv3xsh/getsubopt.html */ +# if !@HAVE_GETSUBOPT@ +_GL_FUNCDECL_SYS (getsubopt, int, + (char **optionp, char *const *tokens, char **valuep) + _GL_ARG_NONNULL ((1, 2, 3))); +# endif +_GL_CXXALIAS_SYS (getsubopt, int, + (char **optionp, char *const *tokens, char **valuep)); +_GL_CXXALIASWARN (getsubopt); +#elif defined GNULIB_POSIXCHECK +# undef getsubopt +# if HAVE_RAW_DECL_GETSUBOPT +_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " + "use gnulib module getsubopt for portability"); +# endif +#endif + +#if @GNULIB_GRANTPT@ +/* Change the ownership and access permission of the slave side of the + pseudo-terminal whose master side is specified by FD. */ +# if !@HAVE_GRANTPT@ +_GL_FUNCDECL_SYS (grantpt, int, (int fd)); +# endif +_GL_CXXALIAS_SYS (grantpt, int, (int fd)); +_GL_CXXALIASWARN (grantpt); +#elif defined GNULIB_POSIXCHECK +# undef grantpt +# if HAVE_RAW_DECL_GRANTPT +_GL_WARN_ON_USE (grantpt, "grantpt is not portable - " + "use gnulib module grantpt for portability"); +# endif +#endif + +/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not + rely on GNU or POSIX semantics for malloc and realloc (for example, + by never specifying a zero size), so it does not need malloc or + realloc to be redefined. */ +#if @GNULIB_MALLOC_POSIX@ +# if @REPLACE_MALLOC@ +# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ + || _GL_USE_STDLIB_ALLOC) +# undef malloc +# define malloc rpl_malloc +# endif +_GL_FUNCDECL_RPL (malloc, void *, (size_t size)); +_GL_CXXALIAS_RPL (malloc, void *, (size_t size)); +# else +_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); +# endif +_GL_CXXALIASWARN (malloc); +#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC +# undef malloc +/* Assume malloc is always declared. */ +_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " + "use gnulib module malloc-posix for portability"); +#endif + +/* Convert a multibyte character to a wide character. */ +#if @GNULIB_MBTOWC@ +# if @REPLACE_MBTOWC@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mbtowc +# define mbtowc rpl_mbtowc +# endif +_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +# else +_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +# endif +_GL_CXXALIASWARN (mbtowc); +#endif + +#if @GNULIB_MKDTEMP@ +/* Create a unique temporary directory from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the directory name unique. + Returns TEMPLATE, or a null pointer if it cannot get a unique name. + The directory is created mode 700. */ +# if !@HAVE_MKDTEMP@ +_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); +_GL_CXXALIASWARN (mkdtemp); +#elif defined GNULIB_POSIXCHECK +# undef mkdtemp +# if HAVE_RAW_DECL_MKDTEMP +_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " + "use gnulib module mkdtemp for portability"); +# endif +#endif + +#if @GNULIB_MKOSTEMP@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The flags are a bitmask, possibly including O_CLOEXEC (defined in ) + and O_TEXT, O_BINARY (defined in "binary-io.h"). + The file is then created, with the specified flags, ensuring it didn't exist + before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +# if !@HAVE_MKOSTEMP@ +_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); +_GL_CXXALIASWARN (mkostemp); +#elif defined GNULIB_POSIXCHECK +# undef mkostemp +# if HAVE_RAW_DECL_MKOSTEMP +_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " + "use gnulib module mkostemp for portability"); +# endif +#endif + +#if @GNULIB_MKOSTEMPS@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE before a suffix of length + SUFFIXLEN must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The flags are a bitmask, possibly including O_CLOEXEC (defined in ) + and O_TEXT, O_BINARY (defined in "binary-io.h"). + The file is then created, with the specified flags, ensuring it didn't exist + before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +# if !@HAVE_MKOSTEMPS@ +_GL_FUNCDECL_SYS (mkostemps, int, + (char * /*template*/, int /*suffixlen*/, int /*flags*/) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkostemps, int, + (char * /*template*/, int /*suffixlen*/, int /*flags*/)); +_GL_CXXALIASWARN (mkostemps); +#elif defined GNULIB_POSIXCHECK +# undef mkostemps +# if HAVE_RAW_DECL_MKOSTEMPS +_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " + "use gnulib module mkostemps for portability"); +# endif +#endif + +#if @GNULIB_MKSTEMP@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The file is then created, ensuring it didn't exist before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +# if @REPLACE_MKSTEMP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mkstemp rpl_mkstemp +# endif +_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); +# else +# if ! @HAVE_MKSTEMP@ +_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); +# endif +_GL_CXXALIASWARN (mkstemp); +#elif defined GNULIB_POSIXCHECK +# undef mkstemp +# if HAVE_RAW_DECL_MKSTEMP +_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " + "use gnulib module mkstemp for portability"); +# endif +#endif + +#if @GNULIB_MKSTEMPS@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE prior to a suffix of length + SUFFIXLEN must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The file is then created, ensuring it didn't exist before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +# if !@HAVE_MKSTEMPS@ +_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); +_GL_CXXALIASWARN (mkstemps); +#elif defined GNULIB_POSIXCHECK +# undef mkstemps +# if HAVE_RAW_DECL_MKSTEMPS +_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " + "use gnulib module mkstemps for portability"); +# endif +#endif + +#if @GNULIB_POSIX_OPENPT@ +/* Return an FD open to the master side of a pseudo-terminal. Flags should + include O_RDWR, and may also include O_NOCTTY. */ +# if !@HAVE_POSIX_OPENPT@ +_GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); +# endif +_GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); +_GL_CXXALIASWARN (posix_openpt); +#elif defined GNULIB_POSIXCHECK +# undef posix_openpt +# if HAVE_RAW_DECL_POSIX_OPENPT +_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " + "use gnulib module posix_openpt for portability"); +# endif +#endif + +#if @GNULIB_PTSNAME@ +/* Return the pathname of the pseudo-terminal slave associated with + the master FD is open on, or NULL on errors. */ +# if @REPLACE_PTSNAME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ptsname +# define ptsname rpl_ptsname +# endif +_GL_FUNCDECL_RPL (ptsname, char *, (int fd)); +_GL_CXXALIAS_RPL (ptsname, char *, (int fd)); +# else +# if !@HAVE_PTSNAME@ +_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); +# endif +_GL_CXXALIAS_SYS (ptsname, char *, (int fd)); +# endif +_GL_CXXALIASWARN (ptsname); +#elif defined GNULIB_POSIXCHECK +# undef ptsname +# if HAVE_RAW_DECL_PTSNAME +_GL_WARN_ON_USE (ptsname, "ptsname is not portable - " + "use gnulib module ptsname for portability"); +# endif +#endif + +#if @GNULIB_PTSNAME_R@ +/* Set the pathname of the pseudo-terminal slave associated with + the master FD is open on and return 0, or set errno and return + non-zero on errors. */ +# if @REPLACE_PTSNAME_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ptsname_r +# define ptsname_r rpl_ptsname_r +# endif +_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); +_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); +# else +# if !@HAVE_PTSNAME_R@ +_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); +# endif +_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); +# endif +_GL_CXXALIASWARN (ptsname_r); +#elif defined GNULIB_POSIXCHECK +# undef ptsname_r +# if HAVE_RAW_DECL_PTSNAME_R +_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " + "use gnulib module ptsname_r for portability"); +# endif +#endif + +#if @GNULIB_PUTENV@ +# if @REPLACE_PUTENV@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef putenv +# define putenv rpl_putenv +# endif +_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (putenv, int, (char *string)); +# else +_GL_CXXALIAS_SYS (putenv, int, (char *string)); +# endif +_GL_CXXALIASWARN (putenv); +#endif + + +#if @GNULIB_RANDOM_R@ +# if !@HAVE_RANDOM_R@ +# ifndef RAND_MAX +# define RAND_MAX 2147483647 +# endif +# endif +#endif + + +#if @GNULIB_RANDOM@ +# if !@HAVE_RANDOM@ +_GL_FUNCDECL_SYS (random, long, (void)); +# endif +_GL_CXXALIAS_SYS (random, long, (void)); +_GL_CXXALIASWARN (random); +#elif defined GNULIB_POSIXCHECK +# undef random +# if HAVE_RAW_DECL_RANDOM +_GL_WARN_ON_USE (random, "random is unportable - " + "use gnulib module random for portability"); +# endif +#endif + +#if @GNULIB_RANDOM@ +# if !@HAVE_RANDOM@ +_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); +# endif +_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed)); +_GL_CXXALIASWARN (srandom); +#elif defined GNULIB_POSIXCHECK +# undef srandom +# if HAVE_RAW_DECL_SRANDOM +_GL_WARN_ON_USE (srandom, "srandom is unportable - " + "use gnulib module random for portability"); +# endif +#endif + +#if @GNULIB_RANDOM@ +# if !@HAVE_RANDOM@ +_GL_FUNCDECL_SYS (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size)); +_GL_CXXALIASWARN (initstate); +#elif defined GNULIB_POSIXCHECK +# undef initstate +# if HAVE_RAW_DECL_INITSTATE_R +_GL_WARN_ON_USE (initstate, "initstate is unportable - " + "use gnulib module random for portability"); +# endif +#endif + +#if @GNULIB_RANDOM@ +# if !@HAVE_RANDOM@ +_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state)); +_GL_CXXALIASWARN (setstate); +#elif defined GNULIB_POSIXCHECK +# undef setstate +# if HAVE_RAW_DECL_SETSTATE_R +_GL_WARN_ON_USE (setstate, "setstate is unportable - " + "use gnulib module random for portability"); +# endif +#endif + + +#if @GNULIB_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef random_r +# define random_r rpl_random_r +# endif +_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); +# else +# if !@HAVE_RANDOM_R@ +_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); +# endif +_GL_CXXALIASWARN (random_r); +#elif defined GNULIB_POSIXCHECK +# undef random_r +# if HAVE_RAW_DECL_RANDOM_R +_GL_WARN_ON_USE (random_r, "random_r is unportable - " + "use gnulib module random_r for portability"); +# endif +#endif + +#if @GNULIB_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef srandom_r +# define srandom_r rpl_srandom_r +# endif +_GL_FUNCDECL_RPL (srandom_r, int, + (unsigned int seed, struct random_data *rand_state) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (srandom_r, int, + (unsigned int seed, struct random_data *rand_state)); +# else +# if !@HAVE_RANDOM_R@ +_GL_FUNCDECL_SYS (srandom_r, int, + (unsigned int seed, struct random_data *rand_state) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (srandom_r, int, + (unsigned int seed, struct random_data *rand_state)); +# endif +_GL_CXXALIASWARN (srandom_r); +#elif defined GNULIB_POSIXCHECK +# undef srandom_r +# if HAVE_RAW_DECL_SRANDOM_R +_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " + "use gnulib module random_r for portability"); +# endif +#endif + +#if @GNULIB_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef initstate_r +# define initstate_r rpl_initstate_r +# endif +_GL_FUNCDECL_RPL (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state) + _GL_ARG_NONNULL ((2, 4))); +_GL_CXXALIAS_RPL (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state)); +# else +# if !@HAVE_RANDOM_R@ +_GL_FUNCDECL_SYS (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state) + _GL_ARG_NONNULL ((2, 4))); +# endif +_GL_CXXALIAS_SYS (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state)); +# endif +_GL_CXXALIASWARN (initstate_r); +#elif defined GNULIB_POSIXCHECK +# undef initstate_r +# if HAVE_RAW_DECL_INITSTATE_R +_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " + "use gnulib module random_r for portability"); +# endif +#endif + +#if @GNULIB_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef setstate_r +# define setstate_r rpl_setstate_r +# endif +_GL_FUNCDECL_RPL (setstate_r, int, + (char *arg_state, struct random_data *rand_state) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (setstate_r, int, + (char *arg_state, struct random_data *rand_state)); +# else +# if !@HAVE_RANDOM_R@ +_GL_FUNCDECL_SYS (setstate_r, int, + (char *arg_state, struct random_data *rand_state) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (setstate_r, int, + (char *arg_state, struct random_data *rand_state)); +# endif +_GL_CXXALIASWARN (setstate_r); +#elif defined GNULIB_POSIXCHECK +# undef setstate_r +# if HAVE_RAW_DECL_SETSTATE_R +_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " + "use gnulib module random_r for portability"); +# endif +#endif + + +#if @GNULIB_REALLOC_POSIX@ +# if @REPLACE_REALLOC@ +# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ + || _GL_USE_STDLIB_ALLOC) +# undef realloc +# define realloc rpl_realloc +# endif +_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); +_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); +# else +_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); +# endif +_GL_CXXALIASWARN (realloc); +#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC +# undef realloc +/* Assume realloc is always declared. */ +_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " + "use gnulib module realloc-posix for portability"); +#endif + +#if @GNULIB_REALPATH@ +# if @REPLACE_REALPATH@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define realpath rpl_realpath +# endif +_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved)); +# else +# if !@HAVE_REALPATH@ +_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved)); +# endif +_GL_CXXALIASWARN (realpath); +#elif defined GNULIB_POSIXCHECK +# undef realpath +# if HAVE_RAW_DECL_REALPATH +_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " + "canonicalize or canonicalize-lgpl for portability"); +# endif +#endif + +#if @GNULIB_RPMATCH@ +/* Test a user response to a question. + Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ +# if !@HAVE_RPMATCH@ +_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); +_GL_CXXALIASWARN (rpmatch); +#elif defined GNULIB_POSIXCHECK +# undef rpmatch +# if HAVE_RAW_DECL_RPMATCH +_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " + "use gnulib module rpmatch for portability"); +# endif +#endif + +#if @GNULIB_SECURE_GETENV@ +/* Look up NAME in the environment, returning 0 in insecure situations. */ +# if !@HAVE_SECURE_GETENV@ +_GL_FUNCDECL_SYS (secure_getenv, char *, + (char const *name) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); +_GL_CXXALIASWARN (secure_getenv); +#elif defined GNULIB_POSIXCHECK +# undef secure_getenv +# if HAVE_RAW_DECL_SECURE_GETENV +_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " + "use gnulib module secure_getenv for portability"); +# endif +#endif + +#if @GNULIB_SETENV@ +/* Set NAME to VALUE in the environment. + If REPLACE is nonzero, overwrite an existing value. */ +# if @REPLACE_SETENV@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef setenv +# define setenv rpl_setenv +# endif +_GL_FUNCDECL_RPL (setenv, int, + (const char *name, const char *value, int replace) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (setenv, int, + (const char *name, const char *value, int replace)); +# else +# if !@HAVE_DECL_SETENV@ +_GL_FUNCDECL_SYS (setenv, int, + (const char *name, const char *value, int replace) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (setenv, int, + (const char *name, const char *value, int replace)); +# endif +# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@) +_GL_CXXALIASWARN (setenv); +# endif +#elif defined GNULIB_POSIXCHECK +# undef setenv +# if HAVE_RAW_DECL_SETENV +_GL_WARN_ON_USE (setenv, "setenv is unportable - " + "use gnulib module setenv for portability"); +# endif +#endif + +#if @GNULIB_STRTOD@ + /* Parse a double from STRING, updating ENDP if appropriate. */ +# if @REPLACE_STRTOD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtod rpl_strtod +# endif +_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp)); +# else +# if !@HAVE_STRTOD@ +_GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp)); +# endif +_GL_CXXALIASWARN (strtod); +#elif defined GNULIB_POSIXCHECK +# undef strtod +# if HAVE_RAW_DECL_STRTOD +_GL_WARN_ON_USE (strtod, "strtod is unportable - " + "use gnulib module strtod for portability"); +# endif +#endif + +#if @GNULIB_STRTOLL@ +/* Parse a signed integer whose textual representation starts at STRING. + The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, + it may be decimal or octal (with prefix "0") or hexadecimal (with prefix + "0x"). + If ENDPTR is not NULL, the address of the first byte after the integer is + stored in *ENDPTR. + Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set + to ERANGE. */ +# if !@HAVE_STRTOLL@ +_GL_FUNCDECL_SYS (strtoll, long long, + (const char *string, char **endptr, int base) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtoll, long long, + (const char *string, char **endptr, int base)); +_GL_CXXALIASWARN (strtoll); +#elif defined GNULIB_POSIXCHECK +# undef strtoll +# if HAVE_RAW_DECL_STRTOLL +_GL_WARN_ON_USE (strtoll, "strtoll is unportable - " + "use gnulib module strtoll for portability"); +# endif +#endif + +#if @GNULIB_STRTOULL@ +/* Parse an unsigned integer whose textual representation starts at STRING. + The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, + it may be decimal or octal (with prefix "0") or hexadecimal (with prefix + "0x"). + If ENDPTR is not NULL, the address of the first byte after the integer is + stored in *ENDPTR. + Upon overflow, the return value is ULLONG_MAX, and errno is set to + ERANGE. */ +# if !@HAVE_STRTOULL@ +_GL_FUNCDECL_SYS (strtoull, unsigned long long, + (const char *string, char **endptr, int base) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtoull, unsigned long long, + (const char *string, char **endptr, int base)); +_GL_CXXALIASWARN (strtoull); +#elif defined GNULIB_POSIXCHECK +# undef strtoull +# if HAVE_RAW_DECL_STRTOULL +_GL_WARN_ON_USE (strtoull, "strtoull is unportable - " + "use gnulib module strtoull for portability"); +# endif +#endif + +#if @GNULIB_UNLOCKPT@ +/* Unlock the slave side of the pseudo-terminal whose master side is specified + by FD, so that it can be opened. */ +# if !@HAVE_UNLOCKPT@ +_GL_FUNCDECL_SYS (unlockpt, int, (int fd)); +# endif +_GL_CXXALIAS_SYS (unlockpt, int, (int fd)); +_GL_CXXALIASWARN (unlockpt); +#elif defined GNULIB_POSIXCHECK +# undef unlockpt +# if HAVE_RAW_DECL_UNLOCKPT +_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " + "use gnulib module unlockpt for portability"); +# endif +#endif + +#if @GNULIB_UNSETENV@ +/* Remove the variable NAME from the environment. */ +# if @REPLACE_UNSETENV@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef unsetenv +# define unsetenv rpl_unsetenv +# endif +_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); +# else +# if !@HAVE_DECL_UNSETENV@ +_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); +# endif +# if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@) +_GL_CXXALIASWARN (unsetenv); +# endif +#elif defined GNULIB_POSIXCHECK +# undef unsetenv +# if HAVE_RAW_DECL_UNSETENV +_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " + "use gnulib module unsetenv for portability"); +# endif +#endif + +/* Convert a wide character to a multibyte character. */ +#if @GNULIB_WCTOMB@ +# if @REPLACE_WCTOMB@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wctomb +# define wctomb rpl_wctomb +# endif +_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); +_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); +# else +_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); +# endif +_GL_CXXALIASWARN (wctomb); +#endif + + +#endif /* _@GUARD_PREFIX@_STDLIB_H */ +#endif /* _@GUARD_PREFIX@_STDLIB_H */ +#endif Index: libidn-1.28/gltests/Makefile.am =================================================================== --- libidn-1.28.orig/gltests/Makefile.am 2016-08-22 15:25:24.923902343 -0400 +++ libidn-1.28/gltests/Makefile.am 2016-08-22 15:25:24.919902304 -0400 @@ -291,6 +291,15 @@ ## end gnulib module getcwd-lgpl-tests +## begin gnulib module getdelim-tests + +TESTS += test-getdelim +check_PROGRAMS += test-getdelim +MOSTLYCLEANFILES += test-getdelim.txt +EXTRA_DIST += test-getdelim.c signature.h macros.h + +## end gnulib module getdelim-tests + ## begin gnulib module getdtablesize @@ -308,6 +317,15 @@ ## end gnulib module getdtablesize-tests +## begin gnulib module getline-tests + +TESTS += test-getline +check_PROGRAMS += test-getline +MOSTLYCLEANFILES += test-getline.txt +EXTRA_DIST += test-getline.c signature.h macros.h + +## end gnulib module getline-tests + ## begin gnulib module getopt-posix-tests TESTS += test-getopt @@ -638,56 +656,6 @@ ## end gnulib module stddef-tests -## begin gnulib module stdint - -BUILT_SOURCES += $(STDINT_H) - -# We need the following in order to create when the system -# doesn't have one that works with the given compiler. -if GL_GENERATE_STDINT_H -stdint.h: stdint.in.h $(top_builddir)/config.status - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''GUARD_PREFIX''@|GL|g' \ - -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ - -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ - -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ - -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ - -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ - -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ - -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ - -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ - -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ - -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ - -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ - -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ - -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ - -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ - -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ - -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ - -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ - -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ - -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ - -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ - -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ - -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ - -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ - < $(srcdir)/stdint.in.h; \ - } > $@-t && \ - mv $@-t $@ -else -stdint.h: $(top_builddir)/config.status - rm -f $@ -endif -MOSTLYCLEANFILES += stdint.h stdint.h-t - -EXTRA_DIST += stdint.in.h - -## end gnulib module stdint - ## begin gnulib module stdint-tests TESTS += test-stdint @@ -832,109 +800,6 @@ ## end gnulib module stdio-tests -## begin gnulib module stdlib - -BUILT_SOURCES += stdlib.h - -# We need the following in order to create when the system -# doesn't have one that works with the given compiler. -stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ - $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''GUARD_PREFIX''@|GL|g' \ - -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ - -e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \ - -e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \ - -e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \ - -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \ - -e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \ - -e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \ - -e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \ - -e 's/@''GNULIB_MALLOC_POSIX''@/$(GNULIB_MALLOC_POSIX)/g' \ - -e 's/@''GNULIB_MBTOWC''@/$(GNULIB_MBTOWC)/g' \ - -e 's/@''GNULIB_MKDTEMP''@/$(GNULIB_MKDTEMP)/g' \ - -e 's/@''GNULIB_MKOSTEMP''@/$(GNULIB_MKOSTEMP)/g' \ - -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \ - -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \ - -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \ - -e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \ - -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \ - -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \ - -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \ - -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \ - -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ - -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ - -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ - -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ - -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \ - -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \ - -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \ - -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \ - -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \ - -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \ - -e 's/@''GNULIB_UNLOCKPT''@/$(GNULIB_UNLOCKPT)/g' \ - -e 's/@''GNULIB_UNSETENV''@/$(GNULIB_UNSETENV)/g' \ - -e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \ - < $(srcdir)/stdlib.in.h | \ - sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ - -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ - -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ - -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ - -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ - -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ - -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ - -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ - -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ - -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \ - -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \ - -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \ - -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \ - -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \ - -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \ - -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ - -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ - -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ - -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ - -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \ - -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ - -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ - -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ - -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ - -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ - -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ - -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \ - -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ - -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ - -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ - -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ - -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ - -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ - -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \ - -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ - -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ - -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ - -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ - -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ - -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ - -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ - -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ - -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ - -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ - -e '/definition of _Noreturn/r $(_NORETURN_H)' \ - -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += stdlib.h stdlib.h-t - -EXTRA_DIST += stdlib.in.h - -## end gnulib module stdlib - ## begin gnulib module strerror-tests TESTS += test-strerror Index: libidn-1.28/gltests/test-getdelim.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/gltests/test-getdelim.c 2016-08-22 15:25:24.919902304 -0400 @@ -0,0 +1,94 @@ +/* Test of getdelim() function. + Copyright (C) 2007-2015 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, 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 . */ + +/* Written by Eric Blake , 2007. */ + +#include + +#include + +#include "signature.h" +SIGNATURE_CHECK (getdelim, ssize_t, (char **, size_t *, int, FILE *)); + +#include +#include + +#include "macros.h" + +int +main (void) +{ + FILE *f; + char *line; + size_t len; + ssize_t result; + + /* Create test file. */ + f = fopen ("test-getdelim.txt", "wb"); + if (!f || fwrite ("anAnbcnd\0f", 1, 10, f) != 10 || fclose (f) != 0) + { + fputs ("Failed to create sample file.\n", stderr); + remove ("test-getdelim.txt"); + return 1; + } + f = fopen ("test-getdelim.txt", "rb"); + if (!f) + { + fputs ("Failed to reopen sample file.\n", stderr); + remove ("test-getdelim.txt"); + return 1; + } + + /* Test initial allocation, which must include trailing NUL. */ + line = NULL; + len = 0; + result = getdelim (&line, &len, 'n', f); + ASSERT (result == 2); + ASSERT (strcmp (line, "an") == 0); + ASSERT (2 < len); + free (line); + + /* Test initial allocation again, with line = NULL and len != 0. */ + line = NULL; + len = (size_t)(~0) / 4; + result = getdelim (&line, &len, 'n', f); + ASSERT (result == 2); + ASSERT (strcmp (line, "An") == 0); + ASSERT (2 < len); + free (line); + + /* Test growth of buffer. */ + line = malloc (1); + len = 1; + result = getdelim (&line, &len, 'n', f); + ASSERT (result == 3); + ASSERT (strcmp (line, "bcn") == 0); + ASSERT (3 < len); + + /* Test embedded NULs and EOF behavior. */ + result = getdelim (&line, &len, 'n', f); + ASSERT (result == 3); + ASSERT (memcmp (line, "d\0f", 4) == 0); + ASSERT (3 < len); + + result = getdelim (&line, &len, 'n', f); + ASSERT (result == -1); + + free (line); + fclose (f); + remove ("test-getdelim.txt"); + return 0; +} Index: libidn-1.28/gltests/test-getline.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/gltests/test-getline.c 2016-08-22 15:25:24.919902304 -0400 @@ -0,0 +1,94 @@ +/* Test of getline() function. + Copyright (C) 2007-2015 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, 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 . */ + +/* Written by Eric Blake , 2007. */ + +#include + +#include + +#include "signature.h" +SIGNATURE_CHECK (getline, ssize_t, (char **, size_t *, FILE *)); + +#include +#include + +#include "macros.h" + +int +main (void) +{ + FILE *f; + char *line; + size_t len; + ssize_t result; + + /* Create test file. */ + f = fopen ("test-getline.txt", "wb"); + if (!f || fwrite ("a\nA\nbc\nd\0f", 1, 10, f) != 10 || fclose (f) != 0) + { + fputs ("Failed to create sample file.\n", stderr); + remove ("test-getline.txt"); + return 1; + } + f = fopen ("test-getline.txt", "rb"); + if (!f) + { + fputs ("Failed to reopen sample file.\n", stderr); + remove ("test-getline.txt"); + return 1; + } + + /* Test initial allocation, which must include trailing NUL. */ + line = NULL; + len = 0; + result = getline (&line, &len, f); + ASSERT (result == 2); + ASSERT (strcmp (line, "a\n") == 0); + ASSERT (2 < len); + free (line); + + /* Test initial allocation again, with line = NULL and len != 0. */ + line = NULL; + len = (size_t)(~0) / 4; + result = getline (&line, &len, f); + ASSERT (result == 2); + ASSERT (strcmp (line, "A\n") == 0); + ASSERT (2 < len); + free (line); + + /* Test growth of buffer, must not leak. */ + line = malloc (1); + len = 0; + result = getline (&line, &len, f); + ASSERT (result == 3); + ASSERT (strcmp (line, "bc\n") == 0); + ASSERT (3 < len); + + /* Test embedded NULs and EOF behavior. */ + result = getline (&line, &len, f); + ASSERT (result == 3); + ASSERT (memcmp (line, "d\0f", 4) == 0); + ASSERT (3 < len); + + result = getline (&line, &len, f); + ASSERT (result == -1); + + free (line); + fclose (f); + remove ("test-getline.txt"); + return 0; +} Index: libidn-1.28/src/idn.c =================================================================== --- libidn-1.28.orig/src/idn.c 2016-08-22 15:25:24.923902343 -0400 +++ libidn-1.28/src/idn.c 2016-08-22 15:25:24.919902304 -0400 @@ -126,7 +126,8 @@ main (int argc, char *argv[]) { struct gengetopt_args_info args_info; - char readbuf[BUFSIZ]; + char *line = NULL; + size_t linelen = 0; char *p, *r; uint32_t *q; unsigned cmdn = 0; @@ -190,11 +191,8 @@ do { if (cmdn < args_info.inputs_num) - { - strncpy (readbuf, args_info.inputs[cmdn++], BUFSIZ - 1); - readbuf[BUFSIZ - 1] = '\0'; - } - else if (fgets (readbuf, BUFSIZ, stdin) == NULL) + line = strdup (args_info.inputs[cmdn++]); + else if (getline (&line, &linelen, stdin) == -1) { if (feof (stdin)) break; @@ -202,12 +200,12 @@ error (EXIT_FAILURE, errno, _("input error")); } - if (readbuf[strlen (readbuf) - 1] == '\n') - readbuf[strlen (readbuf) - 1] = '\0'; + if (line[strlen (line) - 1] == '\n') + line[strlen (line) - 1] = '\0'; if (args_info.stringprep_given) { - p = stringprep_locale_to_utf8 (readbuf); + p = stringprep_locale_to_utf8 (line); if (!p) error (EXIT_FAILURE, 0, _("could not convert from %s to UTF-8"), stringprep_locale_charset ()); @@ -267,9 +265,10 @@ if (args_info.punycode_encode_given) { + char encbuf[BUFSIZ]; size_t len, len2; - p = stringprep_locale_to_utf8 (readbuf); + p = stringprep_locale_to_utf8 (line); if (!p) error (EXIT_FAILURE, 0, _("could not convert from %s to UTF-8"), stringprep_locale_charset ()); @@ -289,15 +288,15 @@ } len2 = BUFSIZ - 1; - rc = punycode_encode (len, q, NULL, &len2, readbuf); + rc = punycode_encode (len, q, NULL, &len2, encbuf); free (q); if (rc != PUNYCODE_SUCCESS) error (EXIT_FAILURE, 0, _("punycode_encode: %s"), punycode_strerror (rc)); - readbuf[len2] = '\0'; + encbuf[len2] = '\0'; - p = stringprep_utf8_to_locale (readbuf); + p = stringprep_utf8_to_locale (encbuf); if (!p) error (EXIT_FAILURE, 0, _("could not convert from UTF-8 to %s"), stringprep_locale_charset ()); @@ -316,7 +315,7 @@ if (!q) error (EXIT_FAILURE, ENOMEM, N_("malloc")); - rc = punycode_decode (strlen (readbuf), readbuf, &len, q, NULL); + rc = punycode_decode (strlen (line), line, &len, q, NULL); if (rc != PUNYCODE_SUCCESS) { free (q); @@ -352,7 +351,7 @@ if (args_info.idna_to_ascii_given) { - p = stringprep_locale_to_utf8 (readbuf); + p = stringprep_locale_to_utf8 (line); if (!p) error (EXIT_FAILURE, 0, _("could not convert from %s to UTF-8"), stringprep_locale_charset ()); @@ -429,7 +428,7 @@ if (args_info.idna_to_unicode_given) { - p = stringprep_locale_to_utf8 (readbuf); + p = stringprep_locale_to_utf8 (line); if (!p) error (EXIT_FAILURE, 0, _("could not convert from %s to UTF-8"), stringprep_locale_charset ()); @@ -510,7 +509,7 @@ if (args_info.nfkc_given) { - p = stringprep_locale_to_utf8 (readbuf); + p = stringprep_locale_to_utf8 (line); if (!p) error (EXIT_FAILURE, 0, _("could not convert from %s to UTF-8"), stringprep_locale_charset ()); @@ -572,5 +571,7 @@ while (!feof (stdin) && !ferror (stdin) && (args_info.inputs_num == 0 || cmdn < args_info.inputs_num)); + free (line); + return EXIT_SUCCESS; } debian/patches/CVE-2016-6263.patch0000664000000000000000000000607712756644023013264 0ustar Backport of: From 1fbee57ef3c72db2206dd87e4162108b2f425555 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Thu, 14 Jan 2016 14:31:33 +0100 Subject: stringprep_utf8_nfkc_normalize: Reject invalid UTF8 instead of crashing. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also add regression self check. Reported by Hanno Böck. --- .gitignore | 2 ++ lib/nfkc.c | 12 +++++++++++- tests/Makefile.am | 5 +++-- tests/tst_badutf8nfkc.c | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 tests/tst_badutf8nfkc.c Index: libidn-1.28/lib/nfkc.c =================================================================== --- libidn-1.28.orig/lib/nfkc.c 2016-08-22 14:43:52.572031840 -0400 +++ libidn-1.28/lib/nfkc.c 2016-08-22 14:43:52.568031803 -0400 @@ -1086,6 +1086,16 @@ char * stringprep_utf8_nfkc_normalize (const char *str, ssize_t len) { + size_t n; + + if (len < 0) + n = strlen (str); + else + n = len; + + if (u8_check ((const uint8_t *) str, n)) + return NULL; + return g_utf8_normalize (str, len, G_NORMALIZE_NFKC); } Index: libidn-1.28/tests/tst_badutf8nfkc.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/tests/tst_badutf8nfkc.c 2016-08-22 14:43:52.568031803 -0400 @@ -0,0 +1,41 @@ +/* tst_badutf8nfkc.c --- Self tests for malformed UTF-8 NFKC input. + * Copyright (C) 2016 Simon Josefsson + * + * This file is part of GNU Libidn. + * + * 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 . + * + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#include + +#include "utils.h" + +void +doit (void) +{ + char *badutf8 = strdup ("\xe4"); + char *s = NULL; + + s = stringprep_utf8_nfkc_normalize (badutf8, -1); + free (s); + free (badutf8); +} Index: libidn-1.28/tests/Makefile.am =================================================================== --- libidn-1.28.orig/tests/Makefile.am 2016-08-22 14:43:52.572031840 -0400 +++ libidn-1.28/tests/Makefile.am 2016-08-22 14:44:28.668367270 -0400 @@ -27,7 +27,7 @@ ctests = tst_stringprep tst_punycode tst_idna tst_idna2 tst_idna3 \ tst_idna4 tst_nfkc tst_pr29 tst_strerror tst_toutf8 \ - tst_symbols tst_badutf8 tst_toascii64oob + tst_symbols tst_badutf8 tst_toascii64oob tst_badutf8nfkc if TLD ctests += tst_tld endif debian/patches/CVE-2016-6261-1.patch0000664000000000000000000000161212756643505013412 0ustar From f20ce1128fb7f4d33297eee307dddaf0f92ac72d Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Thu, 14 Jan 2016 13:46:52 +0100 Subject: =?UTF-8?q?Fix=20out-of-bounds=20stack=20read.=20=20Report=20and?= =?UTF-8?q?=20patch=20by=20Hanno=20B=C3=B6ck.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/idna.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/idna.c b/lib/idna.c index 5107d73..0ccd102 100644 --- a/lib/idna.c +++ b/lib/idna.c @@ -212,6 +212,8 @@ step3: } if (i < 64) out[i] = '\0'; + else + return IDNA_INVALID_LENGTH; if (inasciirange) goto step8; } @@ -266,7 +268,7 @@ step3: step8: free (src); - if (strlen (out) < 1 || strlen (out) > 63) + if (strlen (out) < 1) return IDNA_INVALID_LENGTH; return IDNA_SUCCESS; -- cgit v1.0 debian/patches/fix_gdoc.patch0000664000000000000000000004523612757103132013435 0ustar From 083588cd7b41f0b2ed01b6b83f72b15e4e92b4e6 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Mon, 2 Mar 2015 10:58:14 +0100 Subject: [PATCH] Sync gdoc. --- doc/gdoc | 369 ++++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 263 insertions(+), 106 deletions(-) Index: libidn-1.28/doc/gdoc =================================================================== --- libidn-1.28.orig/doc/gdoc 2016-08-23 13:22:32.181018397 -0400 +++ libidn-1.28/doc/gdoc 2016-08-23 13:22:32.181018397 -0400 @@ -1,7 +1,6 @@ eval '(exit $?0)' && eval 'exec perl -S "$0" ${1+"$@"}' - & eval 'exec perl -S "$0" $argv:q' + & eval 'exec perl -S "$0" $argv:q' if 0; -# Generate documentation from source code. ## Copyright (c) 2002-2013 Simon Josefsson ## added -texinfo, -listfunc, -pkg-name @@ -10,6 +9,8 @@ ## Copyright (c) 2001, 2002 Nikos Mavrogiannopoulos ## added -tex ## Copyright (c) 1998 Michael Zucchi +## Copyright (c) 2013 Adam Sampson +## made highlighting not depend on hash order, for Perl 5.18 # 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 @@ -103,14 +104,14 @@ # * my_function - does my stuff # * @my_arg: its mine damnit # * -# * Does my stuff explained. +# * Does my stuff explained. # */ # # or, could also use: # /** # * my_function - does my stuff # * @my_arg: its mine damnit -# * Description: Does my stuff explained. +# * Description: Does my stuff explained. # */ # etc. # @@ -135,57 +136,59 @@ use POSIX qw(strftime); # match expressions used to find embedded type information -$type_constant = "\\\%(\\w+)"; -$type_func = "(\\w+\\(\\))"; -$type_param = "\\\@(\\w+)"; -$type_struct = "\\\#(\\w+)"; -$type_env = "(\\\$\\w+)"; +$type_constant = "\\\%([A-Za-z0-9_]+)"; +$type_func = "([A-Za-z0-9_]+\\(\\))"; +$type_param = '\@([A-Za-z0-9_]+)\s*'; +$type_struct = "\\\#([A-Za-z0-9_]+)"; +$type_env = "(\\\$[A-Za-z0-9_]+)"; # Output conversion substitutions. # One for each output format # these work fairly well -%highlights_html = ( $type_constant, "\$1", - $type_func, "\$1", - $type_struct, "\$1", - $type_param, "\$1" ); +@highlights_html = ( [$type_constant, '"$1"'], + [$type_func, '"$1"'], + [$type_struct, '"$1"'], + [$type_param, '" $1 "'] ); $blankline_html = "

"; -%highlights_texinfo = ( $type_constant, "\\\@code{\$1}", - $type_func, "\\\@code{\$1}", - $type_struct, "\\\@code{\$1}", - $type_param, "\\\@code{\$1}" ); +@highlights_texinfo = ( [$type_param, '" \@code{$1} "'], + [$type_constant, '"\@code{$1} "'], + [$type_func, '"\@code{$1} "'], + [$type_struct, '"\@code{$1} "'], + ); $blankline_texinfo = ""; -%highlights_tex = ( $type_constant, "{\\\\it \$1}", - $type_func, "{\\\\bf \$1}", - $type_struct, "{\\\\it \$1}", - $type_param, "{\\\\bf \$1}" ); +@highlights_tex = ( [$type_param, '" {\\\bf $1} "'], + [$type_constant, '"{\\\it $1}"'], + [$type_func, '"{\\\bf $1}"'], + [$type_struct, '"{\\\it $1}"'], + ); $blankline_tex = "\\\\"; # sgml, docbook format -%highlights_sgml = ( $type_constant, "\$1", - $type_func, "\$1", - $type_struct, "\$1", - $type_env, "\$1", - $type_param, "\$1" ); +@highlights_sgml = ( [$type_constant, '"$1"'], + [$type_func, '"$1"'], + [$type_struct, '"$1"'], + [$type_env, '"$1"'], + [$type_param, '" $1 "'] ); $blankline_sgml = "\n"; # these are pretty rough -%highlights_man = ( $type_constant, "\\\\fB\$1\\\\fP", - $type_func, "\\\\fB\$1\\\\fP", - $type_struct, "\\\\fB\$1\\\\fP", - $type_param, "\\\\fI\$1\\\\fP" ); +@highlights_man = ( [$type_constant, '"\\\fB$1\\\fP"'], + [$type_func, '"\\\fB$1\\\fP"'], + [$type_struct, '"\\\fB$1\\\fP"'], + [$type_param, '" \\\fI$1\\\fP "'] ); $blankline_man = ""; # text-mode -%highlights_text = ( $type_constant, "\$1", - $type_func, "\$1", - $type_struct, "\$1", - $type_param, "\$1" ); +@highlights_text = ( [$type_constant, '"$1"'], + [$type_func, '"$1"'], + [$type_struct, '"$1"'], + [$type_param, '"$1 "'] ); $blankline_text = ""; - +my $lineprefix = ""; sub usage { print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man | -tex | -texinfo -listfunc ]\n"; @@ -204,7 +207,7 @@ $verbose = 0; $output_mode = "man"; -%highlights = %highlights_man; +@highlights = @highlights_man; $blankline = $blankline_man; $modulename = "API Documentation"; $sourceversion = strftime "%Y-%m-%d", localtime; @@ -213,27 +216,27 @@ $cmd = shift @ARGV; if ($cmd eq "-html") { $output_mode = "html"; - %highlights = %highlights_html; + @highlights = @highlights_html; $blankline = $blankline_html; } elsif ($cmd eq "-man") { $output_mode = "man"; - %highlights = %highlights_man; + @highlights = @highlights_man; $blankline = $blankline_man; } elsif ($cmd eq "-tex") { $output_mode = "tex"; - %highlights = %highlights_tex; + @highlights = @highlights_tex; $blankline = $blankline_tex; } elsif ($cmd eq "-texinfo") { $output_mode = "texinfo"; - %highlights = %highlights_texinfo; + @highlights = @highlights_texinfo; $blankline = $blankline_texinfo; } elsif ($cmd eq "-text") { $output_mode = "text"; - %highlights = %highlights_text; + @highlights = @highlights_text; $blankline = $blankline_text; } elsif ($cmd eq "-docbook") { $output_mode = "sgml"; - %highlights = %highlights_sgml; + @highlights = @highlights_sgml; $blankline = $blankline_sgml; } elsif ($cmd eq "-listfunc") { $output_mode = "listfunc"; @@ -273,6 +276,8 @@ my $name = shift @_; my $contents = join "\n", @_; + $name = " $name"; + if ($name =~ m/$type_constant/) { $name = $1; # print STDERR "constant section '$1' = '$contents'\n"; @@ -283,6 +288,7 @@ $parameters{$name} = $contents; } else { # print STDERR "other section '$name' = '$contents'\n"; + $name =~ tr/ //d; $sections{$name} = $contents; push @sectionlist, $name; } @@ -297,37 +303,17 @@ # parameters => %parameter descriptions # sectionlist => @list of sections # sections => %descriont descriptions -# - -sub repstr { - $pattern = shift; - $repl = shift; - $match1 = shift; - $match2 = shift; - $match3 = shift; - $match4 = shift; - - $output = $repl; - $output =~ s,\$1,$match1,g; - $output =~ s,\$2,$match2,g; - $output =~ s,\$3,$match3,g; - $output =~ s,\$4,$match4,g; - - eval "\$return = qq/$output/"; - -# print "pattern $pattern matched 1=$match1 2=$match2 3=$match3 4=$match4 replace $repl yielded $output interpolated $return\n"; - - $return; -} +# sub just_highlight { my $contents = join "\n", @_; my $line; my $ret = ""; - foreach $pattern (keys %highlights) { -# print "scanning pattern $pattern ($highlights{$pattern})\n"; - $contents =~ s:$pattern:repstr($pattern, $highlights{$pattern}, $1, $2, $3, $4):gse; + foreach $highlight (@highlights) { + my ($pattern, $replace) = @$highlight; + #print "scanning pattern $pattern ($replace)\n"; + $contents =~ s/$pattern/$replace/gees; } foreach $line (split "\n", $contents) { if ($line eq ""){ @@ -373,13 +359,45 @@ } } foreach $section (@{$args{'sectionlist'}}) { + $section =~ s/\@//g; print "\n\@strong{$section:} " if $section ne $section_default; - $args{'sections'}{$section} =~ s:([{}]):\@\1:gs; + $args{'sections'}{$section} =~ s:([{}]):\@$1:gs; output_highlight($args{'sections'}{$section}); } print "\@end deftypefun\n\n"; } +sub output_enum_texinfo { + my %args = %{$_[0]}; + my ($parameter, $section); + my $count; + my $name = $args{'enum'}; + my $param; + my $param2; + my $sec; + my $check; + my $type; + + print "\n\@c $name\n"; + print "\@table \@code\n"; + + $check=0; + foreach $parameter (@{$args{'parameterlist'}}) { + $param1 = $parameter; + $param1 =~ s/_/_\@-/g; + + $check = 1; + print "\@item ".$param1."\n"; +# print "\n"; + + $param2 = $args{'parameters'}{$parameter}; + $out = just_highlight($param2); + chomp $out; + print $out . "\n"; + } + print "\@end table\n"; +} + # output in html sub output_html { my %args = %{$_[0]}; @@ -431,7 +449,9 @@ $func =~ s/_/\\_/g; - print "\n\n\\subsection{". $func . "}\n\\label{" . $args{'function'} . "}\n"; + print "\n\n\\begin{function}\n"; + print "\\functionTitle{". $func . "}\n"; + print "\\index{". $func . "}\n"; $type = $args{'functiontype'}; $type =~ s/_/\\_/g; @@ -454,9 +474,8 @@ } print ")\n"; - print "\n{\\large{Arguments}}\n"; + print "\n\\begin{functionArguments}\n"; - print "\\begin{itemize}\n"; $check=0; foreach $parameter (@{$args{'parameterlist'}}) { $param1 = $args{'parametertypes'}{$parameter}; @@ -465,11 +484,12 @@ $param2 =~ s/_/\\_/g; $check = 1; - print "\\item {\\it ".$param1."} {\\bf ".$param2."}: \n"; + print "\\functionArgument {\\it ".$param1."} {\\bf ".$param2."}: \n"; # print "\n"; $param3 = $args{'parameters'}{$parameter}; - $param3 =~ s/#([a-zA-Z\_]+)/{\\it \1}/g; + $param3 =~ s/\#([a-zA-Z\_]+)/{\\it $1}/g; + $param3 =~ s/\%([a-zA-Z\_]+)/{\\bf $1}/g; $out = just_highlight($param3); $out =~ s/_/\\_/g; @@ -478,31 +498,72 @@ if ($check==0) { print "\\item void\n"; } - print "\\end{itemize}\n"; + print "\\end{functionArguments}\n"; foreach $section (@{$args{'sectionlist'}}) { $sec = $section; $sec =~ s/_/\\_/g; - $sec =~ s/#([a-zA-Z\_]+)/{\\it \1}/g; + $sec =~ s/#([a-zA-Z\_]+)/{\\it $1}/g; - print "\n{\\large{$sec}}\\\\\n"; - print "\\begin{rmfamily}\n"; + print "\n\\begin{function${sec}}\n"; + $out = $args{'sections'}{$section}; - $sec = $args{'sections'}{$section}; - $sec =~ s/\\:/:/g; - $sec =~ s/#([a-zA-Z\_]+)/{\\it \1}/g; - $sec =~ s/->/\$\\rightarrow\$/g; - $sec =~ s/([0-9]+)\^([0-9]+)/\$\{\1\}\^\{\2\}\$/g; - - $out = just_highlight($sec); - $out =~ s/_/\\_/g; + $out =~ s/\#([a-zA-Z\_]+)/{\\it $1}/g; + $out =~ s/\%([a-zA-Z\_]+)/{\\bf $1}/g; + $out =~ s/\@([a-zA-Z\_]+)/{\\bf $1}/g; + $out =~ s/_/\\_\\-/g; + $out =~ s/\$/\\\$/g; + $out =~ s/#/\\#/g; + $out =~ s/\n\n/\n/g; + $out =~ s/\\:/:/g; + $out =~ s/\-\>/\$\\rightarrow\$/g; + $out =~ s/([0-9]+)\^([0-9]+)/\$\{$1\}\^\{$2\}\$/g; print $out; - print "\\end{rmfamily}\n"; + print "\\end{function${sec}}\n"; } - print "\n"; + print "\\end{function}\n\n"; } +sub output_enum_tex { + my %args = %{$_[0]}; + my ($parameter, $section); + my $count; + my $name = $args{'enum'}; + my $param; + my $param2; + my $sec; + my $check; + my $type; + + print "\n\n\\begin{enum}\n"; + $name =~ s/_/\\_/g; + print "\\enumTitle{". $name . "}\n"; + print "\\index{". $name . "}\n"; + + print "\n\\begin{enumList}\n"; + + $check=0; + foreach $parameter (@{$args{'parameterlist'}}) { + $param1 = $parameter; + $param1 =~ s/_/\\_\\-/g; + + $check = 1; + print "\\enumElement{".$param1."}{"; +# print "\n"; + + $param2 = $args{'parameters'}{$parameter}; + $param2 =~ s/\#([a-zA-Z\_]+)/{\\it $1}/g; + $param2 =~ s/\%([a-zA-Z\_]+)/{\\bf $1}/g; + $out = just_highlight($param2); + $out =~ s/_/\\_/g; + chomp $out; + print $out . "}\n"; + } + print "\\end{enumList}\n"; + + print "\\end{enum}\n\n"; +} # output in sgml DocBook sub output_sgml { @@ -642,11 +703,14 @@ if ($args{'bugsto'}) { print ".SH \"REPORTING BUGS\"\n"; print "Report bugs to <". $args{'bugsto'} . ">.\n"; + print ".br\n"; + print "General guidelines for reporting bugs: http://www.gnu.org/gethelp/\n"; + print ".br\n"; if ($args{'pkgname'}) { print $args{'pkgname'} . " home page: " . "http://www.gnu.org/software/" . $args{'module'} . "/\n"; } - print "General help using GNU software: http://www.gnu.org/gethelp/\n"; + print "\n"; } if ($args{'copyright'}) { @@ -673,6 +737,10 @@ print ".B info " . $args{'seeinfo'} . "\n"; print ".PP\n"; print "should give you access to the complete manual.\n"; + print "As an alternative you may obtain the manual from:\n"; + print ".IP\n"; + print ".B http://www.gnu.org/software/" . $args{'module'} . "/manual/\n"; + print ".PP\n"; } } @@ -708,6 +776,10 @@ eval "output_".$output_mode."(\@_);"; } +sub output_enum { + eval "output_enum_".$output_mode."(\@_);"; +} + ## # takes a function prototype and spits out all the details @@ -747,7 +819,7 @@ # print STDERR " :> @args\n"; $type = join " ", @args; - if ($parameters{$param} eq "" && $param != "void") { + if ((!defined($parameters{$param}) || $parameters{$param} eq "") && $param ne "void") { $parameters{$param} = "-- undescribed --"; print STDERR "warning: $lineno: Function parameter '$param' not described in '$function_name'\n"; } @@ -758,7 +830,7 @@ # print STDERR "param = '$param', type = '$type'\n"; } } else { - print STDERR "warning: $lineno: Cannot understand prototype: '$prototype'\n"; + print STDERR "warning: $lineno: Cannot understand prototype: '$prototype'\n" if (!($prototype =~ m,GSASL_VALID_MECHANISM_CHARACTERS,)); return; } @@ -784,6 +856,56 @@ } } +sub dump_enum { + my $prototype = shift @_; + + if (($prototype =~ m/^\s*typedef\s+enum\s*[a-zA-Z0-9_~:]*\s*\{([\-a-zA-Z0-9_~=,:\s\(\)\<]+)\s*\}\s*([a-zA-Z0-9_]+);.*/)) { +# || $prototype =~ m/^\s*enum\s+([a-zA-Z0-9_~:]+).*/) { + $args = $1; + $name = $2; + + foreach $arg (split ',', $args) { + # strip leading/trailing spaces + $arg =~ s/^\s*//; + $arg =~ s/\s*$//; + $arg =~ s/([A-Za-z0-9_]+)\s*=.*/$1/g; +# print STDERR "SCAN ARG: '$arg'\n"; + + next if $arg eq ''; + if ((!defined($parameters{$arg}) || $parameters{$arg} eq "")) { + $parameters{$arg} = "-- undescribed --"; + print STDERR "warning: $lineno: Enumeration parameter '$arg' not described in '$name'\n"; + } + + push @parameterlist, $arg; + +# print STDERR "param = '$arg'\n"; + } + } else { +# print STDERR "warning: $lineno: Cannot understand enumeration: '$prototype'\n"; + return; + } + + output_enum({'enum' => $name, + 'module' => $modulename, + 'sourceversion' => $sourceversion, + 'include' => $include, + 'includefuncprefix' => $includefuncprefix, + 'bugsto' => $bugsto, + 'pkgname' => $pkgname, + 'copyright' => $copyright, + 'verbatimcopying' => $verbatimcopying, + 'seeinfo' => $seeinfo, + 'functiontype' => $return_type, + 'parameterlist' => \@parameterlist, + 'parameters' => \%parameters, + 'parametertypes' => \%parametertypes, + 'sectionlist' => \@sectionlist, + 'sections' => \%sections, + 'purpose' => $function_purpose + }); +} + ###################################################################### # main # states @@ -800,7 +922,7 @@ $doc_end = "\\*/"; $doc_com = "\\s*\\*\\s*"; $doc_func = $doc_com."(\\w+):?"; -$doc_sect = $doc_com."([".$doc_special."[:upper:]][\\w ]+):\\s*(.*)"; +$doc_sect = $doc_com."([".$doc_special."[:upper:]][\\w]+):\\s*(.*)"; $doc_content = $doc_com."(.*)"; %constants = (); @@ -812,25 +934,30 @@ $contents = ""; $section_default = "Description"; # default section $section = $section_default; +$enum = 0; $lineno = 0; + foreach $file (@ARGV) { if (!open(IN,"<$file")) { print STDERR "Error: Cannot open file $file\n"; next; } - while () { + while ($line = ) { $lineno++; if ($state == 0) { - if (/$doc_start/o) { + if ($line =~ /$doc_start/o) { $state = 1; # next line is always the function name +# print STDERR "XXX: start of doc comment\n"; } } elsif ($state == 1) { # this line is the function name (always) - if (/$doc_func/o) { + if ($line =~ /$doc_func/o) { $function = $1; $state = 2; - if (/-\s*(.*)/) { +# print STDERR "XXX: start of doc comment, looking for prototype\n"; + + if ($line =~ /-\s*(.*)/) { $function_purpose = $1; } else { $function_purpose = ""; @@ -844,11 +971,11 @@ $state = 0; } } elsif ($state == 2) { # look for head: lines, and include content - if (/$doc_sect/o) { + if ($line =~ /$doc_sect/o) { $newsection = $1; $newcontents = $2; - if ($contents ne "") { + if ($contents ne '') { dump_section($section, $contents); $section = $section_default; } @@ -858,7 +985,7 @@ $contents .= "\n"; } $section = $newsection; - } elsif (/$doc_end/) { + } elsif ($line =~ /$doc_end/) { if ($contents ne "") { dump_section($section, $contents); @@ -866,13 +993,12 @@ $contents = ""; } -# print STDERR "end of doc comment, looking for prototype\n"; - $prototype = ""; + $prototype = ''; $state = 3; - } elsif (/$doc_content/) { + } elsif ($line =~ /$doc_content/) { # miguel-style comment kludge, look for blank lines after # @parameter line to signify start of description - if ($1 eq "" && $section =~ m/^@/) { + if ($1 eq '' && $section =~ m/^@/) { dump_section($section, $contents); $section = $section_default; $contents = ""; @@ -884,16 +1010,25 @@ print STDERR "warning: $lineno: Bad line: $_"; } } elsif ($state == 3) { # scanning for function { (end of prototype) - if (m#\s*/\*\s+MACDOC\s*#io) { + if ($line =~ /([a-zA-Z\s]+)enum(.*)$/) { + $enum = 1; + } + + if ($line =~ m#\s*/\*\s+MACDOC\s*#io) { # do nothing } - elsif (/([^\{]*)/) { + elsif ($enum == 1 && $line =~ /(\s*\{).*/) { + $prototype = "typedef enum {"; + } + elsif ($line =~ /([^\{]*)/) { $prototype .= $1; } - if (/\{/) { + + if ($enum == 0 && $line =~ /;/) { $prototype =~ s@/\*.*?\*/@@gos; # strip comments. $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's. $prototype =~ s@^ +@@gos; # strip leading spaces + dump_function($prototype); $function = ""; @@ -904,9 +1039,31 @@ %sections = (); @sectionlist = (); $prototype = ""; + $enum = 0; $state = 0; } + elsif ($enum == 1 && $line =~ /\}/) { + $prototype =~ s@/\*.*?\*/@@gos; # strip comments. + $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's. + $prototype =~ s@^ +@@gos; # strip leading spaces + + dump_enum($prototype); + + $function = ""; + %constants = (); + %parameters = (); + %parametertypes = (); + @parameterlist = (); + %sections = (); + @sectionlist = (); + $prototype = ""; + $enum = 0; + + $state = 0; + } + } } + } debian/patches/series0000664000000000000000000000036613162217160012040 0ustar link-pthread.diff CVE-2015-2059-1.patch CVE-2015-2059-2.patch CVE-2015-8948.patch CVE-2016-6261-1.patch CVE-2016-6261-2.patch CVE-2016-6261-3.patch CVE-2016-6262.patch CVE-2016-6263.patch fix_broken_test.patch fix_gdoc.patch CVE-2017-14062.patch debian/patches/link-pthread.diff0000664000000000000000000000311412250033212014020 0ustar Index: b/lib/gltests/Makefile.am =================================================================== --- a/lib/gltests/Makefile.am +++ b/lib/gltests/Makefile.am @@ -265,6 +265,7 @@ TESTS += test-lock check_PROGRAMS += test-lock test_lock_LDADD = $(LDADD) @LIBMULTITHREAD@ @YIELD_LIB@ +test_lock_LDFLAGS = -Wl,--no-as-needed EXTRA_DIST += test-lock.c ## end gnulib module lock-tests @@ -655,6 +655,7 @@ check_PROGRAMS += test-thread_self test-thread_create test_thread_self_LDADD = $(LDADD) @LIBTHREAD@ test_thread_create_LDADD = $(LDADD) @LIBMULTITHREAD@ +test_thread_create_LDFLAGS = -Wl,--no-as-needed EXTRA_DIST += test-thread_self.c test-thread_create.c macros.h ## end gnulib module thread-tests Index: b/lib/gltests/Makefile.in =================================================================== --- a/lib/gltests/Makefile.in +++ b/lib/gltests/Makefile.in @@ -1610,6 +1610,7 @@ test_iconv_LDADD = $(LDADD) @LIBICONV@ test_localename_LDADD = $(LDADD) @INTL_MACOSX_LIBS@ $(LIBTHREAD) test_lock_LDADD = $(LDADD) @LIBMULTITHREAD@ @YIELD_LIB@ +test_lock_LDFLAGS = -Wl,--no-as-needed # Because this Makefile snippet defines a variable used by other # gnulib Makefile snippets, it must be present in all Makefile.am that @@ -1622,6 +1622,7 @@ test_striconv_LDADD = $(LDADD) @LIBICONV@ test_thread_self_LDADD = $(LDADD) @LIBTHREAD@ test_thread_create_LDADD = $(LDADD) @LIBMULTITHREAD@ +test_thread_create_LDFLAGS = -Wl,--no-as-needed test_u8_mbtoucr_SOURCES = unistr/test-u8-mbtoucr.c test_u8_mbtoucr_LDADD = $(LDADD) $(LIBUNISTRING) test_u8_uctomb_SOURCES = unistr/test-u8-uctomb.c debian/patches/CVE-2016-6261-2.patch0000664000000000000000000000113712756643512013413 0ustar From 11abd0e02c16f9e0b6944aea4ef0f2df44b42dd4 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Thu, 14 Jan 2016 14:09:29 +0100 Subject: Fix memory leak in last fix. --- lib/idna.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/idna.c b/lib/idna.c index 0ccd102..3ab1869 100644 --- a/lib/idna.c +++ b/lib/idna.c @@ -213,7 +213,10 @@ step3: if (i < 64) out[i] = '\0'; else - return IDNA_INVALID_LENGTH; + { + free (src); + return IDNA_INVALID_LENGTH; + } if (inasciirange) goto step8; } -- cgit v1.0 debian/patches/fix_broken_test.patch0000664000000000000000000000170712756652545015053 0ustar From a8dc72ad1cc0c666a99b472e7fbcee96fe9c5c96 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Wed, 8 Jul 2015 01:02:00 +0200 Subject: [PATCH] Fix broken encoding (ISO-8859-1 vs UTF-8) of this file. --- tests/tst_idna4.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Index: libidn-1.28/tests/tst_idna4.c =================================================================== --- libidn-1.28.orig/tests/tst_idna4.c 2016-08-22 15:40:37.333009750 -0400 +++ libidn-1.28/tests/tst_idna4.c 2016-08-22 15:41:17.357414708 -0400 @@ -46,7 +46,9 @@ if (rc != IDNA_INVALID_LENGTH) fail ("unexpected rc %d\n", rc); - rc = idna_to_ascii_8z("Loading...°°°°°°°°°°°°°°]", &out, 0); + rc = idna_to_ascii_8z("Loading...\xC2\xB0\xC2\xB0\xC2\xB0\xC2\xB0\xC2\xB0" + "\xC2\xB0\xC2\xB0\xC2\xB0\xC2\xB0\xC2\xB0\xC2\xB0" + "\xC2\xB0\xC2\xB0\xC2\xB0]", &out, 0); if (rc != IDNA_INVALID_LENGTH) fail ("unexpected rc %d\n", rc); } debian/patches/CVE-2017-14062.patch0000664000000000000000000000175613162217165013333 0ustar From: =?utf-8?q?Tim_R=C3=BChsen?= Date: Tue, 1 Aug 2017 11:16:47 +0200 Subject: lib/puny_decode: Fix integer overflow (found by fuzzing) --- lib/punycode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Index: libidn-1.28/lib/punycode.c =================================================================== --- libidn-1.28.orig/lib/punycode.c 2017-09-25 11:19:13.521215165 -0400 +++ libidn-1.28/lib/punycode.c 2017-09-25 11:19:13.505214957 -0400 @@ -89,11 +89,11 @@ enum /* point (for use in representing integers) in the range 0 to */ /* base-1, or base if cp does not represent a value. */ -static punycode_uint +static unsigned decode_digit (punycode_uint cp) { - return cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 : - cp - 97 < 26 ? cp - 97 : base; + return (unsigned) (cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 : + cp - 97 < 26 ? cp - 97 : base); } /* encode_digit(d,flag) returns the basic code point whose value */ debian/patches/CVE-2016-6261-3.patch0000664000000000000000000000610312756644060013411 0ustar Backport of: From 9a1a7e15d0706634971364493fbb06e77e74726c Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Thu, 14 Jan 2016 13:06:26 +0100 Subject: =?UTF-8?q?Add=20regression=20check=20for=20Hanno=20B=C3=B6ck's=20?= =?UTF-8?q?stack=20OOB=20issue.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ tests/Makefile.am | 2 +- tests/tst_toascii64oob.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 tests/tst_toascii64oob.c Index: libidn-1.28/tests/tst_toascii64oob.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/tests/tst_toascii64oob.c 2016-08-22 14:38:31.589057429 -0400 @@ -0,0 +1,59 @@ +/* tst_toascii64oob.c --- Regression tests for stack OOB in idna_to_ascii(). + * Copyright (C) 2002-2016 Simon Josefsson + * + * This file is part of GNU Libidn. + * + * 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 . + * + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include + +#include +#include + +#include "utils.h" + +/* Reported by Hanno Böck in + https://lists.gnu.org/archive/html/help-libidn/2015-07/msg00016.html */ + +/* This test requires you to build with CFLAGS="-fsanitize=address" + and disable valgrind since asan and valgrind conflict. Thus + normally a bit uneffective, but may be useful to have around. */ + +void +doit (void) +{ + const char *in = "00000000000000000000000000000000000000000000000000" + "00000000000000"; + char *output; + uint32_t *tmp; + int rc; + + tmp = stringprep_utf8_to_ucs4 (in, -1, NULL); + if (!tmp) + fail ("stringprep_utf8_to_ucs4 failed"); + + rc = idna_to_ascii_4z (tmp, &output, 0); + free (tmp); + if (rc != IDNA_INVALID_LENGTH) + fail ("idna_to_ascii_4z: %d", rc); +} Index: libidn-1.28/tests/Makefile.am =================================================================== --- libidn-1.28.orig/tests/Makefile.am 2016-08-22 14:38:06.588826411 -0400 +++ libidn-1.28/tests/Makefile.am 2016-08-22 14:39:12.253433395 -0400 @@ -27,7 +27,7 @@ ctests = tst_stringprep tst_punycode tst_idna tst_idna2 tst_idna3 \ tst_idna4 tst_nfkc tst_pr29 tst_strerror tst_toutf8 \ - tst_symbols tst_badutf8 + tst_symbols tst_badutf8 tst_toascii64oob if TLD ctests += tst_tld endif debian/patches/CVE-2015-2059-1.patch0000664000000000000000000006027112756643606013422 0ustar Backport of: From 2e97c2796581c27213962c77f5a8571a598f9a2e Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Wed, 8 Jul 2015 02:06:22 +0200 Subject: libidn: stringprep_utf8_to_ucs4 now rejects invalid UTF-8. CVE-2015-2059 --- .gitignore | 8 ++ NEWS | 31 +++++- lib/gl/Makefile.am | 10 +- lib/gl/m4/gnulib-cache.m4 | 3 +- lib/gl/m4/gnulib-comp.m4 | 5 + lib/gl/unistr/u8-check.c | 105 +++++++++++++++++++++ lib/gltests/Makefile.am | 10 ++ lib/gltests/unistr/test-u8-check.c | 188 +++++++++++++++++++++++++++++++++++++ lib/nfkc.c | 19 +++- lib/strerror-idna.c | 2 +- lib/strerror-stringprep.c | 4 + lib/stringprep.c | 5 +- lib/stringprep.h | 1 + tests/Makefile.am | 2 +- tests/tst_badutf8.c | 50 ++++++++++ tests/tst_stringprep.c | 22 +++-- 16 files changed, 450 insertions(+), 15 deletions(-) create mode 100644 lib/gl/unistr/u8-check.c create mode 100644 lib/gltests/unistr/test-u8-check.c create mode 100644 tests/tst_badutf8.c Index: libidn-1.28/lib/gl/Makefile.am =================================================================== --- libidn-1.28.orig/lib/gl/Makefile.am 2016-08-22 14:27:57.407178956 -0400 +++ libidn-1.28/lib/gl/Makefile.am 2016-08-22 14:27:57.399178882 -0400 @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --local-dir=lib/gl/override --lib=libgnu --source-base=lib/gl --m4-base=lib/gl/m4 --doc-base=doc --tests-base=lib/gltests --aux-dir=build-aux --with-tests --avoid=iconv-h-tests --avoid=string-tests --avoid=wchar-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=lgl --no-vc-files gettext-h lib-msvc-compat lib-symbol-versions lib-symbol-visibility stdint striconv strverscmp +# Reproduce by: gnulib-tool --import --dir=. --local-dir=lib/gl/override --lib=libgnu --source-base=lib/gl --m4-base=lib/gl/m4 --doc-base=doc --tests-base=lib/gltests --aux-dir=build-aux --with-tests --avoid=iconv-h-tests --avoid=string-tests --avoid=wchar-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=lgl --no-vc-files gettext-h lib-msvc-compat lib-symbol-versions lib-symbol-visibility stdint striconv strverscmp unistr/u8-check AUTOMAKE_OPTIONS = 1.9.6 gnits subdir-objects @@ -489,6 +489,14 @@ ## end gnulib module unistr/base +## begin gnulib module unistr/u8-check + +if LIBUNISTRING_COMPILE_UNISTR_U8_CHECK +libgnu_la_SOURCES += unistr/u8-check.c +endif + +## end gnulib module unistr/u8-check + ## begin gnulib module unistr/u8-mbtoucr if LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR Index: libidn-1.28/lib/gl/m4/gnulib-cache.m4 =================================================================== --- libidn-1.28.orig/lib/gl/m4/gnulib-cache.m4 2016-08-22 14:27:57.407178956 -0400 +++ libidn-1.28/lib/gl/m4/gnulib-cache.m4 2016-08-22 14:27:57.399178882 -0400 @@ -27,7 +27,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --local-dir=lib/gl/override --lib=libgnu --source-base=lib/gl --m4-base=lib/gl/m4 --doc-base=doc --tests-base=lib/gltests --aux-dir=build-aux --with-tests --avoid=iconv-h-tests --avoid=string-tests --avoid=wchar-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=lgl --no-vc-files gettext-h lib-msvc-compat lib-symbol-versions lib-symbol-visibility stdint striconv strverscmp +# gnulib-tool --import --dir=. --local-dir=lib/gl/override --lib=libgnu --source-base=lib/gl --m4-base=lib/gl/m4 --doc-base=doc --tests-base=lib/gltests --aux-dir=build-aux --with-tests --avoid=iconv-h-tests --avoid=string-tests --avoid=wchar-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=lgl --no-vc-files gettext-h lib-msvc-compat lib-symbol-versions lib-symbol-visibility stdint striconv strverscmp unistr/u8-check # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([lib/gl/override]) @@ -39,6 +39,7 @@ stdint striconv strverscmp + unistr/u8-check ]) gl_AVOID([iconv-h-tests string-tests wchar-tests]) gl_SOURCE_BASE([lib/gl]) Index: libidn-1.28/lib/gl/m4/gnulib-comp.m4 =================================================================== --- libidn-1.28.orig/lib/gl/m4/gnulib-comp.m4 2016-08-22 14:27:57.407178956 -0400 +++ libidn-1.28/lib/gl/m4/gnulib-comp.m4 2016-08-22 14:28:32.495504411 -0400 @@ -112,6 +112,8 @@ # Code from module unistd: # Code from module unistd-tests: # Code from module unistr/base: + # Code from module unistr/u8-check: + # Code from module unistr/u8-check-tests: # Code from module unistr/u8-mbtoucr: # Code from module unistr/u8-mbtoucr-tests: # Code from module unistr/u8-uctomb: @@ -173,6 +175,7 @@ fi gl_STRING_MODULE_INDICATOR([strverscmp]) gl_LIBUNISTRING_LIBHEADER([0.9.2], [unistr.h]) + gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-check]) gl_MODULE_INDICATOR([unistr/u8-mbtoucr]) gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-mbtoucr]) gl_MODULE_INDICATOR([unistr/u8-uctomb]) @@ -403,6 +406,7 @@ lib/string.in.h lib/strverscmp.c lib/unistr.in.h + lib/unistr/u8-check.c lib/unistr/u8-mbtoucr.c lib/unistr/u8-uctomb-aux.c lib/unistr/u8-uctomb.c @@ -498,6 +502,7 @@ tests/test-unsetenv.c tests/test-verify.c tests/test-verify.sh + tests/unistr/test-u8-check.c tests/unistr/test-u8-mbtoucr.c tests/unistr/test-u8-uctomb.c tests=lib/alloca.in.h Index: libidn-1.28/lib/gl/unistr/u8-check.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/lib/gl/unistr/u8-check.c 2016-08-22 14:27:57.399178882 -0400 @@ -0,0 +1,105 @@ +/* Check UTF-8 string. + Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + 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 . */ + +#include + +/* Specification. */ +#include "unistr.h" + +const uint8_t * +u8_check (const uint8_t *s, size_t n) +{ + const uint8_t *s_end = s + n; + + while (s < s_end) + { + /* Keep in sync with unistr.h and u8-mbtouc-aux.c. */ + uint8_t c = *s; + + if (c < 0x80) + { + s++; + continue; + } + if (c >= 0xc2) + { + if (c < 0xe0) + { + if (s + 2 <= s_end + && (s[1] ^ 0x80) < 0x40) + { + s += 2; + continue; + } + } + else if (c < 0xf0) + { + if (s + 3 <= s_end + && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0)) + { + s += 3; + continue; + } + } + else if (c < 0xf8) + { + if (s + 4 <= s_end + && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) +#if 1 + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) +#endif + ) + { + s += 4; + continue; + } + } +#if 0 + else if (c < 0xfc) + { + if (s + 5 <= s_end + && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88)) + { + s += 5; + continue; + } + } + else if (c < 0xfe) + { + if (s + 6 <= s_end + && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (s[5] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84)) + { + s += 6; + continue; + } + } +#endif + } + /* invalid or incomplete multibyte character */ + return s; + } + return NULL; +} Index: libidn-1.28/lib/gltests/Makefile.am =================================================================== --- libidn-1.28.orig/lib/gltests/Makefile.am 2016-08-22 14:27:57.407178956 -0400 +++ libidn-1.28/lib/gltests/Makefile.am 2016-08-22 14:27:57.403178920 -0400 @@ -829,6 +829,16 @@ ## end gnulib module unistd-tests +## begin gnulib module unistr/u8-check-tests + +TESTS += test-u8-check +check_PROGRAMS += test-u8-check +test_u8_check_SOURCES = unistr/test-u8-check.c +test_u8_check_LDADD = $(LDADD) $(LIBUNISTRING) +EXTRA_DIST += unistr/test-u8-check.c macros.h + +## end gnulib module unistr/u8-check-tests + ## begin gnulib module unistr/u8-mbtoucr-tests TESTS += test-u8-mbtoucr Index: libidn-1.28/lib/gltests/unistr/test-u8-check.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/lib/gltests/unistr/test-u8-check.c 2016-08-22 14:27:57.403178920 -0400 @@ -0,0 +1,188 @@ +/* Test of u8_check() function. + Copyright (C) 2010-2015 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 . */ + +/* Written by Bruno Haible , 2010. */ + +#include + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Test empty string. */ + { + static const uint8_t input[] = ""; + ASSERT (u8_check (input, 0) == NULL); + } + + /* Test valid non-empty string. */ + { + static const uint8_t input[] = /* "Данило Шеган" */ + "\320\224\320\260\320\275\320\270\320\273\320\276 \320\250\320\265\320\263\320\260\320\275"; + ASSERT (u8_check (input, sizeof (input) - 1) == NULL); + } + + /* Test out-of-range character with 4 bytes: U+110000. */ + { + static const uint8_t input[] = "\320\224\320\260\364\220\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test out-of-range character with 5 bytes: U+200000. */ + { + static const uint8_t input[] = "\320\224\320\260\370\210\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test out-of-range character with 6 bytes: U+4000000. */ + { + static const uint8_t input[] = "\320\224\320\260\374\204\200\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test invalid lead byte. */ + { + static const uint8_t input[] = "\320\224\320\260\376\200\200\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\377\200\200\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test overlong 2-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\301\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test overlong 3-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\340\200\277"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test overlong 4-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\360\200\277\277"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test invalid bytes in 2-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\302\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == NULL); + } + { + static const uint8_t input[] = "\320\224\320\260\302\100"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\302\300"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test invalid bytes in 3-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\342\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == NULL); + } + { + static const uint8_t input[] = "\320\224\320\260\342\100\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\342\300\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\342\200\100"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\342\200\300"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test invalid bytes in 4-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\362\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == NULL); + } + { + static const uint8_t input[] = "\320\224\320\260\362\100\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\300\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\200\100\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\200\300\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\200\200\100"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\200\200\300"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test truncated/incomplete 2-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\302"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test truncated/incomplete 3-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\342\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test truncated/incomplete 4-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\362\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test missing lead byte. */ + { + static const uint8_t input[] = "\320\224\320\260\200\200\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test surrogate codepoints. */ + { + static const uint8_t input[] = "\320\224\320\260\355\240\200\355\260\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\355\260\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + return 0; +} Index: libidn-1.28/lib/nfkc.c =================================================================== --- libidn-1.28.orig/lib/nfkc.c 2016-08-22 14:27:57.407178956 -0400 +++ libidn-1.28/lib/nfkc.c 2016-08-22 14:27:57.403178920 -0400 @@ -1002,6 +1002,8 @@ return g_unichar_to_utf8 (c, outbuf); } +#include + /** * stringprep_utf8_to_ucs4: * @str: a UTF-8 encoded string @@ -1010,9 +1012,10 @@ * @items_written: location to store the number of characters in the * result, or %NULL. * - * Convert a string from UTF-8 to a 32-bit fixed width - * representation as UCS-4, assuming valid UTF-8 input. - * This function does no error checking on the input. + * Convert a string from UTF-8 to a 32-bit fixed width representation + * as UCS-4. The function now performs error checking to verify that + * the input is valid UTF-8 (before it was documented to not do error + * checking). * * Return value: a pointer to a newly allocated UCS-4 string. * This value must be deallocated by the caller. @@ -1020,6 +1023,16 @@ uint32_t * stringprep_utf8_to_ucs4 (const char *str, ssize_t len, size_t * items_written) { + size_t n; + + if (len < 0) + n = strlen (str); + else + n = len; + + if (u8_check ((const uint8_t *) str, n)) + return NULL; + return g_utf8_to_ucs4_fast (str, (glong) len, (glong *) items_written); } Index: libidn-1.28/lib/strerror-idna.c =================================================================== --- libidn-1.28.orig/lib/strerror-idna.c 2016-08-22 14:27:57.407178956 -0400 +++ libidn-1.28/lib/strerror-idna.c 2016-08-22 14:27:57.403178920 -0400 @@ -115,7 +115,7 @@ break; case IDNA_ICONV_ERROR: - p = _("System iconv failed"); + p = _("Could not convert string in locale encoding"); break; case IDNA_MALLOC_ERROR: Index: libidn-1.28/lib/strerror-stringprep.c =================================================================== --- libidn-1.28.orig/lib/strerror-stringprep.c 2016-08-22 14:27:57.407178956 -0400 +++ libidn-1.28/lib/strerror-stringprep.c 2016-08-22 14:27:57.403178920 -0400 @@ -65,6 +65,7 @@ * This usually indicate a problem in the calling application. * STRINGPREP_UNKNOWN_PROFILE: The supplied profile name was not * known to the library. + * STRINGPREP_ICONV_ERROR: Could not convert string in locale encoding. * STRINGPREP_NFKC_FAILED: The Unicode NFKC operation failed. This * usually indicate an internal error in the library. * STRINGPREP_MALLOC_ERROR: The malloc() was out of memory. This is @@ -121,6 +122,9 @@ case STRINGPREP_UNKNOWN_PROFILE: p = _("Unknown profile"); break; + case STRINGPREP_ICONV_ERROR: + p = _("Could not convert string in locale encoding."); + break; case STRINGPREP_NFKC_FAILED: p = _("Unicode normalization failed (internal error)"); Index: libidn-1.28/lib/stringprep.c =================================================================== --- libidn-1.28.orig/lib/stringprep.c 2016-08-22 14:27:57.407178956 -0400 +++ libidn-1.28/lib/stringprep.c 2016-08-22 14:27:57.403178920 -0400 @@ -380,6 +380,8 @@ free (ucs4); ucs4 = stringprep_utf8_to_ucs4 (in, -1, &ucs4len); + if (ucs4 == NULL) + return STRINGPREP_ICONV_ERROR; maxucs4len = ucs4len + adducs4len; newp = realloc (ucs4, maxucs4len * sizeof (uint32_t)); if (!newp) @@ -402,7 +404,7 @@ utf8 = stringprep_ucs4_to_utf8 (ucs4, ucs4len, 0, 0); free (ucs4); if (!utf8) - return STRINGPREP_MALLOC_ERROR; + return STRINGPREP_ICONV_ERROR; if (strlen (utf8) >= maxlen) { @@ -590,6 +592,7 @@ * This usually indicate a problem in the calling application. * @STRINGPREP_UNKNOWN_PROFILE: The supplied profile name was not * known to the library. + * @STRINGPREP_ICONV_ERROR: Could not convert string in locale encoding. * @STRINGPREP_NFKC_FAILED: The Unicode NFKC operation failed. This * usually indicate an internal error in the library. * @STRINGPREP_MALLOC_ERROR: The malloc() was out of memory. This is Index: libidn-1.28/lib/stringprep.h =================================================================== --- libidn-1.28.orig/lib/stringprep.h 2016-08-22 14:27:57.407178956 -0400 +++ libidn-1.28/lib/stringprep.h 2016-08-22 14:27:57.403178920 -0400 @@ -68,6 +68,7 @@ STRINGPREP_PROFILE_ERROR = 101, STRINGPREP_FLAG_ERROR = 102, STRINGPREP_UNKNOWN_PROFILE = 103, + STRINGPREP_ICONV_ERROR = 104, /* Internal errors. */ STRINGPREP_NFKC_FAILED = 200, STRINGPREP_MALLOC_ERROR = 201 Index: libidn-1.28/tests/Makefile.am =================================================================== --- libidn-1.28.orig/tests/Makefile.am 2016-08-22 14:27:57.407178956 -0400 +++ libidn-1.28/tests/Makefile.am 2016-08-22 14:27:57.403178920 -0400 @@ -27,7 +27,7 @@ ctests = tst_stringprep tst_punycode tst_idna tst_idna2 tst_idna3 \ tst_idna4 tst_nfkc tst_pr29 tst_strerror tst_toutf8 \ - tst_symbols + tst_symbols tst_badutf8 if TLD ctests += tst_tld endif Index: libidn-1.28/tests/tst_badutf8.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libidn-1.28/tests/tst_badutf8.c 2016-08-22 14:27:57.403178920 -0400 @@ -0,0 +1,50 @@ +/* tst_badutf8.c --- Self tests for malformed UTF-8 regressions. + * Copyright (C) 2015 Simon Josefsson + * + * This file is part of GNU Libidn. + * + * 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 . + * + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include + +#include +#include + +#include "utils.h" + +void +doit (void) +{ + char *badutf8 = strdup ("\x7e\x64\x61\x72\x10\x2f\x2f\xf9\x2b\x71" + "\x60\x79\x7b\x2e\x63\x75\x2b\x61\x65\x72" + "\x75\x65\x56\x66\x7f\x62\xc5\x76\xe5\x00"); + char *s = NULL; + int rc; + + rc = idna_to_ascii_8z (badutf8, &s, 0); + free (badutf8); + if (rc != IDNA_ICONV_ERROR) + fail ("rc %d\n", rc); + + idn_free (s); +} Index: libidn-1.28/tests/tst_stringprep.c =================================================================== --- libidn-1.28.orig/tests/tst_stringprep.c 2016-08-22 14:27:57.407178956 -0400 +++ libidn-1.28/tests/tst_stringprep.c 2016-08-22 14:27:57.403178920 -0400 @@ -100,7 +100,8 @@ "\xF4\x8F\xBF\xBF", NULL, "Nameprep", 0, STRINGPREP_CONTAINS_PROHIBITED}, {"Surrogate code U+DF42", - "\xED\xBD\x82", NULL, "Nameprep", 0, STRINGPREP_CONTAINS_PROHIBITED}, + "\xED\xBD\x82", NULL, "Nameprep", 0, STRINGPREP_ICONV_ERROR + /* was STRINGPREP_CONTAINS_PROHIBITED */}, {"Non-plain text character U+FFFD", "\xEF\xBF\xBD", NULL, "Nameprep", 0, STRINGPREP_CONTAINS_PROHIBITED}, {"Ideographic description character U+2FF5", @@ -234,15 +235,22 @@ hexprint (strprep[i].in, strlen (strprep[i].in)); binprint (strprep[i].in, strlen (strprep[i].in)); } - { uint32_t *l; - char *x; + char *x = NULL; l = stringprep_utf8_to_ucs4 (strprep[i].in, -1, NULL); - x = stringprep_ucs4_to_utf8 (l, -1, NULL, NULL); + if (l) + x = stringprep_ucs4_to_utf8 (l, -1, NULL, NULL); free (l); - - if (strcmp (strprep[i].in, x) != 0) + if (i == 29) + /* Ignoring known bad UTF-8 in entry 29 */ + continue; + else if (l == NULL) + { + fail ("bad UTF-8 in entry %ld\n", i); + continue; + } + else if (strcmp (strprep[i].in, x) != 0) { fail ("bad UTF-8 in entry %ld\n", i); if (debug) @@ -254,10 +262,12 @@ escapeprint (x, strlen (x)); hexprint (x, strlen (x)); } + continue; } free (x); } + rc = stringprep_profile (strprep[i].in, &p, strprep[i].profile ? strprep[i].profile : debian/patches/CVE-2015-2059-2.patch0000664000000000000000000000221612756643472013417 0ustar From 58c721ac2dc96bccd737f3f544f3a22a50477bbf Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Sat, 1 Aug 2015 15:12:10 +0200 Subject: libidn: Fix crash in idna_to_unicode_8z8z and idna_to_unicode_8zlz. --- NEWS | 3 +++ lib/idna.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) Index: libidn-1.28/lib/idna.c =================================================================== --- libidn-1.28.orig/lib/idna.c 2016-08-22 14:28:54.207705890 -0400 +++ libidn-1.28/lib/idna.c 2016-08-22 14:28:54.203705853 -0400 @@ -746,13 +746,16 @@ int rc; rc = idna_to_unicode_8z4z (input, &ucs4, flags); + if (rc != IDNA_SUCCESS) + return rc; + *output = stringprep_ucs4_to_utf8 (ucs4, -1, NULL, NULL); free (ucs4); if (!*output) return IDNA_ICONV_ERROR; - return rc; + return IDNA_SUCCESS; } /** @@ -777,13 +780,16 @@ int rc; rc = idna_to_unicode_8z8z (input, &utf8, flags); + if (rc != IDNA_SUCCESS) + return rc; + *output = stringprep_utf8_to_locale (utf8); free (utf8); if (!*output) return IDNA_ICONV_ERROR; - return rc; + return IDNA_SUCCESS; } /** debian/libidn11-dev.info0000664000000000000000000000004611077565772012245 0ustar debian/tmp/usr/share/info/libidn.info debian/libidn11-java.docs0000664000000000000000000000005511150744446012372 0ustar debian/tmp/usr/share/doc/libidn11-java/api/* debian/libidn11.symbols0000664000000000000000000000544011336240530012205 0ustar libidn.so.11 libidn11 #MINVER# LIBIDN_1.0@LIBIDN_1.0 1.13 idn_free@LIBIDN_1.0 1.13 idna_strerror@LIBIDN_1.0 1.13 idna_to_ascii_4i@LIBIDN_1.0 1.13 idna_to_ascii_4z@LIBIDN_1.0 1.13 idna_to_ascii_8z@LIBIDN_1.0 1.13 idna_to_ascii_lz@LIBIDN_1.0 1.13 idna_to_unicode_44i@LIBIDN_1.0 1.13 idna_to_unicode_4z4z@LIBIDN_1.0 1.13 idna_to_unicode_8z4z@LIBIDN_1.0 1.13 idna_to_unicode_8z8z@LIBIDN_1.0 1.13 idna_to_unicode_8zlz@LIBIDN_1.0 1.13 idna_to_unicode_lzlz@LIBIDN_1.0 1.13 pr29_4@LIBIDN_1.0 1.13 pr29_4z@LIBIDN_1.0 1.13 pr29_8z@LIBIDN_1.0 1.13 pr29_strerror@LIBIDN_1.0 1.13 punycode_decode@LIBIDN_1.0 1.13 punycode_encode@LIBIDN_1.0 1.13 punycode_strerror@LIBIDN_1.0 1.13 stringprep@LIBIDN_1.0 1.13 stringprep_4i@LIBIDN_1.0 1.13 stringprep_4zi@LIBIDN_1.0 1.13 stringprep_check_version@LIBIDN_1.0 1.13 stringprep_convert@LIBIDN_1.0 1.13 stringprep_iscsi@LIBIDN_1.0 1.13 stringprep_iscsi_prohibit@LIBIDN_1.0 1.17 stringprep_kerberos5@LIBIDN_1.0 1.13 stringprep_locale_charset@LIBIDN_1.0 1.13 stringprep_locale_to_utf8@LIBIDN_1.0 1.13 stringprep_nameprep@LIBIDN_1.0 1.13 stringprep_plain@LIBIDN_1.0 1.13 stringprep_profile@LIBIDN_1.0 1.13 stringprep_profiles@LIBIDN_1.0 1.13 stringprep_rfc3454_A_1@LIBIDN_1.0 1.17 stringprep_rfc3454_B_1@LIBIDN_1.0 1.17 stringprep_rfc3454_B_2@LIBIDN_1.0 1.17 stringprep_rfc3454_B_3@LIBIDN_1.0 1.17 stringprep_rfc3454_C_1_1@LIBIDN_1.0 1.17 stringprep_rfc3454_C_1_2@LIBIDN_1.0 1.17 stringprep_rfc3454_C_2_1@LIBIDN_1.0 1.17 stringprep_rfc3454_C_2_2@LIBIDN_1.0 1.17 stringprep_rfc3454_C_3@LIBIDN_1.0 1.17 stringprep_rfc3454_C_4@LIBIDN_1.0 1.17 stringprep_rfc3454_C_5@LIBIDN_1.0 1.17 stringprep_rfc3454_C_6@LIBIDN_1.0 1.17 stringprep_rfc3454_C_7@LIBIDN_1.0 1.17 stringprep_rfc3454_C_8@LIBIDN_1.0 1.17 stringprep_rfc3454_C_9@LIBIDN_1.0 1.17 stringprep_rfc3454_D_1@LIBIDN_1.0 1.17 stringprep_rfc3454_D_2@LIBIDN_1.0 1.17 stringprep_saslprep@LIBIDN_1.0 1.13 stringprep_saslprep_space_map@LIBIDN_1.0 1.17 stringprep_strerror@LIBIDN_1.0 1.13 stringprep_trace@LIBIDN_1.0 1.13 stringprep_ucs4_nfkc_normalize@LIBIDN_1.0 1.13 stringprep_ucs4_to_utf8@LIBIDN_1.0 1.13 stringprep_unichar_to_utf8@LIBIDN_1.0 1.13 stringprep_utf8_nfkc_normalize@LIBIDN_1.0 1.13 stringprep_utf8_to_locale@LIBIDN_1.0 1.13 stringprep_utf8_to_ucs4@LIBIDN_1.0 1.13 stringprep_utf8_to_unichar@LIBIDN_1.0 1.13 stringprep_xmpp_nodeprep@LIBIDN_1.0 1.13 stringprep_xmpp_nodeprep_prohibit@LIBIDN_1.0 1.13 stringprep_xmpp_resourceprep@LIBIDN_1.0 1.13 tld_check_4@LIBIDN_1.0 1.13 tld_check_4t@LIBIDN_1.0 1.13 tld_check_4tz@LIBIDN_1.0 1.13 tld_check_4z@LIBIDN_1.0 1.13 tld_check_8z@LIBIDN_1.0 1.13 tld_check_lz@LIBIDN_1.0 1.13 tld_default_table@LIBIDN_1.0 1.13 tld_get_4@LIBIDN_1.0 1.13 tld_get_4z@LIBIDN_1.0 1.13 tld_get_table@LIBIDN_1.0 1.13 tld_get_z@LIBIDN_1.0 1.13 tld_strerror@LIBIDN_1.0 1.13 debian/idn.manpages0000664000000000000000000000004411077565772011476 0ustar debian/tmp/usr/share/man/man1/idn.1 debian/copyright0000664000000000000000000004200711761412110011120 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Libidn Upstream-Contact: Simon Josefsson Source: https://www.gnu.org/software/libidn/ Files: * Copyright: Copyright (C) 2002-2012 Simon Josefsson License: GPL-3+ The command-line tools, the build environment, the self-tests, the Emacs Lisp code, and the examples are licensed under the GPLv3+. For example quoting src/idn.c: . * idn.c --- Command line interface to libidn. * Copyright (C) 2003-2012 Simon Josefsson * * This file is part of GNU Libidn. * * 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 . . On Debian systems, the full text of the GNU General Public License version 3 can be found in the `/usr/share/common-licenses/GPL-3' file. Files: doc/libidn.texi Copyright: Copyright 2002-2012 Simon Josefsson. License: GFDL-1.3+ This is the manual, licensed under GFDLv1.3+, quoting the file: . Copyright @copyright{} 2002-2012 Simon Josefsson. . Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. . On Debian systems, the complete text of the GNU Free Documentation License Version 1.3 can be found in the file `/usr/share/common-licenses/GFDL-1.3'. Files: csharp/* Copyright: Copyright (C) 2004-2012 Free Software Foundation, Inc. License: LGPL-3+ | GPL-2+ The C# library is dual-licensed under LGPLv3+ and GPLv2+. For example quoting csharp/IDNA.cs: . // Copyright (C) 2004-2012 Free Software Foundation, Inc. // // Author: Alexander Gnauck AG-Software, mailto:gnauck@ag-software.de // // This file is part of GNU Libidn. // // GNU Libidn is free software: you can redistribute it and/or // modify it under the terms of either: // // * the GNU Lesser General Public License as published by the Free // Software Foundation; either version 3 of the License, or (at // your option) any later version. // // or // // * the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or (at // your option) any later version. // // or both in parallel, as here. // // GNU Libidn 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 copies of the GNU General Public License and // the GNU Lesser General Public License along with this program. If // not, see . . On Debian systems, the full text of the GNU Lesser General Public License version 3.0 can be found in the `/usr/share/common-licenses/LGPL-3' file, and the full text of the GNU General Public License version 2.0 can be found in the `/usr/share/common-licenses/GPL-2' file. Files: java/* Copyright: Copyright (C) 2004-2007 Free Software Foundation, Inc. License: LGPL-3+ | GPL-2+ The Java library is dual-licensed under LGPLv3+ and GPLv2+. For example quoting java/gnu/inet/encoding/IDNA.java: . Copyright (C) 2004-2012 Free Software Foundation, Inc. Author: Oliver Hitz . This file is part of GNU Libidn. . GNU Libidn is free software: you can redistribute it and/or modify it under the terms of either: . * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. . or . * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . or both in parallel, as here. . GNU Libidn 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 copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see . Files: gl/* gltests/* build-aux/* GNUmakefile maint.mk Copyright: Copyright (C) 2007 Free Software Foundation, Inc. License: GPL-3+ These files are copied from gnulib, and the copyright is normally held by Free Software Foundation, Inc. For example gl/strerror.c: . Copyright (C) 2007-2012 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 . Files: lib/* Copyright: Copyright (C) 2002-2012 Simon Josefsson License: LGPL-3+ | GPL-2+ The C library is dual-licensed under LGPLv3+ and GPLv2+. For example quoting lib/stringprep.c: . Copyright (C) 2002-2012 Simon Josefsson . This file is part of GNU Libidn. . GNU Libidn is free software: you can redistribute it and/or modify it under the terms of either: . * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. . or . * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . or both in parallel, as here. . GNU Libidn 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 copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see . Files: lib/gen-unicode-tables.pl Copyright: Copyright (C) 2004, 2005, 2006, 2007, 2008 Simon Josefsson Copyright (C) 1998, 1999 Tom Tromey Copyright (C) 2001 Red Hat Software License: GPL-3+ This file is originally from glib, quoting the file: . # Copyright (C) 2004-2012 Simon Josefsson # Copyright (C) 1998, 1999 Tom Tromey # Copyright (C) 2001 Red Hat Software . # 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 . . # I consider the output of this program to be unrestricted. Use it as # you will. Files: lib/punycode.? Copyright: Copyright (C) 2002-2012 Simon Josefsson Copyright (C) The Internet Society (2003). License: LGPL-3+ | GPL-2+ This file was written by Adam M. Costello and is released under the following license (see RFC 3492): . * Disclaimer and license: Regarding this entire document or any * portion of it (including the pseudocode and C code), the author * makes no guarantees and is not responsible for any damage resulting * from its use. The author grants irrevocable permission to anyone * to use, modify, and distribute it in any way that does not diminish * the rights of anyone else to use, modify, and distribute it, * provided that redistributed derivative works do not contain * misleading author or version information. Derivative works need * not be licensed under similar terms. . The file has been modified and is now distributed under dual LGPLv3+ and GPLv2+, quoting the file: . Copyright (C) 2002-2012 Simon Josefsson . This file is part of GNU Libidn. . GNU Libidn is free software: you can redistribute it and/or modify it under the terms of either: . * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. . or . * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . or both in parallel, as here. . GNU Libidn 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 copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see . Files: lib/nfkc.c Copyright: Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008, 2009 Simon Josefsson Copyright (C) 1999, 2000 Tom Tromey Copyright 2000 Red Hat, Inc. License: LGPL-3+ | GPL-2+ This file contains some functions derived from glib under LGPLv2+ but the entire file uses the dual LGPLv3+ and GPLv2+ license, quoting the file: . Copyright (C) 2002-2012 Simon Josefsson . This file is part of GNU Libidn. . GNU Libidn is free software: you can redistribute it and/or modify it under the terms of either: . * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. . or . * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . or both in parallel, as here. . GNU Libidn 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 copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see . . /* Code from GLIB gmacros.h starts here. */ . /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library 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 of the License, or (at your option) any later version. * * This library 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. . /* Code from GLIB gunicode.h starts here. */ . /* gunicode.h - Unicode manipulation functions * * Copyright (C) 1999, 2000 Tom Tromey * Copyright 2000, 2005 Red Hat, Inc. * * The Gnome Library 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 of the * License, or (at your option) any later version. * * The Gnome Library 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. . /* Code from GLIB gutf8.c starts here. */ . /* gutf8.c - Operations on UTF-8 strings. * * Copyright (C) 1999 Tom Tromey * Copyright (C) 2000 Red Hat, Inc. * * This library 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 of the License, or (at your option) any later version. * * This library 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. . /* Code from GLIB gunidecomp.c starts here. */ . /* decomp.c - Character decomposition. * * Copyright (C) 1999, 2000 Tom Tromey * Copyright 2000 Red Hat, Inc. * * The Gnome Library 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 of the * License, or (at your option) any later version. * * The Gnome Library 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. . On Debian systems, the full text of the GNU Lesser General Public License version 2 can be found in the `/usr/share/common-licenses/LGPL-2' file. Files: lib/gl/* lib/gltests/* Copyright: Copyright (C) 2007 Free Software Foundation, Inc. License: LGPL-2.1+ These files are copied from gnulib, and the copyright is normally held by Free Software Foundation, Inc. For example lib/gl/strverscmp.c: . Copyright (C) 1997, 2000, 2002, 2004, 2006, 2009-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jean-François Bignolles , 1997. . 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. */ . On Debian systems, the full text of the GNU Lesser General Public License version 2.1 can be found in the `/usr/share/common-licenses/LGPL-2.1' file. Files: doc/gdoc Copyright: Copyright (c) 2002-2012 Simon Josefsson Copyright (c) 2001, 2002 Nikos Mavrogiannopoulos Copyright (c) 1998 Michael Zucchi License: GPL-3+ This tool is used to generate texinfo snippets and man pages from the source code. . # 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 . Files: doc/man/* Copyright: Copyright © 2002-2012 Simon Josefsson. License: GAP These are the auto-generated man pages. For example doc/man/stringprep.3: . Copyright © 2002-2012 Simon Josefsson. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. debian/watch0000664000000000000000000000010011150745200010203 0ustar version=3 ftp://ftp.gnu.org/pub/gnu/libidn/libidn-(.*)\.tar\.gz debian/idn.install0000664000000000000000000000010111077565772011343 0ustar debian/tmp/usr/bin/idn debian/tmp/usr/share/emacs/site-lisp/*.el debian/libidn11-dev.docs0000664000000000000000000000001711077565772012240 0ustar doc/libidn.pdf debian/libidn11-dev.manpages0000664000000000000000000000004011077565772013077 0ustar debian/tmp/usr/share/man/man3/* debian/libidn11-java.doc-base0000664000000000000000000000050411150744446013116 0ustar Document: libidn11-java Title: Programmer API for libidn-java Author: Simon Josefsson Abstract: Javadocs programmer API of libidn-java, a library for internationalized domain names handling Section: Programming Format: HTML Index: /usr/share/doc/libidn11-java/api/index.html Files: /usr/share/doc/libidn11-java/api/*.html debian/libidn11-dev.doc-base0000664000000000000000000000035011264562730012752 0ustar Document: libidn11 Title: Programmer API for Libidn Author: Simon Josefsson Abstract: Manual for Internationalized Domain Names library (GNU Libidn) Section: Programming Format: PDF Files: /usr/share/doc/libidn11-dev/libidn.pdf.gz debian/libidn11-dev.install0000664000000000000000000000024211611235171012733 0ustar debian/tmp/usr/include/* debian/tmp/usr/lib/*/lib*.a debian/tmp/usr/lib/*/lib*so debian/tmp/usr/lib/*/pkgconfig/* debian/tmp/usr/share/info/libidn-components.png debian/libidn11-dev.examples0000664000000000000000000000003511077565772013126 0ustar examples/README examples/*.c debian/rules0000775000000000000000000000610612250033417010250 0ustar #!/usr/bin/make -f # -*- makefile -*- export DH_VERBOSE=1 # Don't build libidn11-java on platforms that doesn't have gcj. NO_JAVA_ARCHES := arm hppa hurd-i386 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) ifeq (,$(filter $(DEB_HOST_ARCH),$(NO_JAVA_ARCHES))) ENABLE_JAVA := --enable-java else export DH_OPTIONS=-Nlibidn11-java endif # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) CFG_CROSS = --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) CFG_PATHS = --prefix=/usr --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFG_VERS = `dpkg-parsechangelog|grep ^Version:|cut -d\ -f2` CFG_DEBP = --with-packager=Debian --with-packager-version=$(CFG_VERS) --with-packager-bug-reports=http://bugs.debian.org/ --disable-silent-rules # http://wiki.debian.org/Hardening CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS) config.status: configure dh_testdir dh_autoreconf # Add here commands to configure the package. ./configure $(CFG_CROSS) $(CFG_PATHS) $(CFG_DEBP) $(ENABLE_JAVA) \ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \ LDFLAGS="$(LDFLAGS) -Wl,-z,defs" build: build-arch build-indep build-arch: build-stamp build-indep: build-stamp build-stamp: config.status dh_testdir # Add here commands to compile the package. $(MAKE) all ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) $(MAKE) check endif touch $@ clean: dh_testdir dh_testroot rm -f build-stamp # Add here commands to clean up after the build process. [ ! -f Makefile ] || $(MAKE) distclean dh_autoreconf_clean dh_clean --exclude ./contrib/doxygen/Doxyfile.orig install: build dh_testdir dh_testroot dh_prep --exclude ./contrib/doxygen/Doxyfile.orig dh_installdirs # Add here commands to install the package into debian/tmp $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install install -d $(CURDIR)/debian/libidn11-java/usr/share/doc/libidn11-java/api/ cp -a $(CURDIR)/doc/java/* $(CURDIR)/debian/libidn11-java/usr/share/doc/libidn11-java/api/ rm -f $(CURDIR)/debian/libidn11-java/usr/share/doc/libidn11-java/api/package-list # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_installchangelogs ChangeLog dh_installdocs -A README NEWS TODO AUTHORS THANKS dh_installexamples dh_install dh_installinfo -n dh_installman dh_link dh_strip dh_compress -X.png dh_fixperms dh_makeshlibs -- -c4 dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install debian/libidn11.postinst0000664000000000000000000000011611151533123012371 0ustar #! /bin/sh set -e if [ "$1" = "configure" ]; then ldconfig fi #DEBHELPER#