Zdenek Dohnal [Tue, 7 Jan 2025 14:12:15 +0000 (15:12 +0100)]
Add `NoSystem` SSLOptions value
In case using system crypto policy breaks communication with device
irreversibly (f.e. if device does not support better key exchange
algorithm), the new option value gives a way how to opt-out from crypto
policy if user do not want to change default system crypto policy for
the whole machine.
Zdenek Dohnal [Fri, 6 Dec 2024 06:59:16 +0000 (07:59 +0100)]
tls-gnutls.c: Use system crypto policy if available
Some Linux systems provide a way how to control cryptography on system or service level via cryptographic policies. OpenSSL implementation reflects system changes to some degree, however GnuTLS implementation does not take system policy into account.
GnuTLS supports fallback mechanism, so we can fallback to NORMAL if @System is not defined on the system.
Fortunately, the current GnuTLS implementation allows overrides via priority strings (so no "this cipher/hash is disabled" if we enabled them in our application by priority string), so allowing to honor system policy can save us work if someone wants to disable a specific cipher, so we don't have to implement it in libcups.
Zdenek Dohnal [Mon, 2 Dec 2024 13:20:26 +0000 (14:20 +0100)]
scheduler: Clean up failed IPP Everywhere permanent queues
If creating of permanent queue with IPP Everywhere model fails
in separate thread, the print queue is created as raw.
It would be great if we remove such queue if creation fails,
and marking them as temporary would make them to be removed automatically.
> A slice unit is a concept for hierarchically managing resources of a group of processes.
Benefits of collecting our two systemd services into a slice include
* ease of configuring resource limits on the entire CUPS system,
* ``systemctl status`` showing the CUPS units in an indented subtree,
making it more organized,
* and the possibility of viewing all interlaced logs from all of the CUPS
daemons using ``journalctl -u system-cups.slice``.
[1]:
https://www.freedesktop.org/software/systemd/man/latest/systemd.slice.html
or ``man systemd.slice(5)``
zdohnal [Tue, 18 Jun 2024 08:41:50 +0000 (10:41 +0200)]
scheduler: Fix cupsd activated on-demand via socket
If only the expected cups.sock is set as listener in cupsd.conf, the array Listeners was NULL. To prevent copying the code, do the array allocation earlier and have only one check for Listeners, in service_checkin() which is run every time cupsd starts.
Zdenek Dohnal [Tue, 18 Jun 2024 08:38:48 +0000 (10:38 +0200)]
scheduler: Fix cupsd activated on-demand via socket
If only the expected cups.sock is set as listener in cupsd.conf, the
array Listeners was NULL. To prevent copying the code, do the array
allocation earlier and have only one check for Listeners, in
service_checkin() which is run every time cupsd starts.
Zdenek Dohnal [Tue, 11 Jun 2024 14:19:11 +0000 (16:19 +0200)]
Fix domain socket handling (fixes CVE-2024-35235)
- Check status of unlink and bind system calls.
- Don't allow extra domain sockets when running from launchd/systemd.
- Validate length of domain socket path (< sizeof(sun_path))
Zdenek Dohnal [Mon, 10 Jun 2024 06:49:39 +0000 (08:49 +0200)]
cgi: Fix showing query string in Help
If a string was searched on CUPS Web UI help page, garbage was printed
out in search box. It was because text field pointer was freed before
and contained garbage - previously it was variable value which was
allocated, so the string survived `cgCleanVariables(()`, but the text
field is a pointer into form variables which gets cleaned up.
Fix is to use `strdup()` if `cgiGetTextfield()` returns non-NULL
pointer. The binary exits shortly after either way, so memory is taken
care of by OS.
Andreas Karlson [Tue, 9 Apr 2024 13:14:22 +0000 (15:14 +0200)]
scheduler: Fix potential bug when adding new printers (Issue #934)
When adding a new printer a thread is created to handle PPD generation,
and the requesting client connection might close while the thread is running.
This commit prevents full connection cleanup until the thread is finished.
Sometimes headers are not correctly copied into response to the client (some are missing). It happens because sent_header is set prematurely before the actual send happens. The present code in affected cupsdWriteClient() scope looks like code remains from CUPS 1.6.3, where cupsdSendHeader() is called earlier and generates the required headers by itself - the current cupsdSendHeader() sends only the headers which are saved in array fields, so the premature setting of sent_header sometimes causes not having all headers in the response.
With the change, testing via curl gives reliable results all time.
Zdenek Dohnal [Thu, 15 Feb 2024 17:15:55 +0000 (18:15 +0100)]
ppd-cache.c: Check for required attributes if URF or PWG Raster are found
Some devices have image/urf in document-format-supported, but is missing urf-supported
if AirPrint support is turned off, which breaks PPD generation. Check for attribute
urf-supported when we are about to decide whether the printer uses AirPrint, so in case
the device supports another driverless standard, we can use it for PPD generation.
Apply the same for PWG Raster too.
Zdenek Dohnal [Wed, 14 Feb 2024 13:22:40 +0000 (14:22 +0100)]
Use PAM password-auth or system-auth if present
Enables possibility to use PAM modules password-auth or system-auth
if they exist during compilation. password-auth module is
for remote authentication and system-auth for local authentication.
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.