Release v0.8.0

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCgAGBQJVw3EoAAoJEAgwLbaiZwQovbwQAKmQA8xrnTau05LUyyffyi1Q
 qKNMqXQFKeAJWfJ0tYCHi0vh6wLRUDPL/Xxa4DUoN5Lj8KsHqQOPGk41iScRm6ff
 xSGYzMxznQOcS9rhq+VcwHq/JvEPk9KDKH9gctJNdPQqY4uVfP+Vd7vxCuJZXeRK
 rj7oTVmojzLjWj2MYG1qJJD+EZroRiMFfbNplLZL7547Q1YJ30tcrs8zyqRIm7UI
 YeThQc4MutXG9TvPX+Bja+HWYWg4aKBddLpnmjfF/7gkQGASbCPvvVRflIDK6y13
 mfDgpF3C5/j4Zp5D3W9KlgRKAZH4zUuKh5Yv03TgEZBqSd8+M7kMP57qMcLIrmOt
 3HQY/als0Ct7BBS5XeE+PmzeX6njJ/GYjTghzOIlo1hKFXvqMtSFVwFDfsCuKiGq
 2v6+537oRmTnSNCjQR+n/gswV4SjmAf2yHnEJ/sNtRUQyDSG/2Zca5v4Q0E41oWv
 ys1BNGKG3SOb+pQG5UwzcS88rk1PrP6C4fMz/Y8KSIfkGHoQNA7FC6VqaskwtvMV
 DdtM3CICGyrG59DdFW4Tehyx6DbKgYR97EQtuSbGYw+/1tMM61bzh6eYOWpXCrkr
 Gk48/fhTsMVqXUg42J5WMtoxNp2EWJ0dfj9pXTrSLFYneAm2BI57XZ7sPCtzLkO+
 2iEa7H1VnNzWzARvcTOd
 =/73c
 -----END PGP SIGNATURE-----

Merge tag 'libpsl-0.8.0' into debian

Release v0.8.0
This commit is contained in:
Daniel Kahn Gillmor 2015-08-06 15:48:31 -04:00
commit 9883a5af6d
16 changed files with 198 additions and 9872 deletions

66
.gitignore vendored
View File

