From: Zdenek Dohnal Date: Tue, 8 Oct 2024 10:35:43 +0000 (+0200) Subject: dest.c: Don't look for user config in cupsGetNamedDest as root X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9205f41bcc749da7a42d20df6a24edbb8b5334c;p=thirdparty%2Fcups.git 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. --- diff --git a/cups/dest.c b/cups/dest.c index 6abae8e718..f0067100a6 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -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);