cups/0001-dest.c-Don-t-look-for-user-config-in-cupsGetNamedDes.patch

58 lines
1.7 KiB
Diff

From 8dce8d76c1f9ae1769284e3a3b9405f906956a10 Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Wed, 9 Oct 2024 10:31:18 +0200
Subject: [PATCH] dest.c: Don't look for user config in cupsGetNamedDest as
root
We were still looking into ~/.cups/lpoptions as root in the function,
which IMHO is not expected.
Merged from master
---
cups/dest.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/cups/dest.c b/cups/dest.c
index b48d8f219..3eeb50933 100644
--- a/cups/dest.c
+++ b/cups/dest.c
@@ -1784,7 +1784,11 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
else
instance = NULL;
}
+#if _WIN32
else if (cg->home)
+#else
+ else if (cg->home && getuid() != 0)
+#endif
{
/*
* No default in the environment, try the user's lpoptions files...
@@ -1899,7 +1903,11 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
snprintf(filename, sizeof(filename), "%s/lpoptions", cg->cups_serverroot);
cups_get_dests(filename, dest_name, instance, 0, 1, 1, &dest);
+#if _WIN32
if (cg->home)
+#else
+ if (cg->home && getuid() != 0)
+#endif // _WIN32
{
#if _WIN32
snprintf(filename, sizeof(filename), "%s/AppData/Local/cups/lpoptions", cg->home);
@@ -3493,7 +3501,11 @@ cups_enum_dests(
snprintf(filename, sizeof(filename), "%s/lpoptions", cg->cups_serverroot);
data.num_dests = cups_get_dests(filename, NULL, NULL, 1, user_default != NULL, data.num_dests, &data.dests);
+#if _WIN32
if (cg->home)
+#else
+ if (cg->home && getuid() != 0)
+#endif // _WIN32
{
#if _WIN32
snprintf(filename, sizeof(filename), "%s/AppData/Local/cups/lpoptions", cg->home);
--
2.47.0