diff --git a/.gitignore b/.gitignore index aa5b855..0bafad0 100644 --- a/.gitignore +++ b/.gitignore @@ -18,8 +18,8 @@ /config.log /config.status /configure~ -/daemon/cups-locald -/daemon/cups-locald-dbus.service -/daemon/cups-locald-systemd.service -/daemon/org.openprinting.cups-locald.plist +/daemon/cupslocald +/daemon/cupslocald-dbus.service +/daemon/cupslocald-systemd.service +/daemon/org.openprinting.cupslocald.plist /Makedefs diff --git a/configure b/configure index d54f8d1..336807a 100755 --- a/configure +++ b/configure @@ -693,7 +693,7 @@ with_dbusdir with_systemddir enable_debug enable_maintainer -enable_sanitizer +with_sanitizer with_ldflags ' ac_precious_vars='build_alias @@ -1329,13 +1329,14 @@ Optional Features: --disable-dbus build without D-Bus support --enable-debug turn on debugging, default=no --enable-maintainer turn on maintainer mode, default=no - --enable-sanitizer build with AddressSanitizer, default=no Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-dbusdir set D-Bus configuration directory --with-systemddir set systemd configuration directory + --with-sanitizer build with address, leak, memory, thread, or + undefined sanitizer, default=no --with-ldflags=... Specify additional LDFLAGS Some influential environment variables: @@ -3985,12 +3986,26 @@ then : enableval=$enable_maintainer; fi -# Check whether --enable-sanitizer was given. -if test ${enable_sanitizer+y} + +# Check whether --with-sanitizer was given. +if test ${with_sanitizer+y} then : - enableval=$enable_sanitizer; + withval=$with_sanitizer; +else $as_nop + with_sanitizer=no fi +if test "x$with_sanitizer" = xyes +then : + + with_sanitizer="address" + +elif test "$with_sanitizer" != address -a "$with_sanitizer" != leak -a "$with_sanitizer" != memory -a "$with_sanitizer" != no -a "$with_sanitizer" != thread -a "$with_sanitizer" != undefined +then : + + as_fn_error $? "Unsupported --with-sanitizer value \"$with_sanitizer\" specified." "$LINENO" 5 + +fi if test x$enable_debug = xyes then : @@ -4013,20 +4028,26 @@ WARNINGS="" if test -n "$GCC" then : - if test x$enable_sanitizer = xyes + if test x$with_sanitizer != xno +then : + + # Use -fsanitize=FOO with debugging... + OPTIM="$OPTIM -fsanitize=$with_sanitizer" + +elif echo "$CPPFLAGS $CFLAGS" | grep -q _FORTIFY_SOURCE then : - # Use -fsanitize=address with debugging... - OPTIM="$OPTIM -fsanitize=address" + # Don't add _FORTIFY_SOURCE if it is already there else $as_nop # Otherwise use the Fortify enhancements to catch any unbounded # string operations... - CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2" + CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=3" fi + WARNINGS="-Wall -Wunused" for warning in char-subscripts format-truncation format-y2k switch unused-result; do @@ -4235,7 +4256,7 @@ printf "%s\n" "#define CUPS_LOCAL_DATADIR \"$datadir/cups-local\"" >>confdefs.h -ac_config_files="$ac_config_files Makedefs daemon/cups-locald-dbus.service daemon/cups-locald-systemd.service daemon/org.openprinting.cups-locald.plist" +ac_config_files="$ac_config_files Makedefs daemon/cupslocald-dbus.service daemon/cupslocald-systemd.service daemon/org.openprinting.cupslocald.plist" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -4924,9 +4945,9 @@ do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makedefs") CONFIG_FILES="$CONFIG_FILES Makedefs" ;; - "daemon/cups-locald-dbus.service") CONFIG_FILES="$CONFIG_FILES daemon/cups-locald-dbus.service" ;; - "daemon/cups-locald-systemd.service") CONFIG_FILES="$CONFIG_FILES daemon/cups-locald-systemd.service" ;; - "daemon/org.openprinting.cups-locald.plist") CONFIG_FILES="$CONFIG_FILES daemon/org.openprinting.cups-locald.plist" ;; + "daemon/cupslocald-dbus.service") CONFIG_FILES="$CONFIG_FILES daemon/cupslocald-dbus.service" ;; + "daemon/cupslocald-systemd.service") CONFIG_FILES="$CONFIG_FILES daemon/cupslocald-systemd.service" ;; + "daemon/org.openprinting.cupslocald.plist") CONFIG_FILES="$CONFIG_FILES daemon/org.openprinting.cupslocald.plist" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/configure.ac b/configure.ac index baa7965..d633df1 100644 --- a/configure.ac +++ b/configure.ac @@ -166,7 +166,12 @@ AC_SUBST([SYSTEMDDIR]) dnl Extra compiler options... AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [turn on debugging, default=no])) AC_ARG_ENABLE([maintainer], AS_HELP_STRING([--enable-maintainer], [turn on maintainer mode, default=no])) -AC_ARG_ENABLE([sanitizer], AS_HELP_STRING([--enable-sanitizer], [build with AddressSanitizer, default=no])) +AC_ARG_WITH([sanitizer], AS_HELP_STRING([--with-sanitizer], [build with address, leak, memory, thread, or undefined sanitizer, default=no]), [], [with_sanitizer=no]) +AS_IF([test "x$with_sanitizer" = xyes], [ + with_sanitizer="address" +], [test "$with_sanitizer" != address -a "$with_sanitizer" != leak -a "$with_sanitizer" != memory -a "$with_sanitizer" != no -a "$with_sanitizer" != thread -a "$with_sanitizer" != undefined], [ + AC_MSG_ERROR([Unsupported --with-sanitizer value "$with_sanitizer" specified.]) +]) AS_IF([test x$enable_debug = xyes], [ OPTIM="$OPTIM -g" @@ -182,15 +187,18 @@ WARNINGS="" AC_SUBST([WARNINGS]) AS_IF([test -n "$GCC"], [ - AS_IF([test x$enable_sanitizer = xyes], [ - # Use -fsanitize=address with debugging... - OPTIM="$OPTIM -fsanitize=address" + AS_IF([test x$with_sanitizer != xno], [ + # Use -fsanitize=FOO with debugging... + OPTIM="$OPTIM -fsanitize=$with_sanitizer" + ], [echo "$CPPFLAGS $CFLAGS" | grep -q _FORTIFY_SOURCE], [ + # Don't add _FORTIFY_SOURCE if it is already there ], [ # Otherwise use the Fortify enhancements to catch any unbounded # string operations... - CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2" + CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=3" ]) + dnl Show all standard warnings + unused variables when compiling... WARNINGS="-Wall -Wunused" @@ -296,8 +304,8 @@ AC_SUBST([CUPS_LOCAL_DATADIR]) dnl Generate a bunch of files... AC_CONFIG_FILES([ Makedefs - daemon/cups-locald-dbus.service - daemon/cups-locald-systemd.service - daemon/org.openprinting.cups-locald.plist + daemon/cupslocald-dbus.service + daemon/cupslocald-systemd.service + daemon/org.openprinting.cupslocald.plist ]) AC_OUTPUT diff --git a/daemon/Dependencies b/daemon/Dependencies index ddeb688..22cf510 100644 --- a/daemon/Dependencies +++ b/daemon/Dependencies @@ -1,4 +1,10 @@ -main.o: main.c cups-locald.h ../config.h \ +main.o: main.c cupslocald.h ../config.h \ + \ + \ + \ + \ + \ + \ \ \ \ @@ -15,7 +21,12 @@ main.o: main.c cups-locald.h ../config.h \ \ \ -dbus.o: dbus.c cups-locald.h ../config.h \ +dbus.o: dbus.c cupslocald.h ../config.h \ + \ + \ + \ + \ + \ \ \ \ @@ -32,7 +43,7 @@ dbus.o: dbus.c cups-locald.h ../config.h \ \ \ -drivers.o: drivers.c cups-locald.h ../config.h \ +drivers.o: drivers.c cupslocald.h ../config.h \ \ \ \ @@ -49,8 +60,17 @@ drivers.o: drivers.c cups-locald.h ../config.h \ \ \ \ - -transform.o: transform.c cups-locald.h ../config.h \ + \ + \ + \ + \ + \ + icons.h +transform.o: transform.c cupslocald.h ../config.h \ + \ + \ + \ + \ \ \ \ diff --git a/daemon/Makefile b/daemon/Makefile index 7302033..f63d7c3 100644 --- a/daemon/Makefile +++ b/daemon/Makefile @@ -11,7 +11,7 @@ include ../Makedefs TARGETS = \ - cups-locald + cupslocald OBJS = \ main.o \ dbus.o \ @@ -54,24 +54,24 @@ depend: # install: - echo Installing cups-locald to $(BUILDROOT)$(sbindir) + echo Installing cupslocald to $(BUILDROOT)$(sbindir) $(INSTALL_DIR) -m 755 $(BUILDROOT)$(sbindir) - $(INSTALL_BIN) cups-locald $(BUILDROOT)$(sbindir) + $(INSTALL_BIN) cupslocald $(BUILDROOT)$(sbindir) if test "x$(DBUSDIR)" != x; then \ echo Installing D-Bus files to $(BUILDROOT)$(DBUSDIR); \ $(INSTALL_DIR) -m 755 $(BUILDROOT)$(DBUSDIR)/interfaces; \ - $(INSTALL_DATA) org.openprinting.cups-locald.xml $(BUILDROOT)$(DBUSDIR)/interfaces; \ + $(INSTALL_DATA) org.openprinting.cupslocald.xml $(BUILDROOT)$(DBUSDIR)/interfaces; \ $(INSTALL_DIR) -m 755 $(BUILDROOT)$(DBUSDIR)/services; \ - $(INSTALL_DATA) cups-locald-dbus.service $(BUILDROOT)$(DBUSDIR)/services/cups-locald.service; \ + $(INSTALL_DATA) cupslocald-dbus.service $(BUILDROOT)$(DBUSDIR)/services/cupslocald.service; \ fi if test "x$$(uname)" = xDarwin; then \ echo Installing launchd files to $(BUILDROOT)/Library/LaunchAgents; \ $(INSTALL_DIR) -m 755 $(BUILDROOT)/Library/LaunchAgents; \ - $(INSTALL_DATA) org.openprinting.cups-locald.plist $(BUILDROOT)/Library/LaunchAgents; \ + $(INSTALL_DATA) org.openprinting.cupslocald.plist $(BUILDROOT)/Library/LaunchAgents; \ elif test "x$(SYSTEMDDIR)" != x; then \ echo Installing systemd files to $(BUILDROOT)$(SYSTEMDDIR); \ $(INSTALL_DIR) -m 755 $(BUILDROOT)$(SYSTEMDDIR)/user; \ - $(INSTALL_DATA) cups-locald-systemd.service $(BUILDROOT)$(SYSTEMDDIR)/user/cups-locald.service; \ + $(INSTALL_DATA) cupslocald-systemd.service $(BUILDROOT)$(SYSTEMDDIR)/user/cupslocald.service; \ fi @@ -80,28 +80,28 @@ install: # uninstall: - $(RM) $(BUILDROOT)$(sbindir)/cups-locald + $(RM) $(BUILDROOT)$(sbindir)/cupslocald -$(RMDIR) $(BUILDROOT)$(sbindir) if test "x$(DBUSDIR)" != x; then \ - $(RM) $(BUILDROOT)$(DBUSDIR)/interfaces/org.openprinting.cups-locald.xml; \ + $(RM) $(BUILDROOT)$(DBUSDIR)/interfaces/org.openprinting.cupslocald.xml; \ $(RMDIR) $(BUILDROOT)$(DBUSDIR)/interfaces; \ - $(RM) $(BUILDROOT)$(DBUSDIR)/services/cups-locald.service; \ + $(RM) $(BUILDROOT)$(DBUSDIR)/services/cupslocald.service; \ $(RMDIR) $(BUILDROOT)$(DBUSDIR)/services; \ fi if test "x$$(uname)" = xDarwin; then \ - $(RM) $(BUILDROOT)/Library/LaunchAgents/org.openprinting.cups-locald.plist; \ + $(RM) $(BUILDROOT)/Library/LaunchAgents/org.openprinting.cupslocald.plist; \ $(RMDIR) $(BUILDROOT)/Library/LaunchAgents; \ elif test "x$(SYSTEMDDIR)" != x; then \ - $(RM) $(BUILDROOT)$(SYSTEMDDIR)/user/cups-locald.service; \ + $(RM) $(BUILDROOT)$(SYSTEMDDIR)/user/cupslocald.service; \ $(RMDIR) $(BUILDROOT)$(SYSTEMDDIR)/user; \ fi # -# cups-locald +# cupslocald # -cups-locald: $(OBJS) +cupslocald: $(OBJS) echo Linking $@... $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(CODE_SIGN) -s "$(CODESIGN_IDENTITY)" $@ diff --git a/daemon/cups-locald-dbus.service.in b/daemon/cupslocald-dbus.service.in similarity index 100% rename from daemon/cups-locald-dbus.service.in rename to daemon/cupslocald-dbus.service.in diff --git a/daemon/cups-locald-systemd.service.in b/daemon/cupslocald-systemd.service.in similarity index 100% rename from daemon/cups-locald-systemd.service.in rename to daemon/cupslocald-systemd.service.in diff --git a/daemon/cups-locald.h b/daemon/cupslocald.h similarity index 86% rename from daemon/cups-locald.h rename to daemon/cupslocald.h index d88560b..902a335 100644 --- a/daemon/cups-locald.h +++ b/daemon/cupslocald.h @@ -1,14 +1,14 @@ // -// Common header for cups-local. +// Common header for cupslocald. // -// Copyright © 2023 by OpenPrinting. +// Copyright © 2023-2024 by OpenPrinting. // // Licensed under Apache License v2.0. See the file "LICENSE" for more // information. // -#ifndef CUPS_LOCALD_H -# define CUPS_LOCALD_H 1 +#ifndef CUPSLOCALD_H +# define CUPSLOCALD_H 1 # include # include @@ -17,16 +17,16 @@ // Globals... // -# ifdef CUPS_LOCAL_MAIN_C +# ifdef CUPSLOCALD_MAIN_C # define VAR # define VALUE(x) =x # else # define VAR extern # define VALUE(x) -# endif // CUPS_LOCAL_MAIN_C +# endif // CUPSLOCALD_MAIN_C VAR pappl_pr_driver_t LocalDrivers[7] -# ifdef CUPS_LOCAL_MAIN_C +# ifdef CUPSLOCALD_MAIN_C = { { "everywhere", "IPP Everywhere™", NULL, NULL }, { "pcl", "Generic PCL", NULL, NULL }, @@ -36,7 +36,7 @@ VAR pappl_pr_driver_t LocalDrivers[7] { "ps_duplex", "Generic PostScript w/Duplexer", NULL, NULL }, { "ps_color_duplex", "Generic Color PostScript w/Duplexer", NULL, NULL } } -# endif // CUPS_LOCAL_MAIN_C +# endif // CUPSLOCALD_MAIN_C ; VAR char LocalSocket[256] VALUE(""); // Domain socket path @@ -59,4 +59,4 @@ extern bool LocalDriverCallback(pappl_system_t *system, const char *driver_name extern bool LocalTransformFilter(pappl_job_t *job, int doc_number, pappl_pr_options_t *options, pappl_device_t *device, void *data); -#endif // !CUPS_LOCALD_H +#endif // !CUPSLOCALD_H diff --git a/daemon/dbus.c b/daemon/dbus.c index 1954537..ce50266 100644 --- a/daemon/dbus.c +++ b/daemon/dbus.c @@ -7,7 +7,7 @@ // information. // -#include "cups-locald.h" +#include "cupslocald.h" #ifdef HAVE_DBUS # include diff --git a/daemon/drivers.c b/daemon/drivers.c index 931aca9..94dc42d 100644 --- a/daemon/drivers.c +++ b/daemon/drivers.c @@ -1,13 +1,13 @@ // -// Generic drivers for cups-local. +// Generic drivers for cupslocald. // -// Copyright © 2023 by OpenPrinting. +// Copyright © 2023-2024 by OpenPrinting. // // Licensed under Apache License v2.0. See the file "LICENSE" for more // information. // -#include "cups-locald.h" +#include "cupslocald.h" #include #include "icons.h" #include diff --git a/daemon/main.c b/daemon/main.c index a1de1fc..628bf35 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -1,14 +1,14 @@ // -// Main entry for cups-local. +// Main entry for cupslocald. // -// Copyright © 2023 by OpenPrinting. +// Copyright © 2023-2024 by OpenPrinting. // // Licensed under Apache License v2.0. See the file "LICENSE" for more // information. // -#define CUPS_LOCAL_MAIN_C -#include "cups-locald.h" +#define CUPSLOCALD_MAIN_C +#include "cupslocald.h" #include #ifdef __APPLE__ # include diff --git a/daemon/org.openprinting.cups-locald.plist.in b/daemon/org.openprinting.cupslocald.plist.in similarity index 100% rename from daemon/org.openprinting.cups-locald.plist.in rename to daemon/org.openprinting.cupslocald.plist.in diff --git a/daemon/org.openprinting.cups-locald.xml b/daemon/org.openprinting.cupslocald.xml similarity index 100% rename from daemon/org.openprinting.cups-locald.xml rename to daemon/org.openprinting.cupslocald.xml diff --git a/daemon/transform.c b/daemon/transform.c index 23d0678..ca2ddf8 100644 --- a/daemon/transform.c +++ b/daemon/transform.c @@ -1,13 +1,13 @@ // -// Transform support for cups-local. +// Transform support for cupslocald. // -// Copyright © 2023 by OpenPrinting. +// Copyright © 2023-2024 by OpenPrinting. // // Licensed under Apache License v2.0. See the file "LICENSE" for more // information. // -#include "cups-locald.h" +#include "cupslocald.h" #include #include #include @@ -60,17 +60,42 @@ LocalTransformFilter( { "copies", "finishings", + "force-front-side", + "image-orientation", + "imposition-template", + "insert-sheet", + "job-error-sheet", + "job-name", + "job-originating-user-name", + "job-pages-per-set", + "job-sheet-message", + "job-sheets", + "job-sheets-col", "media", "media-col", + "multiple-document-handling", + "number-up", "orientation-requested", "output-bin", + "overrides", + "page-delivery", "page-ranges", "print-color-mode", "print-content-optimize", "print-quality", + "print-rendering-intent", "print-scaling", "printer-resolution", - "sides" + "separator-sheets", + "sides", + "x-image-position", + "x-image-shift", + "x-side1-image-shift", + "x-side2-image-shift", + "y-image-position", + "y-image-shift", + "y-side1-image-shift", + "y-side2-image-shift" };