diff --git a/.cups-filters.metadata b/.cups-filters.metadata new file mode 100644 index 0000000..8005771 --- /dev/null +++ b/.cups-filters.metadata @@ -0,0 +1,4 @@ +e6ba7481d0e71b965d4c3b63dbfb8b489a87ca2f SOURCES/backend.tar.gz +969e4efc14a33816f3d81a4afd3b5b0d52a6f769 SOURCES/cups-filters-1.0.35.tar.xz +8073f56a227f3bc0f9f5348030e8c852657be733 SOURCES/m4.tar.gz +031a9f1d7a4e4ba870f70a3e57ffd4cc39fb421d SOURCES/utils.tar.gz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..01c6229 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +SOURCES/backend.tar.gz +SOURCES/cups-filters-1.0.35.tar.xz +SOURCES/m4.tar.gz +SOURCES/utils.tar.gz diff --git a/SOURCES/0001-Fixing-covscan-issues.patch b/SOURCES/0001-Fixing-covscan-issues.patch new file mode 100644 index 0000000..0d3b982 --- /dev/null +++ b/SOURCES/0001-Fixing-covscan-issues.patch @@ -0,0 +1,136 @@ +diff -up cups-filters-1.0.35/utils/cups-browsed.c.covscan cups-filters-1.0.35/utils/cups-browsed.c +--- cups-filters-1.0.35/utils/cups-browsed.c.covscan 2019-02-27 17:52:37.000000000 +0100 ++++ cups-filters-1.0.35/utils/cups-browsed.c 2019-03-18 16:01:49.345858931 +0100 +@@ -1934,7 +1934,10 @@ is_disabled(const char *printer, const c + pstate = (ipp_pstate_t)ippGetInteger(attr, 0); + else if (!strcmp(ippGetName(attr), "printer-state-message") && + ippGetValueTag(attr) == IPP_TAG_TEXT) { +- free(pstatemsg); ++ if (pstatemsg != NULL) { ++ free(pstatemsg); ++ pstatemsg = NULL; ++ } + p = ippGetString(attr, 0, NULL); + if (p != NULL) pstatemsg = strdup(p); + } +@@ -1951,16 +1954,22 @@ is_disabled(const char *printer, const c + case IPP_PRINTER_IDLE: + case IPP_PRINTER_PROCESSING: + ippDelete(response); +- free(pstatemsg); ++ if (pstatemsg != NULL) { ++ free(pstatemsg); ++ pstatemsg = NULL; ++ } + return NULL; + case IPP_PRINTER_STOPPED: + ippDelete(response); + if (reason == NULL) + return pstatemsg; +- else if (strcasestr(pstatemsg, reason) != NULL) ++ else if (pstatemsg != NULL && (strcasestr(pstatemsg, reason) != NULL)) + return pstatemsg; + else { +- free(pstatemsg); ++ if (pstatemsg != NULL) { ++ free(pstatemsg); ++ pstatemsg = NULL; ++ } + return NULL; + } + } +@@ -1969,12 +1978,18 @@ is_disabled(const char *printer, const c + debug_printf("No information regarding enabled/disabled found about the requested printer '%s'\n", + printer); + ippDelete(response); +- free(pstatemsg); ++ if (pstatemsg != NULL) { ++ free(pstatemsg); ++ pstatemsg = NULL; ++ } + return NULL; + } + debug_printf("ERROR: Request for printer info failed: %s\n", + cupsLastErrorString()); +- free(pstatemsg); ++ if (pstatemsg != NULL) { ++ free(pstatemsg); ++ pstatemsg = NULL; ++ } + return NULL; + } + +@@ -3421,6 +3436,8 @@ gboolean handle_cups_queues(gpointer unu + } else { + /* Device URI: ipp(s)://:631/printers/ */ + strncpy(device_uri, p->uri, sizeof(device_uri)); ++ if (strlen(p->uri) > HTTP_MAX_URI-1) ++ device_uri[HTTP_MAX_URI-1] = '\0'; + debug_printf("Print queue %s is for an IPP network printer, or we do not get notifications from CUPS, using direct device URI %s\n", + p->name, device_uri); + } +@@ -3529,6 +3546,8 @@ gboolean handle_cups_queues(gpointer unu + } else if (!strncmp(line, "*Default", 8)) { + cont_line_read = 0; + strncpy(keyword, line + 8, sizeof(keyword)); ++ if ((strlen(line) + 8) > 1023) ++ keyword[1023] = '\0'; + for (keyptr = keyword; *keyptr; keyptr ++) + if (*keyptr == ':' || isspace(*keyptr & 255)) + break; +@@ -5871,7 +5890,7 @@ read_configuration (const char *filename + in the configuration file is used. */ + while ((i < cupsArrayCount(command_line_config) && + (value = cupsArrayIndex(command_line_config, i++)) && +- strncpy(line, value, sizeof(line))) || ++ strncpy(line, value, sizeof(line)) && ((strlen(value) > HTTP_MAX_BUFFER-1)? line[HTTP_MAX_BUFFER-1] = '\0': 1)) || + cupsFileGetConf(fp, line, sizeof(line), &value, &linenum)) { + if (linenum < 0) { + /* We are still reading options from the command line ("-o ..."), +@@ -6098,6 +6117,7 @@ read_configuration (const char *filename + if (filter->cregexp) + regfree(filter->cregexp); + free(filter); ++ filter = NULL; + } + } else if ((!strcasecmp(line, "BrowseInterval") || !strcasecmp(line, "BrowseTimeout")) && value) { + int t = atoi(value); +@@ -6113,7 +6133,7 @@ read_configuration (const char *filename + debug_printf("Invalid %s value: %d\n", + line, t); + } else if (!strcasecmp(line, "DomainSocket") && value) { +- if (value[0] != '\0') ++ if (DomainSocket == NULL && value[0] != '\0') + DomainSocket = strdup(value); + } else if ((!strcasecmp(line, "HttpLocalTimeout") || !strcasecmp(line, "HttpRemoteTimeout")) && value) { + int t = atoi(value); +@@ -6168,7 +6188,7 @@ read_configuration (const char *filename + else if (!strncasecmp(value, "QueueOnServers", 14)) + LoadBalancingType = QUEUE_ON_SERVERS; + } else if (!strcasecmp(line, "DefaultOptions") && value) { +- if (strlen(value) > 0) ++ if (DefaultOptions == NULL && strlen(value) > 0) + DefaultOptions = strdup(value); + } else if (!strcasecmp(line, "AutoShutdown") && value) { + char *p, *saveptr; +@@ -6537,6 +6557,8 @@ int main(int argc, char*argv[]) { + daemon, not with remote ones. */ + if (getenv("CUPS_SERVER") != NULL) { + strncpy(local_server_str, getenv("CUPS_SERVER"), sizeof(local_server_str)); ++ if (strlen(getenv("CUPS_SERVER")) > 1023) ++ local_server_str[1023] = '\0'; + } else { + #ifdef CUPS_DEFAULT_DOMAINSOCKET + if (DomainSocket == NULL) +@@ -6876,6 +6898,11 @@ fail: + /* Close log file if we have one */ + if (debug_logfile == 1) + stop_debug_logging(); ++ ++ if (DefaultOptions != NULL) ++ free(DefaultOptions); ++ if (DomainSocket != NULL) ++ free(DomainSocket); + + return ret; + diff --git a/SOURCES/0001-cups-browsed-Fixed-freeing-of-literal-string-caused-.patch b/SOURCES/0001-cups-browsed-Fixed-freeing-of-literal-string-caused-.patch new file mode 100644 index 0000000..6c2bf22 --- /dev/null +++ b/SOURCES/0001-cups-browsed-Fixed-freeing-of-literal-string-caused-.patch @@ -0,0 +1,26 @@ +diff --git a/utils/cups-browsed.c b/utils/cups-browsed.c +index 9f6f25b7..7c3f5c2b 100644 +--- a/utils/cups-browsed.c ++++ b/utils/cups-browsed.c +@@ -7889,8 +7889,11 @@ read_configuration (const char *filename) + debug_printf("Invalid %s value: %d\n", + line, t); + } else if (!strcasecmp(line, "DomainSocket") && value) { +- if (DomainSocket == NULL && value[0] != '\0') ++ if (value[0] != '\0') { ++ if (DomainSocket != NULL) ++ free(DomainSocket); + DomainSocket = strdup(value); ++ } + } else if ((!strcasecmp(line, "HttpLocalTimeout") || !strcasecmp(line, "HttpRemoteTimeout")) && value) { + int t = atoi(value); + if (t >= 0) { +@@ -8466,7 +8469,7 @@ int main(int argc, char*argv[]) { + } else { + #ifdef CUPS_DEFAULT_DOMAINSOCKET + if (DomainSocket == NULL) +- DomainSocket = CUPS_DEFAULT_DOMAINSOCKET; ++ DomainSocket = strdup(CUPS_DEFAULT_DOMAINSOCKET); + #endif + if (DomainSocket != NULL) { + struct stat sockinfo; /* Domain socket information */ diff --git a/SOURCES/Makefile.am b/SOURCES/Makefile.am new file mode 100644 index 0000000..c51d452 --- /dev/null +++ b/SOURCES/Makefile.am @@ -0,0 +1,735 @@ +ACLOCAL_AMFLAGS = -I m4 + +pkgconfdir = $(libdir)/pkgconfig +pkgconf_DATA = \ + libcupsfilters.pc \ + libfontembed.pc + +doc_DATA = \ + AUTHORS \ + COPYING \ + NEWS \ + INSTALL \ + README + +EXTRA_DIST = \ + $(doc_DATA) \ + autogen.sh \ + libcupsfilters.pc.in \ + libfontembed.pc.in \ + utils/cups-browsed.service + +# ======== +# Backends +# ======== +pkgbackenddir = $(CUPS_SERVERBIN)/backend +pkgbackend_PROGRAMS = parallel serial implicitclass + +check_PROGRAMS = test1284 +# We need ieee1284 up and running. +# Leave it to the user to run if they have the bus. +#TESTS = test1284 + +parallel_SOURCES = \ + backend/backend-private.h \ + backend/ieee1284.c \ + backend/parallel.c +parallel_LDADD = $(CUPS_LIBS) +parallel_CFLAGS = $(CUPS_CFLAGS) + +serial_SOURCES = \ + backend/backend-private.h \ + backend/serial.c +serial_LDADD = $(CUPS_LIBS) +serial_CFLAGS = $(CUPS_CFLAGS) + +implicitclass_SOURCES = \ + backend/backend-private.h \ + backend/implicitclass.c +implicitclass_LDADD = $(CUPS_LIBS) +implicitclass_CFLAGS = $(CUPS_CFLAGS) + +test1284_SOURCES = \ + backend/backend-private.h \ + backend/ieee1284.c \ + backend/test1284.c +test1284_LDADD = $(CUPS_LIBS) +test1284_CFLAGS = $(CUPS_CFLAGS) + +# ======= +# Banners +# ======= +pkgbannerdir = $(CUPS_DATADIR)/banners +pkgbanner_DATA = \ + banners/classified \ + banners/confidential \ + banners/secret \ + banners/standard \ + banners/topsecret \ + banners/unclassified + +EXTRA_DIST += $(pkgbanner_DATA) + +# ======== +# Charsets +# ======== +pkgcharsetdir = $(CUPS_DATADIR)/charsets +pkgcharset_DATA = \ + charset/pdf.utf-8.heavy \ + charset/pdf.utf-8.simple + +EXTRA_DIST += $(pkgcharset_DATA) + +# ==================== +# CUPS Filters library +# ==================== +pkgfiltersincludedir = $(includedir)/cupsfilters +pkgfiltersinclude_DATA = \ + cupsfilters/driver.h \ + cupsfilters/image.h + +lib_LTLIBRARIES = libcupsfilters.la + +check_PROGRAMS += \ + testcmyk \ + testdither \ + testimage \ + testrgb +TESTS = \ + testdither +# testcmyk # fails as it opens some image.ppm which is nowerhe to be found. +# testimage # requires also some ppm file as argument +# testrgb # same error +# FIXME: run old testdither +# ./testdither > test/0-255.pgm 2>test/0-255.log +# ./testdither 0 127 255 > test/0-127-255.pgm 2>test/0-127-255.log +# ./testdither 0 85 170 255 > test/0-85-170-255.pgm 2>test/0-85-170-255.log +# ./testdither 0 63 127 170 198 227 255 > test/0-63-127-170-198-227-255.pgm 2>test/0-63-127-170-198-227-255.log +# ./testdither 0 210 383 > test/0-210-383.pgm 2>test/0-210-383.log +# ./testdither 0 82 255 > test/0-82-255.pgm 2>test/0-82-255.log +# ./testdither 0 510 > test/0-510.pgm 2>test/0-510.log +# ./testdither 0 1020 > test/0-1020.pgm 2>test/0-1020.log + + +libcupsfilters_la_SOURCES = \ + cupsfilters/attr.c \ + cupsfilters/check.c \ + cupsfilters/cmyk.c \ + cupsfilters/dither.c \ + cupsfilters/image.c \ + cupsfilters/image-bmp.c \ + cupsfilters/image-colorspace.c \ + cupsfilters/image-gif.c \ + cupsfilters/image-jpeg.c \ + cupsfilters/image-photocd.c \ + cupsfilters/image-pix.c \ + cupsfilters/image-png.c \ + cupsfilters/image-pnm.c \ + cupsfilters/image-private.h \ + cupsfilters/image-sgi.c \ + cupsfilters/image-sgi.h \ + cupsfilters/image-sgilib.c \ + cupsfilters/image-sun.c \ + cupsfilters/image-tiff.c \ + cupsfilters/image-zoom.c \ + cupsfilters/lut.c \ + cupsfilters/pack.c \ + cupsfilters/rgb.c \ + cupsfilters/srgb.c \ + $(pkgfiltersinclude_DATA) +libcupsfilters_la_LIBADD = \ + $(CUPS_LIBS) \ + $(LIBJPEG_LIBS) \ + $(LIBPNG_LIBS) \ + $(TIFF_LIBS) \ + -lm +libcupsfilters_la_CFLAGS = \ + $(CUPS_CFLAGS) \ + $(LIBJPEG_CFLAGS) \ + $(LIBPNG_CFLAGS) \ + $(TIFF_CFLAGS) + +libcupsfilters_la_LDFLAGS = \ + -no-undefined \ + -version-info 1 + +testcmyk_SOURCES = \ + cupsfilters/testcmyk.c \ + $(pkgfiltersinclude_DATA) +testcmyk_LDADD = \ + libcupsfilters.la \ + -lm + +testdither_SOURCES = \ + cupsfilters/testdither.c \ + $(pkgfiltersinclude_DATA) +testdither_LDADD = \ + libcupsfilters.la \ + -lm + +testimage_SOURCES = \ + cupsfilters/testimage.c \ + $(pkgfiltersinclude_DATA) +testimage_LDADD = \ + $(LIBJPEG_LIBS) \ + $(LIBPNG_LIBS) \ + $(TIFF_LIBS) \ + libcupsfilters.la \ + -lm +testimage_CFLAGS = \ + $(LIBJPEG_CFLAGS) \ + $(LIBPNG_CFLAGS) \ + $(TIFF_CFLAGS) + +testrgb_SOURCES = \ + cupsfilters/testrgb.c \ + $(pkgfiltersinclude_DATA) +testrgb_LDADD = \ + libcupsfilters.la \ + -lm + +EXTRA_DIST += \ + $(pkgfiltersinclude_DATA) \ + cupsfilters/image.pgm \ + cupsfilters/image.ppm + +# ========= +# CUPS Data +# ========= +pkgcupsdatadir = $(CUPS_DATADIR)/data +pkgcupsdata_DATA = \ + data/default.pdf \ + data/default-testpage.pdf \ + data/testprint + +EXTRA_DIST += $(pkgcupsdata_DATA) + +# =========== +# CUPS Config +# =========== +pkgcupsserverrootdir = $(CUPS_SERVERROOT) +pkgcupsserverroot_DATA = \ + utils/cups-browsed.conf + +# ======= +# Drivers +# ======= +pkgdriverdir = $(CUPS_DATADIR)/drv +pkgdriver_DATA = \ + drv/cupsfilters.drv + +EXTRA_DIST += $(pkgdriver_DATA) + +# ======= +# Definitions for drivers +# ======= +pkgppdcdir = $(CUPS_DATADIR)/ppdc +pkgppdc_DATA = \ + filter/pcl.h + +EXTRA_DIST += $(pkgppdc_DATA) + +# ===== +# MIMEs +# ===== +pkgmimedir = $(CUPS_DATADIR)/mime +pkgmime_DATA = \ + mime/cupsfilters.convs \ + mime/cupsfilters.types + +EXTRA_DIST += $(pkgmime_DATA) + +# ================= +# Fontembed library +# ================= +pkgfontembedincludedir = $(includedir)/fontembed +pkgfontembedinclude_DATA = \ + fontembed/bitset.h \ + fontembed/embed.h \ + fontembed/fontfile.h \ + fontembed/iofn.h \ + fontembed/sfnt.h + +lib_LTLIBRARIES += libfontembed.la + +bin_PROGRAMS = ttfread + +check_PROGRAMS += \ + test_analyze \ + test_pdf \ + test_ps +TESTS += \ + test_analyze \ + test_pdf \ + test_ps + +libfontembed_la_SOURCES = \ + fontembed/aglfn13.c \ + fontembed/bitset.h \ + fontembed/dynstring.c \ + fontembed/dynstring.h \ + fontembed/embed.c \ + fontembed/embed.h \ + fontembed/embed_sfnt.c \ + fontembed/embed_sfnt_int.h \ + fontembed/embed_pdf.c \ + fontembed/embed_pdf.h \ + fontembed/embed_pdf_int.h \ + fontembed/fontfile.c \ + fontembed/fontfile.h \ + fontembed/frequent.c \ + fontembed/frequent.h \ + fontembed/iofn.h \ + fontembed/macroman.h \ + fontembed/sfnt.c \ + fontembed/sfnt.h \ + fontembed/sfnt_int.h \ + fontembed/sfnt_subset.c +libfontembed_la_LDFLAGS = \ + -no-undefined \ + -version-info 1 + +ttfread_SOURCES = fontembed/main.c +ttfread_LDADD = libfontembed.la + +test_analyze_SOURCES = fontembed/test_analyze.c +test_analyze_LDADD = libfontembed.la + +test_pdf_SOURCES = fontembed/test_pdf.c +test_pdf_LDADD = libfontembed.la + +test_ps_SOURCES = fontembed/test_ps.c +test_ps_LDADD = libfontembed.la + +EXTRA_DIST += \ + $(pkgfontembedinclude_DATA) \ + fontembed/README + +# =========== +# PDF to OPVP +# =========== +pkgfilterdir = $(CUPS_SERVERBIN)/filter +pkgfilter_PROGRAMS = pdftoopvp + +pkgfontconfigdir = $(sysconfdir)/$(FONTDIR) +pkgfontconfig_DATA = filter/pdftoopvp/99pdftoopvp.conf + +pdftoopvp_SOURCES = \ + filter/pdftoopvp/oprs/OPRS.cxx \ + filter/pdftoopvp/oprs/OPRS.h \ + filter/pdftoopvp/oprs/OPVPSplashClip.cxx \ + filter/pdftoopvp/oprs/OPVPSplashClip.h \ + filter/pdftoopvp/oprs/OPVPSplash.cxx \ + filter/pdftoopvp/oprs/OPVPSplash.h \ + filter/pdftoopvp/oprs/OPVPSplashPath.cxx \ + filter/pdftoopvp/oprs/OPVPSplashPath.h \ + filter/pdftoopvp/oprs/OPVPSplashState.cxx \ + filter/pdftoopvp/oprs/OPVPSplashState.h \ + filter/pdftoopvp/oprs/OPVPSplashXPath.cxx \ + filter/pdftoopvp/oprs/OPVPSplashXPath.h \ + filter/pdftoopvp/oprs/OPVPWrapper.cxx \ + filter/pdftoopvp/oprs/OPVPWrapper.h \ + filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx \ + filter/pdftoopvp/oprs/OPVPWrapper_0_2.h \ + filter/pdftoopvp/OPVPError.h \ + filter/pdftoopvp/opvp/opvp_common.h \ + filter/pdftoopvp/opvp/opvp.h \ + filter/pdftoopvp/opvp/opvp_0_2_0.h \ + filter/pdftoopvp/OPVPOutputDev.cxx \ + filter/pdftoopvp/OPVPOutputDev.h \ + filter/pdftoopvp/pdftoopvp.cxx +pdftoopvp_CFLAGS = \ + $(CUPS_CFLAGS) \ + $(FREETYPE_CFLAGS) \ + $(FONTCONFIG_CFLAGS) \ + $(LIBPNG_CFLAGS) \ + $(POPPLER_CFLAGS) \ + -I$(srcdir)/filter/pdftoopvp/oprs \ + -I$(srcdir)/filter/pdftoopvp/opvp +pdftoopvp_CXXFLAGS = $(pdftoopvp_CFLAGS) +pdftoopvp_LDADD = \ + $(CUPS_LIBS) \ + $(FREETYPE_LIBS) \ + $(FONTCONFIG_LIBS) \ + $(LIBPNG_LIBS) \ + $(POPPLER_LIBS) \ + $(DLOPEN_LIBS) + +EXTRA_DIST += $(pkgfontconfig_DATA) + +# ========== +# PDF to PDF +# ========== +pkgfilter_PROGRAMS += pdftopdf + +pdftopdf_SOURCES = \ + filter/pdftopdf/pdftopdf.cc \ + filter/pdftopdf/pdftopdf_jcl.cc \ + filter/pdftopdf/pdftopdf_jcl.h \ + filter/pdftopdf/pdftopdf_processor.cc \ + filter/pdftopdf/pdftopdf_processor.h \ + filter/pdftopdf/qpdf_pdftopdf_processor.cc \ + filter/pdftopdf/qpdf_pdftopdf_processor.h \ + filter/pdftopdf/pptypes.cc \ + filter/pdftopdf/pptypes.h \ + filter/pdftopdf/nup.cc \ + filter/pdftopdf/nup.h \ + filter/pdftopdf/intervalset.cc \ + filter/pdftopdf/intervalset.h \ + filter/pdftopdf/qpdf_tools.cc \ + filter/pdftopdf/qpdf_tools.h \ + filter/pdftopdf/qpdf_xobject.cc \ + filter/pdftopdf/qpdf_xobject.h \ + filter/pdftopdf/qpdf_pdftopdf.cc \ + filter/pdftopdf/qpdf_pdftopdf.h \ + filter/pdftopdf/qpdf_cm.cc \ + filter/pdftopdf/qpdf_cm.h +pdftopdf_CFLAGS = \ + $(LIBQPDF_CFLAGS) \ + $(CUPS_CFLAGS) +pdftopdf_CXXFLAGS = -std=c++0x $(pdftopdf_CFLAGS) # -std=c++11 +pdftopdf_LDADD = \ + $(LIBQPDF_LIBS) \ + $(CUPS_LIBS) + +# ====================== +# Simple filter binaries +# ====================== +pkgfilter_SCRIPTS = \ + filter/imagetops \ + filter/pstopdf \ + filter/textonly \ + filter/texttops +pkgfilter_PROGRAMS += \ + bannertopdf \ + commandtoescpx \ + commandtopclx \ + pdftoijs \ + pdftops \ + pdftoraster \ + rastertoescpx \ + rastertopclx \ + texttopdf \ + urftopdf +if ENABLE_IMAGEFILTERS +pkgfilter_PROGRAMS += \ + imagetopdf \ + imagetoraster +endif + +check_PROGRAMS += \ + test_pdf1 \ + test_pdf2 + +TESTS += \ + test_pdf1 \ + test_pdf2 + +bannertopdf_SOURCES = \ + filter/banner.c \ + filter/banner.h \ + filter/bannertopdf.c \ + filter/pdf.cxx \ + filter/pdf.h +EXTRA_bannertopdf_SOURCES = filter/getline.c +bannertopdf_CFLAGS = \ + $(CUPS_CFLAGS) \ + $(LIBJPEG_CFLAGS) \ + $(LIBPNG_CFLAGS) \ + $(POPPLER_CFLAGS) \ + $(TIFF_CFLAGS) +bannertopdf_CXXFLAGS = $(bannertopdf_CFLAGS) +bannertopdf_LDADD = \ + $(GETLINE) \ + $(CUPS_LIBS) \ + $(LIBJPEG_LIBS) \ + $(LIBPNG_LIBS) \ + $(POPPLER_LIBS) \ + $(TIFF_LIBS) +bannertopdf_DEPENDENCIES = $(GETLINE) + +commandtoescpx_SOURCES = \ + cupsfilters/driver.h \ + filter/commandtoescpx.c \ + filter/pcl.h +commandtoescpx_CFLAGS= \ + $(CUPS_CFLAGS) \ + -I$(srcdir)/cupsfilters/ +commandtoescpx_LDADD = $(CUPS_LIBS) + +commandtopclx_SOURCES = \ + cupsfilters/driver.h \ + filter/commandtopclx.c \ + filter/pcl.h +commandtopclx_CFLAGS = \ + $(CUPS_CFLAGS) \ + -I$(srcdir)/cupsfilters/ +commandtopclx_LDADD = $(CUPS_LIBS) + +imagetopdf_SOURCES = \ + cupsfilters/image.h \ + filter/common.c \ + filter/common.h \ + filter/imagetopdf.c +imagetopdf_CFLAGS = \ + $(CUPS_CFLAGS) \ + $(LIBJPEG_CFLAGS) \ + $(LIBPNG_CFLAGS) \ + $(TIFF_CFLAGS) \ + -I$(srcdir)/cupsfilters/ +imagetopdf_LDADD = \ + $(CUPS_LIBS) \ + $(LIBJPEG_LIBS) \ + $(LIBPNG_LIBS) \ + $(TIFF_LIBS) \ + libcupsfilters.la + +imagetoraster_SOURCES = \ + cupsfilters/image.h \ + cupsfilters/image-private.h \ + filter/common.c \ + filter/common.h \ + filter/imagetoraster.c +imagetoraster_CFLAGS = \ + $(CUPS_CFLAGS) \ + -I$(srcdir)/cupsfilters/ +imagetoraster_LDADD = \ + $(CUPS_LIBS) \ + libcupsfilters.la + +urftopdf_SOURCES = \ + filter/urftopdf.cpp \ + filter/unirast.h +urftopdf_CXXFLAGS = \ + $(LIBQPDF_CFLAGS) +urftopdf_LDADD = \ + $(LIBQPDF_LIBS) + +pdftoijs_SOURCES = \ + filter/pdftoijs.cxx \ + filter/PDFError.h +pdftoijs_CFLAGS = \ + $(CUPS_CFLAGS) \ + $(IJS_CFLAGS) \ + $(POPPLER_CFLAGS) +pdftoijs_CXXFLAGS = $(pdftoijs_CFLAGS) +pdftoijs_LDADD = \ + $(CUPS_LIBS) \ + $(IJS_LIBS) \ + $(POPPLER_LIBS) + +pdftops_SOURCES = \ + filter/common.c \ + filter/common.h \ + filter/pdftops.c +EXTRA_pdftops_SOURCES = filter/strcasestr.c +pdftops_CFLAGS = $(CUPS_CFLAGS) +pdftops_LDADD = $(STRCASESTR) $(CUPS_LIBS) +pdftops_DEPENDENCIES = $(STRCASESTR) + +pdftoraster_SOURCES = \ + filter/pdftoraster.cxx \ + filter/PDFError.h +pdftoraster_CFLAGS = \ + $(CUPS_CFLAGS) \ + $(LCMS_CFLAGS) \ + $(LIBJPEG_CFLAGS) \ + $(LIBPNG_CFLAGS) \ + $(POPPLER_CFLAGS) \ + $(TIFF_CFLAGS) \ + -I$(srcdir)/cupsfilters/ +pdftoraster_CXXFLAGS = $(pdftoraster_CFLAGS) +pdftoraster_LDADD = \ + $(CUPS_LIBS) \ + $(LCMS_LIBS) \ + $(LIBJPEG_LIBS) \ + $(LIBPNG_LIBS) \ + $(POPPLER_LIBS) \ + $(TIFF_LIBS) \ + libcupsfilters.la + +rastertoescpx_SOURCES = \ + cupsfilters/driver.h \ + filter/escp.h \ + filter/rastertoescpx.c +rastertoescpx_CFLAGS = \ + $(CUPS_CFLAGS) \ + -I$(srcdir)/cupsfilters/ +rastertoescpx_LDADD = \ + $(CUPS_LIBS) \ + libcupsfilters.la + +rastertopclx_SOURCES = \ + cupsfilters/driver.h \ + filter/pcl.h \ + filter/pcl-common.c \ + filter/pcl-common.h \ + filter/rastertopclx.c +rastertopclx_CFLAGS = \ + $(CUPS_CFLAGS) \ + $(LIBPNG_CFLAGS) \ + -I$(srcdir)/cupsfilters/ +rastertopclx_LDADD = \ + $(CUPS_LIBS) \ + $(LIBPNG_LIBS) \ + libcupsfilters.la + +test_pdf1_SOURCES = \ + filter/pdfutils.c \ + filter/pdfutils.h \ + filter/test_pdf1.c \ + fontembed/embed.h \ + fontembed/sfnt.h +test_pdf1_CFLAGS = -I$(srcdir)/fontembed/ +test_pdf1_LDADD = libfontembed.la + +test_pdf2_SOURCES = \ + filter/pdfutils.c \ + filter/pdfutils.h \ + filter/test_pdf2.c \ + fontembed/embed.h \ + fontembed/sfnt.h +test_pdf2_CFLAGS = -I$(srcdir)/fontembed/ +test_pdf2_LDADD = libfontembed.la + +texttopdf_SOURCES = \ + filter/common.c \ + filter/common.h \ + filter/pdfutils.c \ + filter/pdfutils.h \ + filter/textcommon.c \ + filter/textcommon.h \ + filter/texttopdf.c \ + fontembed/bitset.h \ + fontembed/embed.h \ + fontembed/fontfile.h \ + fontembed/iofn.h \ + fontembed/sfnt.h +texttopdf_CFLAGS = \ + $(CUPS_CFLAGS) \ + $(FONTCONFIG_CFLAGS) \ + -I$(srcdir)/fontembed/ +texttopdf_LDADD = \ + $(CUPS_LIBS) \ + $(FONTCONFIG_LIBS) \ + libfontembed.la + +# Not reliable bash script +#TESTS += filter/test.sh + +EXTRA_DIST += \ + $(pkgfilter_SCRIPTS) \ + filter/test.sh + +# ===== +# UTILS +# ===== + +cups_notifier_sources = \ + cups-notifier.c \ + cups-notifier.h + +$(cups_notifier_sources): utils/org.cups.cupsd.Notifier.xml + gdbus-codegen \ + --interface-prefix org.cups.cupsd \ + --c-namespace Cups \ + --generate-c-code cups-notifier \ + utils/org.cups.cupsd.Notifier.xml + +sbin_PROGRAMS = \ + cups-browsed +cups_browsed_SOURCES = \ + utils/cups-browsed.c +nodist_cups_browsed_SOURCES = \ + $(cups_notifier_sources) +cups_browsed_CFLAGS = \ + $(CUPS_CFLAGS) \ + $(AVAHI_CFLAGS) \ + $(AVAHI_GLIB_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(GIO_CFLAGS) \ + $(GIO_UNIX_CFLAGS) \ + -I$(srcdir)/cupsfilters/ +cups_browsed_CXXFLAGS = $(cups_browsed_CFLAGS) +cups_browsed_LDADD = \ + $(CUPS_LIBS) \ + $(AVAHI_LIBS) \ + $(AVAHI_GLIB_LIBS) \ + $(GLIB_LIBS) \ + $(GLIB_LIBS) \ + $(GIO_LIBS) \ + $(GIO_UNIX_LIBS) \ + libcupsfilters.la +initrcdir = $(INITDDIR) +initrc_SCRIPTS = utils/cups-browsed +man_MANS = \ + utils/cups-browsed.8 \ + utils/cups-browsed.conf.5 +EXTRA_DIST += utils/cups-browsed.in \ + $(man_MANS) \ + utils/org.cups.cupsd.Notifier.xml +BUILT_SOURCES = $(cups_notifier_sources) +CLEANFILES = $(BUILT_SOURCES) + +# === +# PPD +# === +ppddir = $(datadir)/ppd/cupsfilters +ppd_DATA = \ + ppd/Generic-PDF_Printer-PDF.ppd \ + ppd/HP-Color_LaserJet_CM3530_MFP-PDF.ppd \ + ppd/HP-PhotoSmart_Pro_B8300-hpijs-pdftoijs.ppd \ + ppd/textonly.ppd + +EXTRA_DIST += $(ppd_DATA) + +# ========= +# Scripting +# ========= +if WITH_PHP +phpextensiondir = $(PHPDIR) +phpextension_LTLIBRARIES = libphpcups.la +libphpcups_la_SOURCES = \ + scripting/php/phpcups.c \ + scripting/php/phpcups.h +libphpcups_la_LIBADD = $(CUPS_LIBS) +libphpcups_la_CFLAGS = $(CUPS_CFLAGS) +libphpcups_la_LDFLAGS = -no-undefined +endif # WITH_PHP + +EXTRA_DIST += \ + scripting/perl \ + scripting/php/README \ + scripting/php/phpcups.php + +distclean-local: + rm -rf *.cache *~ + +install-exec-hook: + $(INSTALL) -d -m 755 $(DESTDIR)$(bindir) + $(INSTALL) -d -m 755 $(DESTDIR)$(pkgfilterdir) + $(INSTALL) -d -m 755 $(DESTDIR)$(pkgbackenddir) + +install-data-hook: +if RCLINKS + for level in $(RCLEVELS); do \ + $(INSTALL) -d -m 755 $(DESTDIR)$(INITDIR)/rc$${level}.d; \ + $(LN_S) -f ../init.d/cups-browsed $(DESTDIR)$(INITDIR)/rc$${level}.d/S$(RCSTART)cups-browsed; \ + $(LN_S) -f ../init.d/cups-browsed $(DESTDIR)$(INITDIR)/rc$${level}.d/K$(RCSTOP)cups-browsed; \ + done; \ + $(INSTALL) -d -m 755 $(DESTDIR)$(INITDIR)/rc0.d; \ + $(LN_S) -f ../init.d/cups-browsed $(DESTDIR)$(INITDIR)/rc0.d/K$(RCSTOP)cups-browsed; +endif + $(LN_S) -f pdf.utf-8.simple \ + $(DESTDIR)$(pkgcharsetdir)/pdf.utf-8 + + +uninstall-hook: +if RCLINKS + if test "x$(INITDIR)" != x; then \ + $(RM) $(DESTDIR)$(BUILDROOT)$(INITDIR)/rc?.d/[SK]??cups-browsed || :; \ + rmdir $(DESTDIR)$(BUILDROOT)$(INITDIR)/rc?.d || :;\ + fi +endif + $(RM) $(DESTDIR)$(pkgcharsetdir)/pdf.utf-8 diff --git a/SOURCES/configure.ac b/SOURCES/configure.ac new file mode 100644 index 0000000..036855d --- /dev/null +++ b/SOURCES/configure.ac @@ -0,0 +1,675 @@ +# Process this file with autoconf to create configure. + +AC_PREREQ([2.65]) + +# ==================== +# Version informations +# ==================== +m4_define([cups_filters_version_major],[1]) +m4_define([cups_filters_version_minor],[0]) +m4_define([cups_filters_version_micro],[35]) +m4_define([cups_filters_version],[cups_filters_version_major.cups_filters_version_minor.cups_filters_version_micro]) + +# ============= +# Automake init +# ============= +AC_INIT([cups-filters],[cups_filters_version]) +AC_CONFIG_MACRO_DIR([m4]) +m4_include([m4/ac_define_dir.m4]) +m4_include([m4/ax_compare_version.m4]) +AM_INIT_AUTOMAKE([1.11 gnu dist-xz dist-bzip2]) +AM_SILENT_RULES([yes]) +AC_LANG([C++]) +AC_CONFIG_HEADERS([config.h]) +# Extra defines for the config.h +AH_BOTTOM([ +#ifdef HAVE_LONG_LONG +# define CUPS_LLFMT "%lld" +# define CUPS_LLCAST (long long) +#else +# define CUPS_LLFMT "%ld" +# define CUPS_LLCAST (long) +#endif /* HAVE_LONG_LONG */ + +#ifdef HAVE_ARC4RANDOM +# define CUPS_RAND() arc4random() +# define CUPS_SRAND(v) arc4random_stir() +#elif defined(HAVE_RANDOM) +# define CUPS_RAND() random() +# define CUPS_SRAND(v) srandom(v) +#elif defined(HAVE_LRAND48) +# define CUPS_RAND() lrand48() +# define CUPS_SRAND(v) srand48(v) +#else +# define CUPS_RAND() rand() +# define CUPS_SRAND(v) srand(v) +#endif /* HAVE_ARC4RANDOM */ +]) + +# =========================== +# Find required base packages +# =========================== +AC_PROG_CC +AC_PROG_CXX +AM_PROG_CC_C_O +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_PROG_LIBTOOL +PKG_PROG_PKG_CONFIG([0.20]) + +# ======================================== +# Specify the fontdir patch if not default +# ======================================== +AC_ARG_WITH([fontdir], + [AS_HELP_STRING([--with-fontdir=path], [Specify path to font config directory (default: fonts/conf.d/).])], + [FONTDIR="$withval"], + [FONTDIR="fonts/conf.d"] +) +AC_SUBST(FONTDIR) + +# ================================ +# Find CUPS internals (no pc file) +# ================================ +AC_ARG_WITH([cups-config], + [AS_HELP_STRING([--with-cups-config=path], [Specify path to cups-config executable.])], + [with_cups_config="$withval"], + [with_cups_config=system] +) + +AS_IF([test "x$with_cups_config" != "xsystem"], [ + CUPSCONFIG=$with_cups_config +], [ + AC_PATH_PROG(CUPSCONFIG, [cups-config]) + AS_IF([test -z "$CUPSCONFIG"], [ + AC_MSG_ERROR([Required cups-config is missing. Please install CUPS developer packages.]) + ]) +]) +CUPS_CFLAGS=`$CUPSCONFIG --cflags` +CUPS_LIBS=`$CUPSCONFIG --image --libs` +CUPS_VERSION=`$CUPSCONFIG --version` +AC_SUBST(CUPS_CFLAGS) +AC_SUBST(CUPS_LIBS) + +CUPS_DATADIR="`$CUPSCONFIG --datadir`" +AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$CUPS_DATADIR", [CUPS datadir]) +AC_SUBST(CUPS_DATADIR) + +CUPS_SERVERROOT="`$CUPSCONFIG --serverroot`" +AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$CUPS_SERVERROOT", [CUPS serverroot]) +AC_SUBST(CUPS_SERVERROOT) + +CUPS_FONTPATH="$CUPS_DATADIR/fonts" +AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$CUPS_FONTPATH", [Path to CUPS fonts dir]) +AC_SUBST(CUPS_FONTPATH) + +CUPS_SERVERBIN="`$CUPSCONFIG --serverbin`" +AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$CUPS_SERVERBIN", [Path to CUPS binaries dir]) +AC_SUBST(CUPS_SERVERBIN) + +AX_COMPARE_VERSION([$CUPS_VERSION],[gt],[1.4], [ + AC_DEFINE(CUPS_1_4, 1, [CUPS Version is 1.4 or newer]) +]) +AC_DEFINE(PDFTOPDF, [], [Needed for pdftopdf filter compilation]) +AC_DEFINE_DIR(BANNERTOPDF_DATADIR, "{CUPS_DATADIR}/data", [Directory where bannertopdf finds its data files (PDF templates)]) + +AC_SEARCH_LIBS([dlopen], + [dl], + DLOPEN_LIBS="-ldl", + AC_MSG_ERROR([unable to find the dlopen() function]) +) +AC_SUBST(DLOPEN_LIBS) + +# Transient run-time state dir of CUPS +CUPS_STATEDIR="" +AC_ARG_WITH(cups-rundir, [ --with-cups-rundir set transient run-time state directory of CUPS],CUPS_STATEDIR="$withval",[ + case "$uname" in + Darwin*) + # Darwin (OS X) + CUPS_STATEDIR="$CUPS_SERVERROOT" + ;; + *) + # All others + CUPS_STATEDIR="$localstatedir/run/cups" + ;; + esac]) +AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR", [Transient run-time state dir of CUPS]) +AC_SUBST(CUPS_STATEDIR) + +# Domain socket of CUPS... +CUPS_DEFAULT_DOMAINSOCKET="" +AC_ARG_WITH(cups-domainsocket, [ --with-cups-domainsocket set unix domain socket name used by CUPS +], + default_domainsocket="$withval", + default_domainsocket="") + +if test x$enable_domainsocket != xno -a x$default_domainsocket != xno; then + if test "x$default_domainsocket" = x; then + case "$uname" in + Darwin*) + # Darwin and MaxOS X do their own thing... + CUPS_DEFAULT_DOMAINSOCKET="$localstatedir/run/cupsd" + ;; + *) + # All others use FHS standard... + CUPS_DEFAULT_DOMAINSOCKET="$CUPS_STATEDIR/cups.sock" + ;; + esac + else + CUPS_DEFAULT_DOMAINSOCKET="$default_domainsocket" + fi +fi +AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DOMAINSOCKET, "$CUPS_DEFAULT_DOMAINSOCKET", "Domain socket of CUPS") +AC_SUBST(CUPS_DEFAULT_DOMAINSOCKET) + +# ====================== +# Check system functions +# ====================== +AC_CHECK_FUNCS(strlcat) +AC_CHECK_FUNCS(strlcpy) +AC_CHECK_FUNCS(sigaction) +AC_CHECK_FUNCS(waitpid wait3) +AC_CHECK_FUNCS(strtoll) +AC_CHECK_FUNCS(open_memstream) +AC_CHECK_FUNCS(getline,[],AC_SUBST([GETLINE],['bannertopdf-getline.$(OBJEXT)'])) +AC_CHECK_FUNCS(strcasestr,[],AC_SUBST([STRCASESTR],['pdftops-strcasestr.$(OBJEXT)'])) +AC_SEARCH_LIBS(pow, m) + +# ======================== +# Check for system headers +# ======================== +AC_CHECK_HEADERS([stdlib.h]) +AC_CHECK_HEADERS([sys/stat.h]) +AC_CHECK_HEADERS([sys/types.h]) +AC_CHECK_HEADERS([unistd.h]) +AC_CHECK_HEADERS([zlib.h]) +AC_CHECK_HEADERS([endian.h]) +AC_CHECK_HEADERS([dirent.h]) +AC_CHECK_HEADERS([sys/ioctl.h]) + +# ============= +# Image options +# ============= +AC_ARG_ENABLE([imagefilters], + [AS_HELP_STRING([--disable-imagefilters], [Build the image filters.])], + [enable_imagefilters="$enableval"], + [enable_imagefilters=yes] +) +AM_CONDITIONAL([ENABLE_IMAGEFILTERS], [test "x$enable_imagefilters" != "xno"]) + +# Libraries +AC_ARG_WITH([jpeg], + [AS_HELP_STRING([--without-jpeg], [Disable jpeg support.])], + [with_jpeg="$withval"], + [with_jpeg=yes] +) +AS_IF([test x"$with_jpeg" != "xno"], [ + AC_DEFINE([HAVE_LIBJPEG], [], [Defines if we provide jpeg library.]) + AC_CHECK_HEADERS([jpeglib.h]) + AC_SEARCH_LIBS([jpeg_destroy_decompress], + [jpeg], + LIBJPEG_LIBS="-ljpeg", + AC_MSG_ERROR([jpeg libraries not found.]) + ) + AC_SUBST(LIBJPEG_LIBS) +]) + +AC_ARG_WITH([png], + [AS_HELP_STRING([--without-png], [Disable png support.])], + [with_png="$withval"], + [with_png=yes] +) +AS_IF([test x"$with_png" != "xno"], [ + PKG_CHECK_MODULES([LIBPNG], [libpng]) + AC_DEFINE([HAVE_LIBPNG], [], [Defines if we provide png library.]) +]) + +AC_ARG_WITH([tiff], + [AS_HELP_STRING([--without-tiff], [Disable tiff support.])], + [with_tiff="$withval"], + [with_tiff=yes] +) +AS_IF([test x"$with_tiff" != "xno"], [ + AC_DEFINE([HAVE_LIBTIFF], [], [Defines if we provide tiff library.]) + AC_CHECK_HEADERS([tiff.h]) + AC_SEARCH_LIBS([TIFFReadScanline], + [tiff], + LIBJPEG_LIBS="-ltiff", + AC_MSG_ERROR([tiff libraries not found.]) + ) + AC_SUBST(LIBTIFF_LIBS) +]) + +# ================================== +# Check for modules needed by utils/ +# ================================== + +dnl Avahi for cups-browsed +AVAHI_LIBS="" +AVAHI_CFLAGS="" +AVAHI_GLIB_CFLAGS="" +AVAHI_GLIB_LIBS="" + +AC_ARG_ENABLE([avahi], + [AS_HELP_STRING([--disable-avahi], [Disable DNS Service Discovery support using Avahi.])], + [enable_avahi="$enableval"], + [enable_avahi=yes] +) +AM_CONDITIONAL([ENABLE_AVAHI], [test "x$enable_avahi" != "xno"]) + +AC_ARG_WITH(avahi-libs, + [AS_HELP_STRING([--with-avahi-libs], [Set directory for Avahi library.])], + AVAHI_LIBS="-L$withval $AVAHI_LIBS",) +AC_ARG_WITH(avahi-includes, + [AS_HELP_STRING([--with-avahi-includes], [Set directory for Avahi includes])], + AVAHI_CFLAGS="-I$withval $AVAHI_CFLAGS",) + +if test "x$enable_avahi" != xno; then + PKG_CHECK_MODULES(AVAHI, avahi-client, + [AC_DEFINE(HAVE_AVAHI, [], [Define if you have the avahi library])]) +fi + +AC_SUBST(AVAHI_LIBS) +AC_SUBST(AVAHI_CFLAGS) + +dnl +dnl LDAP configuration stuff for CUPS. +dnl +dnl Copyright 2007-2011 by Apple Inc. +dnl Copyright 2003-2006 by Easy Software Products, all rights reserved. +dnl +dnl These coded instructions, statements, and computer programs are the +dnl property of Apple Inc. and are protected by Federal copyright +dnl law. Distribution and use rights are outlined in the file "COPYING" +dnl which should have been included with this file. +dnl + +AC_ARG_ENABLE([ldap], [AS_HELP_STRING([--disable-ldap], [disable LDAP support.])], + [enable_ldap="$enableval"], + [enable_ldap=yes] +) +AC_ARG_WITH([ldap-libs], [AS_HELP_STRING([--with-ldap-libs], [set directory for LDAP library.])], + LDFLAGS="-L$withval $LDFLAGS" + DSOFLAGS="-L$withval $DSOFLAGS",) +AC_ARG_WITH([ldap-includes], [AS_HELP_STRING([--with-ldap-includes], [set directory for LDAP includes.])], + CFLAGS="-I$withval $CFLAGS" + CPPFLAGS="-I$withval $CPPFLAGS",) + +if test x$enable_ldap != xno; then + + AC_CHECK_HEADER([ldap.h], [ + AC_SEARCH_LIBS([ldap_initialize], [ldap], [ + AC_DEFINE([HAVE_LDAP], [], [Define if LDAP support should be enabled]) + AC_DEFINE([HAVE_OPENLDAP], [], [If LDAP support is that of OpenLDAP]) + AC_CHECK_LIB([ldap], [ldap_start_tls], + AC_DEFINE([HAVE_LDAP_SSL], [], [If LDAP has SSL/TLS support enabled]))],[ + + AC_CHECK_LIB([ldap], [ldap_init], [ + AC_DEFINE([HAVE_LDAP], [], [Define if LDAP support should be enabled]) + AC_DEFINE([HAVE_MOZILLA_LDAP], [], [If LDAP support is that of Mozilla]) + AC_CHECK_HEADERS([ldap_ssl.h], [], [], [#include ]) + AC_CHECK_LIB([ldap], [ldapssl_init], + AC_DEFINE([HAVE_LDAP_SSL], [], [If LDAP has SSL/TLS support enabled]))])] + ) + AC_CHECK_LIB([ldap], [ldap_set_rebind_proc], AC_DEFINE([HAVE_LDAP_REBIND_PROC], [], [If libldap implements ldap_set_rebind_proc])) + ]) + +fi + +PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.30.2]) +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) + +if test x$enable_avahi != xno; then + PKG_CHECK_MODULES(AVAHI_GLIB, [avahi-glib]) +fi + +AC_SUBST(AVAHI_GLIB_CFLAGS) +AC_SUBST(AVAHI_GLIB_LIBS) + +PKG_CHECK_MODULES(GIO, [gio-2.0]) +AC_SUBST(GIO_CFLAGS) +AC_SUBST(GIO_LIBS) + +PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0]) +AC_SUBST(GIO_UNIX_CFLAGS) +AC_SUBST(GIO_UNIX_LIBS) + +AC_ARG_WITH([browseremoteprotocols], + [AS_HELP_STRING([--with-browseremoteprotocols=value], [Set which protocols to listen for in cups-browsed (default: dnssd cups)])], + [with_browseremoteprotocols="$withval"], + [with_browseremoteprotocols="dnssd cups"] +) +BROWSEREMOTEPROTOCOLS="$with_browseremoteprotocols" +AC_SUBST(BROWSEREMOTEPROTOCOLS) + +dnl Setup init.d locations... +AC_ARG_WITH(rcdir, [AS_HELP_STRING([--with-rcdir], [Set path for rc scripts])],rcdir="$withval",rcdir="") +AC_ARG_WITH(rclevels, [AS_HELP_STRING([--with-rclevels], [Set run levels for rc scripts])],rclevels="$withval",rclevels="2 3 5") +AC_ARG_WITH(rcstart, [AS_HELP_STRING([--with-rcstart], [Set start number for rc scripts])],rcstart="$withval",rcstart="99") +AC_ARG_WITH(rcstop, [AS_HELP_STRING([--with-rcstop], [Set stop number for rc scripts])],rcstop="$withval",rcstop="00") + +INITDIR="" +INITDDIR="" +RCLEVELS="$rclevels" +RCSTART="$rcstart" +RCSTOP="$rcstop" + +if test x$rcdir = x; then + case "`uname`" in + FreeBSD* | OpenBSD* | MirBSD* | ekkoBSD*) + # FreeBSD and OpenBSD + ;; + + Linux | GNU | GNU/k*BSD*) + # Linux/HURD seems to choose an init.d directory at random... + if test -d /sbin/init.d; then + # SuSE + INITDIR="/sbin/init.d" + else + if test -d /etc/init.d; then + # Others + INITDIR="/etc" + else + # RedHat + INITDIR="/etc/rc.d" + fi + fi + RCSTART="82" + RCSTOP="35" + ;; + + NetBSD*) + # NetBSD + INITDDIR="/etc/rc.d" + ;; + + *) + INITDIR="/etc" + ;; + + esac +elif test "x$rcdir" != xno; then + if test "x$rclevels" = x; then + INITDDIR="$rcdir" + else + INITDIR="$rcdir" + fi +fi + +AM_CONDITIONAL([RCLINKS], [test "x$INITDIR" != "x"]) + +if test "x${INITDIR}" != "x" -a "x${INITDDIR}" = "x"; then + INITDDIR="${INITDIR}/init.d" +fi + +AC_SUBST(INITDIR) +AC_SUBST(INITDDIR) +AC_SUBST(RCLEVELS) +AC_SUBST(RCSTART) +AC_SUBST(RCSTOP) + +# ====================================== +# Check for various pdf required modules +# ====================================== +PKG_CHECK_MODULES([LCMS], [lcms2], [lcms2=yes], [lcms2=no]) +AS_IF([test x"$lcms2" = "xno"], [ + PKG_CHECK_MODULES([LCMS], [lcms]) + AC_DEFINE([USE_LCMS1], [1], [Defines if use lcms1]) +]) +PKG_CHECK_MODULES([FREETYPE], [freetype2], [AC_DEFINE([HAVE_FREETYPE_H], [1], [Have FreeType2 include files])]) +PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.0.0]) +PKG_CHECK_MODULES([IJS], [ijs], [have_ijs=yes], [have_ijs=no]) +PKG_CHECK_MODULES([ZLIB], [zlib]) +AC_DEFINE([HAVE_LIBZ], [], [Define that we use zlib]) +PKG_CHECK_MODULES([LIBQPDF], [libqpdf >= 3.0.2]) + +# ================= +# Check for Poppler +# ================= +AC_ARG_ENABLE(poppler, AS_HELP_STRING([--enable-poppler],[enable Poppler-based filters]), + enable_poppler=$enableval,enable_poppler=yes) +AM_CONDITIONAL(ENABLE_POPPLER, test x$enable_poppler = xyes) +if test x$enable_poppler = xyes; then + PKG_CHECK_MODULES([POPPLER], [poppler >= 0.18]) + AC_CHECK_HEADER([poppler/cpp/poppler-version.h], [AC_DEFINE([HAVE_CPP_POPPLER_VERSION_H],,[Define if you have Poppler's "cpp/poppler-version.h" header file.])], []) +fi + +# =============== +# Check for D-Bus +# =============== +AC_ARG_ENABLE(dbus, AS_HELP_STRING([--enable-dbus],[enable DBus CMS code]), + enable_dbus=$enableval,enable_dbus=yes) +AM_CONDITIONAL(BUILD_DBUS, test x$enable_dbus = xyes) +if test x$enable_dbus = xyes; then + PKG_CHECK_MODULES(DBUS, dbus-1) +fi + +# =================================== +# Check for large files and long long +# =================================== +AC_SYS_LARGEFILE +LARGEFILE="" +AS_IF([test x"$enable_largefile" != "xno"], [ + LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" + AS_IF([test x"$ac_cv_sys_large_files" = "x1"], [LARGEFILE="$LARGEFILE -D_LARGE_FILES"]) + AS_IF([test x"$ac_cv_sys_file_offset_bits" = "x64"], [LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"]) +]) +AC_SUBST(LARGEFILE) + +AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no]) +AS_IF([test x"$long_long_found" = "xyes"], [ + AC_DEFINE([HAVE_LONG_LONG], [], [Platform supports long long type]) +]) + +# ================ +# Check for pdf2ps +# ================ +AC_ARG_WITH([pdftops], + [AS_HELP_STRING([--with-pdftops=value], [Set which pdftops to use (gs,pdftops,pdftocairo,acroread).])], + [with_pdftops="$withval"], + [with_pdftops=gs] +) +AS_CASE([x$with_pdftops], + [xgs|xpdftops|xpdftocairo|xacroread], [], + [AC_MSG_ERROR([Unknown value of with-pdftops provided: $with_pdftops])] +) +AC_ARG_WITH([gs-path], + [AS_HELP_STRING([--with-gs-path=value], [Set path to ghostcript binary (default: system).])], + [with_gs_path="$withval"], + [with_gs_path=system] +) +AC_ARG_WITH([pdftops-path], + [AS_HELP_STRING([--with-pdftops-path=value], [Set path to pdftops/ghostscript binary (default: system).])], + [with_pdftops_path="$withval"], + [with_pdftops_path=system] +) +AC_ARG_WITH([pdftocairo-path], + [AS_HELP_STRING([--with-pdftocairo-path=value], [Set path to pdftocairo binary (default: system).])], + [with_pdftocairo_path="$withval"], + [with_pdftocairo_path=system] +) +AC_ARG_WITH([acroread-path], + [AS_HELP_STRING([--with-acroread-path=value], [Set path to acroread binary (default: system).])], + [with_acroread_path="$withval"], + [with_acroread_path=system] +) +AC_ARG_WITH([pdftops-maxres], + [AS_HELP_STRING([--with-pdftops-maxres=value], [Set maximum image rendering resolution for pdftops filter (0, 75, 150, 300, 600, 1200, 2400, 4800, 90, 180, 360, 720, 1440, 2880, 5760, unlimited). Default: 1440])], + [with_pdftops_maxres="$withval"], + [with_pdftops_maxres=1440] +) +AS_CASE([x$with_pdftops_maxres], + [x0|x75|x150|x300|x600|x1200|x2400|x4800|x90|x180|x360|x720|x1440|x2880|x5760], [CUPS_PDFTOPS_MAXRES=$with_pdftops_maxres], + [xunlimited], [CUPS_PDFTOPS_MAXRES=0], + [AC_MSG_ERROR([Unknown value of with-pdftops-maxres provided: $with_pdftops])] +) + +AS_IF([test "x$with_gs_path" != "xsystem"], [ + CUPS_GHOSTSCRIPT="$with_gs_path" +], [ + AC_PATH_PROG(CUPS_GHOSTSCRIPT, [gs], [AC_MSG_ERROR([Required gs binary is missing. Please install ghostscript-gpl package.])]) +]) +AS_IF([test "x$CUPS_GHOSTSCRIPT" != "x"], [ + AC_DEFINE([HAVE_GHOSTSCRIPT], [], [Define that we provide ghostscript binary]) + AS_IF([test x"$with_pdftops" = xgs], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [GS], [Define default renderer])]) + + AC_MSG_CHECKING(whether gs supports the ps2write device) + AS_IF([`$CUPS_GHOSTSCRIPT -h 2>&1 | grep -q ps2write`], [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_GHOSTSCRIPT_PS2WRITE], [], [gs supports ps2write]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) + +AS_IF([test "x$with_pdftops_path" != "xsystem"], [ + CUPS_PDFTOPS="$with_pdftops" +], [ + AC_PATH_PROG(CUPS_PDFTOPS, [pdftops], [AC_MSG_ERROR([Required pdftops is missing. Please install CUPS developer packages.])]) +]) +AS_IF([test "x$CUPS_PDFTOPS" != "x"], [ + AC_DEFINE([HAVE_POPPLER_PDFTOPS], [], [Define that we provide poppler pdftops.]) + AS_IF([test x"$with_pdftops" = xpdftops], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [PDFTOPS], [Define default renderer])]) + + AC_MSG_CHECKING([whether pdftops supports -origpagesizes]) + AS_IF([`$CUPS_PDFTOPS -h 2>&1 | grep -q -- -origpagesizes`], [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_POPPLER_PDFTOPS_WITH_ORIGPAGESIZES], [] , [pdftops supports -origpagesizes.]) + ], [ + AC_MSG_RESULT([no]) + ]) + AC_MSG_CHECKING([whether pdftops supports -r]) + AS_IF([`$CUPS_PDFTOPS -h 2>&1 | grep -q -- '-r '`], [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_POPPLER_PDFTOPS_WITH_RESOLUTION], [] , [pdftops supports -r argument.]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) +AS_IF([test "x$with_pdftocairo_path" != "xsystem"], [ + CUPS_PDFTOPS="$with_pdftocairo_path" +], [ + AC_PATH_PROG(CUPS_PDFTOCAIRO, [pdftocairo], [AC_MSG_ERROR([Required pdftocairo is missing. Please install Poppler developer packages.])]) +]) +AS_IF([test "x$CUPS_PDFTOCAIRO" != "x"], [ + AC_DEFINE([HAVE_POPPLER_PDFTOCAIRO], [], [Define that we provide poppler pdftocairo.]) + AS_IF([test x"$with_pdftops" = xpdftocairo], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [PDFTOCAIRO], [Define default renderer])]) +]) +AS_IF([test "x$with_acroread_path" != "xsystem"], [ + CUPS_ACROREAD="$with_acroread_path" +], [ + AC_PATH_PROG(CUPS_ACROREAD, [acroread], [AC_MSG_ERROR([Required acroread binary is missing. Please install acroread package.])]) +]) +AS_IF([test "x$CUPS_ACROREAD" != "x"], [ + AC_DEFINE([HAVE_ACROREAD], [], [Define that we provide acroread.]) + AS_IF([test x"$with_pdftops" = xacroread], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [ACROREAD], [Define default renderer])]) +]) + +AC_DEFINE_UNQUOTED([CUPS_GHOSTSCRIPT], "$CUPS_GHOSTSCRIPT", [gs binary to use]) +AC_DEFINE_UNQUOTED([CUPS_POPPLER_PDFTOPS], "$CUPS_PDFTOPS", [pdftops binary to use.]) +AC_DEFINE_UNQUOTED([CUPS_POPPLER_PDFTOCAIRO], "$CUPS_PDFTOCAIRO", [pdftocairo binary to use.]) +AC_DEFINE_UNQUOTED([CUPS_ACROREAD], "$CUPS_ACROREAD", [acroread binary to use.]) +AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_MAX_RESOLUTION], [$CUPS_PDFTOPS_MAXRES], [max resolution used for pdftops when converting images]) + +# ============= +# Check for php +# ============= +# NOTE: This stuff is broken, requires internal cups headers. +AC_ARG_WITH([php], + [AS_HELP_STRING([--with-php], [Determine whether to build php cups extension.])], + [with_php="$withval"], + [with_php=no] +) +AC_ARG_WITH([php-config], + [AS_HELP_STRING([--with-php-config=path], [Specify path to php-config executable.])], + [with_php_config="$withval"], + [with_php_config=system] +) +AM_CONDITIONAL([WITH_PHP], [test "x$with_php" = "xyes"]) +AS_IF([test x"$with_php" = "xyes"], [ + AS_IF([test "x$with_php_config" != "xsystem"], [ + PHPCONFIG=$with_php_config + ], [ + AC_PATH_PROG(PHPCONFIG, [php-config]) + AS_IF([test -z "$PHPCONFIG"], [ + AC_MSG_ERROR([Required php-config is missing. Please install PHP developer packages.]) + ]) + ]) + PHPDIR="`$PHPCONFIG --extension-dir`" + AC_SUBST(PHPDIR) +]) + +# ========= +# Test ARGS +# ========= +AC_ARG_WITH([test-font-path], + [AS_HELP_STRING([--with-test-font-path=value], [Set path to pdftops/ghostscript binary (default: /usr/share/fonts/dejavu/DejaVuSans.ttf).])], + [with_test_font_path="$withval"], + [with_test_font_path="/usr/share/fonts/dejavu/DejaVuSans.ttf"] +) +AC_DEFINE_UNQUOTED([TESTFONT], ["$with_test_font_path"], [Path to font used in tests]) + +# ================ +# Check for cflags +# ================ +AC_ARG_ENABLE([werror], + [AS_HELP_STRING([--enable-werror], [Treat all warnings as errors, useful for development.])], + [enable_werror="$enableval"], + [enable_werror=no] +) +AS_IF([test x"$enable_werror" = "xyes"], [ + CFLAGS="$CFLAGS -Werror" +]) +AS_IF([test x"$GCC" = "xyes"], [ + # Be tough with warnings and produce less careless code + CFLAGS="$CFLAGS -Wall -pedantic -std=gnu99" + CXXFLAGS="$CXXFLAGS -Wall -pedantic" # -Weffc++" # TODO: enable when it does not print 1MB of warnings +]) +CFLAGS="$CFLAGS -D_GNU_SOURCE" +CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE" + +# ===================== +# Prepare all .in files +# ===================== +AC_CONFIG_FILES([ + libcupsfilters.pc + libfontembed.pc + Makefile + utils/cups-browsed + utils/cups-browsed.conf +]) +AC_OUTPUT + +# ============================================== +# Display final informations about configuration +# ============================================== +AC_MSG_NOTICE([ +============================================================================== +Environment settings: + CFLAGS: ${CFLAGS} + CXXFLAGS: ${CXXFLAGS} + LDFLAGS: ${LDFLAGS} +Build configuration: + cups-config: ${with_cups_config} + font directory: ${sysconfdir}/${FONTDIR} + init directory: ${INITDDIR} + cups dom socket: ${CUPS_DEFAULT_DOMAINSOCKET} + gs-path: ${with_gs_path} + imagefilters: ${enable_imagefilters} + jpeg: ${with_jpeg} + pdftocairo-path: ${with_pdftocairo_path} + pdftops: ${with_pdftops} + pdftops-path: ${with_pdftops_path} + png: ${with_png} + php: ${with_php} + php-config: ${with_php_config} + test-font: ${with_test_font_path} + tiff: ${with_tiff} + avahi: ${enable_avahi} + dbus: ${enable_dbus} + browsing: ${with_browseremoteprotocols} + werror: ${enable_werror} +============================================================================== +]) diff --git a/SOURCES/cups-filters-CVE-2013-6475.patch b/SOURCES/cups-filters-CVE-2013-6475.patch new file mode 100644 index 0000000..3ce4bf7 --- /dev/null +++ b/SOURCES/cups-filters-CVE-2013-6475.patch @@ -0,0 +1,156 @@ +diff -up cups-filters-1.0.35/filter/pdftoopvp/oprs/OPVPSplash.cxx.CVE-2013-6475 cups-filters-1.0.35/filter/pdftoopvp/oprs/OPVPSplash.cxx +--- cups-filters-1.0.35/filter/pdftoopvp/oprs/OPVPSplash.cxx.CVE-2013-6475 2014-01-20 13:32:28.906801955 +0000 ++++ cups-filters-1.0.35/filter/pdftoopvp/oprs/OPVPSplash.cxx 2014-01-20 13:34:03.581403757 +0000 +@@ -1094,7 +1094,7 @@ void OPVPSplash::fillGlyph(SplashCoord x + + opvpbytes = (m+3)/4; + opvpbytes *= 4; +- bp = (Guchar *)gmalloc(opvpbytes*glyph->h); ++ bp = (Guchar *)gmallocn(opvpbytes, glyph->h); + for (i = 0;i < glyph->h;i++) { + memcpy(bp+i*opvpbytes,glyph->data+i*m,m); + } +@@ -1238,8 +1238,8 @@ SplashError OPVPSplash::fillImageMaskFas + /* align 4 */ + opvpbytes = (opvpbytes+3)/4; + opvpbytes *= 4; +- buf = (Guchar *)gmalloc(opvpbytes*h); +- lineBuf = (SplashColorPtr)gmalloc(opvpbytes*8); ++ buf = (Guchar *)gmallocn(opvpbytes, h); ++ lineBuf = (SplashColorPtr)gmallocn(opvpbytes, 8); + + for (i = 0;i < h;i++) { + int k; +@@ -1417,7 +1417,7 @@ SplashError OPVPSplash::fillImageMask(Sp + imat[3] = mat[0]/det; + + /* read source image */ +- pixBuf = (SplashColorPtr)gmalloc(h * w); ++ pixBuf = (SplashColorPtr)gmallocn(h, w); + + p = pixBuf; + for (i = 0; i < h; ++i) { +@@ -1571,7 +1571,7 @@ SplashError OPVPSplash::drawImageNotShea + hs = h-1; + he = -1; + } +- buf = (Guchar *)gmalloc(opvpbytes*h); ++ buf = (Guchar *)gmallocn(opvpbytes, h); + lineBuf = (SplashColorPtr)gmalloc(lineBufSize); + switch (colorMode) { + case splashModeMono1: +@@ -1734,7 +1734,7 @@ SplashError OPVPSplash::drawImageFastWit + return splashErrOPVP; + break; + } +- buf = (Guchar *)gmalloc(opvpbytes*h); ++ buf = (Guchar *)gmallocn(opvpbytes, h); + + switch (colorMode) { + case splashModeMono1: +@@ -1960,7 +1960,7 @@ SplashError OPVPSplash::drawImage(Splash + } + + /* read source image */ +- pixBuf = (SplashColorPtr)gmalloc(h * linesize); ++ pixBuf = (SplashColorPtr)gmallocn(h, linesize); + + p = pixBuf; + for (i = 0; i < h; ++i) { +diff -up cups-filters-1.0.35/filter/pdftoopvp/OPVPOutputDev.cxx.CVE-2013-6475 cups-filters-1.0.35/filter/pdftoopvp/OPVPOutputDev.cxx +--- cups-filters-1.0.35/filter/pdftoopvp/OPVPOutputDev.cxx.CVE-2013-6475 2014-01-20 13:34:26.782551214 +0000 ++++ cups-filters-1.0.35/filter/pdftoopvp/OPVPOutputDev.cxx 2014-01-20 13:37:30.670719614 +0000 +@@ -147,9 +147,9 @@ T3FontCache::T3FontCache(Ref *fontIDA, d + } else { + cacheSets = 1; + } +- cacheData = (Guchar *)gmalloc(cacheSets * cacheAssoc * glyphSize); +- cacheTags = (T3FontCacheTag *)gmalloc(cacheSets * cacheAssoc * +- sizeof(T3FontCacheTag)); ++ cacheData = (Guchar *)gmallocn3(cacheSets, cacheAssoc, glyphSize); ++ cacheTags = (T3FontCacheTag *)gmallocn3(cacheSets, cacheAssoc, ++ sizeof(T3FontCacheTag)); + for (i = 0; i < cacheSets * cacheAssoc; ++i) { + cacheTags[i].mru = i & (cacheAssoc - 1); + } +@@ -1424,7 +1424,7 @@ void OPVPOutputDev::drawImage(GfxState * + } + break; + case splashModeRGB8: +- imgData.lookup = (SplashColorPtr)gmalloc(3 * n); ++ imgData.lookup = (SplashColorPtr)gmallocn(3, n); + for (i = 0; i < n; ++i) { + pix = (Guchar)i; + colorMap->getRGB(&pix, &rgb); +@@ -1434,7 +1434,7 @@ void OPVPOutputDev::drawImage(GfxState * + } + break; + case splashModeBGR8: +- imgData.lookup = (SplashColorPtr)gmalloc(3 * n); ++ imgData.lookup = (SplashColorPtr)gmallocn(3, n); + for (i = 0; i < n; ++i) { + pix = (Guchar)i; + colorMap->getRGB(&pix, &rgb); +@@ -1445,7 +1445,7 @@ void OPVPOutputDev::drawImage(GfxState * + break; + #if SPLASH_CMYK + case splashModeCMYK8: +- imgData.lookup = (SplashColorPtr)gmalloc(4 * n); ++ imgData.lookup = (SplashColorPtr)gmallocn(4, n); + for (i = 0; i < n; ++i) { + pix = (Guchar)i; + colorMap->getCMYK(&pix, &cmyk); +@@ -1680,7 +1680,7 @@ void OPVPOutputDev::drawMaskedImage(GfxS + } + break; + case splashModeRGB8: +- imgData.lookup = (SplashColorPtr)gmalloc(3 * n); ++ imgData.lookup = (SplashColorPtr)gmallocn(3, n); + for (i = 0; i < n; ++i) { + pix = (Guchar)i; + colorMap->getRGB(&pix, &rgb); +@@ -1690,7 +1690,7 @@ void OPVPOutputDev::drawMaskedImage(GfxS + } + break; + case splashModeBGR8: +- imgData.lookup = (SplashColorPtr)gmalloc(3 * n); ++ imgData.lookup = (SplashColorPtr)gmallocn(3, n); + for (i = 0; i < n; ++i) { + pix = (Guchar)i; + colorMap->getRGB(&pix, &rgb); +@@ -1701,7 +1701,7 @@ void OPVPOutputDev::drawMaskedImage(GfxS + break; + #if SPLASH_CMYK + case splashModeCMYK8: +- imgData.lookup = (SplashColorPtr)gmalloc(4 * n); ++ imgData.lookup = (SplashColorPtr)gmallocn(4, n); + for (i = 0; i < n; ++i) { + pix = (Guchar)i; + colorMap->getCMYK(&pix, &cmyk); +@@ -1847,7 +1847,7 @@ void OPVPOutputDev::drawSoftMaskedImage( + } + break; + case splashModeRGB8: +- imgData.lookup = (SplashColorPtr)gmalloc(3 * n); ++ imgData.lookup = (SplashColorPtr)gmallocn(3, n); + for (i = 0; i < n; ++i) { + pix = (Guchar)i; + colorMap->getRGB(&pix, &rgb); +@@ -1857,7 +1857,7 @@ void OPVPOutputDev::drawSoftMaskedImage( + } + break; + case splashModeBGR8: +- imgData.lookup = (SplashColorPtr)gmalloc(3 * n); ++ imgData.lookup = (SplashColorPtr)gmallocn(3, n); + for (i = 0; i < n; ++i) { + pix = (Guchar)i; + colorMap->getRGB(&pix, &rgb); +@@ -1868,7 +1868,7 @@ void OPVPOutputDev::drawSoftMaskedImage( + break; + #if SPLASH_CMYK + case splashModeCMYK8: +- imgData.lookup = (SplashColorPtr)gmalloc(4 * n); ++ imgData.lookup = (SplashColorPtr)gmallocn(4, n); + for (i = 0; i < n; ++i) { + pix = (Guchar)i; + colorMap->getCMYK(&pix, &cmyk); diff --git a/SOURCES/cups-filters-CVE-2015-3258-3279.patch b/SOURCES/cups-filters-CVE-2015-3258-3279.patch new file mode 100644 index 0000000..6fcd83a --- /dev/null +++ b/SOURCES/cups-filters-CVE-2015-3258-3279.patch @@ -0,0 +1,98 @@ +diff -up cups-filters-1.0.35/filter/textcommon.c.CVE-2015-3258-3279 cups-filters-1.0.35/filter/textcommon.c +--- cups-filters-1.0.35/filter/textcommon.c.CVE-2015-3258-3279 2013-05-07 19:24:58.000000000 +0100 ++++ cups-filters-1.0.35/filter/textcommon.c 2015-07-09 08:16:32.506423028 +0100 +@@ -26,6 +26,7 @@ + */ + + #include "textcommon.h" ++#include + + + /* +@@ -644,6 +645,45 @@ TextMain(const char *name, /* I - Name o + if (PrettyPrint) + PageTop -= 216.0f / LinesPerInch; + ++ /* ++ * Allocate memory for the page... ++ */ ++ ++ SizeColumns = (PageRight - PageLeft) / 72.0 * CharsPerInch; ++ SizeLines = (PageTop - PageBottom) / 72.0 * LinesPerInch; ++ ++ /* ++ * Enforce minimum size... ++ */ ++ if (SizeColumns < 1) ++ SizeColumns = 1; ++ if (SizeLines < 1) ++ SizeLines = 1; ++ ++ if (SizeLines >= INT_MAX / SizeColumns / sizeof(lchar_t)) ++ { ++ fprintf(stderr, "ERROR: bad page size\n"); ++ exit(1); ++ } ++ ++ Page = calloc(sizeof(lchar_t *), SizeLines); ++ if (!Page) ++ { ++ fprintf(stderr, "ERROR: cannot allocate memory for page\n"); ++ exit(1); ++ } ++ ++ Page[0] = calloc(sizeof(lchar_t), SizeColumns * SizeLines); ++ if (!Page[0]) ++ { ++ free(Page); ++ fprintf(stderr, "ERROR: cannot allocate memory for page\n"); ++ exit(1); ++ } ++ ++ for (i = 1; i < SizeLines; i ++) ++ Page[i] = Page[0] + i * SizeColumns; ++ + Copies = atoi(argv[4]); + + WriteProlog(argv[3], argv[2], getenv("CLASSIFICATION"), +@@ -1122,6 +1162,8 @@ TextMain(const char *name, /* I - Name o + if (ppd != NULL) + ppdClose(ppd); + ++ free(Page[0]); ++ free(Page); + return (0); + } + +diff -up cups-filters-1.0.35/filter/texttopdf.c.CVE-2015-3258-3279 cups-filters-1.0.35/filter/texttopdf.c +--- cups-filters-1.0.35/filter/texttopdf.c.CVE-2015-3258-3279 2015-07-09 08:16:12.266663237 +0100 ++++ cups-filters-1.0.35/filter/texttopdf.c 2015-07-09 08:16:32.506423028 +0100 +@@ -172,9 +172,6 @@ WriteEpilogue(void) + { "FN","FB","FI" }; + int i,j; + +- free(Page[0]); +- free(Page); +- + // embed fonts + for (i = PrettyPrint ? 2 : 1; i >= 0; i --) { + for (j = 0; j < NumFonts; j ++) +@@ -333,18 +330,6 @@ WriteProlog(const char *title, /* I - T + PageTop -= 36; + } + +- /* +- * Allocate memory for the page... +- */ +- +- SizeColumns = (PageRight - PageLeft) / 72.0 * CharsPerInch; +- SizeLines = (PageTop - PageBottom) / 72.0 * LinesPerInch; +- +- Page = calloc(sizeof(lchar_t *), SizeLines); +- Page[0] = calloc(sizeof(lchar_t), SizeColumns * SizeLines); +- for (i = 1; i < SizeLines; i ++) +- Page[i] = Page[0] + i * SizeColumns; +- + if (PageColumns > 1) + { + ColumnGutter = CharsPerInch / 2; diff --git a/SOURCES/cups-filters-filter-costs.patch b/SOURCES/cups-filters-filter-costs.patch new file mode 100644 index 0000000..750c92c --- /dev/null +++ b/SOURCES/cups-filters-filter-costs.patch @@ -0,0 +1,59 @@ +diff -up cups-filters-1.0.35/mime/cupsfilters.convs.filter-costs cups-filters-1.0.35/mime/cupsfilters.convs +--- cups-filters-1.0.35/mime/cupsfilters.convs.filter-costs 2013-06-25 18:34:40.000000000 +0100 ++++ cups-filters-1.0.35/mime/cupsfilters.convs 2013-08-21 12:47:45.133967497 +0100 +@@ -42,32 +42,32 @@ + # if it comes from an encrypted PDF file, we simply override pstopdf and the + # PDF workflow. + +-application/postscript application/pdf 100 pstopdf ++application/postscript application/pdf 0 pstopdf + application/vnd.adobe-reader-postscript application/vnd.cups-postscript 66 pstops + + application/pdf application/vnd.cups-pdf 66 pdftopdf +-application/x-cshell application/pdf 0 texttopdf +-application/x-csource application/pdf 0 texttopdf +-application/x-perl application/pdf 0 texttopdf +-application/x-shell application/pdf 0 texttopdf +-text/plain application/pdf 0 texttopdf +-text/html application/pdf 0 texttopdf +-image/gif application/vnd.cups-pdf 33 imagetopdf +-image/png application/vnd.cups-pdf 33 imagetopdf +-image/jpeg application/vnd.cups-pdf 33 imagetopdf +-image/tiff application/vnd.cups-pdf 33 imagetopdf +-image/x-bitmap application/vnd.cups-pdf 33 imagetopdf +-image/x-photocd application/vnd.cups-pdf 33 imagetopdf +-image/x-portable-anymap application/vnd.cups-pdf 33 imagetopdf +-image/x-portable-bitmap application/vnd.cups-pdf 33 imagetopdf +-image/x-portable-graymap application/vnd.cups-pdf 33 imagetopdf +-image/x-portable-pixmap application/vnd.cups-pdf 33 imagetopdf +-image/x-sgi-rgb application/vnd.cups-pdf 33 imagetopdf +-image/x-xbitmap application/vnd.cups-pdf 33 imagetopdf +-image/x-xpixmap application/vnd.cups-pdf 33 imagetopdf +-image/x-xwindowdump application/vnd.cups-pdf 33 imagetopdf +-image/x-sun-raster application/vnd.cups-pdf 33 imagetopdf +-application/vnd.cups-pdf-banner application/pdf 33 bannertopdf ++application/x-cshell application/pdf 32 texttopdf ++application/x-csource application/pdf 32 texttopdf ++application/x-perl application/pdf 32 texttopdf ++application/x-shell application/pdf 32 texttopdf ++text/plain application/pdf 32 texttopdf ++text/html application/pdf 32 texttopdf ++image/gif application/vnd.cups-pdf 65 imagetopdf ++image/png application/vnd.cups-pdf 65 imagetopdf ++image/jpeg application/vnd.cups-pdf 65 imagetopdf ++image/tiff application/vnd.cups-pdf 65 imagetopdf ++image/x-bitmap application/vnd.cups-pdf 65 imagetopdf ++image/x-photocd application/vnd.cups-pdf 65 imagetopdf ++image/x-portable-anymap application/vnd.cups-pdf 65 imagetopdf ++image/x-portable-bitmap application/vnd.cups-pdf 65 imagetopdf ++image/x-portable-graymap application/vnd.cups-pdf 65 imagetopdf ++image/x-portable-pixmap application/vnd.cups-pdf 65 imagetopdf ++image/x-sgi-rgb application/vnd.cups-pdf 65 imagetopdf ++image/x-xbitmap application/vnd.cups-pdf 65 imagetopdf ++image/x-xpixmap application/vnd.cups-pdf 65 imagetopdf ++image/x-xwindowdump application/vnd.cups-pdf 65 imagetopdf ++image/x-sun-raster application/vnd.cups-pdf 65 imagetopdf ++application/vnd.cups-pdf-banner application/pdf 32 bannertopdf + image/urf application/pdf 0 urftopdf + + ######################################################################## diff --git a/SOURCES/cups-filters-format-mismatch.patch b/SOURCES/cups-filters-format-mismatch.patch new file mode 100644 index 0000000..ffe0f84 --- /dev/null +++ b/SOURCES/cups-filters-format-mismatch.patch @@ -0,0 +1,71 @@ +diff -up cups-filters-1.0.35/filter/pdfutils.c.format-mismatch cups-filters-1.0.35/filter/pdfutils.c +--- cups-filters-1.0.35/filter/pdfutils.c.format-mismatch 2013-10-01 12:22:16.244383288 +0100 ++++ cups-filters-1.0.35/filter/pdfutils.c 2013-10-01 12:24:05.510864420 +0100 +@@ -242,7 +242,7 @@ void pdfOut_finish_pdf(pdfOut *pdf) // { + "%010d 65535 f \n", + 0,pdf->xrefsize+1,0); + for (iA=0;iAxrefsize;iA++) { +- pdfOut_printf(pdf,"%010d 00000 n \n", ++ pdfOut_printf(pdf,"%010ld 00000 n \n", + pdf->xref[iA]); + } + pdfOut_printf(pdf,"trailer\n" +@@ -347,7 +347,7 @@ int pdfOut_write_font(pdfOut *pdf,EMB_PA + const int l0_obj=pdfOut_add_xref(pdf); + assert(l0_obj==ff_obj+1); + pdfOut_printf(pdf,"%d 0 obj\n" +- "%d\n" ++ "%ld\n" + "endobj\n" + ,l0_obj,streamsize); + +diff -up cups-filters-1.0.35/filter/pdfutils.h.format-mismatch cups-filters-1.0.35/filter/pdfutils.h +--- cups-filters-1.0.35/filter/pdfutils.h.format-mismatch 2012-06-22 17:10:47.000000000 +0100 ++++ cups-filters-1.0.35/filter/pdfutils.h 2013-10-01 12:07:07.393378641 +0100 +@@ -42,7 +42,8 @@ void pdfOut_finish_pdf(pdfOut *pdf); + /* General output routine for our pdf. + * Keeps track of characters actually written out + */ +-void pdfOut_printf(pdfOut *pdf,const char *fmt,...); ++void pdfOut_printf(pdfOut *pdf,const char *fmt,...) ++ __attribute__((format(printf, 2, 3))); + + /* write out an escaped pdf string: e.g. (Text \(Test\)\n) + * >len==-1: use strlen(str) +diff -up cups-filters-1.0.35/filter/texttopdf.c.format-mismatch cups-filters-1.0.35/filter/texttopdf.c +--- cups-filters-1.0.35/filter/texttopdf.c.format-mismatch 2013-10-01 12:24:41.218021702 +0100 ++++ cups-filters-1.0.35/filter/texttopdf.c 2013-10-01 12:24:41.863024579 +0100 +@@ -250,7 +250,7 @@ WritePage(void) + int len_obj=pdfOut_add_xref(pdf); + assert(len_obj==content+1); + pdfOut_printf(pdf,"%d 0 obj\n" +- "%d\n" ++ "%ld\n" + "endobj\n", + len_obj,size); + +diff -up cups-filters-1.0.35/fontembed/dynstring.h.format-mismatch cups-filters-1.0.35/fontembed/dynstring.h +--- cups-filters-1.0.35/fontembed/dynstring.h.format-mismatch 2012-06-22 17:10:47.000000000 +0100 ++++ cups-filters-1.0.35/fontembed/dynstring.h 2013-10-01 12:07:07.393378641 +0100 +@@ -9,7 +9,8 @@ typedef struct { + int dyn_init(DYN_STRING *ds,int reserve_size); // -1 on error + void dyn_free(DYN_STRING *ds); + int dyn_ensure(DYN_STRING *ds,int free_space); +-int dyn_printf(DYN_STRING *ds,const char *fmt,...); // appends ++int dyn_printf(DYN_STRING *ds,const char *fmt,...) // appends ++ __attribute__((format(printf, 2, 3))); + + #endif + +diff -up cups-filters-1.0.35/fontembed/embed_sfnt.c.format-mismatch cups-filters-1.0.35/fontembed/embed_sfnt.c +--- cups-filters-1.0.35/fontembed/embed_sfnt.c.format-mismatch 2013-10-01 12:25:24.164210823 +0100 ++++ cups-filters-1.0.35/fontembed/embed_sfnt.c 2013-10-01 12:25:39.727279359 +0100 +@@ -519,7 +519,7 @@ int emb_otf_ps(OTF_FILE *otf,unsigned sh + free(ds.buf); + return -1; + } +- dyn_printf(&ds,"%!PS-TrueTypeFont-%d-%d\n", ++ dyn_printf(&ds,"%%!PS-TrueTypeFont-%d-%d\n", + otf->version,get_ULONG(head+4)); + const int bbxmin=get_SHORT(head+36)*1000/otf->unitsPerEm, + bbymin=get_SHORT(head+38)*1000/otf->unitsPerEm, diff --git a/SOURCES/cups-filters-manpages.patch b/SOURCES/cups-filters-manpages.patch new file mode 100644 index 0000000..f692331 --- /dev/null +++ b/SOURCES/cups-filters-manpages.patch @@ -0,0 +1,15 @@ +diff --git a/utils/cups-browsed.8 b/utils/cups-browsed.8 +index cc8374c..236f372 100644 +--- a/utils/cups-browsed.8 ++++ b/utils/cups-browsed.8 +@@ -100,8 +100,8 @@ and command line tools. + + \fBcups-browsed.conf\fP(5) + .PP +-/usr/share/doc/\fBcups-browsed\fP/README.gz ++/usr/share/doc/cups-filters-1.0.35/README + .SH AUTHOR +-The authors of \fBcups-browsed\fP are listed in /usr/share/doc/\fBcups-browsed\fP/AUTHORS. ++The authors of \fBcups-browsed\fP are listed in /usr/share/doc/cups-filters-1.0.35/AUTHORS. + .PP + This manual page was written for the Debian Project, but it may be used by others. diff --git a/SOURCES/cups-filters-page-label.patch b/SOURCES/cups-filters-page-label.patch new file mode 100644 index 0000000..2008e99 --- /dev/null +++ b/SOURCES/cups-filters-page-label.patch @@ -0,0 +1,229 @@ +diff -up cups-filters-1.0.35/filter/pdftopdf/pdftopdf.cc.page-label cups-filters-1.0.35/filter/pdftopdf/pdftopdf.cc +--- cups-filters-1.0.35/filter/pdftopdf/pdftopdf.cc.page-label 2013-04-09 19:14:42.000000000 +0100 ++++ cups-filters-1.0.35/filter/pdftopdf/pdftopdf.cc 2013-07-24 08:49:23.919081384 +0100 +@@ -9,6 +9,8 @@ + #include + #include + #include ++#include ++#include + #include + + #include "pdftopdf_processor.h" +@@ -402,8 +404,27 @@ void getParameters(ppd_file_t *ppd,int n + param.reverse=ppdDefaultOrder(ppd); + } + +- // TODO: pageLabel (not used) +- // param.pageLabel=cupsGetOption("page-label",num_options,options); // strdup? ++ std::string rawlabel; ++ char *classification = getenv("CLASSIFICATION"); ++ if (classification) ++ rawlabel.append (classification); ++ ++ if ( (val=cupsGetOption("page-label", num_options, options)) != NULL) { ++ if (!rawlabel.empty()) ++ rawlabel.append (" - "); ++ rawlabel.append(cupsGetOption("page-label",num_options,options)); ++ } ++ ++ std::ostringstream cookedlabel; ++ for (std::string::iterator it = rawlabel.begin(); ++ it != rawlabel.end (); ++ ++it) { ++ if (*it < 32 || *it > 126) ++ cookedlabel << "\\" << std::oct << std::setfill('0') << std::setw(3) << (unsigned int) *it; ++ else ++ cookedlabel.put (*it); ++ } ++ param.pageLabel = cookedlabel.str (); + + if ( (val=cupsGetOption("page-set",num_options,options)) != NULL) { + if (strcasecmp(val,"even")==0) { +diff -up cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.cc.page-label cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.cc +--- cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.cc.page-label 2013-02-15 17:37:59.000000000 +0000 ++++ cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.cc 2013-07-24 09:50:04.437720618 +0100 +@@ -80,12 +80,8 @@ void ProcessingParameters::dump() const + fprintf(stderr,"evenDuplex: %s\n", + (evenDuplex)?"true":"false"); + +-/* +- // std::string pageLabel; // or NULL? must stay/dup! +- ... +- ... +- +-*/ ++ fprintf(stderr,"pageLabel: %s\n", ++ pageLabel.empty () ? "(none)" : pageLabel.c_str()); + + fprintf(stderr,"bookletMode: "); + BookletMode_dump(booklet); +@@ -206,6 +202,10 @@ bool processPDFTOPDF(PDFTOPDF_Processor + page->mirror(); + } + ++ if (!param.pageLabel.empty()) { ++ page->add_label(param.page, param.pageLabel); ++ } ++ + // place border + if ( (param.border!=BorderType::NONE)&&(iAadd_border_rect(rect,param.border,1.0/pgedit.scale); + } + ++ if (!param.pageLabel.empty()) { ++ page->add_label(param.page, param.pageLabel); ++ } ++ + if (!param.fitplot) { + curpage->add_subpage(page,pgedit.xpos+xpos,pgedit.ypos+ypos,pgedit.scale,&rect); + } else { +diff -up cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.h.page-label cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.h +--- cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.h.page-label 2012-11-15 15:58:39.000000000 +0000 ++++ cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.h 2013-07-24 08:49:23.920081389 +0100 +@@ -20,7 +20,7 @@ struct ProcessingParameters { + border(NONE), + reverse(false), + +-// pageLabel(NULL), ++ pageLabel(), + evenPages(true),oddPages(true), + + mirror(false), +@@ -60,7 +60,7 @@ struct ProcessingParameters { + NupParameters nup; + bool reverse; + +- // std::string pageLabel; // or NULL? must stay/dup! ++ std::string pageLabel; + bool evenPages,oddPages; + IntervalSet pageRange; + +@@ -105,6 +105,7 @@ public: + virtual void add_subpage(const std::shared_ptr &sub,float xpos,float ypos,float scale,const PageRect *crop=NULL) =0; + virtual void mirror() =0; + virtual void rotate(Rotation rot) =0; ++ virtual void add_label(const PageRect &rect, const std::string label) =0; + }; + + // TODO: ... error output? +diff -up cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.cc.page-label cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.cc +--- cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.cc.page-label 2013-03-14 20:32:42.000000000 +0000 ++++ cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.cc 2013-07-24 08:49:23.920081389 +0100 +@@ -257,6 +257,94 @@ void QPDF_PDFTOPDF_PageHandle::rotate(Ro + } + // }}} + ++void QPDF_PDFTOPDF_PageHandle::add_label(const PageRect &_rect, const std::string label) // {{{ ++{ ++ assert(isExisting()); ++ ++ PageRect rect = ungetRect (_rect, *this, rotation, page); ++ ++ assert (rect.left <= rect.right); ++ assert (rect.bottom <= rect.top); ++ ++ // TODO: Only add in the font once, not once per page. ++ QPDFObjectHandle font = page.getOwningQPDF()->makeIndirectObject ( ++ QPDFObjectHandle::parse( ++ "<<" ++ " /Type /Font" ++ " /Subtype /Type1" ++ " /Name /pagelabel-font" ++ " /BaseFont /Helvetica" // TODO: support UTF-8 labels? ++ ">>")); ++ QPDFObjectHandle resources = page.getKey ("/Resources"); ++ QPDFObjectHandle rfont = resources.getKey ("/Font"); ++ rfont.replaceKey ("/pagelabel-font", font); ++ ++ double margin = 2.25; ++ double height = 12; ++ ++ std::string boxcmd = "q\n"; ++ ++ // White filled rectangle (top) ++ boxcmd += " 1 1 1 rg\n"; ++ boxcmd += " " + QUtil::double_to_string(rect.left + margin) + " " + ++ QUtil::double_to_string(rect.top - height - 2 * margin) + " " + ++ QUtil::double_to_string(rect.right - rect.left - 2 * margin) + " " + ++ QUtil::double_to_string(height + 2 * margin) + " re f\n"; ++ ++ // White filled rectangle (bottom) ++ boxcmd += " " + QUtil::double_to_string(rect.left + margin) + " " + ++ QUtil::double_to_string(rect.bottom + height + margin) + " " + ++ QUtil::double_to_string(rect.right - rect.left - 2 * margin) + " " + ++ QUtil::double_to_string(height + 2 * margin) + " re f\n"; ++ ++ // Black outline (top) ++ boxcmd += " 0 0 0 RG\n"; ++ boxcmd += " " + QUtil::double_to_string(rect.left + margin) + " " + ++ QUtil::double_to_string(rect.top - height - 2 * margin) + " " + ++ QUtil::double_to_string(rect.right - rect.left - 2 * margin) + " " + ++ QUtil::double_to_string(height + 2 * margin) + " re S\n"; ++ ++ // Black outline (bottom) ++ boxcmd += " " + QUtil::double_to_string(rect.left + margin) + " " + ++ QUtil::double_to_string(rect.bottom + height + margin) + " " + ++ QUtil::double_to_string(rect.right - rect.left - 2 * margin) + " " + ++ QUtil::double_to_string(height + 2 * margin) + " re S\n"; ++ ++ // Black text (top) ++ boxcmd += " 0 0 0 rg\n"; ++ boxcmd += " BT\n"; ++ boxcmd += " /pagelabel-font 12 Tf\n"; ++ boxcmd += " " + QUtil::double_to_string(rect.left + 2 * margin) + " " + ++ QUtil::double_to_string(rect.top - height - margin) + " Td\n"; ++ boxcmd += " (" + label + ") Tj\n"; ++ boxcmd += " ET\n"; ++ ++ // Black text (bottom) ++ boxcmd += " BT\n"; ++ boxcmd += " /pagelabel-font 12 Tf\n"; ++ boxcmd += " " + QUtil::double_to_string(rect.left + 2 * margin) + " " + ++ QUtil::double_to_string(rect.bottom + height + 2 * margin) + " Td\n"; ++ boxcmd += " (" + label + ") Tj\n"; ++ boxcmd += " ET\n"; ++ ++ boxcmd += "Q\n"; ++ ++ assert(page.getOwningQPDF()); // existing pages are always indirect ++ static const char *pre="%pdftopdf q\n" ++ "q\n", ++ *post="%pdftopdf Q\n" ++ "Q\n"; ++ ++ QPDFObjectHandle stm1=QPDFObjectHandle::newStream(page.getOwningQPDF(), ++ pre), ++ stm2=QPDFObjectHandle::newStream(page.getOwningQPDF(), ++ std::string(post) + boxcmd); ++ ++ page.addPageContents(stm1,true); // before ++ page.addPageContents(stm2,false); // after ++} ++// }}} ++ + void QPDF_PDFTOPDF_PageHandle::debug(const PageRect &rect,float xpos,float ypos) // {{{ + { + assert(!isExisting()); +@@ -264,7 +352,7 @@ void QPDF_PDFTOPDF_PageHandle::debug(con + } + // }}} + +- ++// }}} + void QPDF_PDFTOPDF_Processor::closeFile() // {{{ + { + pdf.reset(); +diff -up cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.h.page-label cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.h +--- cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.h.page-label 2012-11-15 15:58:39.000000000 +0000 ++++ cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.h 2013-07-24 08:49:23.920081389 +0100 +@@ -11,6 +11,7 @@ public: + virtual void add_subpage(const std::shared_ptr &sub,float xpos,float ypos,float scale,const PageRect *crop=NULL); + virtual void mirror(); + virtual void rotate(Rotation rot); ++ virtual void add_label(const PageRect &rect, const std::string label); + + void debug(const PageRect &rect,float xpos,float ypos); + private: diff --git a/SOURCES/cups-filters-pdf-landscape.patch b/SOURCES/cups-filters-pdf-landscape.patch new file mode 100644 index 0000000..1f4cf3e --- /dev/null +++ b/SOURCES/cups-filters-pdf-landscape.patch @@ -0,0 +1,29 @@ +diff -up cups-filters-1.0.35/filter/pdftops.c.pdf-landscape cups-filters-1.0.35/filter/pdftops.c +--- cups-filters-1.0.35/filter/pdftops.c.pdf-landscape 2013-06-24 22:59:27.000000000 +0100 ++++ cups-filters-1.0.35/filter/pdftops.c 2013-10-16 15:53:51.766917387 +0100 +@@ -626,21 +626,17 @@ main(int argc, /* I - Number of comm + else if ((renderer == PDFTOPS) || (renderer == PDFTOCAIRO)) + { + /* +- * Use the page sizes of the original PDF document, this way documents +- * which contain pages of different sizes can be printed correctly ++ * No options to add. Note: pdftopdf has already rotated pages ++ * for us. + */ +- +- pdf_argv[pdf_argc++] = (char *)"-origpagesizes"; + } + #endif /* HAVE_POPPLER_PDFTOPS_WITH_ORIGPAGESIZES */ + else if (renderer == ACROREAD) + { + /* +- * Use the page sizes of the original PDF document, this way documents +- * which contain pages of different sizes can be printed correctly ++ * No options to add. Note: pdftopdf has already rotated pages ++ * for us. + */ +- +- pdf_argv[pdf_argc++] = (char *)"-choosePaperByPDFPageSize"; + } + + /* diff --git a/SOURCES/cups-filters-pdftoopvp.patch b/SOURCES/cups-filters-pdftoopvp.patch new file mode 100644 index 0000000..66d3dc1 --- /dev/null +++ b/SOURCES/cups-filters-pdftoopvp.patch @@ -0,0 +1,160 @@ +diff -up cups-filters-1.0.35/Makefile.am.pdftoopvp cups-filters-1.0.35/Makefile.am +--- cups-filters-1.0.35/Makefile.am.pdftoopvp 2013-11-08 12:47:26.064965281 +0000 ++++ cups-filters-1.0.35/Makefile.am 2013-11-08 12:48:16.015201539 +0000 +@@ -302,10 +302,7 @@ EXTRA_DIST += \ + # PDF to OPVP + # =========== + pkgfilterdir = $(CUPS_SERVERBIN)/filter +-pkgfilter_PROGRAMS = pdftoopvp +- +-pkgfontconfigdir = $(sysconfdir)/$(FONTDIR) +-pkgfontconfig_DATA = filter/pdftoopvp/99pdftoopvp.conf ++pkgfilter_PROGRAMS = + + pdftoopvp_SOURCES = \ + filter/pdftoopvp/oprs/OPRS.cxx \ +@@ -348,8 +345,6 @@ pdftoopvp_LDADD = \ + $(POPPLER_LIBS) \ + $(DLOPEN_LIBS) + +-EXTRA_DIST += $(pkgfontconfig_DATA) +- + # ========== + # PDF to PDF + # ========== +diff -up cups-filters-1.0.35/Makefile.in.pdftoopvp cups-filters-1.0.35/Makefile.in +--- cups-filters-1.0.35/Makefile.in.pdftoopvp 2013-11-08 12:48:20.032220554 +0000 ++++ cups-filters-1.0.35/Makefile.in 2013-11-08 12:50:28.864829900 +0000 +@@ -62,7 +62,7 @@ check_PROGRAMS = test1284$(EXEEXT) testc + TESTS = testdither$(EXEEXT) test_analyze$(EXEEXT) test_pdf$(EXEEXT) \ + test_ps$(EXEEXT) test_pdf1$(EXEEXT) test_pdf2$(EXEEXT) + bin_PROGRAMS = ttfread$(EXEEXT) +-pkgfilter_PROGRAMS = pdftoopvp$(EXEEXT) pdftopdf$(EXEEXT) \ ++pkgfilter_PROGRAMS = pdftopdf$(EXEEXT) \ + bannertopdf$(EXEEXT) commandtoescpx$(EXEEXT) \ + commandtopclx$(EXEEXT) pdftoijs$(EXEEXT) pdftops$(EXEEXT) \ + pdftoraster$(EXEEXT) rastertoescpx$(EXEEXT) \ +@@ -132,7 +132,6 @@ am__installdirs = "$(DESTDIR)$(libdir)" + "$(DESTDIR)$(pkgcupsserverrootdir)" \ + "$(DESTDIR)$(pkgdriverdir)" \ + "$(DESTDIR)$(pkgfiltersincludedir)" \ +- "$(DESTDIR)$(pkgfontconfigdir)" \ + "$(DESTDIR)$(pkgfontembedincludedir)" \ + "$(DESTDIR)$(pkgmimedir)" "$(DESTDIR)$(pkgppdcdir)" \ + "$(DESTDIR)$(ppddir)" +@@ -448,7 +447,7 @@ am__can_run_installinfo = \ + DATA = $(doc_DATA) $(pkgbanner_DATA) $(pkgcharset_DATA) \ + $(pkgconf_DATA) $(pkgcupsdata_DATA) $(pkgcupsserverroot_DATA) \ + $(pkgdriver_DATA) $(pkgfiltersinclude_DATA) \ +- $(pkgfontconfig_DATA) $(pkgfontembedinclude_DATA) \ ++ $(pkgfontembedinclude_DATA) \ + $(pkgmime_DATA) $(pkgppdc_DATA) $(ppd_DATA) + ETAGS = etags + CTAGS = ctags +@@ -666,7 +665,7 @@ EXTRA_DIST = $(doc_DATA) autogen.sh libc + $(pkgfiltersinclude_DATA) cupsfilters/image.pgm \ + cupsfilters/image.ppm $(pkgcupsdata_DATA) $(pkgdriver_DATA) \ + $(pkgppdc_DATA) $(pkgmime_DATA) $(pkgfontembedinclude_DATA) \ +- fontembed/README $(pkgfontconfig_DATA) $(pkgfilter_SCRIPTS) \ ++ fontembed/README $(pkgfilter_SCRIPTS) \ + filter/test.sh utils/cups-browsed.in $(ppd_DATA) \ + scripting/perl scripting/php/README scripting/php/phpcups.php + +@@ -920,8 +919,6 @@ test_ps_LDADD = libfontembed.la + # PDF to OPVP + # =========== + pkgfilterdir = $(CUPS_SERVERBIN)/filter +-pkgfontconfigdir = $(sysconfdir)/$(FONTDIR) +-pkgfontconfig_DATA = filter/pdftoopvp/99pdftoopvp.conf + pdftoopvp_SOURCES = \ + filter/pdftoopvp/oprs/OPRS.cxx \ + filter/pdftoopvp/oprs/OPRS.h \ +@@ -3191,43 +3188,6 @@ uninstall-pkgfiltersincludeDATA: + @list='$(pkgfiltersinclude_DATA)'; test -n "$(pkgfiltersincludedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgfiltersincludedir)'; $(am__uninstall_files_from_dir) +-install-pkgfontconfigDATA: $(pkgfontconfig_DATA) +- @$(NORMAL_INSTALL) +- @list='$(pkgfontconfig_DATA)'; test -n "$(pkgfontconfigdir)" || list=; \ +- if test -n "$$list"; then \ +- echo " $(MKDIR_P) '$(DESTDIR)$(pkgfontconfigdir)'"; \ +- $(MKDIR_P) "$(DESTDIR)$(pkgfontconfigdir)" || exit 1; \ +- fi; \ +- for p in $$list; do \ +- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ +- echo "$$d$$p"; \ +- done | $(am__base_list) | \ +- while read files; do \ +- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgfontconfigdir)'"; \ +- $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgfontconfigdir)" || exit $$?; \ +- done +- +-uninstall-pkgfontconfigDATA: +- @$(NORMAL_UNINSTALL) +- @list='$(pkgfontconfig_DATA)'; test -n "$(pkgfontconfigdir)" || list=; \ +- files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ +- dir='$(DESTDIR)$(pkgfontconfigdir)'; $(am__uninstall_files_from_dir) +-install-pkgfontembedincludeDATA: $(pkgfontembedinclude_DATA) +- @$(NORMAL_INSTALL) +- @list='$(pkgfontembedinclude_DATA)'; test -n "$(pkgfontembedincludedir)" || list=; \ +- if test -n "$$list"; then \ +- echo " $(MKDIR_P) '$(DESTDIR)$(pkgfontembedincludedir)'"; \ +- $(MKDIR_P) "$(DESTDIR)$(pkgfontembedincludedir)" || exit 1; \ +- fi; \ +- for p in $$list; do \ +- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ +- echo "$$d$$p"; \ +- done | $(am__base_list) | \ +- while read files; do \ +- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgfontembedincludedir)'"; \ +- $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgfontembedincludedir)" || exit $$?; \ +- done +- + uninstall-pkgfontembedincludeDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgfontembedinclude_DATA)'; test -n "$(pkgfontembedincludedir)" || list=; \ +@@ -3613,7 +3573,7 @@ all-am: Makefile $(LTLIBRARIES) $(PROGRA + install-binPROGRAMS: install-libLTLIBRARIES + + installdirs: +- for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(phpextensiondir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgbackenddir)" "$(DESTDIR)$(pkgfilterdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(initrcdir)" "$(DESTDIR)$(pkgfilterdir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgbannerdir)" "$(DESTDIR)$(pkgcharsetdir)" "$(DESTDIR)$(pkgconfdir)" "$(DESTDIR)$(pkgcupsdatadir)" "$(DESTDIR)$(pkgcupsserverrootdir)" "$(DESTDIR)$(pkgdriverdir)" "$(DESTDIR)$(pkgfiltersincludedir)" "$(DESTDIR)$(pkgfontconfigdir)" "$(DESTDIR)$(pkgfontembedincludedir)" "$(DESTDIR)$(pkgmimedir)" "$(DESTDIR)$(pkgppdcdir)" "$(DESTDIR)$(ppddir)"; do \ ++ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(phpextensiondir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgbackenddir)" "$(DESTDIR)$(pkgfilterdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(initrcdir)" "$(DESTDIR)$(pkgfilterdir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgbannerdir)" "$(DESTDIR)$(pkgcharsetdir)" "$(DESTDIR)$(pkgconfdir)" "$(DESTDIR)$(pkgcupsdatadir)" "$(DESTDIR)$(pkgcupsserverrootdir)" "$(DESTDIR)$(pkgdriverdir)" "$(DESTDIR)$(pkgfiltersincludedir)" "$(DESTDIR)$(pkgfontembedincludedir)" "$(DESTDIR)$(pkgmimedir)" "$(DESTDIR)$(pkgppdcdir)" "$(DESTDIR)$(ppddir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done + install: install-am +@@ -3678,7 +3638,7 @@ install-data-am: install-docDATA install + install-pkgconfDATA install-pkgcupsdataDATA \ + install-pkgcupsserverrootDATA install-pkgdriverDATA \ + install-pkgfilterPROGRAMS install-pkgfilterSCRIPTS \ +- install-pkgfiltersincludeDATA install-pkgfontconfigDATA \ ++ install-pkgfiltersincludeDATA \ + install-pkgfontembedincludeDATA install-pkgmimeDATA \ + install-pkgppdcDATA install-ppdDATA + @$(NORMAL_INSTALL) +@@ -3737,7 +3697,7 @@ uninstall-am: uninstall-binPROGRAMS unin + uninstall-pkgconfDATA uninstall-pkgcupsdataDATA \ + uninstall-pkgcupsserverrootDATA uninstall-pkgdriverDATA \ + uninstall-pkgfilterPROGRAMS uninstall-pkgfilterSCRIPTS \ +- uninstall-pkgfiltersincludeDATA uninstall-pkgfontconfigDATA \ ++ uninstall-pkgfiltersincludeDATA \ + uninstall-pkgfontembedincludeDATA uninstall-pkgmimeDATA \ + uninstall-pkgppdcDATA uninstall-ppdDATA uninstall-sbinPROGRAMS + @$(NORMAL_INSTALL) +@@ -3766,7 +3726,7 @@ uninstall-am: uninstall-binPROGRAMS unin + install-pkgcupsdataDATA install-pkgcupsserverrootDATA \ + install-pkgdriverDATA install-pkgfilterPROGRAMS \ + install-pkgfilterSCRIPTS install-pkgfiltersincludeDATA \ +- install-pkgfontconfigDATA install-pkgfontembedincludeDATA \ ++ install-pkgfontembedincludeDATA \ + install-pkgmimeDATA install-pkgppdcDATA install-ppdDATA \ + install-ps install-ps-am install-sbinPROGRAMS install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ +@@ -3780,7 +3740,7 @@ uninstall-am: uninstall-binPROGRAMS unin + uninstall-pkgcupsdataDATA uninstall-pkgcupsserverrootDATA \ + uninstall-pkgdriverDATA uninstall-pkgfilterPROGRAMS \ + uninstall-pkgfilterSCRIPTS uninstall-pkgfiltersincludeDATA \ +- uninstall-pkgfontconfigDATA uninstall-pkgfontembedincludeDATA \ ++ uninstall-pkgfontembedincludeDATA \ + uninstall-pkgmimeDATA uninstall-pkgppdcDATA uninstall-ppdDATA \ + uninstall-sbinPROGRAMS + diff --git a/SOURCES/cups-filters-poppler023.patch b/SOURCES/cups-filters-poppler023.patch new file mode 100644 index 0000000..416bad8 --- /dev/null +++ b/SOURCES/cups-filters-poppler023.patch @@ -0,0 +1,225 @@ +diff -up cups-filters-1.0.35/filter/pdf.cxx.poppler023 cups-filters-1.0.35/filter/pdf.cxx +--- cups-filters-1.0.35/filter/pdf.cxx.poppler023 2015-06-16 15:47:21.870132195 +0100 ++++ cups-filters-1.0.35/filter/pdf.cxx 2015-06-16 15:47:59.623128579 +0100 +@@ -17,6 +17,10 @@ + #include "pdf.h" + + #include ++#include ++#ifdef HAVE_CPP_POPPLER_VERSION_H ++#include "cpp/poppler-version.h" ++#endif + + + extern "C" pdf_t * pdf_load_template(const char *filename) +@@ -343,7 +347,11 @@ public: + { + } + ++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23 ++ Goffset getPos() ++#else + int getPos() ++#endif + { + return this->pos; + } +diff -up cups-filters-1.0.35/filter/pdftoijs.cxx.poppler023 cups-filters-1.0.35/filter/pdftoijs.cxx +--- cups-filters-1.0.35/filter/pdftoijs.cxx.poppler023 2015-06-16 15:47:21.871132195 +0100 ++++ cups-filters-1.0.35/filter/pdftoijs.cxx 2015-06-16 15:47:59.623128579 +0100 +@@ -70,8 +70,13 @@ namespace { + } + + #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 ++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23 ++void CDECL myErrorFun(void *data, ErrorCategory category, ++ Goffset pos, char *msg) ++#else + void CDECL myErrorFun(void *data, ErrorCategory category, + int pos, char *msg) ++#endif + { + if (pos >= 0) { + fprintf(stderr, "ERROR (%d): ", pos); +@@ -297,19 +302,15 @@ int main(int argc, char *argv[]) { + if (argc == 6) { + /* stdin */ + int fd; +- Object obj; +- BaseStream *str; +- FILE *fp; ++ char name[BUFSIZ]; + char buf[BUFSIZ]; + int n; + +- fd = cupsTempFd(buf,sizeof(buf)); ++ fd = cupsTempFd(name,sizeof(name)); + if (fd < 0) { + pdfError(-1,"Can't create temporary file"); + exit(1); + } +- /* remove name */ +- unlink(buf); + + /* copy stdin to the tmp file */ + while ((n = read(0,buf,BUFSIZ)) > 0) { +@@ -319,23 +320,10 @@ int main(int argc, char *argv[]) { + exit(1); + } + } +- if (lseek(fd,0,SEEK_SET) < 0) { +- pdfError(-1,"Can't rewind temporary file"); +- close(fd); +- exit(1); +- } +- +- if ((fp = fdopen(fd,"rb")) == 0) { +- pdfError(-1,"Can't fdopen temporary file"); +- close(fd); +- exit(1); +- } +- +- obj.initNull(); +-// parsePDFTOPDFComment(fp); // TODO? +- rewind(fp); +- str = new FileStream(fp,0,gFalse,0,&obj); +- doc = new PDFDoc(str); ++ close(fd); ++ doc = new PDFDoc(new GooString(name)); ++ /* remove name */ ++ unlink(name); + } else { + GooString *fileName = new GooString(argv[6]); + /* argc == 7 filenmae is specified */ +diff -up cups-filters-1.0.35/filter/pdftoopvp/pdftoopvp.cxx.poppler023 cups-filters-1.0.35/filter/pdftoopvp/pdftoopvp.cxx +--- cups-filters-1.0.35/filter/pdftoopvp/pdftoopvp.cxx.poppler023 2015-06-16 15:47:21.871132195 +0100 ++++ cups-filters-1.0.35/filter/pdftoopvp/pdftoopvp.cxx 2015-06-16 15:47:59.624128579 +0100 +@@ -112,8 +112,13 @@ static int outOnePage(PDFDoc *doc, OPVPO + #define MAX_OPVP_OPTIONS 20 + + #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 ++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23 ++void CDECL myErrorFun(void *data, ErrorCategory category, ++ Goffset pos, char *msg) ++#else + void CDECL myErrorFun(void *data, ErrorCategory category, + int pos, char *msg) ++#endif + { + if (pos >= 0) { + fprintf(stderr, "ERROR (%d): ", pos); +@@ -619,9 +624,6 @@ exit(0); + char *s; + GooString name; + int fd; +- Object obj; +- BaseStream *str; +- FILE *fp; + char buf[4096]; + int n; + +@@ -633,8 +635,6 @@ exit(0); + } + name.append("/XXXXXX"); + fd = mkstemp(name.getCString()); +- /* remove name */ +- unlink(name.getCString()); + if (fd < 0) { + opvpError(-1,"Can't create temporary file"); + exitCode = 2; +@@ -675,23 +675,10 @@ exit(0); + goto err0; + } + } +- if (lseek(fd,0,SEEK_SET) < 0) { +- opvpError(-1,"Can't rewind temporary file"); +- close(fd); +- exitCode = 2; +- goto err0; +- } +- +- if ((fp = fdopen(fd,"rb")) == 0) { +- opvpError(-1,"Can't fdopen temporary file"); +- close(fd); +- exitCode = 2; +- goto err0; +- } +- +- obj.initNull(); +- str = new FileStream(fp,0,gFalse,0,&obj); +- doc = new PDFDoc(str); ++ close(fd); ++ doc = new PDFDoc(&name); ++ /* remove name */ ++ unlink(name.getCString()); + } else { + /* no jcl check */ + doc = new PDFDoc(fileName.copy()); +diff -up cups-filters-1.0.35/filter/pdftoraster.cxx.poppler023 cups-filters-1.0.35/filter/pdftoraster.cxx +--- cups-filters-1.0.35/filter/pdftoraster.cxx.poppler023 2015-06-16 15:47:21.871132195 +0100 ++++ cups-filters-1.0.35/filter/pdftoraster.cxx 2015-06-16 15:47:59.624128579 +0100 +@@ -185,8 +185,13 @@ namespace { + } + + #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 ++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23 ++void CDECL myErrorFun(void *data, ErrorCategory category, ++ Goffset pos, char *msg) ++#else + void CDECL myErrorFun(void *data, ErrorCategory category, + int pos, char *msg) ++#endif + { + if (pos >= 0) { + fprintf(stderr, "ERROR (%d): ", pos); +@@ -1762,19 +1767,15 @@ int main(int argc, char *argv[]) { + if (argc == 6) { + /* stdin */ + int fd; +- Object obj; +- BaseStream *str; +- FILE *fp; ++ char name[BUFSIZ]; + char buf[BUFSIZ]; + int n; + +- fd = cupsTempFd(buf,sizeof(buf)); ++ fd = cupsTempFd(name,sizeof(name)); + if (fd < 0) { + pdfError(-1,const_cast("Can't create temporary file")); + exit(1); + } +- /* remove name */ +- unlink(buf); + + /* copy stdin to the tmp file */ + while ((n = read(0,buf,BUFSIZ)) > 0) { +@@ -1784,23 +1785,10 @@ int main(int argc, char *argv[]) { + exit(1); + } + } +- if (lseek(fd,0,SEEK_SET) < 0) { +- pdfError(-1,const_cast("Can't rewind temporary file")); +- close(fd); +- exit(1); +- } +- +- if ((fp = fdopen(fd,"rb")) == 0) { +- pdfError(-1,const_cast("Can't fdopen temporary file")); +- close(fd); +- exit(1); +- } +- +- obj.initNull(); +- parsePDFTOPDFComment(fp); +- rewind(fp); +- str = new FileStream(fp,0,gFalse,0,&obj); +- doc = new PDFDoc(str); ++ close(fd); ++ doc = new PDFDoc(new GooString(name)); ++ /* remove name */ ++ unlink(name); + } else { + GooString *fileName = new GooString(argv[6]); + /* argc == 7 filenmae is specified */ +diff -up cups-filters-1.0.35/NEWS.poppler023 cups-filters-1.0.35/NEWS diff --git a/SOURCES/cups-filters-urftopdf.patch b/SOURCES/cups-filters-urftopdf.patch new file mode 100644 index 0000000..5b6c2fa --- /dev/null +++ b/SOURCES/cups-filters-urftopdf.patch @@ -0,0 +1,38 @@ +diff -up cups-filters-1.0.35/Makefile.am.urftopdf cups-filters-1.0.35/Makefile.am +--- cups-filters-1.0.35/Makefile.am.urftopdf 2013-08-30 11:16:08.166987338 +0100 ++++ cups-filters-1.0.35/Makefile.am 2013-08-30 11:16:09.181993633 +0100 +@@ -402,8 +402,8 @@ pkgfilter_PROGRAMS += \ + pdftoraster \ + rastertoescpx \ + rastertopclx \ +- texttopdf \ +- urftopdf ++ texttopdf ++ + if ENABLE_IMAGEFILTERS + pkgfilter_PROGRAMS += \ + imagetopdf \ +diff -up cups-filters-1.0.35/Makefile.in.urftopdf cups-filters-1.0.35/Makefile.in +--- cups-filters-1.0.35/Makefile.in.urftopdf 2013-08-30 11:16:14.880027661 +0100 ++++ cups-filters-1.0.35/Makefile.in 2013-08-30 11:17:44.440432004 +0100 +@@ -66,7 +66,7 @@ pkgfilter_PROGRAMS = pdftoopvp$(EXEEXT) + bannertopdf$(EXEEXT) commandtoescpx$(EXEEXT) \ + commandtopclx$(EXEEXT) pdftoijs$(EXEEXT) pdftops$(EXEEXT) \ + pdftoraster$(EXEEXT) rastertoescpx$(EXEEXT) \ +- rastertopclx$(EXEEXT) texttopdf$(EXEEXT) urftopdf$(EXEEXT) \ ++ rastertopclx$(EXEEXT) texttopdf$(EXEEXT) \ + $(am__EXEEXT_1) + @ENABLE_IMAGEFILTERS_TRUE@am__append_1 = \ + @ENABLE_IMAGEFILTERS_TRUE@ imagetopdf \ +diff -up cups-filters-1.0.35/mime/cupsfilters.convs.urftopdf cups-filters-1.0.35/mime/cupsfilters.convs +--- cups-filters-1.0.35/mime/cupsfilters.convs.urftopdf 2013-08-30 11:11:24.693868551 +0100 ++++ cups-filters-1.0.35/mime/cupsfilters.convs 2013-08-30 11:11:44.149958234 +0100 +@@ -68,7 +68,6 @@ image/x-xpixmap application/vnd.cups-pd + image/x-xwindowdump application/vnd.cups-pdf 65 imagetopdf + image/x-sun-raster application/vnd.cups-pdf 65 imagetopdf + application/vnd.cups-pdf-banner application/pdf 32 bannertopdf +-image/urf application/pdf 0 urftopdf + + ######################################################################## + # +diff -up cups-filters-1.0.35/mime/cupsfilters.types.urftopdf cups-filters-1.0.35/mime/cupsfilters.types diff --git a/SPECS/cups-filters.spec b/SPECS/cups-filters.spec new file mode 100644 index 0000000..77925eb --- /dev/null +++ b/SPECS/cups-filters.spec @@ -0,0 +1,475 @@ +# we build CUPS also with relro +%global _hardened_build 1 + +Summary: OpenPrinting CUPS filters and backends +Name: cups-filters +Version: 1.0.35 +Release: 26%{?dist} + +# For a breakdown of the licensing, see COPYING file +# GPLv2: filters: commandto*, imagetoraster, pdftops, rasterto*, +# imagetopdf, pstopdf, texttopdf +# backends: parallel, serial +# GPLv2+: filters: textonly, texttops, imagetops +# GPLv3: filters: bannertopdf +# GPLv3+: filters: urftopdf +# LGPLv2+: utils: cups-browsed +# MIT: filters: pdftoijs, pdftoopvp, pdftopdf, pdftoraster +License: GPLv2 and GPLv2+ and GPLv3 and GPLv3+ and LGPLv2+ and MIT + +Group: System Environment/Base +Url: http://www.linuxfoundation.org/collaborate/workgroups/openprinting/cups-filters +Source0: http://www.openprinting.org/download/cups-filters/cups-filters-%{version}.tar.xz + +# source files from cups-filters-1.13.4 for partial rebase of cups-browsed and introducing +# implicitclass backend for high availability and load balancing +Source1: backend.tar.gz +Source2: m4.tar.gz +Source3: utils.tar.gz +Source4: configure.ac +Source5: Makefile.am + +Patch1: cups-filters-page-label.patch +Patch2: cups-filters-filter-costs.patch +Patch3: cups-filters-urftopdf.patch +Patch4: cups-filters-format-mismatch.patch +Patch5: cups-filters-pdf-landscape.patch +Patch6: cups-filters-pdftoopvp.patch +Patch7: cups-filters-CVE-2013-6475.patch +Patch8: cups-filters-poppler023.patch +Patch9: cups-filters-CVE-2015-3258-3279.patch +# fixed covscan issues from upstream +Patch10: 0001-Fixing-covscan-issues.patch +# badly fixed coverity issue (bug #1700333) +Patch11: 0001-cups-browsed-Fixed-freeing-of-literal-string-caused-.patch +# bad paths in manpages (bug #1508018) +Patch12: cups-filters-manpages.patch + +Requires: cups-filters-libs%{?_isa} = %{version}-%{release} + +# Obsolete cups-php (bug #971741) +Obsoletes: cups-php < 1:1.6.0-1 +# Don't Provide it because we don't build the php module +#Provides: cups-php = 1:1.6.0-1 + +BuildRequires: cups-devel +# pdftopdf +BuildRequires: qpdf-devel +# pdftops +BuildRequires: poppler-utils +# pdftoijs, pdftoopvp, pdftoraster +BuildRequires: poppler-devel poppler-cpp-devel +BuildRequires: libjpeg-devel +BuildRequires: libpng-devel +BuildRequires: libtiff-devel +BuildRequires: zlib-devel +# libijs +BuildRequires: ghostscript-devel +BuildRequires: freetype-devel +BuildRequires: fontconfig-devel +BuildRequires: lcms2-devel +# cups-browsed +BuildRequires: avahi-devel avahi-glib-devel +BuildRequires: systemd + +# Make sure we get postscriptdriver tags. +BuildRequires: python-cups + +# autogen.sh +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool + +# gdbus-codegen is used in Makefile.am for generating cups-notifier code, +# so we need glib2-devel +BuildRequires: glib2-devel + +# dbus-devel is needed for new dbus CMS functionality +BuildRequires: dbus-devel + +Requires: cups-filesystem +Requires: poppler-utils + +# texttopdf +Requires: liberation-mono-fonts + +# pstopdf +Requires: bc grep sed which + +# cups-browsed +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + +%package libs +Summary: OpenPrinting CUPS filters and backends - cupsfilters and fontembed libraries +Group: System Environment/Libraries +# LGPLv2: libcupsfilters +# MIT: libfontembed +License: LGPLv2 and MIT + +%package devel +Summary: OpenPrinting CUPS filters and backends - development environment +Group: Development/Libraries +License: LGPLv2 and MIT +Requires: cups-filters-libs%{?_isa} = %{version}-%{release} + +%description +Contains backends, filters, and other software that was +once part of the core CUPS distribution but is no longer maintained by +Apple Inc. In addition it contains additional filters developed +independently of Apple, especially filters for the PDF-centric printing +workflow introduced by OpenPrinting. + +%description libs +This package provides cupsfilters and fontembed libraries. + +%description devel +This is the development package for OpenPrinting CUPS filters and backends. + +%prep +# untar m4.tar.gz, backend.tar.gz and utils.tar.gz after untaring main source +# tarball and going into the it +%setup -q -a 1 -a 2 -a 3 + +# copy configure.ac and Makefile.am into untared directory +cp %{SOURCE4} . +cp %{SOURCE5} . + +# Added support for page-label (bug #987515). +%patch1 -p1 -b .page-label + +# Upstream patch to re-work filter costs (bug #998981). +%patch2 -p1 -b .filter-costs + +# Don't ship urftopdf for now (bug #1002947). +%patch3 -p1 -b .urftopdf + +# Fixes for some printf-type format mismatches (bug #1003035). +%patch4 -p1 -b .format-mismatch + +# Fix PDF landscape printing (bug #1018313). +%patch5 -p1 -b .pdf-landscape + +# Don't ship pdftoopvp for now (bug #1027557). +%patch6 -p1 -b .pdftoopvp + +# Apply CVE-2013-6475 to pdftoopvp even though we don't ship it +# (bug #1052741). +%patch7 -p1 -b .CVE-2013-6475 + +# Build against newer poppler (bug #1217552). +%patch8 -p1 -b .poppler023 + +# Fix heap-based buffer overflow in texttopdf filter (bug #1194263, +# CVE-2015-3258, CVE-2015-3279). +%patch9 -p1 -b .CVE-2015-3258-3279 + +# fixed covscan issues from upstream +%patch10 -p1 -b .covscan + +# 1700333 - [abrt] [faf] cups-filters: raise(): /usr/sbin/cups-browsed killed by 6 +%patch11 -p1 -b .abrt-during-restart + +# 1508018 - man pages: wrong links in man cups-browsed +%patch12 -p1 -b .manpages + +%build +# work-around Rpath +./autogen.sh + +# --with-pdftops=pdftops - use Poppler instead of Ghostscript (see README) +# --with-rcdir=no - don't install SysV init script +%configure --disable-static \ + --disable-silent-rules \ + --with-pdftops=pdftops \ + --with-rcdir=no + +make %{?_smp_mflags} + +%install +make install DESTDIR=%{buildroot} + +# https://fedoraproject.org/wiki/Packaging_tricks#With_.25doc +mkdir __doc +mv %{buildroot}%{_datadir}/doc/cups-filters/* __doc +rm -rf %{buildroot}%{_datadir}/doc/cups-filters + +# Don't ship libtool la files. +rm -f %{buildroot}%{_libdir}/lib*.la + +# Not sure what is this good for. +rm -f %{buildroot}%{_bindir}/ttfread + +# systemd unit file +mkdir -p %{buildroot}%{_unitdir} +install -p -m 644 utils/cups-browsed.service %{buildroot}%{_unitdir} + +%post +%systemd_post cups-browsed.service + +# Initial installation +if [ $1 -eq 1 ] ; then + IN=%{_sysconfdir}/cups/cupsd.conf + OUT=%{_sysconfdir}/cups/cups-browsed.conf + keyword=BrowsePoll + + # We can remove this after few releases, it's just for the introduction of cups-browsed. + if [ -f "$OUT" ]; then + echo -e "\n# NOTE: This file is not part of CUPS. You need to start & enable cups-browsed service." >> "$OUT" + fi + + # move BrowsePoll from cupsd.conf to cups-browsed.conf + if [ -f "$IN" ] && grep -iq ^$keyword "$IN"; then + if ! grep -iq ^$keyword "$OUT"; then + (cat >> "$OUT" <> "$OUT") || : + #systemctl enable cups-browsed.service >/dev/null 2>&1 || : + fi + sed -i -e "s,^$keyword,#$keyword directive moved to cups-browsed.conf\n#$keyword,i" "$IN" || : + fi +fi + +%preun +%systemd_preun cups-browsed.service + +%postun +%systemd_postun_with_restart cups-browsed.service + +%post libs -p /sbin/ldconfig + +%postun libs -p /sbin/ldconfig + + +%files +%doc __doc/README __doc/AUTHORS __doc/NEWS +%config(noreplace) %{_sysconfdir}/cups/cups-browsed.conf +%attr(0755,root,root) %{_cups_serverbin}/filter/* +%attr(0755,root,root) %{_cups_serverbin}/backend/parallel +%attr(0755,root,root) %{_cups_serverbin}/backend/implicitclass +# Serial backend needs to run as root (bug #212577#c4). +%attr(0700,root,root) %{_cups_serverbin}/backend/serial +%{_datadir}/cups/banners +%{_datadir}/cups/charsets +%{_datadir}/cups/data/* +# this needs to be in the main package because of cupsfilters.drv +%{_datadir}/cups/ppdc/pcl.h +%{_datadir}/cups/drv/cupsfilters.drv +%{_datadir}/cups/mime/cupsfilters.types +%{_datadir}/cups/mime/cupsfilters.convs +%{_datadir}/ppd/cupsfilters +%{_sbindir}/cups-browsed +%{_unitdir}/cups-browsed.service +%{_mandir}/man8/cups-browsed.8.gz +%{_mandir}/man5/cups-browsed.conf.5.gz + +%files libs +%doc __doc/COPYING fontembed/README +%attr(0755,root,root) %{_libdir}/libcupsfilters.so.* +%attr(0755,root,root) %{_libdir}/libfontembed.so.* + +%files devel +%{_includedir}/cupsfilters +%{_includedir}/fontembed +%{_libdir}/pkgconfig/libcupsfilters.pc +%{_libdir}/pkgconfig/libfontembed.pc +%{_libdir}/libcupsfilters.so +%{_libdir}/libfontembed.so + +%changelog +* Tue May 21 2019 Zdenek Dohnal - 1.0.35-26 +- 1508018 - man pages: wrong links in man cups-browsed + +* Wed Apr 17 2019 Zdenek Dohnal - 1.0.35-25 +- 1700333 - [abrt] [faf] cups-filters: raise(): /usr/sbin/cups-browsed killed by 6 + +* Mon Mar 18 2019 Zdenek Dohnal - 1.0.35-24 +- fixing covscan issues, backported from upstream - 1485502 + +* Wed Feb 20 2019 Zdenek Dohnal - 1.0.35-23 +- 1485502 - Rebase cups-browsed to latest version in upstream cups-filters + +* Thu Mar 02 2017 Zdenek Dohnal - 1.0.35-22 +- 1427690 - /usr/lib/cups/filter/pstopdf: line 17: which: command not found + +* Thu Jul 9 2015 Tim Waugh - 1.0.35-21 +- Fix heap-based buffer overflow in texttopdf filter (bug #1241242, + CVE-2015-3258, CVE-2015-3279). + +* Thu Jun 25 2015 Tim Waugh - 1.0.35-20 +- Improvements to cups-browsed efficiency patch (bug #1191691). + +* Mon Jun 22 2015 Tim Waugh - 1.0.35-18 +- Fix segfault in texttopdf filter (bug #1194263). +- Improve cups-browsed efficiency (bug #1191691). +- Fetch printer descriptions with cups-browsed (bug #1223719). +- Fix cups-browsed "_" handling for printer names (bug #1167408). + +* Tue Jun 16 2015 Tim Waugh - 1.0.35-17 +- Build against newer poppler (bug #1217552). + +* Wed Oct 8 2014 Tim Waugh - 1.0.35-16 +- Applied upstream patch to fix BrowseAllow parsing issue + (CVE-2014-4338, bug #1091568). +- Applied upstream patch for cups-browsed DoS via + process_browse_data() out-of-bounds read (CVE-2014-4337, + bug #1111510). + +* Fri Mar 28 2014 Tim Waugh - 1.0.35-15 +- The texttopdf filter requires a TrueType monospaced font + (bug #1070729). + +* Fri Jan 24 2014 Daniel Mach - 1.0.35-14 +- Mass rebuild 2014-01-24 + +* Mon Jan 20 2014 Tim Waugh - 1.0.35-13 +- Apply CVE-2013-6475 to pdftoopvp even though we don't ship it + (bug #1052741). + +* Fri Dec 27 2013 Daniel Mach - 1.0.35-12 +- Mass rebuild 2013-12-27 + +* Fri Nov 8 2013 Tim Waugh - 1.0.35-11 +- Don't ship pdftoopvp for now (bug #1027557). + +* Wed Oct 16 2013 Tim Waugh - 1.0.35-10 +- Fix PDF landscape printing (bug #1018313). + +* Tue Oct 1 2013 Tim Waugh - 1.0.35-9 +- Fixes for some printf-type format mismatches (bug #1003035). + +* Fri Aug 30 2013 Tim Waugh - 1.0.35-8 +- Don't ship urftopdf for now (bug #1002947). + +* Wed Aug 21 2013 Tim Waugh - 1.0.35-7 +- Upstream patch to re-work filter costs (bug #998981). No longer need + text filter costs patch as paps gets used by default now if + installed. + +* Tue Jul 30 2013 Tim Waugh - 1.0.35-6 +- Set cost for text filters to 200 so that the paps filter gets + preference for the time being (bug #988909). + +* Wed Jul 24 2013 Tim Waugh - 1.0.35-5 +- Handle page-label when printing n-up as well. + +* Tue Jul 23 2013 Tim Waugh - 1.0.35-4 +- Added support for page-label (bug #987515). + +* Thu Jul 11 2013 Jiri Popelka - 1.0.35-3 +- Rebuild (qpdf-5.0.0) + +* Mon Jul 01 2013 Jiri Popelka - 1.0.35-2 +- add cups-browsed(8) and cups-browsed.conf(5) +- don't reverse lookup IP address in URI (#975822) + +* Wed Jun 26 2013 Jiri Popelka - 1.0.35-1 +- 1.0.35 + +* Mon Jun 24 2013 Marek Kasik - 1.0.34-9 +- Rebuild (poppler-0.22.5) + +* Wed Jun 19 2013 Jiri Popelka - 1.0.34-8 +- fix the note we add in cups-browsed.conf + +* Wed Jun 12 2013 Jiri Popelka - 1.0.34-7 +- Obsolete cups-php (#971741) + +* Wed Jun 05 2013 Jiri Popelka - 1.0.34-6 +- one more cups-browsed leak fixed (#959682) + +* Wed Jun 05 2013 Jiri Popelka - 1.0.34-5 +- perl is actually not required by pstopdf, because the calling is in dead code + +* Mon Jun 03 2013 Jiri Popelka - 1.0.34-4 +- fix resource leaks and other problems found by Coverity & Valgrind (#959682) + +* Wed May 15 2013 Jiri Popelka - 1.0.34-3 +- ship ppdc/pcl.h because of cupsfilters.drv + +* Tue May 07 2013 Jiri Popelka - 1.0.34-2 +- pstopdf requires bc (#960315) + +* Thu Apr 11 2013 Jiri Popelka - 1.0.34-1 +- 1.0.34 + +* Fri Apr 05 2013 Fridolin Pokorny - 1.0.33-1 +- 1.0.33 +- removed cups-filters-1.0.32-null-info.patch, accepted by upstream + +* Thu Apr 04 2013 Fridolin Pokorny - 1.0.32-2 +- fixed segfault when info is NULL + +* Thu Apr 04 2013 Fridolin Pokorny - 1.0.32-1 +- 1.0.32 + +* Fri Mar 29 2013 Jiri Popelka - 1.0.31-3 +- add note to cups-browsed.conf + +* Thu Mar 28 2013 Jiri Popelka - 1.0.31-2 +- check cupsd.conf existence prior to grepping it (#928816) + +* Fri Mar 22 2013 Jiri Popelka - 1.0.31-1 +- 1.0.31 + +* Tue Mar 19 2013 Jiri Popelka - 1.0.30-4 +- revert previous change + +* Wed Mar 13 2013 Jiri Popelka - 1.0.30-3 +- don't ship banners for now (#919489) + +* Tue Mar 12 2013 Jiri Popelka - 1.0.30-2 +- move BrowsePoll from cupsd.conf to cups-browsed.conf in %%post + +* Fri Mar 08 2013 Jiri Popelka - 1.0.30-1 +- 1.0.30: CUPS browsing and broadcasting in cups-browsed + +* Wed Feb 13 2013 Fedora Release Engineering - 1.0.29-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sat Jan 19 2013 Rex Dieter 1.0.29-3 +- backport upstream buildfix for poppler-0.22.x + +* Fri Jan 18 2013 Adam Tkac - 1.0.29-2 +- rebuild due to "jpeg8-ABI" feature drop + +* Thu Jan 03 2013 Jiri Popelka 1.0.29-1 +- 1.0.29 + +* Wed Jan 02 2013 Jiri Popelka 1.0.28-1 +- 1.0.28: cups-browsed daemon and service + +* Thu Nov 29 2012 Jiri Popelka 1.0.25-1 +- 1.0.25 + +* Fri Sep 07 2012 Jiri Popelka 1.0.24-1 +- 1.0.24 + +* Wed Aug 22 2012 Jiri Popelka 1.0.23-1 +- 1.0.23: old pdftopdf removed + +* Tue Aug 21 2012 Jiri Popelka 1.0.22-1 +- 1.0.22: new pdftopdf (uses qpdf instead of poppler) + +* Wed Aug 08 2012 Jiri Popelka 1.0.20-4 +- rebuild + +* Thu Aug 02 2012 Jiri Popelka 1.0.20-3 +- commented multiple licensing breakdown (#832130) +- verbose build output + +* Thu Aug 02 2012 Jiri Popelka 1.0.20-2 +- BuildRequires: poppler-cpp-devel (to build against poppler-0.20) + +* Mon Jul 23 2012 Jiri Popelka 1.0.20-1 +- 1.0.20 + +* Tue Jul 17 2012 Jiri Popelka 1.0.19-1 +- 1.0.19 + +* Wed May 30 2012 Jiri Popelka 1.0.18-1 +- initial spec file