From: Michael R Sweet Date: Tue, 5 Dec 2017 19:58:19 +0000 (-0500) Subject: Fix writing of default options (Issue #4717) X-Git-Tag: v2.3b1~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42a5ae2af841c59314465115b5ecc43bb5be3eee;p=thirdparty%2Fcups.git Fix writing of default options (Issue #4717) --- diff --git a/CHANGES.md b/CHANGES.md index fbd42bd845..56364ee7d1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -CHANGES - 2.3b1 - 2017-11-29 +CHANGES - 2.3b1 - 2017-12-05 ============================ @@ -7,6 +7,7 @@ Changes in CUPS v2.3b1 - CUPS is now provided under the Apache License, Version 2.0. - Documentation updates (Issue #4580) +- The `lpoptions` command incorrectly saved default options (Issue #4717) - The `lpstat` command now reports when new jobs are being held (Issue #4761) - The `ippfind` command now supports finding printers whose name starts with an underscore (Issue #4833) diff --git a/cups/dest.c b/cups/dest.c index f7b435662c..0c4d549032 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -2159,12 +2159,6 @@ cupsSetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_ #ifndef WIN32 if (getuid()) { - /* - * Merge in server defaults... - */ - - num_temps = cups_get_dests(filename, NULL, NULL, 0, num_temps, &temps); - /* * Point to user defaults... */ @@ -2225,8 +2219,7 @@ cupsSetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_ else wrote = 0; - if ((temp = cupsGetDest(dest->name, dest->instance, num_temps, temps)) == NULL) - temp = cupsGetDest(dest->name, NULL, num_temps, temps); + temp = cupsGetDest(dest->name, NULL, num_temps, temps); for (j = dest->num_options, option = dest->options; j > 0; j --, option ++) { @@ -2234,19 +2227,14 @@ cupsSetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_ * See if this option is a printer attribute; if so, skip it... */ - if ((match = _ippFindOption(option->name)) != NULL && - match->group_tag == IPP_TAG_PRINTER) + if ((match = _ippFindOption(option->name)) != NULL && match->group_tag == IPP_TAG_PRINTER) continue; /* - * See if the server/global options match these; if so, don't - * write 'em. + * See if the server options match these; if so, don't write 'em. */ - if (temp && - (val = cupsGetOption(option->name, temp->num_options, - temp->options)) != NULL && - !_cups_strcasecmp(val, option->value)) + if (temp && (val = cupsGetOption(option->name, temp->num_options, temp->options)) != NULL && !_cups_strcasecmp(val, option->value)) continue; /* @@ -2263,10 +2251,7 @@ cupsSetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_ if (option->value[0]) { - if (strchr(option->value, ' ') || - strchr(option->value, '\\') || - strchr(option->value, '\"') || - strchr(option->value, '\'')) + if (strchr(option->value, ' ') || strchr(option->value, '\\') || strchr(option->value, '\"') || strchr(option->value, '\'')) { /* * Quote the value... @@ -2317,9 +2302,7 @@ cupsSetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_ if ((dest = cupsGetDest(NULL, NULL, num_dests, dests)) != NULL) { - CFStringRef name = CFStringCreateWithCString(kCFAllocatorDefault, - dest->name, - kCFStringEncodingUTF8); + CFStringRef name = CFStringCreateWithCString(kCFAllocatorDefault, dest->name, kCFStringEncodingUTF8); /* Default printer name */ if (name)