Zdenek Dohnal [Fri, 14 Mar 2025 06:42:25 +0000 (07:42 +0100)]
Avoid NULL strcmp argument
It is possible for format to be NULL (as described in the function signature)
which causes a segmentation fault when it is passed to strcmp. This patch changes
the conditional to short-circuit if format is NULL and only call strcmp otherwise.
Zdenek Dohnal [Wed, 12 Mar 2025 15:26:55 +0000 (16:26 +0100)]
backend/ipp.c: Raise alert if there is issue with cert
Currently we show more detailed info about this error in debug logs, but
since there are not many desktops to pick up our dBUS notification, it
would be great to report it in CUPS log too.
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.