From 6d04fdc993ce8a2e84f95a42b09539c097d7ea11 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Mar 11 2014 15:42:53 +0000 Subject: Track local default in cupsEnumDests() (STR #4332). (cherry picked from commit fbc1998b1dad252bb59ad83ff10bcc21ba3f3ad0) Conflicts: cups.spec --- diff --git a/cups-str4332.patch b/cups-str4332.patch new file mode 100644 index 0000000..2f57feb --- /dev/null +++ b/cups-str4332.patch @@ -0,0 +1,46 @@ +diff -up cups-1.6.4/cups/dest.c.str4332 cups-1.6.4/cups/dest.c +--- cups-1.6.4/cups/dest.c.str4332 2014-03-11 15:41:45.903450653 +0000 ++++ cups-1.6.4/cups/dest.c 2014-03-11 15:42:36.019765361 +0000 +@@ -889,6 +889,10 @@ cupsEnumDests( + num_dests; /* Number of destinations */ + cups_dest_t *dests = NULL, /* Destinations */ + *dest; /* Current destination */ ++ const char *defprinter; /* Default printer */ ++ char name[1024], /* Copy of printer name */ ++ *instance, /* Pointer to instance name */ ++ *user_default; /* User default printer */ + #if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + int count, /* Number of queries started */ + remaining; /* Remainder of timeout */ +@@ -934,6 +938,31 @@ cupsEnumDests( + num_dests = _cupsGetDests(CUPS_HTTP_DEFAULT, CUPS_GET_PRINTERS, NULL, &dests, + type, mask); + ++ if ((user_default = _cupsUserDefault(name, sizeof(name))) != NULL) ++ defprinter = name; ++ else if ((defprinter = cupsGetDefault2(CUPS_HTTP_DEFAULT)) != NULL) ++ { ++ strlcpy(name, defprinter, sizeof(name)); ++ defprinter = name; ++ } ++ ++ if (defprinter) ++ { ++ /* ++ * Separate printer and instance name... ++ */ ++ ++ if ((instance = strchr(name, '/')) != NULL) ++ *instance++ = '\0'; ++ ++ /* ++ * Lookup the printer and instance and make it the default... ++ */ ++ ++ if ((dest = cupsGetDest(name, instance, num_dests, dests)) != NULL) ++ dest->is_default = 1; ++ } ++ + for (i = num_dests, dest = dests; + i > 0 && (!cancel || !*cancel); + i --, dest ++) diff --git a/cups.spec b/cups.spec index a706a50..0ef2192 100644 --- a/cups.spec +++ b/cups.spec @@ -72,6 +72,7 @@ Patch41: cups-usb-timeout.patch Patch42: cups-avahi-browse.patch Patch43: cups-str4380.patch Patch44: cups-str4366.patch +Patch45: cups-str4332.patch Patch100: cups-lspp.patch @@ -276,6 +277,8 @@ Sends IPP requests to the specified URI and tests and/or displays the results. %patch43 -p1 -b .str4380 # Prevent feedback loop when fetching error_log over HTTP (STR #4366). %patch44 -p1 -b .str4366 +# Track local default in cupsEnumDests() (STR #4332). +%patch45 -p1 -b .str4332 %if %lspp # LSPP support. @@ -665,6 +668,7 @@ rm -f %{cups_serverbin}/backend/smb %changelog * Tue Mar 11 2014 Tim Waugh - 1:1.6.4-4 +- Track local default in cupsEnumDests() (STR #4332). - Prevent feedback loop when fetching error_log over HTTP (STR #4366). - Fix for cupsEnumDest() 'removed' callbacks (bug #1054312, STR #4380). - Prevent dnssd backend exiting too early (bug #1026940, STR #4365).