There was a change in CGI script regarding checkboxes, however it did
not propagate into templates. Based on the change, the only valid check
was if the variable value was checkbox, but some browsers (at least
Firefox) send on as a default value for input form of type checkbox.
Additionally, the value checkbox looks like typo, because we use checked
as value for checkboxes in admin CGI program, so I updated
cgiGetCheckbox() as well.
To fix the behavior, we have to set VALUE="CHECKED" into every tag in
every templates for all checkboxes - this value will be sent in the
input form, so it will properly match with cgiGetCheckbox() logic now.
In the end, I have found out "Preserve Job History" checkbox from
template was handled as text field, which did not look correct.
Zdenek Dohnal [Tue, 18 Jun 2024 08:43:30 +0000 (10:43 +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 [Mon, 3 Jun 2024 16:53:58 +0000 (18:53 +0200)]
Fix domain socket handling
- 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))
zdohnal [Mon, 10 Jun 2024 06:27:04 +0000 (08:27 +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.
Zdenek Dohnal [Thu, 6 Jun 2024 15:28:59 +0000 (17:28 +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.
zdohnal [Thu, 6 Jun 2024 05:54:22 +0000 (07:54 +0200)]
client.c: Fix web UI job queries on Classes/Printers pages
Web UI query on Classes/Printers should support:
search for class/printer (/?QUERY=)
manage printers (/?)
listing jobs for the printer/class (/name?Which_jobs=completed)
show NOT FOUND for non-existing destinations
The PR reworks the code to fix the 3rd point and support all other at the same time.
Zdenek Dohnal [Wed, 5 Jun 2024 14:13:28 +0000 (16:13 +0200)]
client.c: Fix web UI job queries on Classes/Printers pages
Web UI query on Classes/Printers should support:
- search for class/printer (/?QUERY=)
- manage printers (/?)
- listing jobs for the printer/class (/name?Which_jobs=completed)
- show NOT FOUND for non-existing destinations
The PR reworks the code to fix the 3rd point and support all other at
the same time.
zdohnal [Thu, 16 May 2024 13:45:53 +0000 (15:45 +0200)]
cgi-bin/var.c: Fix return value if the text is invalid
In `cgiGetTextfield()`, if the original value contains double quote, which is forbidden for text, we free the variable and move the next variable from array to its place. However, the return value still contains the original value of freed pointer, and shows garbage when used.
Set it NULL, since we don't have any value to return for the requested name.
Zdenek Dohnal [Thu, 16 May 2024 13:29:34 +0000 (15:29 +0200)]
cgi-bin/var.c: Fix return value if the text is invalid
If the original value contains double quote, which is forbidden for
text, we free the variable and move the next variable from array to its
place. However, the return value still contains the original value of
freed pointer.
Set it NULL, since we don't have any value to return for the requested
name.
Michael R Sweet [Sun, 14 Apr 2024 14:51:54 +0000 (10:51 -0400)]
Localize finishings/finishings-col, media-source, media-type, output-bin, and
printer-state-reasons keywords using both the standard CUPS message catalogs and
the printer's own strings files, with a backup of converting keywords like
"one-two-three" to "One Two Three".