diff options
Diffstat (limited to 't/recipes/checks/libraries/embedded')
23 files changed, 309 insertions, 0 deletions
diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/fill-values b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/fill-values new file mode 100644 index 0000000..ffb07bb --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/fill-values @@ -0,0 +1,4 @@ +Skeleton: upload-native +Testname: binaries-embedded-libs +Package-Architecture: any +Description: Package with binary with library-unique strings diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/Makefile b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/Makefile new file mode 100644 index 0000000..cffe7c4 --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/Makefile @@ -0,0 +1,26 @@ +BINARIES := zlib libpng libjpeg libopenjpeg libtiff libpcre3 libbz2 libxml2 \ + libmagic libexpat libsqlite libm gmp mpfr \ + ieee-data1 ieee-data2 ieee-data3 + +MANPAGES := $(patsubst %,%.1,$(BINARIES)) + +all: $(BINARIES) $(MANPAGES) + +%: %.c + gcc $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $* $*.c + +%.1: template.1 + sed 's/#BIN#/$*/g' < $< > $@ + +install: + install -d $(DESTDIR)/usr/bin + install -d $(DESTDIR)/usr/share/man/man1 + for b in $(BINARIES); do \ + install -m 755 -c $$b $(DESTDIR)/usr/bin/$$b; \ + install -m 644 -c $$b.1 $(DESTDIR)/usr/share/man/man1/$$b.1; \ + done + +clean distclean: + rm -f $(BINARIES) $(MANPAGES) + +check test: diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/gmp.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/gmp.c new file mode 100644 index 0000000..1c13690 --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/gmp.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include "hardening-trigger.h" + +/* + * There's not much you can do with GMP without having the allocation + * code ... + */ +static const char alloc_failure[] + = "GNU MP: Cannot allocate memory"; + +int +main(void) +{ + printf("%s\n", alloc_failure); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/hardening-trigger.h b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/hardening-trigger.h new file mode 100644 index 0000000..0bfe592 --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/hardening-trigger.h @@ -0,0 +1,6 @@ +void e(char *p, int i, void (*f)(char *)){ + char test[10]; + memcpy(test, p, i); + f(test); + printf("%s", test); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/ieee-data1.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/ieee-data1.c new file mode 100644 index 0000000..68922cc --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/ieee-data1.c @@ -0,0 +1,10 @@ +#include <stdio.h> + +static const char ieee_data_url[] + = "http://standards.ieee.org/develop/regauth/oui/oui.txt"; + +int +main(void) +{ + printf("%s\n", ieee_data_url); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/ieee-data2.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/ieee-data2.c new file mode 100644 index 0000000..37ecf4d --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/ieee-data2.c @@ -0,0 +1,10 @@ +#include <stdio.h> + +static const char ieee_data_url[] + = "http://standards-oui.ieee.org/oui.txt"; + +int +main(void) +{ + printf("%s\n", ieee_data_url); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/ieee-data3.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/ieee-data3.c new file mode 100644 index 0000000..615e312 --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/ieee-data3.c @@ -0,0 +1,17 @@ +#include <stdio.h> + +struct ieee_data { + char a1; + char a2; + char a3; + const char * name; +}; + +static const struct ieee_data ieee_data_array[] + = { 0x00, 0x00, 0x56, "DR. B. STRUCK"}; + +int +main(void) +{ + printf("%s\n", ieee_data_array[0].name); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libbz2.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libbz2.c new file mode 100644 index 0000000..9fc9d92 --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libbz2.c @@ -0,0 +1,11 @@ +#include <stdio.h> +#include "hardening-trigger.h" + +static const char bzip2_bug[] + = "This is a bug in bzip2"; + +int +main(void) +{ + printf("%s\n", bzip2_bug); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libexpat.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libexpat.c new file mode 100644 index 0000000..1df8c01 --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libexpat.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include "hardening-trigger.h" + +/* + * The XML_DTD warning string is always present, even if expat was + * built with XML_DTD + */ +static const char xml_dtd[] + = "requested feature requires XML_DTD support in Expat"; + +int +main(void) +{ + printf("%s\n", xml_dtd); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libjpeg.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libjpeg.c new file mode 100644 index 0000000..6f76a7d --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libjpeg.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include "hardening-trigger.h" + +/* + * The quantization tables warning message is unique enough to be used to + * detect embedded or statically-linked copies of libjpeg. + */ +static const char quantization_tables_warning[] + = "Caution: quantization tables are too coarse for baseline JPEG"; + +int +main(void) +{ + printf("%s\n", quantization_tables_warning); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libm.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libm.c new file mode 100644 index 0000000..b69548d --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libm.c @@ -0,0 +1,11 @@ +#include <stdio.h> +#include "hardening-trigger.h" + +static const char domain_error[] + = "neg**non-integral: DOMAIN error"; + +int +main(void) +{ + printf("%s\n", domain_error); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libmagic.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libmagic.c new file mode 100644 index 0000000..d8a7d4c --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libmagic.c @@ -0,0 +1,11 @@ +#include <stdio.h> +#include "hardening-trigger.h" + +static const char no_magic_files[] + = "could not find any magic files!"; + +int +main(void) +{ + printf("%s\n", no_magic_files); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libopenjpeg.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libopenjpeg.c new file mode 100644 index 0000000..b232b21 --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libopenjpeg.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include "hardening-trigger.h" + +/* + * The tcd_decode error message appears to be unique enough to be used to + * detect embedded or statically-linked copies of libopenjpeg. + */ +static const char tcd_error[] + = "tcd_decode: incomplete bistream"; + +int +main(void) +{ + printf("%s\n", tcd_error); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libpcre3.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libpcre3.c new file mode 100644 index 0000000..5eca82e --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libpcre3.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include "hardening-trigger.h" + +/* + * The PCRE_UTF8 message is unique enough to be used to + * detect embedded or statically-linked copies of pcre. + */ +static const char pcre_utf8[] + = "this version of PCRE is not compiled with PCRE_UTF8 support"; + +int +main(void) +{ + printf("%s\n", pcre_utf8); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libpng.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libpng.c new file mode 100644 index 0000000..3de5e57 --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libpng.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include "hardening-trigger.h" + +/* + * The png_zalloc overflow error message is unique enough to be used to + * detect embedded or statically-linked copies of libpng. + */ +static const char zalloc_error[] + = "Potential overflow in png_zalloc()"; + +int +main(void) +{ + printf("%s\n", zalloc_error); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libsqlite.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libsqlite.c new file mode 100644 index 0000000..9bc97d0 --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libsqlite.c @@ -0,0 +1,14 @@ +#include <stdio.h> +#include "hardening-trigger.h" + +/* + * the sqlite_master table is used by sqlite 2 and 3 + */ +static const char sqlite_create[] + = "CREATE TABLE sqlite_master( foo bar moo)"; + +int +main(void) +{ + printf("%s\n", sqlite_create); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libtiff.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libtiff.c new file mode 100644 index 0000000..ec36402 --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libtiff.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include "hardening-trigger.h" + +/* + * The PixarLog error message is unique enough to be used to + * detect embedded or statically-linked copies of libtiff. + */ +static const char pixarlog_error[] + = "No space for PixarLog state block"; + +int +main(void) +{ + printf("%s\n", pixarlog_error); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libxml2.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libxml2.c new file mode 100644 index 0000000..5c151d2 --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/libxml2.c @@ -0,0 +1,11 @@ +#include <stdio.h> +#include "hardening-trigger.h" + +static const char root_dtd_mismatch[] + = "root and DTD name do not match '%s' and '%s'"; + +int +main(void) +{ + printf("%s\n", root_dtd_mismatch); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/mpfr.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/mpfr.c new file mode 100644 index 0000000..a23b9dc --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/mpfr.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include "hardening-trigger.h" + +/* + * There's not much you can do with MPFR without having the allocation + * code ... + */ +static const char alloc_failure[] + = "MPFR: Can't allocate memory"; + +int +main(void) +{ + printf("%s\n", alloc_failure); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/template.1 b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/template.1 new file mode 100644 index 0000000..e193a57 --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/template.1 @@ -0,0 +1,24 @@ +.\" Copyright (C) 2010 Raphael Geissert <atomo64@gmail.com> +.\" +.\" This is free software; you may redistribute it and/or modify +.\" it under the terms of the GNU General Public License as +.\" published by the Free Software Foundation; either version 2, +.\" or (at your option) any later version. +.\" +.\" This 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 the Debian GNU/Linux system; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +.\" 02111-1307 USA +.TH #BIN# "1" +.SH NAME +#BIN# \- dummy binary simulating embedding the #BIN# library +.SH SYNOPSIS +#BIN# +.SH DESCRIPTION +.B #BIN# +is a dummy binary used internally by lintian as a part of its testsuite. diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/zlib.c b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/zlib.c new file mode 100644 index 0000000..eb43c79 --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/build-spec/orig/zlib.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include "hardening-trigger.h" + +/* + * zlib asks derivative works to include this string, so it's the signature + * that we use to detect embedded copies. + */ +static const char deflate_copyright[] + = "deflate 1.2.3.3 Copyright 1995-2006 Jean-loup Gailly"; + +int +main(void) +{ + printf("%s\n", deflate_copyright); +} diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/eval/desc b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/eval/desc new file mode 100644 index 0000000..fd20867 --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/eval/desc @@ -0,0 +1,2 @@ +Testname: binaries-embedded-libs +Check: libraries/embedded diff --git a/t/recipes/checks/libraries/embedded/binaries-embedded-libs/eval/hints b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/eval/hints new file mode 100644 index 0000000..542340d --- /dev/null +++ b/t/recipes/checks/libraries/embedded/binaries-embedded-libs/eval/hints @@ -0,0 +1,17 @@ +binaries-embedded-libs (binary): embedded-library zlib [usr/bin/zlib] +binaries-embedded-libs (binary): embedded-library tiff [usr/bin/libtiff] +binaries-embedded-libs (binary): embedded-library sqlite [usr/bin/libsqlite] +binaries-embedded-libs (binary): embedded-library pcre3 [usr/bin/libpcre3] +binaries-embedded-libs (binary): embedded-library openjpeg [usr/bin/libopenjpeg] +binaries-embedded-libs (binary): embedded-library mpfr [usr/bin/mpfr] +binaries-embedded-libs (binary): embedded-library libxml2 [usr/bin/libxml2] +binaries-embedded-libs (binary): embedded-library libpng [usr/bin/libpng] +binaries-embedded-libs (binary): embedded-library libm [usr/bin/libm] +binaries-embedded-libs (binary): embedded-library libjpeg [usr/bin/libjpeg] +binaries-embedded-libs (binary): embedded-library ieee-data [usr/bin/ieee-data3] +binaries-embedded-libs (binary): embedded-library ieee-data [usr/bin/ieee-data2] +binaries-embedded-libs (binary): embedded-library ieee-data [usr/bin/ieee-data1] +binaries-embedded-libs (binary): embedded-library gmp [usr/bin/gmp] +binaries-embedded-libs (binary): embedded-library file [usr/bin/libmagic] +binaries-embedded-libs (binary): embedded-library expat [usr/bin/libexpat] +binaries-embedded-libs (binary): embedded-library bzip2 [usr/bin/libbz2] |