OpenPrinting / OpenPrinting/cups-browsed
Review locking/multi-threading implementation
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 49
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
According to @evilsocket, cups-browsed can be held up for an extended period of time:
The lock acquired here doesn't get unlocked until the IPP server has responded. A malicious IPP server can keep the connection going effectively remotely causing a DoS of the service.
I believe there's also a race condition because internally examine_discovered_printer_record then tries to unlock and relocks after a while.
We should review the locking and multi-threading implementation in cups-browsed to ensure we don't deadlock and don't wait indefinitely for a printer to respond. In particular, a short timeout (10 seconds?) should be set on any printer connection so that we minimize the chances of a misbehaving printer from preventing cups-browsed from setting up local print queues for legacy applications.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in daemon/cups-browsed.c at the lock referenced near line 5031, then trace examine_discovered_printer_record and its unlock/relock behavior. Review the printer connection paths for deadlock or indefinite waits; done means locking is safe and misbehaving printers cannot block setup indefinitely, with a short timeout applied where appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- backend, networking, security
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100