Zdenek Dohnal [Tue, 16 Jan 2024 12:30:17 +0000 (13:30 +0100)]
backend/ipp.c: Fix printing jobs with long names on older IPP printers
On older printers (ones which don't support IPP operation Create-Job)
we concatenate job number and title into one string, which we use as
IPP attribute job-name. If the original title was almost 255 chars,
the joining the strings will overflow maximal required length
for this attribute, and Validate-Job fails.
We could check whether the string is longer than 255 and cut it,
but I chose to shrink the buffer to 256, since we already use snprintf()
which will cut the string and put null terminator for us.
Zdenek Dohnal [Mon, 15 Jan 2024 15:09:19 +0000 (16:09 +0100)]
backend/ipp.c: Fix infinite loop with Kerberos
If IP address was used with Kerberos, IPP backend retried connection
indefinitely. The fix is to abort when we find out hostname is an IP
address and we require Kerberos.
Zdenek Dohnal [Fri, 15 Dec 2023 09:59:54 +0000 (10:59 +0100)]
httpAddrConnect2: Check for error if POLLHUP is in valid revents
Some Linux kernel versions put POLLOUT|POLLHUP into revents when client tries to connect with httpAddrConnect2(), which makes the connection fail.
Let's check the option SO_ERROR before scratching the attempt - if there is no error, remove POLLHUP from revents.
I've re-purposed previously Solaris-only code to be used everywhere if the conditions are met - this should prevent bigger delays than necessary.
Slightly different issue than #827, but with similar symptoms (kernel sending POLLOUT|POLLHUP).
Zdenek Dohnal [Wed, 29 Nov 2023 14:10:45 +0000 (15:10 +0100)]
scheduler: Fix build failure on Linux with '-Werror -Wall'
The string which we add into array stays `const` after fixing #814
(because `strdup()`, which caused memory leak returned `char *`)
and compiler fails because of it if it runs with '-Werror -Wall'.
zdohnal [Fri, 24 Nov 2023 05:08:17 +0000 (06:08 +0100)]
scheduler/colorman.c: Fix memory leak during creating color profile
Since the array profiles is set to use strdup() as a copy function, we
don't have to use strdup() on the element which is passed as parameter
of cupsArrayAdd() - using the strdup() as we used till now causes
memory leak.
Zdenek Dohnal [Mon, 30 Oct 2023 10:34:55 +0000 (11:34 +0100)]
scheduler/job.c: unload job before freeing job history in cupsdDeleteJob()
With "PreserveJobHistory Off", LogLevel not set to debug (or debug2),
and "LogDebugHistory 200" (the default), cupsdDeleteJob() frees the
job history and then unloads the job. However, unload_job() calls
cupsdLogJob() which re-creates the job history and puts "Unloading..."
into it because level (debug) is greater than LogLevel (warn) and
LogDebugHistory is set to 200 messages by default. Unused (and
unreachable) job history is left behind, resulting in a memory leak.
Zdenek Dohnal [Mon, 30 Oct 2023 09:49:14 +0000 (10:49 +0100)]
scheduler/colorman.c: Fix memory leak during creating color profile
Since the array `profiles` is set to use `strdup()` as a copy function, we
don't have to use `strdup()` on the element which is passed as parameter
of `cupsArrayAdd()` - using the `strdup()` as we used till now causes
memory leak.
Reproducer is the same as https://github.com/OpenPrinting/cups/pull/813
cups/ppd-cache.c: Add cupsUrfSupported to generated PPD (see #804)
It fixes driverless printing on Pantum BM5100ADW Series and, probably,
on many other devices.
- Without this parameter, /usr/lib/cups/filter/universal generates RGB
image/urf even for monochrome printer
- Pantum BM5100ADW Series rejects to print these RGB images with
the "Print job canceled at printer" status.
- Probably, this issue affects many other devices
zdohnal [Wed, 4 Oct 2023 07:29:20 +0000 (09:29 +0200)]
cups/hash.c: Put support for MacOS/Win SSL libs back
- I mustn't remove their support in patch release - this should happen in 2.5 only.
- I have put back support for several hashes as well - they should be removed in 2.5.
- restrict usage of second block hashing only if OpenSSL/LibreSSL/GnuTLS is available (since IMO I found its implementation useless for SSL libs, which will be removed in 2.5)
This removes hard dependency on OpenSSL/LibreSSL or GnuTLS in 2.4.x, which will happen in 2.5.
Zdenek Dohnal [Tue, 3 Oct 2023 11:59:40 +0000 (13:59 +0200)]
cups/hash.c: Put support for MacOS/Win SSL libs back
- I mustn't remove their support in patch release - this should happen in
2.5 only.
- I have put back support for several hashes as well - they
should be removed in 2.5.
- restrict usage of second block hashing only if OpenSSL/LibreSSL/GnuTLS
is available
We didn't check for end of buffer if it looks there is an escaped
character - check for NULL terminator there and if found, return NULL
as return value and in `ptr`, because a lone backslash is not
a valid PostScript character.
Zdenek Dohnal [Wed, 14 Jun 2023 08:14:38 +0000 (10:14 +0200)]
cups/ppd-cache.c: Put cupsSingleFile into generated PPD
Some printers are not able to print multiple files in one job via IPP
Everywhere. Adding the PPD keyword enables the feature on all printers
in exchange for performance degradation (there is a 1-2s pause between
printed files).
Rose [Sun, 11 Jun 2023 20:09:53 +0000 (16:09 -0400)]
Regression: Certificate data is corrupted during base64 conversion
The bug during which certificates become corrupt was introduced in a521b235a1abc008cb0b2f490a765bb31e2ec14b. It turns out some data was not being truncated after being promoted to an integer, causing 1s to be ORed into the index number when they should not have been.
I only intended to remove the & 255 from the other side, where the & 63 would have rendered that operation redundant.
I apologize for this error. I made the appropriate changes I intended to make in this new PR.
Zdenek Dohnal [Thu, 1 Jun 2023 12:47:49 +0000 (14:47 +0200)]
CI: Fix i386 for now
Although Ubuntu is dropping support for i386, this PR fixes build i386
for now. However we have to remove image upgrade, so probably once there
is a new image, i386 will be broken again.
I would remove the job for i386 once it breaks again due removing
support for i386 in Ubuntu.
Zdenek Dohnal [Tue, 30 May 2023 12:57:46 +0000 (14:57 +0200)]
workflows.yaml: Fix Github Actions on i386
- build i386 was failing due missing dependencies - libgcc-s1:i386 and
libstdc++6:i386
- use ubuntu-latest, so we automatically use the latest stable, but
print out the pretty name in workflow to show which version it is
(dont wanna to look up the names :))
- update the image before testing
Nathan Muggli [Fri, 26 May 2023 18:36:45 +0000 (12:36 -0600)]
Add custom page size values to media-col-database
When creating the IPP attrs based on the PPD file, if the PPD file
supports custom page sizes update our media-col-database to contain a
media-size attr with the min/max range.
Bryan Cain [Fri, 12 May 2023 17:23:24 +0000 (11:23 -0600)]
Fix duplicate PPD->IPP media-type name mappings
If more than one MediaType in a PPD matched the pattern for a registered
PWG media-type name, they would all be mapped to that name, making it
impossible for a client using CUPS' IPP interface to distinguish between
them or specify a particular one.
This comes up with Epson-provided PPDs, which frequently hit this case
by combining print quality with media type like so:
*MediaType PLAIN_HIGH/Plain paper-High: "
*MediaType PLAIN_NORMAL/Plain paper-Standard: "
Solve this problem by not assigning the standard PWG name to either one
when such duplication occurs.