Analysis of the upstream patch that fixes the problem
================================
The new _cupsSetDefaults() in cups v2.1 has been refactored to use a _cups_client_conf_t structure that holds the user defined value. This structure gets populated first by cups_init_client_conf(), that reads the /etc/cups/client.conf and ~/.cups/client.conf if present.
It then runs cups_finalize_client_conf() that reads in the environment variables in the _cups_client_conf_t structure.
A new check is added to verify if a value already exists in cg->server before calling cupsSetServer() on the ENV variable collected value which is stored in the structure.
The original patch is :
if (!cg->server[0] || !cg->ipp_port)
cupsSetServer(cc.server_name);
This portion of code is found in 1.7.2 in the cups_read_client_conf() starting at line 1027. The server name given to cupsSetServer() is conditional to the value set in cups_server :
if ((!cg->server[0] || !cg->ipp_port) && cups_server)
cupsSetServer(cups_server);
So in order to correctly trigger the server name definition, the following patch is needed :
/*
+ * Check if values have been provided as CLI options
+ */
+ if (cg->server[0])
+ cups_server = cg->server;
+
+ /*
* Read the configuration file and apply any environment variables; both
* functions handle NULL cups_file_t pointers...
*/
~
Analysis of the upstream patch that fixes the problem ======= ======= ======= ==== client_ conf(), that reads the /etc/cups/ client. conf and ~/.cups/client.conf if present.
=======
The new _cupsSetDefaults() in cups v2.1 has been refactored to use a _cups_client_conf_t structure that holds the user defined value. This structure gets populated first by cups_init_
It then runs cups_finalize_ client_ conf() that reads in the environment variables in the _cups_client_conf_t structure.
A new check is added to verify if a value already exists in cg->server before calling cupsSetServer() on the ENV variable collected value which is stored in the structure.
The original patch is : er(cc.server_ name);
if (!cg->server[0] || !cg->ipp_port)
cupsSetServ
if (!cg->ipp_port)
{
const char *ipp_port; /* IPP_PORT environment variable */
if ((ipp_port = getenv("IPP_PORT")) != NULL)
cg->ipp_ port = CUPS_DEFAULT_ IPP_PORT; IPP_PORT;
{
if ((cg->ipp_port = atoi(ipp_port)) <= 0)
}
else
cg->ipp_port = CUPS_DEFAULT_
}
This portion of code is found in 1.7.2 in the cups_read_ client_ conf() starting at line 1027. The server name given to cupsSetServer() is conditional to the value set in cups_server :
if ((!cg->server[0] || !cg->ipp_port) && cups_server) er(cups_ server) ;
cupsSetServ
So in order to correctly trigger the server name definition, the following patch is needed :
Index: cups-1. 7.5/cups/ usersys. c ======= ======= ======= ======= ======= ======= ======= ======= ==== 7.5.orig/ cups/usersys. c 2015-02-04 12:58:39.000000000 +0100 7.5/cups/ usersys. c 2015-02-04 13:10:54.062431647 +0100
=======
--- cups-1.
+++ cups-1.
@@ -891,6 +891,12 @@
}
/*
+ * Check if values have been provided as CLI options
+ */
+ if (cg->server[0])
+ cups_server = cg->server;
+
+ /*
* Read the configuration file and apply any environment variables; both
* functions handle NULL cups_file_t pointers...
*/
~