]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix writing of default options (Issue #4717)
authorMichael R Sweet <michaelrsweet@gmail.com>
Tue, 5 Dec 2017 19:58:19 +0000 (14:58 -0500)
committerMichael R Sweet <michaelrsweet@gmail.com>
Tue, 5 Dec 2017 19:58:19 +0000 (14:58 -0500)
CHANGES.md
cups/dest.c

index fbd42bd8457812b13e99c23799ab55245b657147..56364ee7d1c49a52e0d447f950dc9a0bda66c204 100644 (file)
@@ -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)
index f7b435662c21c47db3941107d9ec941f0a2b262d..0c4d549032e61c3ed76ba2770394cc4ea02c2037 100644 (file)
@@ -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)