@ -1,7 +1,16 @@
*.gz
*.o
*.lo
*.la
*.exe
*~ *~
Makefile */.deps
Makefile.in */.libs
*.cache
*.plist
*.stamp
aclocal.m4 aclocal.m4
ar-lib
autom4te.cache/ autom4te.cache/
compile compile
config.guess config.guess
@ -12,19 +21,33 @@ config.rpath
config.status config.status
config.sub config.sub
configure configure
data/Makefile data
data/Makefile.in
depcomp depcomp
include/Makefile docs/libpsl/html/
include/Makefile.in docs/libpsl/libpsl-decl-list.txt
docs/libpsl/libpsl-decl.txt
docs/libpsl/libpsl-overrides.txt
docs/libpsl/libpsl-undeclared.txt
docs/libpsl/libpsl-undocumented.txt
docs/libpsl/libpsl-unused.txt
docs/libpsl/libpsl.3
docs/libpsl/libpsl.args
docs/libpsl/libpsl.hierarchy
docs/libpsl/libpsl.interfaces
docs/libpsl/libpsl.prerequisites
docs/libpsl/libpsl.signals
docs/libpsl/version.xml
docs/libpsl/xml/
gtk-doc.make
install-sh install-sh
libpsl-*.pc libpsl.pc
libtool libtool
ltmain.sh ltmain.sh
m4/ m4/
Makefile
Makefile.in
missing missing
po/Makefile nbproject/
po/Makefile.in
po/Makefile.in.in po/Makefile.in.in
po/Makevars.template po/Makevars.template
po/POTFILES po/POTFILES
@ -34,24 +57,21 @@ po/en@boldquot.header
po/en@quot.header po/en@quot.header
po/insert-header.sin po/insert-header.sin
po/psl.pot po/psl.pot
po/libpsl.pot
po/quot.sed po/quot.sed
po/remove-potcdate.sin po/remove-potcdate.sin
po/remove-potcdate.sed po/remove-potcdate.sed
po/stamp-po po/stamp-po
src/.deps/ src/psl2c
src/.libs/ src/suffixes.c
src/Makefile
src/Makefile.in
src/libpsl-*.la
src/libpsl_*_la-psl.lo
stamp-h1 stamp-h1
test-driver test-driver
tests/.deps/ tests/*.log
tests/Makefile tests/*.trs
tests/Makefile.in tests/test-is-cookie-domain-acceptable
tests/test-is-public
tests/test-is-public-all
tests/test-is-public-builtin
tests/test-is-tld tests/test-is-tld
tests/test-is-tld.log tests/test-registrable-domain
tests/test-is-tld.o tools/psl
tests/test-is-tld.trs
tests/test-suite.log
psl-*.tar.gz

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "list"]
path = list
url = https://github.com/publicsuffix/list

View File

@ -13,3 +13,5 @@ Daniel Stenberg (Discussion, Ideas)
Darshit Shah (Patching Wget to work with libpsl) Darshit Shah (Patching Wget to work with libpsl)
Dagobert Michelsen (Fixed Solaris building) Dagobert Michelsen (Fixed Solaris building)
Christopher Meng (Fedora building) Christopher Meng (Fedora building)
Jakub Čajka
Giuseppe Scrivano

View File

@ -1,6 +1,6 @@
# got some hints from https://gitorious.org/openismus-playground/examplelib/source # got some hints from https://gitorious.org/openismus-playground/examplelib/source
SUBDIRS = po include src tools data $(LIBPSL_DOCS) tests SUBDIRS = po include src tools $(LIBPSL_DOCS) tests
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
@ -14,4 +14,4 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libpsl.pc pkgconfig_DATA = libpsl.pc
EXTRA_DIST = config.rpath EXTRA_DIST = config.rpath LICENSE list/public_suffix_list.dat list/tests/test_psl.txt

8
NEWS
View File

@ -1,5 +1,13 @@
Copyright (C) 2014 Tim Rühsen Copyright (C) 2014 Tim Rühsen
06.08.2015 Release V0.8.0
* Add https://github.com/publicsuffix as git submodule
* Support Debian 'Reproducible Builds'
* Fix generation of docs
* Check UTF-8 sequences for validity (for libidn<=1.30)
* Add LICENSE to distribution tarball
* Fix compatibility function strndup
21.02.2015 Release V0.7.1 21.02.2015 Release V0.7.1
* include configured PSL file into tarball * include configured PSL file into tarball

View File

@ -6,6 +6,12 @@ if test $? -ne 0; then
exit 1 exit 1
fi fi
GIT=`which git 2>/dev/null`
if test $? -ne 0; then
echo "No 'git' found. You must install the git package."
exit 1
fi
# create m4 before gtkdocize # create m4 before gtkdocize
mkdir m4 2>/dev/null mkdir m4 2>/dev/null
@ -21,6 +27,8 @@ else
$GTKDOCIZE || exit $? $GTKDOCIZE || exit $?
fi fi
$GIT submodule init
$GIT submodule update
$AUTORECONF --install --force --symlink || exit $? $AUTORECONF --install --force --symlink || exit $?
echo echo

View File

@ -1,5 +1,5 @@
AC_INIT([libpsl], [0.7.1], [tim.ruehsen@gmx.de], [libpsl], [http://github.com/rockdaboot/libpsl]) AC_INIT([libpsl], [0.8.0], [tim.ruehsen@gmx.de], [libpsl], [http://github.com/rockdaboot/libpsl])
AC_PREREQ([2.59]) AC_PREREQ([2.59])
AM_INIT_AUTOMAKE([1.10 -Wall no-define foreign]) AM_INIT_AUTOMAKE([1.10 -Wall no-define foreign])
@ -37,8 +37,7 @@ AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], false)
]) ])
if test x"$have_gtk_doc" = xyes -a x"$enable_gtk_doc" = xyes; then if test x"$have_gtk_doc" = xyes -a x"$enable_gtk_doc" = xyes; then
docdir_makefile=docs/libpsl/Makefile AC_CONFIG_FILES([docs/libpsl/Makefile docs/libpsl/version.xml])
docdir_version_xml=docs/libpsl/version.xml
AC_SUBST([LIBPSL_DOCS], [docs/libpsl]) AC_SUBST([LIBPSL_DOCS], [docs/libpsl])
fi fi
@ -77,7 +76,7 @@ PKG_PROG_PKG_CONFIG
# 4. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0. # 4. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0.
# 5. If any interfaces have been added since the last public release, then increment age. # 5. If any interfaces have been added since the last public release, then increment age.
# 6. If any existing interfaces have been removed or changed since the last public release, then set age to 0. # 6. If any existing interfaces have been removed or changed since the last public release, then set age to 0.
AC_SUBST([LIBPSL_SO_VERSION], [2:4:2]) AC_SUBST([LIBPSL_SO_VERSION], [2:5:2])
AC_SUBST([LIBPSL_VERSION], $VERSION) AC_SUBST([LIBPSL_VERSION], $VERSION)
# Check for enable/disable builtin PSL data # Check for enable/disable builtin PSL data
@ -232,14 +231,14 @@ fi
AC_ARG_WITH(psl-file, AC_ARG_WITH(psl-file,
AC_HELP_STRING([--with-psl-file=[PATH]], [path to PSL file]), AC_HELP_STRING([--with-psl-file=[PATH]], [path to PSL file]),
PSL_FILE=$withval, PSL_FILE=$withval,
PSL_FILE="\$(top_srcdir)/data/effective_tld_names.dat") PSL_FILE="\$(top_srcdir)/list/public_suffix_list.dat")
AC_SUBST(PSL_FILE) AC_SUBST(PSL_FILE)
# Check for custom PSL test file # Check for custom PSL test file
AC_ARG_WITH(psl-testfile, AC_ARG_WITH(psl-testfile,
AC_HELP_STRING([--with-psl-testfile=[PATH]], [path to PSL test file]), AC_HELP_STRING([--with-psl-testfile=[PATH]], [path to PSL test file]),
PSL_TESTFILE=$withval, PSL_TESTFILE=$withval,
PSL_TESTFILE="\$(top_srcdir)/data/test_psl.txt") PSL_TESTFILE="\$(top_srcdir)/list/tests/test_psl.txt")
AC_SUBST(PSL_TESTFILE) AC_SUBST(PSL_TESTFILE)
# check for alloca / alloca.h # check for alloca / alloca.h
@ -253,9 +252,6 @@ AC_CONFIG_FILES([Makefile
src/Makefile src/Makefile
tools/Makefile tools/Makefile
po/Makefile.in po/Makefile.in
${docdir_makefile}
${docdir_version_xml}
data/Makefile
tests/Makefile tests/Makefile
libpsl.pc:libpsl.pc.in]) libpsl.pc:libpsl.pc.in])
AC_OUTPUT AC_OUTPUT

67
contrib/check-hard Executable file
View File

@ -0,0 +1,67 @@
#!/bin/sh
#
# Do some checking before 'git push'.
# Set a stricter bash mode
set -e
set -u
CORES=$(grep -c ^processor /proc/cpuinfo 2> /dev/null || echo 0)
if [ $CORES -lt 1 ]; then CORES=1; fi
echo "Running: make distclean"
make distclean > /dev/null || true
# We define _GNU_SOURCE to avoid warnings with missing prototypes.
# C89 does not know snprintf, strdup, strndup, popen, pclose
CFLAGS="-std=c89 -pedantic -O2 -g -Wall -Wextra -Wstrict-prototypes -Wold-style-definition -Wwrite-strings -Wshadow -Wformat -Wformat-security -Wunreachable-code -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -D_GNU_SOURCE"
CACHEFILE=$PWD/config_check.cache
# measure time consumed and print it at the end of the script
START=$(date +%s.%N)
# avoid annoying ar warning
export ARFLAGS="cr"
export AR_FLAGS="cr"
echo "Running: ./autogen.sh"
./autogen.sh > /dev/null
echo
for CC in gcc clang; do
export CC
echo
echo "*** Testing with CC=$CC"
# the compiler changed, so we have to remove the cache file here
rm -f $CACHEFILE
for options in \
"--enable-runtime=libicu --enable-builtin=libicu" \
"--enable-runtime=libidn2 --enable-builtin=libidn2" \
"--enable-runtime=libidn --enable-builtin=libidn"; do
export DISTCHECK_CONFIGURE_FLAGS="-C --cache-file=$CACHEFILE $options"
echo
echo " *** ./configure $DISTCHECK_CONFIGURE_FLAGS"
./configure $DISTCHECK_CONFIGURE_FLAGS CFLAGS="$CFLAGS" > /dev/null
for xVALGRIND in 0 1; do
for xLCALL in C tr_TR.utf8; do
export TESTS_ENVIRONMENT="LC_ALL=$xLCALL VALGRIND_TESTS=$xVALGRIND"
echo " *** TESTS_ENVIRONMENT=\"$TESTS_ENVIRONMENT\"" make check -j$CORES
make check -j$CORES > /dev/null
done
done
unset TESTS_ENVIRONMENT
export TESTS_ENVIRONMENT
echo
echo " *** make distcheck CFLAGS=$CFLAGS -j$CORES"
make distcheck CFLAGS="$CFLAGS" -j$CORES > /dev/null
done
done
END=$(date +%s.%N)
echo
echo "Duration: "$(echo "$END - $START" | bc)

View File

@ -1,3 +0,0 @@
filesdir = $(datadir)/@PACKAGE@
files_DATA = $(PSL_FILE) test_psl.txt
EXTRA_DIST = $(files_DATA)

File diff suppressed because it is too large Load Diff

View File

@ -1,98 +0,0 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/
// null input.
checkPublicSuffix(null, null);
// Mixed case.
checkPublicSuffix('COM', null);
checkPublicSuffix('example.COM', 'example.com');
checkPublicSuffix('WwW.example.COM', 'example.com');
// Leading dot.
checkPublicSuffix('.com', null);
checkPublicSuffix('.example', null);
checkPublicSuffix('.example.com', null);
checkPublicSuffix('.example.example', null);
// Unlisted TLD.
checkPublicSuffix('example', null);
checkPublicSuffix('example.example', 'example.example');
checkPublicSuffix('b.example.example', 'example.example');
checkPublicSuffix('a.b.example.example', 'example.example');
// Listed, but non-Internet, TLD.
//checkPublicSuffix('local', null);
//checkPublicSuffix('example.local', null);
//checkPublicSuffix('b.example.local', null);
//checkPublicSuffix('a.b.example.local', null);
// TLD with only 1 rule.
checkPublicSuffix('biz', null);
checkPublicSuffix('domain.biz', 'domain.biz');
checkPublicSuffix('b.domain.biz', 'domain.biz');
checkPublicSuffix('a.b.domain.biz', 'domain.biz');
// TLD with some 2-level rules.
checkPublicSuffix('com', null);
checkPublicSuffix('example.com', 'example.com');
checkPublicSuffix('b.example.com', 'example.com');
checkPublicSuffix('a.b.example.com', 'example.com');
checkPublicSuffix('uk.com', null);
checkPublicSuffix('example.uk.com', 'example.uk.com');
checkPublicSuffix('b.example.uk.com', 'example.uk.com');
checkPublicSuffix('a.b.example.uk.com', 'example.uk.com');
checkPublicSuffix('test.ac', 'test.ac');
// TLD with only 1 (wildcard) rule.
checkPublicSuffix('cy', null);
checkPublicSuffix('c.cy', null);
checkPublicSuffix('b.c.cy', 'b.c.cy');
checkPublicSuffix('a.b.c.cy', 'b.c.cy');
// More complex TLD.
checkPublicSuffix('jp', null);
checkPublicSuffix('test.jp', 'test.jp');
checkPublicSuffix('www.test.jp', 'test.jp');
checkPublicSuffix('ac.jp', null);
checkPublicSuffix('test.ac.jp', 'test.ac.jp');
checkPublicSuffix('www.test.ac.jp', 'test.ac.jp');
checkPublicSuffix('kyoto.jp', null);
checkPublicSuffix('test.kyoto.jp', 'test.kyoto.jp');
checkPublicSuffix('ide.kyoto.jp', null);
checkPublicSuffix('b.ide.kyoto.jp', 'b.ide.kyoto.jp');
checkPublicSuffix('a.b.ide.kyoto.jp', 'b.ide.kyoto.jp');
checkPublicSuffix('c.kobe.jp', null);
checkPublicSuffix('b.c.kobe.jp', 'b.c.kobe.jp');
checkPublicSuffix('a.b.c.kobe.jp', 'b.c.kobe.jp');
checkPublicSuffix('city.kobe.jp', 'city.kobe.jp');
checkPublicSuffix('www.city.kobe.jp', 'city.kobe.jp');
// TLD with a wildcard rule and exceptions.
checkPublicSuffix('ck', null);
checkPublicSuffix('test.ck', null);
checkPublicSuffix('b.test.ck', 'b.test.ck');
checkPublicSuffix('a.b.test.ck', 'b.test.ck');
checkPublicSuffix('www.ck', 'www.ck');
checkPublicSuffix('www.www.ck', 'www.ck');
// US K12.
checkPublicSuffix('us', null);
checkPublicSuffix('test.us', 'test.us');
checkPublicSuffix('www.test.us', 'test.us');
checkPublicSuffix('ak.us', null);
checkPublicSuffix('test.ak.us', 'test.ak.us');
checkPublicSuffix('www.test.ak.us', 'test.ak.us');
checkPublicSuffix('k12.ak.us', null);
checkPublicSuffix('test.k12.ak.us', 'test.k12.ak.us');
checkPublicSuffix('www.test.k12.ak.us', 'test.k12.ak.us');
// IDN labels.
checkPublicSuffix('食狮.com.cn', '食狮.com.cn');
checkPublicSuffix('食狮.公司.cn', '食狮.公司.cn');
checkPublicSuffix('www.食狮.公司.cn', '食狮.公司.cn');
checkPublicSuffix('shishi.公司.cn', 'shishi.公司.cn');
checkPublicSuffix('公司.cn', null);
checkPublicSuffix('食狮.中国', '食狮.中国');
checkPublicSuffix('www.食狮.中国', '食狮.中国');
checkPublicSuffix('shishi.中国', 'shishi.中国');
checkPublicSuffix('中国', null);
// Same as above, but punycoded.
checkPublicSuffix('xn--85x722f.com.cn', 'xn--85x722f.com.cn');
checkPublicSuffix('xn--85x722f.xn--55qx5d.cn', 'xn--85x722f.xn--55qx5d.cn');
checkPublicSuffix('www.xn--85x722f.xn--55qx5d.cn', 'xn--85x722f.xn--55qx5d.cn');
checkPublicSuffix('shishi.xn--55qx5d.cn', 'shishi.xn--55qx5d.cn');
checkPublicSuffix('xn--55qx5d.cn', null);
checkPublicSuffix('xn--85x722f.xn--fiqs8s', 'xn--85x722f.xn--fiqs8s');
checkPublicSuffix('www.xn--85x722f.xn--fiqs8s', 'xn--85x722f.xn--fiqs8s');
checkPublicSuffix('shishi.xn--fiqs8s', 'shishi.xn--fiqs8s');
checkPublicSuffix('xn--fiqs8s', null);

1
list Submodule

@ -0,0 +1 @@
Subproject commit f1c4849aefa4c61257aba5b595be5d552c99144d

View File

@ -22,7 +22,7 @@ endif
noinst_PROGRAMS = psl2c noinst_PROGRAMS = psl2c
psl2c_SOURCES = psl2c.c psl2c_SOURCES = psl2c.c
psl2c_CPPFLAGS = -I$(top_srcdir)/include -D _GNU_SOURCE psl2c_CPPFLAGS = -I$(top_srcdir)/include
if BUILTIN_GENERATOR_LIBICU if BUILTIN_GENERATOR_LIBICU
psl2c_LDADD = -licuuc psl2c_LDADD = -licuuc
endif endif

View File

@ -28,11 +28,6 @@
* *
*/ */
/* need _GNU_SOURCE for qsort_r() */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
@ -94,11 +89,17 @@
#define countof(a) (sizeof(a)/sizeof(*(a))) #define countof(a) (sizeof(a)/sizeof(*(a)))
#ifndef HAVE_STRNDUP #ifndef HAVE_STRNDUP
// I found no strndup on my old SUSE 7.3 test system (gcc 2.95) /* I found no strndup on my old SUSE 7.3 test system (gcc 2.95) */
static char *strndup(const char *s, size_t n) static char *strndup(const char *s, size_t n)
{ {
char *dst = malloc(n + 1); char *dst;
size_t s_len = strlen(s);
if (s_len > n)
n = s_len;
dst = malloc(n + 1);
if (dst) { if (dst) {
memcpy(dst, s, n); memcpy(dst, s, n);
@ -509,6 +510,44 @@ static int _str_is_ascii(const char *s)
return !*s; return !*s;
} }
#if defined(WITH_LIBIDN)
/*
* Work around a libidn <= 1.30 vulnerability.
*
* The function checks for a valid UTF-8 character sequence before
* passing it to idna_to_ascii_8z().
*
* [1] http://lists.gnu.org/archive/html/help-libidn/2015-05/msg00002.html
* [2] https://lists.gnu.org/archive/html/bug-wget/2015-06/msg00002.html
* [3] http://curl.haxx.se/mail/lib-2015-06/0143.html
*/
static int _utf8_is_valid(const char *utf8)
{
const unsigned char *s = (const unsigned char *) utf8;
while (*s) {
if ((*s & 0x80) == 0) /* 0xxxxxxx ASCII char */
s++;
else if ((*s & 0xE0) == 0xC0) /* 110xxxxx 10xxxxxx */ {
if ((s[1] & 0xC0) != 0x80)
return 0;
s += 2;
} else if ((*s & 0xF0) == 0xE0) /* 1110xxxx 10xxxxxx 10xxxxxx */ {
if ((s[1] & 0xC0) != 0x80 || (s[2] & 0xC0) != 0x80)
return 0;
s += 3;
} else if ((*s & 0xF8) == 0xF0) /* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ {
if ((s[1] & 0xC0) != 0x80 || (s[2] & 0xC0) != 0x80 || (s[3] & 0xC0) != 0x80)
return 0;
s += 4;
} else
return 0;
}
return 1;
}
#endif
#if defined(WITH_LIBICU) #if defined(WITH_LIBICU)
static void _add_punycode_if_needed(UIDNA *idna, _psl_vector_t *v, _psl_entry_t *e) static void _add_punycode_if_needed(UIDNA *idna, _psl_vector_t *v, _psl_entry_t *e)
{ {
@ -598,6 +637,11 @@ static void _add_punycode_if_needed(_psl_vector_t *v, _psl_entry_t *e)
if (_str_is_ascii(e->label_buf)) if (_str_is_ascii(e->label_buf))
return; return;
if (!_utf8_is_valid(e->label_buf)) {
/* fprintf(_(stderr, "Invalid UTF-8 sequence not converted: '%s'\n"), e->label_buf); */
return;
}
/* idna_to_ascii_8z() automatically converts UTF-8 to lowercase */ /* idna_to_ascii_8z() automatically converts UTF-8 to lowercase */
if ((rc = idna_to_ascii_8z(e->label_buf, &lookupname, IDNA_USE_STD3_ASCII_RULES)) == IDNA_SUCCESS) { if ((rc = idna_to_ascii_8z(e->label_buf, &lookupname, IDNA_USE_STD3_ASCII_RULES)) == IDNA_SUCCESS) {

View File

@ -143,7 +143,7 @@ int main(int argc, const char **argv)
if (argc != 3) { if (argc != 3) {
fprintf(stderr, "Usage: psl2c <infile> <outfile>\n"); fprintf(stderr, "Usage: psl2c <infile> <outfile>\n");
fprintf(stderr, " <infile> is the 'effective_tld_names.dat' (aka Public Suffix List), lowercase UTF-8 encoded\n"); fprintf(stderr, " <infile> is the 'public_suffix_list.dat', lowercase UTF-8 encoded\n");
fprintf(stderr, " <outfile> is the the C filename to be generated from <infile>\n"); fprintf(stderr, " <outfile> is the the C filename to be generated from <infile>\n");
return 1; return 1;
} }
@ -157,6 +157,7 @@ int main(int argc, const char **argv)
struct stat st; struct stat st;
size_t cmdsize = 16 + strlen(argv[1]); size_t cmdsize = 16 + strlen(argv[1]);
char *cmd = alloca(cmdsize), checksum[64] = ""; char *cmd = alloca(cmdsize), checksum[64] = "";
const char *source_date_epoch = NULL;
#if 0 #if 0
/* include library code did not generate punycode, so let's do it for the builtin data */ /* include library code did not generate punycode, so let's do it for the builtin data */
@ -177,7 +178,10 @@ int main(int argc, const char **argv)
if (stat(argv[1], &st) != 0) if (stat(argv[1], &st) != 0)
st.st_mtime = 0; st.st_mtime = 0;
fprintf(fpout, "static time_t _psl_file_time = %lu;\n", st.st_mtime); fprintf(fpout, "static time_t _psl_file_time = %lu;\n", st.st_mtime);
fprintf(fpout, "static time_t _psl_compile_time = %lu;\n", time(NULL)); if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")))
fprintf(fpout, "static time_t _psl_compile_time = %lu;\n", atol(source_date_epoch));
else
fprintf(fpout, "static time_t _psl_compile_time = %lu;\n", time(NULL));
fprintf(fpout, "static const char _psl_sha1_checksum[] = \"%s\";\n", checksum); fprintf(fpout, "static const char _psl_sha1_checksum[] = \"%s\";\n", checksum);
fprintf(fpout, "static const char _psl_filename[] = \"%s\";\n", argv[1]); fprintf(fpout, "static const char _psl_filename[] = \"%s\";\n", argv[1]);

View File

@ -21,7 +21,7 @@
* *
* This file is part of the test suite of libpsl. * This file is part of the test suite of libpsl.
* *
* Test psl_is_public_suffix() for all entries in effective_tld_names.dat * Test psl_is_public_suffix() for all entries in public_suffix_list.dat
* *
* Changelog * Changelog
* 19.03.2014 Tim Ruehsen created * 19.03.2014 Tim Ruehsen created