Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package cups-pdf for openSUSE:Factory checked in at 2026-10-03 20:15:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cups-pdf (Old) and /work/SRC/openSUSE:Factory/.cups-pdf.new.1631729 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cups-pdf" Sat Oct 3 20:15:01 2026 rev:7 rq:1382259 version:3.0.3 Changes: -------- --- /work/SRC/openSUSE:Factory/cups-pdf/cups-pdf.changes 2025-05-20 17:04:32.850627787 +0200 +++ /work/SRC/openSUSE:Factory/.cups-pdf.new.1631729/cups-pdf.changes 2026-10-03 20:16:30.168056618 +0200 @@ -1,0 +2,8 @@ +Sat Oct 3 06:43:00 UTC 2026 - Carsten Ziepke <[email protected]> + +- Version update to 3.0.3 which includes: + - fixed a possible privilege escalation + - added SPDX license identifiers + - updated default option values in PPD + +------------------------------------------------------------------- Old: ---- cups-pdf_3.0.2.tar.gz New: ---- cups-pdf_3.0.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cups-pdf.spec ++++++ --- /var/tmp/diff_new_pack.z5eUF2/_old 2026-10-03 20:16:30.834084467 +0200 +++ /var/tmp/diff_new_pack.z5eUF2/_new 2026-10-03 20:16:30.837084592 +0200 @@ -1,7 +1,7 @@ # # spec file for package cups-pdf # -# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2026 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: cups-pdf -Version: 3.0.2 +Version: 3.0.3 Release: 0 Summary: Virtual PDF printer for CUPS License: GPL-2.0-or-later ++++++ cups-pdf_3.0.2.tar.gz -> cups-pdf_3.0.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cups-pdf-3.0.2/ChangeLog new/cups-pdf-3.0.3/ChangeLog --- old/cups-pdf-3.0.2/ChangeLog 2025-03-23 16:06:34.976997524 +0100 +++ new/cups-pdf-3.0.3/ChangeLog 2026-05-09 00:48:56.237981031 +0200 @@ -1,10 +1,13 @@ +2026-05-08: CUPS-PDF 3.0.3 - fixed a possible privilege escalation, + added SPDX license identifiers, + updated default option values in PPD 2025-03-23: CUPS-PDF 3.0.2 - updated GhostScript command line arguments, added full code documentation by Lew Pitcher 2017-02-24: CUPS-PDF 3.0.1 - corrected a bug with multiple instance naming, some code and logging improvements, removed obsolete code, updated the README file -2017-01-04: CUPS-PDF 3.0.0 - disabled support for multiple PS-files in one file, +2017-01-04: CUPS-PDF 3.0.0 - disabled support for multiple PS-files in one file, improved PS-structure handling, reordered compiler call to avoid errors 2014-10-19: CUPS-PDF 3.0beta2 - code simplifications and optimizations, @@ -27,7 +30,7 @@ 2011-02-18 : CUPS-PDF 2.5.1 - fixed crash due to an uninitialized pointer, improved logging mechanism in case of crashes, improved recognition of untitled documents via stdin, - job labels can be set before and after document name, + job labels can be set before and after document name, removed several bashisms from SELinux-contribution 2009-01-26 : CUPS-PDF 2.5.0 - new option to truncate long filenames, spoolfile is purged on errors, @@ -43,14 +46,14 @@ 2007-05-04 : CUPS-PDF 2.4.6 - optimized default options for GS to produce PDFs 2007-02-27 : CUPS-PDF 2.4.5 - enclosing parentheses () are removed from title, set a more comprehensive identification string -2007-02-02 : CUPS-PDF 2.4.4 - DOS-style path separators '\' are now recognized +2007-02-02 : CUPS-PDF 2.4.4 - DOS-style path separators '\' are now recognized 2006-11-22 : CUPS-PDF 2.4.3 - replaced 'setenv' by 'putenv' to increase compatibility 2006-09-30 : CUPS-PDF 2.4.2 - several code optimizations, PostScript PPD now uncompressed and rev4 only 2006-06-13 : CUPS-PDF 2.4.1 - added a PDF-to-mail postprocessing script to contrib/, added a new revision of the PostscriptColor PPD file -2006-05-28 : CUPS-PDF 2.4.0 - created the contrib/ directory with additional software -2006-05-17 : CUPS-PDF 2.3.1 - fixed possible read access after end of string, +2006-05-28 : CUPS-PDF 2.4.0 - created the contrib/ directory with additional software +2006-05-17 : CUPS-PDF 2.3.1 - fixed possible read access after end of string, fixed recognition of international characters 2006-05-14 : CUPS-PDF 2.3.0 - experimental option to decode hex strings in title (NK) 2006-04-14 : CUPS-PDF 2.2.0 - new option to remove prefixes from usernames @@ -127,4 +130,4 @@ code now entirely written in C, cups-pdfgen is obsolete 2003-02-14 : CUPS-PDF 0.2 - script re-located to /usr/lib/cups/filter/cups-pdfgen -2003-02-12 : CUPS-PDF 0.1 - first beta release +2003-02-12 : CUPS-PDF 0.1 - first beta release diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cups-pdf-3.0.2/README new/cups-pdf-3.0.3/README --- old/cups-pdf-3.0.2/README 2017-02-24 16:46:27.690529825 +0100 +++ new/cups-pdf-3.0.3/README 2026-05-09 00:20:07.651121757 +0200 @@ -12,7 +12,7 @@ 1. building CUPS-PDF -------------------- - Edit src/cups-pdf.h if you do not like /etc/cups as location for your + Edit src/cups-pdf.h if you do not like /etc/cups as location for your configuration files. To compile CUPS-PDF, invoke gcc in the src/ directory: @@ -25,12 +25,12 @@ of CUPS (usually /usr/lib/cups/backend or /usr/lib64/...). Now copy extra/cups-pdf.conf to /etc/cups (or whatever location you - selected in cups-pdf.h above). Here you can set all properties of + selected in cups-pdf.h above). Here you can set all properties of CUPS-PDF at runtime without the need for restarting any services. (The defaults should work fine on most systems.) If you want to use the color PostScript driver that comes with - CUPS-PDF go to the extra/ subdirectory and copy CUPS-PDF_opt.ppd to + CUPS-PDF go to the extra/ subdirectory and copy CUPS-PDF_opt.ppd to your CUPS model directory (usually /usr/share/cups/model [ /Generic ] ). If you do not want to set any options via PPD (see section 3), use CUPS-PDF_noopt.ppd instead. @@ -42,25 +42,25 @@ Important notes: ================ - * CUPS-PDF requires root privileges since it has to modify file ownerships. + * CUPS-PDF requires root privileges since it has to modify file ownerships. In order to ensure CUPS-PDF is running with the required root privileges - you have to make 'root' the owner of the cups-pdf backend and set the + you have to make 'root' the owner of the cups-pdf backend and set the file permissions of the backend to 0700 (root only). - NOTE: in older versions of CUPS (<1.2.0) you have to set the "RunAsUser" + NOTE: in older versions of CUPS (<1.2.0) you have to set the "RunAsUser" option in cupsd.conf to "No" in order to grant full privileges. * CUPS-PDF needs a fully featured UNIX-filesystem to work. Make sure if any - of CUPS-PDF's working directories (e.g. output) are located on an NFS - mounted volume they are mounted without root_squash! Other filesystems - (e.g. NetWare or Windows shares as well as NFSv4 with kerberos) are _not_ + of CUPS-PDF's working directories (e.g. output) are located on an NFS + mounted volume they are mounted without root_squash! Other filesystems + (e.g. NetWare or Windows shares as well as NFSv4 with kerberos) are _not_ supported! - * CUPS-PDF is known to fail if the gs (GhostScript) binary on a system is + * CUPS-PDF is known to fail if the gs (GhostScript) binary on a system is compressed by upx (Ultimate Packer for eXecutables). * If you are using SELinux, AppArmour or similar tools, make sure these do not interfere with CUPS-PDF. (You can disable SELinux for CUPS by "setsebool -P cupsd_disable_trans 1" or have a look at the SELinux-HOWTO on www.cups-pdf.de) - Now you will be able to choose "CUPS-PDF (Virtual PDF Printer)" when + Now you will be able to choose "CUPS-PDF (Virtual PDF Printer)" when setting up a new printer in CUPS (a CUPS-restart may be necessary). To set up a queue for other UNIX clients you should select Postscript as vendor and the Color Printer as model for your new printer; queues that get @@ -80,24 +80,24 @@ converted PDF files will be placed in subdirectories named after the owner of the print job. In case the owner cannot be identified (i.e. does not exist on the server) the output is placed in the directory for anonymous - operation (if not disabled in cups-pdf.conf - defaults to + operation (if not disabled in cups-pdf.conf - defaults to /var/spool/cups-pdf/ANONYMOUS/). Furthermore if logging is enabled the logfile will be placed by default in /var/log/cups. The files "CUPS-PDF_opt.ppd" and "CUPS-PDF_noopt.ppd" are modified versions - of the "Postscript.ppd.gz" that comes with CUPS 1.1.15 that is able to + of the "Postscript.ppd.gz" that comes with CUPS 1.1.15 that is able to handle color output. You should have a look at the contributed software on www.cups-pdf.de which - contains several additions to CUPS-PDF which enhance functionality or + contains several additions to CUPS-PDF which enhance functionality or supports the setup of CUPS-PDF on different platforms. 3. advanced configuration and multiple instances ------------------------------------------------ - CUPS-PDF now has a PPD file (CUPS-PDF_opt.ppd) that allows setting the following + CUPS-PDF now has a PPD file (CUPS-PDF_opt.ppd) that allows setting the following options in the CUPS webinterface (administration/set default options): - resolution - page size @@ -123,8 +123,8 @@ you have been warned!), set AllowUnsafeOptions in the config file (/etc/cups/cups-pdf.conf) to 1. - To create multiple instances of the backend with different configurations, simply - copy several config files in your config directory, naming them + To create multiple instances of the backend with different configurations, simply + copy several config files in your config directory, naming them cups-pdf-<NAME>.conf, where <NAME> is a unique identifier for this instance. You can then select the new instances as URI when creating a new printer in CUPS. @@ -132,7 +132,7 @@ 4. note for MacOSX ------------------ - Since MacOSX' AFPL GhostScript does not support the way of PDF generation + Since MacOSX' AFPL GhostScript does not support the way of PDF generation used by CUPS-PDF you will have to use pstopdf instead. For this the settings of GhostScript, GSCall and PDFVer in cups-pdf.conf have to be changed accordingly. The values are documented in cups-pdf.conf . @@ -143,5 +143,5 @@ Volker C. Behr [email protected] - http://www.cups-pdf.de + https://www.cups-pdf.de diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cups-pdf-3.0.2/extra/CUPS-PDF_noopt.ppd new/cups-pdf-3.0.3/extra/CUPS-PDF_noopt.ppd --- old/cups-pdf-3.0.2/extra/CUPS-PDF_noopt.ppd 2013-05-05 12:10:34.876600773 +0200 +++ new/cups-pdf-3.0.3/extra/CUPS-PDF_noopt.ppd 2026-05-09 00:16:50.986413273 +0200 @@ -7,7 +7,7 @@ *% *% Michael Goffioul <[email protected]> *% -*% Changes to the original file by Volker Behr, Martin-Eric Racine, +*% Changes to the original file by Volker Behr, Martin-Eric Racine, *% Nickolay Kondrashov and other contributors: *% added IEEE-1284 device id - 2008-03-24 *% added custom page size - 2006-05-18 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cups-pdf-3.0.2/extra/CUPS-PDF_opt.ppd new/cups-pdf-3.0.3/extra/CUPS-PDF_opt.ppd --- old/cups-pdf-3.0.2/extra/CUPS-PDF_opt.ppd 2013-05-05 12:01:10.742029028 +0200 +++ new/cups-pdf-3.0.3/extra/CUPS-PDF_opt.ppd 2026-05-09 00:47:46.591157616 +0200 @@ -7,8 +7,9 @@ *% *% Michael Goffioul <[email protected]> *% -*% Changes to the original file by Volker Behr, Martin-Eric Racine, +*% Changes to the original file by Volker Behr, Martin-Eric Racine, *% Nickolay Kondrashov, Louis Lagendijk and other contributors: +*% updated default values - 2026-05-08 *% added option setting from PPD - 2011-08-05 *% added IEEE-1284 device id - 2008-03-24 *% added custom page size - 2006-05-18 @@ -346,12 +347,13 @@ *OpenUI *PDFVer/PDF version: PickOne *OrderDependency: 100 AnySetup *PDFVer *OPOptionHints PDFVer: "dropdown" -*DefaultPDFVer: 1.2 +*DefaultPDFVer: 1.4 *PDFVer 1.1/1.1: "" *PDFVer 1.2/1.2: "" *PDFVer 1.3/1.3: "" *PDFVer 1.4/1.4: "" *PDFVer 1.5/1.5: "" +*PDFVer 1.6/1.6: "" *CloseUI: *PDFVer *OpenUI *Truncate/Truncate output filename to: PickOne @@ -366,7 +368,7 @@ *OpenUI *Label/Label outputfiles:PickOne *OrdeDependency: 100 AnySetup *Label -*DefaultLabel: 2 +*DefaultLabel: 0 *Label 0/Label only untitled documents with job-id: "" *Label 1/Prefix all documents with job-id: "" *Label 2/Suffix all documents with job-id: "" @@ -380,7 +382,7 @@ *CloseUI: *TitlePref *OpenUI *LogType/Log level: PickOne -*DefaultLogType: 7 +*DefaultLogType: 3 *LogType 1/Only errors: "" *LogType 3/Error and status messages: "" *LogType 7/Debug, error and status messages: "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cups-pdf-3.0.2/extra/cups-pdf.conf new/cups-pdf-3.0.3/extra/cups-pdf.conf --- old/cups-pdf-3.0.2/extra/cups-pdf.conf 2025-03-23 16:03:08.552564822 +0100 +++ new/cups-pdf-3.0.3/extra/cups-pdf.conf 2026-05-09 00:36:23.250839068 +0200 @@ -1,17 +1,18 @@ -# cups-pdf.conf -- CUPS Backend Configuration (version 3.0.2, 2025-03-23) +# cups-pdf.conf -- CUPS Backend Configuration (version 3.0.3, 2026-05-08) # 18.09.2005, Volker C. Behr -# [email protected] -# http://www.cups-pdf.de # +# Copyright (C) 2003-2026 Volker C. Behr <[email protected]> +# SPDX-License-Identifier: GPL-2.0-or-later +# https://www.cups-pdf.de # -# This code may be freely distributed as long as this header -# is preserved. Changes to the code should be clearly indicated. +# This code may be freely distributed as long as this header +# is preserved. Changes to the code should be clearly indicated. # # This code is distributed under the GPL. # (http://www.gnu.org/copyleft/gpl.html) # -# For more detailed licensing information see cups-pdf.c in the -# corresponding version number. +# For more detailed licensing information see cups-pdf.c in the +# corresponding version number. ########################################################################### # # @@ -40,12 +41,12 @@ ########################################################################### ### Key: Out (config) -## CUPS-PDF output directory -## special qualifiers: +## CUPS-PDF output directory +## special qualifiers: ## ${HOME} will be expanded to the user's home directory ## ${USER} will be expanded to the user name ## in case it is an NFS export make sure it is exported without -## root_squash! +## root_squash! ### Default: /var/spool/cups-pdf/${USER} #Out /var/spool/cups-pdf/${USER} @@ -59,7 +60,7 @@ ### Key: Spool (config) ## CUPS-PDF spool directory - make sure there is no user 'SPOOL' on your -## system or change the path +## system or change the path ### Default: /var/spool/cups-pdf/SPOOL #Spool /var/spool/cups-pdf/SPOOL @@ -107,7 +108,7 @@ ## where to look first for a title when creating the output filename ## (title in PS file or title on commandline): ## 0: prefer title from %Title statement in the PS file -## 1: prefer title passed via commandline +## 1: prefer title passed via commandline ### Default: 0 #TitlePref 0 @@ -128,10 +129,10 @@ #AnonUser nobody ### Key: LowerCase (config) -## This options allows to check user names given to CUPS-PDF additionally -## against their lower case variants. This is necessary since in some +## This option allows to check user names given to CUPS-PDF additionally +## against their lower case variants. This is necessary since in some ## Windows environments only upper case user names are passed. Usually UNIX -## user names are all lower case and it is save to use this option +## user names are all lower case and it is save to use this option ## but be aware that it can lead to mis-identifications in case ## you have user names that differ only in upper/lower case. ## check only against user name as passed to CUPS : 0 @@ -142,7 +143,7 @@ ### Key: UserPrefix (config) ## some installations require a domain prefix added to the user name -## leave empty for no prefix +## leave empty for no prefix ### Default: <empty> #UserPrefix @@ -194,7 +195,7 @@ ### Key: AllowUnsafeOptions (config) ## DON'T CHANGE THIS SETTING UNLESS YOU ABSOLUTELY KNOW WHAT YOU ARE DOING -## set to 1 in order to allow users to override any option - including +## set to 1 in order to allow users to override any option - including ## those that pose SEVERE SECURITY RISKS, set to 0 for full security ### Default: 0 @@ -208,14 +209,14 @@ ########################################################################### ### Key: Log (config) -## CUPS-PDF log directory +## CUPS-PDF log directory ## set this to an empty value to disable all logging ### Default: /var/log/cups #Log /var/log/cups ### Key: LogType (config, ppd) -## log-mode +## log-mode ## 1: errors ## 2: status (i.e. activity) ## 4: debug - this will generate a lot of log-output! @@ -233,7 +234,7 @@ ########################################################################### ### Key: GhostScript (config) -## location of GhostScript binary (gs) +## location of GhostScript binary (gs) ## MacOSX: for using pstopdf (recommended) set this to /usr/bin/pstopdf ## or its proper location on your system ### Default: /usr/bin/gs @@ -241,8 +242,8 @@ #GhostScript /usr/bin/gs ### Key: GSTmp (config) -## location of temporary files during GhostScript operation -## this must be user-writable like /var/tmp or /tmp ! +## location of temporary files during GhostScript operation +## this must be user-writable like /var/tmp or /tmp ! ### Default: /var/tmp #GSTmp /var/tmp @@ -255,7 +256,7 @@ #GSCall %s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="%s" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress %s ### Key: PDFVer (config, ppd, lptopions) -## PDF version to be created - can be "1.5", "1.4", "1.3" or "1.2" +## PDF version to be created - e.g., "1.5", "1.4", "1.3" or "1.2" ## MacOSX: for using pstopdf set this to an empty value ### Default: 1.4 @@ -263,13 +264,13 @@ ### Key: PostProcessing (config, lptoptions) ## postprocessing script that will be called after the creation of the PDF -## as arguments the filename of the PDF, the username as determined by +## as arguments the filename of the PDF, the username as determined by ## CUPS-PDF and the one as given to CUPS-PDF will be passed ## the script will be called with user privileges ## set this to an empty value to use no postprocessing ### Default: <empty> -#PostProcessing +#PostProcessing ########################################################################### @@ -285,7 +286,7 @@ ### Key: DecodeHexStrings (config) ## this option will try to decode hex strings in the title to allow ## internationalized titles -## (have a look at pstitleconv on www.cups-pdf.de for a suitable filter +## (have a look at pstitleconv on www.cups-pdf.de for a suitable filter ## for data from Windows clients) ## 0: disable, 1: enable ### Default: 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cups-pdf-3.0.2/src/cups-pdf.c new/cups-pdf-3.0.3/src/cups-pdf.c --- old/cups-pdf-3.0.2/src/cups-pdf.c 2025-03-23 16:07:07.860429362 +0100 +++ new/cups-pdf-3.0.3/src/cups-pdf.c 2026-05-09 00:35:54.287342999 +0200 @@ -1,18 +1,18 @@ -/* cups-pdf.c -- CUPS Backend (version 3.0.2, 2025-03-23) +/* cups-pdf.c -- CUPS Backend (version 3.0.3, 2026-05-08) 08.02.2003, Volker C. Behr - [email protected] - http://www.cups-pdf.de - This code may be freely distributed as long as this header - is preserved. + Copyright (C) 2003-2026 Volker C. Behr <[email protected]> + SPDX-License-Identifier: GPL-2.0-or-later + https://www.cups-pdf.de + + This code may be freely distributed as long as this header + is preserved. This code is distributed under the GPL. (http://www.gnu.org/copyleft/gpl.html) --------------------------------------------------------------------------- - Copyright (C) 2003-2025 Volker C. Behr - This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 @@ -30,12 +30,11 @@ --------------------------------------------------------------------------- If you want to redistribute modified sources/binaries this header - has to be preserved and all modifications should be clearly + has to be preserved and all modifications should be clearly indicated. - In case you want to include this code into your own programs + In case you want to include this code into your own programs I would appreciate your feedback via email. - HISTORY: see ChangeLog in the parent directory of the source archive */ @@ -86,12 +85,12 @@ cp_string logbuffer; va_list ap; - if ((logfp != NULL) && (type & Conf_LogType)) { + if ((logfp != NULL) && (type & Conf_LogType)) { (void) time(&secs); timestring=ctime(&secs); timestring[strlen(timestring)-1]='\0'; - if (type == CPERROR) + if (type == CPERROR) snprintf(ctype, 8, "ERROR"); else if (type == CPSTATUS) snprintf(ctype, 8, "STATUS"); @@ -176,7 +175,7 @@ ** GhostScript location of GhostScript binary (gs) ** GSCall command line for calling GhostScript ** Grp group cups-pdf is supposed to run as -** GSTmp location of temporary files during GhostScript operation +** GSTmp location of temporary files during GhostScript operation ** Log CUPS-PDF log directory ** PDFVer PDF version to be created ** PostProcessing postprocessing script that will be called after the creation of the PDF @@ -244,7 +243,14 @@ break; case PDFVer: - strncpy(Conf_PDFVer, value, BUFSIZE); + if (strlen(value)==3 && isdigit((unsigned char)value[0]) && value[1]=='.' && + isdigit((unsigned char)value[2]) && BUFSIZE>3) { + strncpy(Conf_PDFVer, value, 3); + Conf_PDFVer[3]='\0'; + } + else { + log_event(CPERROR, "Illegal value: %s = %s\n", key, value); + } break; case PostProcessing: @@ -336,7 +342,7 @@ ** Load and merge named configuration file into process configuration ** ** Accepts: valid (not NULL) pointer to string representing path to config file -** Performs: updates global configuration values from values found in named config file +** Performs: updates global configuration values from values found in named config file ** Returns: nothing */ static void read_config_file(char *filename) { @@ -437,7 +443,7 @@ option->value[j] = ' '; } } - _assign_value(SEC_LPOPT, option->name, option->value); + _assign_value(SEC_LPOPT, option->name, option->value); } return; } @@ -456,7 +462,7 @@ ** GhostScript location of GhostScript binary (gs) ** GSCall command line for calling GhostScript ** Grp group cups-pdf is supposed to run as -** GSTmp location of temporary files during GhostScript operation +** GSTmp location of temporary files during GhostScript operation ** Log CUPS-PDF log directory ** PDFVer PDF version to be created ** PostProcessing postprocessing script that will be called after the creation of the PDF @@ -539,7 +545,7 @@ if ((uri != NULL) && (strncmp(uri, "cups-pdf:/", 10) == 0) && strlen(uri) > 10) { uri = uri + 10; sprintf(filename, "%s/cups-pdf-%s.conf", CP_CONFIG_PATH, uri); - } + } else { sprintf(filename, "%s/cups-pdf.conf", CP_CONFIG_PATH); } @@ -556,7 +562,7 @@ if (strlen(Conf_Log)) { if (stat(Conf_Log, &fstatus) || !S_ISDIR(fstatus.st_mode)) { - if (create_dir(Conf_Log, 1)) + if (create_dir(Conf_Log, 1)) return 1; if (chmod(Conf_Log, 0700)) return 1; @@ -570,12 +576,12 @@ if (!group) { log_event(CPERROR, "Grp not found: %s", Conf_Grp); return 1; - } + } else if (grpstat) { log_event(CPERROR, "failed to set new gid: %s", Conf_Grp); return 1; } - else + else log_event(CPDEBUG, "set new gid: %s", Conf_Grp); (void) umask(0022); @@ -589,7 +595,7 @@ log_event(CPERROR, "failed to set mode on spool directory: %s", Conf_Spool); return 1; } - if (chown(Conf_Spool, -1, group->gr_gid)) + if (chown(Conf_Spool, -1, group->gr_gid)) log_event(CPERROR, "failed to set group id %s on spool directory: %s (non fatal)", Conf_Grp, Conf_Spool); log_event(CPSTATUS, "spool directory created: %s", Conf_Spool); } @@ -624,7 +630,7 @@ if ((strncmp(config_ent->d_name, "cups-pdf-", 9) == 0) && (len > 14 && strcmp(config_ent->d_name + len - 5, ".conf") == 0)) { strncpy(setup, config_ent->d_name + 9, BUFSIZE>len-14 ? len-14 : BUFSIZE); - setup[BUFSIZE>len-14 ? len-14 : BUFSIZE - 1] = '\0'; + setup[BUFSIZE>len-14 ? len-14 : BUFSIZE - 1] = '\0'; printf("file cups-pdf:/%s \"Virtual %s Printer\" \"CUPS-PDF\" \"MFG:Generic;MDL:CUPS-PDF Printer;DES:Generic CUPS-PDF Printer;CLS:PRINTER;CMD:POSTSCRIPT;\"\n", setup, setup); } } @@ -637,7 +643,7 @@ ** preparedirname(passwd,uname) **************************************************************************************** ** -** generate user-specific output directory from prototype +** generate user-specific output directory from prototype ** ** Accepts: pointer to struct passwd for selected target user ** pointer to char string naming target user @@ -690,7 +696,7 @@ /*************************************************************************************** ** prepareuser(passwd,dirname) **************************************************************************************** -** Establish user access to the PDF output directory +** Establish user access to the PDF output directory ** ** Accepts: pointer to struct passwd of user requesting print ** pointer to string containing path to output directory @@ -848,7 +854,7 @@ log_event(CPDEBUG, "removing alternate special characters from title: %s", string); for (i=0;i<(unsigned int)strlen(string);i++) if ( isascii(string[i]) && /* leaving non-ascii characters intact */ - (!isalnum(string[i])) && + (!isalnum(string[i])) && string[i] != '-' && string[i] != '+' && string[i] != '.') string[i]='_'; return; @@ -872,7 +878,7 @@ unsigned int i; log_event(CPDEBUG, "removing special characters from title: %s", string); - for (i=0;i<(unsigned int)strlen(string);i++) + for (i=0;i<(unsigned int)strlen(string);i++) if ( ( string[i] < '0' || string[i] > '9' ) && ( string[i] < 'A' || string[i] > 'Z' ) && ( string[i] < 'a' || string[i] > 'z' ) && @@ -924,12 +930,12 @@ while (title[--i]=='_'); if (i<strlen(title)-1) { log_event(CPDEBUG, "removing trailing _ from title: %s", title); - title[i+1]='\0'; + title[i+1]='\0'; } i=0; while (title[i++]=='_'); if (i>1) { - log_event(CPDEBUG, "removing leading _ from title: %s", title); + log_event(CPDEBUG, "removing leading _ from title: %s", title); memmove(title, title+i-1, strlen(title)-i+2); } } @@ -943,7 +949,7 @@ if (cut != NULL) { log_event(CPDEBUG, "removing slashes from full title: %s", title); memmove(title, cut+1, strlen(cut+1)+1); - } + } cut=strrchr(title, '\\'); if (cut != NULL) { log_event(CPDEBUG, "removing backslashes from full title: %s", title); @@ -1036,7 +1042,7 @@ ** 1: label all documents with a preceeding "job_#-" ** 2: label all documents with a tailing "-job_#" */ -static int preparespoolfile(FILE *fpsrc, char *spoolfile, char *title, char *cmdtitle, +static int preparespoolfile(FILE *fpsrc, char *spoolfile, char *title, char *cmdtitle, int job, struct passwd *passwd) { cp_string buffer; int rec_depth,is_title=0; @@ -1098,11 +1104,11 @@ (void) fclose(fpsrc); log_event(CPDEBUG, "all data written to spoolfile: %s", spoolfile); - if (cmdtitle == NULL || !strcmp(cmdtitle, "(stdin)")) + if (cmdtitle == NULL || !strcmp(cmdtitle, "(stdin)")) buffer[0]='\0'; else strncpy(buffer, cmdtitle, BUFSIZE); - if (title == NULL || !strcmp(title, "((stdin))")) + if (title == NULL || !strcmp(title, "((stdin))")) title[0]='\0'; if (Conf_TitlePref) { @@ -1110,7 +1116,7 @@ if (!preparetitle(buffer)) { log_event(CPDEBUG, "empty commandline title, using PS title: %s", title); if (!preparetitle(title)) - log_event(CPDEBUG, "empty PS title"); + log_event(CPDEBUG, "empty PS title"); } else snprintf(title, BUFSIZE, "%s", buffer); @@ -1124,9 +1130,9 @@ else snprintf(title, BUFSIZE, "%s", buffer); } - } + } - if (!strcmp(title, "")) { + if (!strcmp(title, "")) { if (Conf_Label == 2) snprintf(title, BUFSIZE, "untitled_document-job_%i", job); else @@ -1151,7 +1157,7 @@ **************************************************************************************** ** ** mainline of cups-pdf -** +** ** 1) check if running as privileged user, abort if not ** ** 2) gross argument check: @@ -1241,7 +1247,7 @@ return 0; } - if (init(argv)) + if (init(argv)) return 5; log_event(CPDEBUG, "initialization finished: %s", CPVERSION); @@ -1250,18 +1256,18 @@ if (user == NULL) { (void) fputs("CUPS-PDF: failed to allocate memory\n", stderr); return 5; - } + } snprintf(user, size, "%s%s", Conf_UserPrefix, argv[2]); passwd=getpwnam(user); if (passwd == NULL && Conf_LowerCase) { log_event(CPDEBUG, "unknown user: %s", user); - for (size=0;size<(int) strlen(argv[2]);size++) + for (size=0;size<(int) strlen(argv[2]);size++) argv[2][size]=tolower(argv[2][size]); log_event(CPDEBUG, "trying lower case user name: %s", argv[2]); size=strlen(Conf_UserPrefix)+strlen(argv[2])+1; snprintf(user, size, "%s%s", Conf_UserPrefix, argv[2]); passwd=getpwnam(user); - } + } if (passwd == NULL) { if (strlen(Conf_AnonUser)) { passwd=getpwnam(Conf_AnonUser); @@ -1281,7 +1287,7 @@ if (logfp!=NULL) (void) fclose(logfp); return 5; - } + } snprintf(dirname, size, "%s", Conf_AnonDirName); while (strlen(dirname) && ((dirname[strlen(dirname)-1] == '\n') || (dirname[strlen(dirname)-1] == '\r'))) @@ -1296,7 +1302,7 @@ return 0; } mode=(mode_t)(0666&~Conf_AnonUMask); - } + } else { log_event(CPDEBUG, "user identified: %s", passwd->pw_name); if ((dirname=preparedirname(passwd, argv[2])) == NULL) { @@ -1305,7 +1311,7 @@ if (logfp!=NULL) (void) fclose(logfp); return 5; - } + } while (strlen(dirname) && ((dirname[strlen(dirname)-1] == '\n') || (dirname[strlen(dirname)-1] == '\r'))) dirname[strlen(dirname)-1]='\0'; @@ -1379,7 +1385,7 @@ return 5; } log_event(CPDEBUG, "input data read from file: %s", argv[6]); - } + } size=strlen(dirname)+strlen(title)+strlen(Conf_OutExtension)+3; outfile=calloc(size, sizeof(char)); @@ -1446,13 +1452,13 @@ log_event(CPDEBUG, "GID set for current user"); if (setgroups(ngroups, groups)) log_event(CPERROR, "failed to set supplementary groups for current user"); - else + else log_event(CPDEBUG, "supplementary groups set for current user"); if (setuid(passwd->pw_uid)) log_event(CPERROR, "failed to set UID for current user: %s", passwd->pw_name); else log_event(CPDEBUG, "UID set for current user: %s", passwd->pw_name); - + (void) umask(0077); size=system(gscall); log_event(CPDEBUG, "ghostscript has finished: %d", size); @@ -1464,7 +1470,7 @@ if (strlen(Conf_PostProcessing)) { size=strlen(Conf_PostProcessing)+strlen(outfile)+strlen(passwd->pw_name)+strlen(argv[2])+4; ppcall=calloc(size, sizeof(char)); - if (ppcall == NULL) + if (ppcall == NULL) log_event(CPERROR, "failed to allocate memory for postprocessing (non fatal)"); else { snprintf(ppcall, size, "%s %s %s %s", Conf_PostProcessing, outfile, passwd->pw_name, argv[2]); @@ -1483,9 +1489,9 @@ log_event(CPDEBUG, "waiting for child to exit"); (void) waitpid(pid,NULL,0); - if (unlink(spoolfile)) + if (unlink(spoolfile)) log_event(CPERROR, "failed to unlink spoolfile: %s (non fatal)", spoolfile); - else + else log_event(CPDEBUG, "spoolfile unlinked: %s", spoolfile); free(groups); @@ -1493,7 +1499,7 @@ free(spoolfile); free(outfile); free(gscall); - + log_event(CPDEBUG, "all memory has been freed"); log_event(CPSTATUS, "PDF creation successfully finished for %s", passwd->pw_name); @@ -1501,4 +1507,4 @@ if (logfp!=NULL) (void) fclose(logfp); return 0; -} +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cups-pdf-3.0.2/src/cups-pdf.h new/cups-pdf-3.0.3/src/cups-pdf.h --- old/cups-pdf-3.0.2/src/cups-pdf.h 2025-03-23 16:03:36.584080334 +0100 +++ new/cups-pdf-3.0.3/src/cups-pdf.h 2026-05-09 00:37:31.725650277 +0200 @@ -1,20 +1,21 @@ -/* cups-pdf.h -- CUPS Backend Header File (version 3.0.2, 2025-03-23) +/* cups-pdf.h -- CUPS Backend Header File (version 3.0.3, 2026-05-08) 16.05.2003, Volker C. Behr - [email protected] - http://www.cups-pdf.de + Copyright (C) 2003-2026 Volker C. Behr <[email protected]> + SPDX-License-Identifier: GPL-2.0-or-later + https://www.cups-pdf.de - This code may be freely distributed as long as this header - is preserved. Changes to the code should be clearly indicated. + This code may be freely distributed as long as this header + is preserved. Changes to the code should be clearly indicated. This code is distributed under the GPL. (http://www.gnu.org/copyleft/gpl.html) - For more detailed licensing information see cups-pdf.c in the + For more detailed licensing information see cups-pdf.c in the corresponding version number. */ -/* User-customizable settings - if unsure leave the default values +/* User-customizable settings - if unsure leave the default values / they are reasonable for most systems. */ /* location of the configuration file */ @@ -23,10 +24,10 @@ /* --- DO NOT EDIT BELOW THIS LINE --- */ -/* The following settings are for internal purposes only - all relevant +/* The following settings are for internal purposes only - all relevant / options listed below can be set via cups-pdf.conf at runtime */ -#define CPVERSION "v3.1.0" +#define CPVERSION "v3.0.3" #define CPERROR 1 #define CPSTATUS 2
