summaryrefslogtreecommitdiff
path: root/cups/tls-darwin.c
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2019-11-14 15:30:00 -0500
committerMichael R Sweet <michael.r.sweet@gmail.com>2019-11-14 15:30:00 -0500
commite2eb28cfcf10ef163253a65f631e0cc98fe34804 (patch)
treecb7e7018323e6084ef4cf0ec60bd26c0b726ed78 /cups/tls-darwin.c
parent3ff5a8e3932907c5794165b27ecefa1e8d7b1321 (diff)
downloadcups-e2eb28cfcf10ef163253a65f631e0cc98fe34804.tar.gz
Sandboxed applications were not able to get the default printer (Issue #5676)
- Add "home" global pointing to the user's home directory. - Use it instead of getenv("HOME") everywhere we needed it.
Diffstat (limited to 'cups/tls-darwin.c')
-rw-r--r--cups/tls-darwin.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cups/tls-darwin.c b/cups/tls-darwin.c
index e8c4fb713..b3bd50bf8 100644
--- a/cups/tls-darwin.c
+++ b/cups/tls-darwin.c
@@ -2002,7 +2002,8 @@ static const char * /* O - Keychain path */
http_cdsa_default_path(char *buffer, /* I - Path buffer */
size_t bufsize) /* I - Size of buffer */
{
- const char *home = getenv("HOME"); /* HOME environment variable */
+ _cups_globals_t *cg = _cupsGlobals();
+ /* Pointer to library globals */
/*
@@ -2011,8 +2012,8 @@ http_cdsa_default_path(char *buffer, /* I - Path buffer */
* 10.11.4 (!), so we need to create our own keychain just for CUPS.
*/
- if (getuid() && home)
- snprintf(buffer, bufsize, "%s/.cups/ssl.keychain", home);
+ if (cg->home)
+ snprintf(buffer, bufsize, "%s/.cups/ssl.keychain", cg->home);
else
strlcpy(buffer, "/etc/cups/ssl.keychain", bufsize);