]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
dest.c: Don't look for user config in cupsGetNamedDest as root 1076/head
authorZdenek Dohnal <zdohnal@redhat.com>
Tue, 8 Oct 2024 10:35:43 +0000 (12:35 +0200)
committerZdenek Dohnal <zdohnal@redhat.com>
Tue, 8 Oct 2024 10:35:43 +0000 (12:35 +0200)
We were still looking into ~/.cups/lpoptions as root in the function,
which IMHO is not expected.

cups/dest.c

index 6abae8e7186ebed7eb9c68d1ff30fa822189750b..f0067100a60451de8ad0e8ce82eab4a422158999 100644 (file)
@@ -1694,7 +1694,11 @@ cupsGetNamedDest(http_t     *http,       // I - Connection to server or @code CUPS_HTT
       else
         instance = NULL;
     }
+#ifdef _WIN32
     else if (cg->userconfig)
+#else
+    else if (cg->userconfig && getuid() != 0)
+#endif // _WIN32
     {
      /*
       * No default in the environment, try the user's lpoptions files...
@@ -1805,7 +1809,11 @@ cupsGetNamedDest(http_t     *http,       // I - Connection to server or @code CUPS_HTT
   snprintf(filename, sizeof(filename), "%s/lpoptions", cg->sysconfig);
   cups_get_dests(filename, dest_name, instance, 0, 1, 1, &dest);
 
+#ifdef _WIN32
   if (cg->userconfig)
+#else
+  if (cg->userconfig && getuid() != 0)
+#endif // _WIN32
   {
     snprintf(filename, sizeof(filename), "%s/lpoptions", cg->userconfig);