From 849fba7d7a1144e48d45c5e6ba2504765912ece0 Mon Sep 17 00:00:00 2001
From: Michael R Sweet <msweet@msweet.org>
Date: Fri, 24 Apr 2026 14:06:06 -0400
Subject: [PATCH] Fix unauthenticated print policies (Issue #1557)

---
 CHANGES.md       | 2 ++
 scheduler/auth.c | 7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

#diff --git a/CHANGES.md b/CHANGES.md
#index f4cd6b464..4308d2232 100644
#--- a/CHANGES.md
#+++ b/CHANGES.md
#@@ -5,6 +5,8 @@ CHANGES - OpenPrinting CUPS
# Changes in CUPS v2.4.19 (YYYY-MM-DD)
# ------------------------------------
# 
#+- Fixed a regression in shared printing from non-local accounts (Issue #1557)
#+
# 
# Changes in CUPS v2.4.18 (2026-04-22)
# ------------------------------------
diff --git a/scheduler/auth.c b/scheduler/auth.c
index d5f564e0f..7e211ff3d 100644
--- a/scheduler/auth.c
+++ b/scheduler/auth.c
@@ -1835,8 +1835,9 @@ cupsdIsAuthorized(cupsd_client_t *con,	/* I - Connection */
 	 name;
 	 name = (char *)cupsArrayNext(best->names))
     {
-      if (!_cups_strcasecmp(name, "@OWNER") && owner && pw &&
-          !strcmp(pw->pw_name, ownername))
+      if (!_cups_strcasecmp(name, "@OWNER") && owner &&
+          ((pw && !strcmp(pw->pw_name, ownername)) ||
+           (!pw && type == CUPSD_AUTH_NONE && !_cups_strcasecmp(username, ownername))))
 	return (HTTP_OK);
       else if (!_cups_strcasecmp(name, "@SYSTEM"))
       {
@@ -1850,6 +1851,8 @@ cupsdIsAuthorized(cupsd_client_t *con,	/* I - Connection */
       }
       else if (pw && !strcmp(pw->pw_name, name))
         return (HTTP_OK);
+      else if (!pw && type == CUPSD_AUTH_NONE && !_cups_strcasecmp(username, name))
+	return (HTTP_STATUS_OK);
     }
 
     for (name = (char *)cupsArrayFirst(best->names);
