Skip to content

Fix: Satisfy all with multiple Require directives (issue #1304)#1577

Merged
michaelrsweet merged 2 commits into
OpenPrinting:masterfrom
abubakarsabir924-cell:fix/issue-1304-satisfy-all
May 24, 2026
Merged

Fix: Satisfy all with multiple Require directives (issue #1304)#1577
michaelrsweet merged 2 commits into
OpenPrinting:masterfrom
abubakarsabir924-cell:fix/issue-1304-satisfy-all

Conversation

@abubakarsabir924-cell
Copy link
Copy Markdown
Contributor

Problem
When using Satisfy all with multiple Require directives,
CUPS was granting access if ANY one condition passed instead
of requiring ALL conditions to pass.

Two bugs were found:

conf.c: Second Require directive was overwriting the
level set by first Require
auth.c: OR logic was used instead of AND logic when
Satisfy all was set
Fix
conf.c: Prevent level overwrite on multiple Require directives
auth.c: Implement proper AND logic for Satisfy all
Testing
Tested with user joe in @System group:

joe in @System only → 401 Unauthorized ✅
joe in @System + printadmin → 200 OK ✅
Fixes #1304

- conf.c: Prevent level overwrite when multiple Require
  directives are used in same Location block
- auth.c: Implement AND logic for Satisfy all with
  multiple Require conditions instead of OR logic

Fixes OpenPrinting#1304
@abubakarsabir924-cell
Copy link
Copy Markdown
Contributor Author

Hi @michaelrsweet Sir! This PR addresses #1304 by fixing the Satisfy all logic. I’ve corrected the level overwrite in conf.c and ensured that auth.c now uses AND logic for multiple Require directives. Tested locally and it now correctly restricts access unless all requirements are satisfied.

Copy link
Copy Markdown
Member

@michaelrsweet michaelrsweet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor issues to address but otherwise looks good!

Comment thread scheduler/auth.c Outdated
Comment thread scheduler/auth.c Outdated
Comment thread scheduler/auth.c Outdated
@abubakarsabir924-cell
Copy link
Copy Markdown
Contributor Author

@michaelrsweet Sir,

Thank you for the review! I have addressed all your comments:

  • Used bool type with true/false instead of int

  • Updated comments to English

  • Collapsed else { if into else if

Please let me know if anything else needs to be changed!

@michaelrsweet michaelrsweet self-assigned this May 24, 2026
@michaelrsweet michaelrsweet added the bug Something isn't working label May 24, 2026
@michaelrsweet michaelrsweet added this to the v2.5 milestone May 24, 2026
Copy link
Copy Markdown
Member

@michaelrsweet michaelrsweet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@michaelrsweet michaelrsweet merged commit f4360f6 into OpenPrinting:master May 24, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AUTH: two Requires and Satisfy all does not work

2 participants