From a41f09e265d6451d22585430ca176ff406d59f9b Mon Sep 17 00:00:00 2001 From: msweet Date: Fri, 9 Nov 2007 19:55:26 +0000 Subject: [PATCH] Merge changes from 1.4svn-r7067. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@533 a1ca3aef-8c08-0410-bb20-df032aa958be --- CHANGES-1.3.txt | 31 ++++++++++++- Makefile | 8 +--- backend/ipp.c | 3 ++ backend/lpd.c | 3 ++ cups/Makefile | 3 +- cups/auth.c | 2 +- cups/encode.c | 1 + cups/ipp.c | 82 +++++++++++++++++++++++++++------ cups/ipp.h | 3 +- cups/language.c | 10 +++- doc/help/ref-cupsd-conf.html.in | 12 ++--- doc/help/spec-ppd.html | 2 +- filter/pstops.c | 38 +++++++++------ init/Localizable.strings | 9 ---- init/PrintingServices | 45 ------------------ init/PrintingServices.launchd | 28 ----------- init/StartupParameters.plist | 7 --- packaging/cups.list.in | 70 +++++++++++++--------------- packaging/cups.spec.in | 82 ++++++++++++++++----------------- scheduler/conf.c | 7 ++- scheduler/ipp.c | 2 +- scheduler/main.c | 37 ++++++++++++++- scheduler/sysman.c | 2 +- systemv/lpadmin.c | 4 +- tools/testosx | 2 +- 25 files changed, 268 insertions(+), 225 deletions(-) diff --git a/CHANGES-1.3.txt b/CHANGES-1.3.txt index a85d71422..9e3b973b2 100644 --- a/CHANGES-1.3.txt +++ b/CHANGES-1.3.txt @@ -1,9 +1,38 @@ CHANGES-1.3.txt --------------- +CHANGES IN CUPS V1.3.5 + + - The scheduler incorrectly sent the + "com.apple.printerListChanged" message for printer state + changes. + - The PostScript filter drew the page borders (when enabled) + outside the imageable area. + - The LPD and IPP backends did not default to the correct + port numbers when using alternate scheme names. + - The scheduler incorrectly deleted hardwired remote printers + on system sleep. + - The scheduler would abort if a bad browse protocol name + was listed in the cupsd.conf file. + - The online cupsd.conf help file incorrectly showed "dns-sd" + instead of "dnssd" for Bonjour sharing. + - The scheduler could crash changing the port-monitor value. + - The scheduler generated CoreFoundation errors when run + as a background process. + - When printing with number-up > 1, it was possible to get + an extra blank page. + + CHANGES IN CUPS V1.3.4 - - Documentation updates (STR #2560, STR #2563) + - Documentation updates (STR #2560, STR #2563, STR #2569) + - CUPS now maps the "nb" locale to "no" on all platforms + (STR #2575) + - CUPS did not work with a Windows 2003 R2 KDC (STR #2568) + - ippReadIO() could read past the end of a buffer (STR + #2561) + - The scheduler would crash on shutdown if it was unable + to create a Kerberos context. - Multiple AuthTypes in cupsd.conf did not work (STR #2545) - The snmp.conf file referenced the wrong man page (STR diff --git a/Makefile b/Makefile index 972291491..2c72a464f 100644 --- a/Makefile +++ b/Makefile @@ -118,13 +118,7 @@ install: installhdrs fi if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then \ $(INSTALL_DIR) $(BUILDROOT)$(INITDDIR); \ - if test "$(INITDDIR)" = "/System/Library/StartupItems/PrintingServices"; then \ - echo Installing StartupItems files...; \ - $(INSTALL_SCRIPT) init/PrintingServices $(BUILDROOT)$(INITDDIR)/PrintingServices; \ - $(INSTALL_DATA) init/StartupParameters.plist $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \ - $(INSTALL_DIR) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \ - $(INSTALL_DATA) init/Localizable.strings $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \ - elif test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \ + if test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \ echo Installing LaunchDaemons configuration files...; \ $(INSTALL_DATA) init/org.cups.cupsd.plist $(BUILDROOT)$(DEFAULT_LAUNCHD_CONF); \ $(INSTALL_DATA) init/org.cups.cups-lpd.plist $(BUILDROOT)/System/Library/LaunchDaemons; \ diff --git a/backend/ipp.c b/backend/ipp.c index 3dc0991fe..95e598252 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -236,6 +236,9 @@ main(int argc, /* I - Number of command-line args */ return (CUPS_BACKEND_STOP); } + if (!port) + port = IPP_PORT; /* Default to port 631 */ + if (!strcmp(method, "https")) cupsSetEncryption(HTTP_ENCRYPT_ALWAYS); else diff --git a/backend/lpd.c b/backend/lpd.c index 53a6539c1..926033a54 100644 --- a/backend/lpd.c +++ b/backend/lpd.c @@ -201,6 +201,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ hostname, sizeof(hostname), &port, resource, sizeof(resource)); + if (!port) + port = 515; /* Default to port 515 */ + if (!username[0]) { /* diff --git a/cups/Makefile b/cups/Makefile index 1095c789c..822f10f54 100644 --- a/cups/Makefile +++ b/cups/Makefile @@ -96,7 +96,8 @@ HEADERS = \ language.h \ ppd.h \ sidechannel.h \ - transcode.h + transcode.h \ + versioning.h # diff --git a/cups/auth.c b/cups/auth.c index 055977193..6882bfad1 100644 --- a/cups/auth.c +++ b/cups/auth.c @@ -92,7 +92,7 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */ char prompt[1024], /* Prompt for user */ realm[HTTP_MAX_VALUE], /* realm="xyz" string */ nonce[HTTP_MAX_VALUE], /* nonce="xyz" string */ - encode[2048]; /* Encoded username:password */ + encode[4096]; /* Encoded username:password */ int localauth; /* Local authentication result */ _cups_globals_t *cg; /* Global data */ diff --git a/cups/encode.c b/cups/encode.c index c18359801..4e7f78118 100644 --- a/cups/encode.c +++ b/cups/encode.c @@ -100,6 +100,7 @@ static const _ipp_option_t ipp_options[] = { "page-top-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER }, { "penwidth", IPP_TAG_INTEGER, IPP_TAG_JOB }, { "penwidth-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER }, + { "port-monitor", IPP_TAG_NAME, IPP_TAG_PRINTER }, { "ppi", IPP_TAG_INTEGER, IPP_TAG_JOB }, { "ppi-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER }, { "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB }, diff --git a/cups/ipp.c b/cups/ipp.c index 048fdc2fe..c068d84ce 100644 --- a/cups/ipp.c +++ b/cups/ipp.c @@ -1014,8 +1014,10 @@ ippReadIO(void *src, /* I - Data source */ ipp_t *ipp) /* I - IPP data */ { int n; /* Length of data */ - unsigned char buffer[32768], /* Data buffer */ - string[255], /* Small string buffer */ + unsigned char buffer[IPP_MAX_LENGTH], + /* Data buffer */ + string[IPP_MAX_NAME], + /* Small string buffer */ *bufptr; /* Pointer into buffer */ ipp_attribute_t *attr; /* Current attribute */ ipp_tag_t tag; /* Current tag */ @@ -1306,6 +1308,12 @@ ippReadIO(void *src, /* I - Data source */ { case IPP_TAG_INTEGER : case IPP_TAG_ENUM : + if (n != 4) + { + DEBUG_printf(("ippReadIO: bad value length %d!\n", n)); + return (IPP_ERROR); + } + if ((*cb)(src, buffer, 4) < 4) { DEBUG_puts("ippReadIO: Unable to read integer value!"); @@ -1318,6 +1326,12 @@ ippReadIO(void *src, /* I - Data source */ value->integer = n; break; case IPP_TAG_BOOLEAN : + if (n != 1) + { + DEBUG_printf(("ippReadIO: bad value length %d!\n", n)); + return (IPP_ERROR); + } + if ((*cb)(src, buffer, 1) < 1) { DEBUG_puts("ippReadIO: Unable to read boolean value!"); @@ -1335,6 +1349,12 @@ ippReadIO(void *src, /* I - Data source */ case IPP_TAG_CHARSET : case IPP_TAG_LANGUAGE : case IPP_TAG_MIMETYPE : + if (n >= sizeof(buffer)) + { + DEBUG_printf(("ippReadIO: bad value length %d!\n", n)); + return (IPP_ERROR); + } + if ((*cb)(src, buffer, n) < n) { DEBUG_puts("ippReadIO: unable to read name!"); @@ -1347,6 +1367,12 @@ ippReadIO(void *src, /* I - Data source */ value->string.text)); break; case IPP_TAG_DATE : + if (n != 11) + { + DEBUG_printf(("ippReadIO: bad value length %d!\n", n)); + return (IPP_ERROR); + } + if ((*cb)(src, value->date, 11) < 11) { DEBUG_puts("ippReadIO: Unable to date integer value!"); @@ -1354,6 +1380,12 @@ ippReadIO(void *src, /* I - Data source */ } break; case IPP_TAG_RESOLUTION : + if (n != 9) + { + DEBUG_printf(("ippReadIO: bad value length %d!\n", n)); + return (IPP_ERROR); + } + if ((*cb)(src, buffer, 9) < 9) { DEBUG_puts("ippReadIO: Unable to read resolution value!"); @@ -1370,6 +1402,12 @@ ippReadIO(void *src, /* I - Data source */ (ipp_res_t)buffer[8]; break; case IPP_TAG_RANGE : + if (n != 8) + { + DEBUG_printf(("ippReadIO: bad value length %d!\n", n)); + return (IPP_ERROR); + } + if ((*cb)(src, buffer, 8) < 8) { DEBUG_puts("ippReadIO: Unable to read range value!"); @@ -1385,7 +1423,7 @@ ippReadIO(void *src, /* I - Data source */ break; case IPP_TAG_TEXTLANG : case IPP_TAG_NAMELANG : - if (n > sizeof(buffer) || n < 4) + if (n >= sizeof(buffer) || n < 4) { DEBUG_printf(("ippReadIO: bad value length %d!\n", n)); return (IPP_ERROR); @@ -1411,22 +1449,27 @@ ippReadIO(void *src, /* I - Data source */ n = (bufptr[0] << 8) | bufptr[1]; - if (n >= sizeof(string)) + if ((bufptr + 2 + n) >= (buffer + sizeof(buffer)) || + n >= sizeof(string)) { - memcpy(string, bufptr + 2, sizeof(string) - 1); - string[sizeof(string) - 1] = '\0'; + DEBUG_printf(("ippReadIO: bad value length %d!\n", n)); + return (IPP_ERROR); } - else - { - memcpy(string, bufptr + 2, n); - string[n] = '\0'; - } + + memcpy(string, bufptr + 2, n); + string[n] = '\0'; value->string.charset = _cupsStrAlloc((char *)string); bufptr += 2 + n; n = (bufptr[0] << 8) | bufptr[1]; + if ((bufptr + 2 + n) >= (buffer + sizeof(buffer))) + { + DEBUG_printf(("ippReadIO: bad value length %d!\n", n)); + return (IPP_ERROR); + } + bufptr[2 + n] = '\0'; value->string.text = _cupsStrAlloc((char *)bufptr + 2); break; @@ -1468,6 +1511,12 @@ ippReadIO(void *src, /* I - Data source */ * we need to carry over... */ + if (n >= sizeof(buffer)) + { + DEBUG_printf(("ippReadIO: bad value length %d!\n", n)); + return (IPP_ERROR); + } + if ((*cb)(src, buffer, n) < n) { DEBUG_puts("ippReadIO: Unable to read member name value!"); @@ -1489,6 +1538,12 @@ ippReadIO(void *src, /* I - Data source */ break; default : /* Other unsupported values */ + if (n > sizeof(buffer)) + { + DEBUG_printf(("ippReadIO: bad value length %d!\n", n)); + return (IPP_ERROR); + } + value->unknown.length = n; if (n > 0) { @@ -1627,7 +1682,8 @@ ippWriteIO(void *dst, /* I - Destination */ { int i; /* Looping var */ int n; /* Length of data */ - unsigned char buffer[32768], /* Data buffer */ + unsigned char buffer[IPP_MAX_LENGTH + 2], + /* Data buffer + length bytes */ *bufptr; /* Pointer into buffer */ ipp_attribute_t *attr; /* Current attribute */ ipp_value_t *value; /* Current value */ @@ -1947,7 +2003,7 @@ ippWriteIO(void *dst, /* I - Destination */ /* * All simple strings consist of the 2-byte length and * character data without the trailing nul normally found - * in C strings. Also, strings cannot be longer than 32767 + * in C strings. Also, strings cannot be longer than IPP_MAX_LENGTH * bytes since the 2-byte length is a signed (twos-complement) * value. * diff --git a/cups/ipp.h b/cups/ipp.h index 04f689a91..29ef86afd 100644 --- a/cups/ipp.h +++ b/cups/ipp.h @@ -55,7 +55,8 @@ extern "C" { * Common limits... */ -# define IPP_MAX_NAME 256 +# define IPP_MAX_LENGTH 32767 /* Maximum size of any single value */ +# define IPP_MAX_NAME 256 /* Maximum length of common name values */ # define IPP_MAX_VALUES 8 /* Power-of-2 allocation increment */ diff --git a/cups/language.c b/cups/language.c index c1af03a3d..4edaab418 100644 --- a/cups/language.c +++ b/cups/language.c @@ -413,8 +413,14 @@ cupsLangGet(const char *language) /* I - Language or locale */ strlcpy(locale, ptr, sizeof(locale)); language = locale; - DEBUG_printf(("cupsLangGet: new language value is \"%s\"\n", - language ? language : "(null)")); + /* + * CUPS STR #2575: Map "nb" to "no" for back-compatibility... + */ + + if (!strncmp(locale, "nb", 2)) + locale[1] = 'o'; + + DEBUG_printf(("cupsLangGet: new language value is \"%s\"\n", language)); } } #endif /* __APPLE__ */ diff --git a/doc/help/ref-cupsd-conf.html.in b/doc/help/ref-cupsd-conf.html.in index e15c6c1d4..a6cc6254c 100644 --- a/doc/help/ref-cupsd-conf.html.in +++ b/doc/help/ref-cupsd-conf.html.in @@ -510,10 +510,10 @@ printers. The default is to not include any options.

BrowseLocalProtocols all BrowseLocalProtocols none BrowseLocalProtocols cups -BrowseLocalProtocols dns-sd +BrowseLocalProtocols dnssd BrowseLocalProtocols ldap BrowseLocalProtocols slp -BrowseLocalProtocols cups dns-sd +BrowseLocalProtocols cups dnssd

Description

@@ -603,10 +603,10 @@ on all of the systems that you want to see. BrowseProtocols all BrowseProtocols none BrowseProtocols cups -BrowseProtocols dns-sd +BrowseProtocols dnssd BrowseProtocols ldap BrowseProtocols slp -BrowseProtocols cups dns-sd +BrowseProtocols cups dnssd

Description

@@ -689,10 +689,10 @@ The default is to not include any options.

BrowseRemoteProtocols all BrowseRemoteProtocols none BrowseRemoteProtocols cups -BrowseRemoteProtocols dns-sd +BrowseRemoteProtocols dnssd BrowseRemoteProtocols ldap BrowseRemoteProtocols slp -BrowseRemoteProtocols cups dns-sd +BrowseRemoteProtocols cups dnssd

Description

diff --git a/doc/help/spec-ppd.html b/doc/help/spec-ppd.html index 91c65738b..0285f4697 100644 --- a/doc/help/spec-ppd.html +++ b/doc/help/spec-ppd.html @@ -540,7 +540,7 @@ options on Mac OS X must provide their own user interface via the
 *% Base JCL key code option 
-*OpenUI JCLPasscode/Key Code: PickOne
+*JCLOpenUI JCLPasscode/Key Code: PickOne
 *OrderDependency: 10 JCLSetup *JCLPasscode
 *DefaultJCLPasscode: None
 *JCLPasscode None/No Code: ""
diff --git a/filter/pstops.c b/filter/pstops.c
index 964df1867..0064199da 100644
--- a/filter/pstops.c
+++ b/filter/pstops.c
@@ -889,7 +889,7 @@ copy_dsc(cups_file_t  *fp,		/* I - File to read from */
   * Finish up the last page(s)...
   */
 
-  if (number && is_not_last_page(number) && cupsArrayLast(doc->pages))
+  if (number && !is_first_page(number) && cupsArrayLast(doc->pages))
   {
     pageinfo = (pstops_page_t *)cupsArrayLast(doc->pages);
 
@@ -2785,8 +2785,11 @@ start_nup(pstops_doc_t *doc,		/* I - Document information */
 		tx, ty;			/* Translation values for subpage */
   float		pagew,			/* Printable width of page */
 		pagel;			/* Printable height of page */
-  int		bboxw,			/* BoundingBox width */
+  int		bboxx,			/* BoundingBox X origin */
+		bboxy,			/* BoundingBox Y origin */
+		bboxw,			/* BoundingBox width */
 		bboxl;			/* BoundingBox height */
+  float		margin = 0;		/* Current margin for border */
 
 
   if (doc->number_up > 1)
@@ -2801,17 +2804,22 @@ start_nup(pstops_doc_t *doc,		/* I - Document information */
 
   if (doc->fitplot)
   {
+    bboxx = bounding_box[0];
+    bboxy = bounding_box[1];
     bboxw = bounding_box[2] - bounding_box[0];
     bboxl = bounding_box[3] - bounding_box[1];
   }
   else
   {
+    bboxx = 0;
+    bboxy = 0;
     bboxw = PageWidth;
     bboxl = PageLength;
   }
 
   fprintf(stderr, "DEBUG: pagew = %.1f, pagel = %.1f\n", pagew, pagel);
-  fprintf(stderr, "DEBUG: bboxw = %d, bboxl = %d\n", bboxw, bboxl);
+  fprintf(stderr, "DEBUG: bboxx = %d, bboxy = %d, bboxw = %d, bboxl = %d\n",
+          bboxx, bboxy, bboxw, bboxl);
   fprintf(stderr, "DEBUG: PageLeft = %.1f, PageRight = %.1f\n",
           PageLeft, PageRight);
   fprintf(stderr, "DEBUG: PageTop = %.1f, PageBottom = %.1f\n",
@@ -3129,8 +3137,7 @@ start_nup(pstops_doc_t *doc,		/* I - Document information */
   if (doc->page_border && show_border)
   {
     int		rects;			/* Number of border rectangles */
-    float	fscale,			/* Scaling value for points */
-		margin;			/* Current margin for borders */
+    float	fscale;			/* Scaling value for points */
 
 
     rects  = (doc->page_border & PSTOPS_BORDERDOUBLE) ? 2 : 1;
@@ -3153,10 +3160,10 @@ start_nup(pstops_doc_t *doc,		/* I - Document information */
     for (; rects > 0; rects --, margin += 2 * fscale)
       if (doc->number_up > 1)
 	doc_printf(doc, "%.1f %.1f %.1f %.1f ESPrs\n",
-		   margin - 2.25 * fscale,
-		   margin - 2.25 * fscale,
-		   bboxw + 4.5 * fscale - 2 * margin,
-		   bboxl + 4.5 * fscale - 2 * margin);
+		   margin,
+		   margin,
+		   bboxw - 2 * margin,
+		   bboxl - 2 * margin);
       else
 	doc_printf(doc, "%.1f %.1f %.1f %.1f ESPrs\n",
         	   PageLeft + margin,
@@ -3174,21 +3181,22 @@ start_nup(pstops_doc_t *doc,		/* I - Document information */
   if (doc->fitplot)
   {
    /*
-    * Clip the page that follows to the bounding box of the page...
+    * Offset the page by its bounding box...
     */
 
     doc_printf(doc, "%d %d translate\n", -bounding_box[0],
                -bounding_box[1]);
-    doc_printf(doc, "%d %d %d %d ESPrc\n", bounding_box[0], bounding_box[1],
-               bboxw, bboxl);
   }
-  else if (doc->number_up > 1)
+
+  if (doc->fitplot || doc->number_up > 1)
   {
    /*
-    * Clip the page that follows to the default page size...
+    * Clip the page to the page's bounding box...
     */
 
-    doc_printf(doc, "0 0 %d %d ESPrc\n", bboxw, bboxl);
+    doc_printf(doc, "%.1f %.1f %.1f %.1f ESPrc\n",
+               bboxx + margin, bboxy + margin,
+               bboxw - 2 * margin, bboxl - 2 * margin);
   }
 }
 
diff --git a/init/Localizable.strings b/init/Localizable.strings
index d08f91972..e69de29bb 100644
--- a/init/Localizable.strings
+++ b/init/Localizable.strings
@@ -1,9 +0,0 @@
-
-
-
-
-	Starting printing services
-	Starting printing services
-
-
-
diff --git a/init/PrintingServices b/init/PrintingServices
index bbe5ac36b..e69de29bb 100755
--- a/init/PrintingServices
+++ b/init/PrintingServices
@@ -1,45 +0,0 @@
-#!/bin/sh
-
-##
-# PrintingServices - a.k.a. CUPS
-##
-
-. /etc/rc.common
-
-StartService ()
-{
-	if [ "${CUPS:=-AUTOMATIC-}" = "-AUTOMATIC-" ]; then
-		ConsoleMessage "Starting printing services"
-		/usr/sbin/cupsd
-	elif [ "${CUPS:=-AUTOMATIC-}" = "-YES-" ]; then
-		ConsoleMessage "Starting printing services"
-		/usr/sbin/cupsd
-	fi
-}
-
-StopService ()
-{
-	# Until cupsd has a pid file...
-	pid=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
-	if test "$pid" != ""; then
-		ConsoleMessage "Stopping printing services"
-		kill "${pid}"
-	fi
-}
-
-RestartService ()
-{
-	# Until cupsd has a pid file...
-	pid=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
-	if test "x$pid" != x; then
-		ConsoleMessage "Restarting printing services"
-		kill -HUP "${pid}"
-	else
-		if [ "${CUPS:=-AUTOMATIC-}" = "-AUTOMATIC-" -o "${CUPS:=-AUTOMATIC-}" = "-YES-" ]; then
-			ConsoleMessage "Starting printing services"
-			/usr/sbin/cupsd
-		fi
-	fi
-}
-
-RunService "$1"
diff --git a/init/PrintingServices.launchd b/init/PrintingServices.launchd
index be9992a78..e69de29bb 100755
--- a/init/PrintingServices.launchd
+++ b/init/PrintingServices.launchd
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-##
-# PrintingServices - a.k.a. CUPS
-##
-
-. /etc/rc.common
-
-StartService ()
-{
-	ConsoleMessage "Starting printing services"
-	launchctl start org.cups.cupsd
-}
-
-StopService ()
-{
-	ConsoleMessage "Stopping printing services"
-	launchctl stop org.cups.cupsd
-}
-
-RestartService ()
-{
-	ConsoleMessage "Restarting printing services"
-	launchctl stop org.cups.cupsd
-	launchctl start org.cups.cupsd
-}
-
-RunService "$1"
diff --git a/init/StartupParameters.plist b/init/StartupParameters.plist
index 0633bf88a..e69de29bb 100644
--- a/init/StartupParameters.plist
+++ b/init/StartupParameters.plist
@@ -1,7 +0,0 @@
-{
-  Description     = "Printing Services";
-  Provides        = ("PrintingServices");
-  Requires        = ("Resolver");
-  Uses            = ("Network Time");
-  OrderPreference = "Late";
-}
diff --git a/packaging/cups.list.in b/packaging/cups.list.in
index a6205f6a8..8198efa7a 100644
--- a/packaging/cups.list.in
+++ b/packaging/cups.list.in
@@ -450,38 +450,38 @@ f 0644 root sys $DATADIR/model ppd/*.ppd
 d 0755 root sys $DATADIR/templates -
 f 0644 root sys $DATADIR/templates templates/*.tmpl
 
-# Japanese template files
-%subpackage de
-d 0755 root sys $DATADIR/templates/de
-f 0644 root sys $DATADIR/templates/de templates/de/*.tmpl
-%subpackage es
-d 0755 root sys $DATADIR/templates/es
-f 0644 root sys $DATADIR/templates/es templates/es/*.tmpl
-%subpackage et
-d 0755 root sys $DATADIR/templates/et
-f 0644 root sys $DATADIR/templates/et templates/et/*.tmpl
-%subpackage fr
-d 0755 root sys $DATADIR/templates/fr
-f 0644 root sys $DATADIR/templates/fr templates/fr/*.tmpl
-%subpackage he
-d 0755 root sys $DATADIR/templates/he
-f 0644 root sys $DATADIR/templates/he templates/he/*.tmpl
-%subpackage it
-d 0755 root sys $DATADIR/templates/it
-f 0644 root sys $DATADIR/templates/it templates/it/*.tmpl
-%subpackage ja
-d 0755 root sys $DATADIR/templates/ja
-f 0644 root sys $DATADIR/templates/ja templates/ja/*.tmpl
-%subpackage pl
-d 0755 root sys $DATADIR/templates/pl
-f 0644 root sys $DATADIR/templates/pl templates/pl/*.tmpl
-%subpackage sv
-d 0755 root sys $DATADIR/templates/sv
-f 0644 root sys $DATADIR/templates/sv templates/sv/*.tmpl
-%subpackage zh
-d 0755 root sys $DATADIR/templates/zh_TW
-f 0644 root sys $DATADIR/templates/zh_TW templates/zh_TW/*.tmpl
-%subpackage
+## Template files
+#%subpackage de
+#d 0755 root sys $DATADIR/templates/de
+#f 0644 root sys $DATADIR/templates/de templates/de/*.tmpl
+#%subpackage es
+#d 0755 root sys $DATADIR/templates/es
+#f 0644 root sys $DATADIR/templates/es templates/es/*.tmpl
+#%subpackage et
+#d 0755 root sys $DATADIR/templates/et
+#f 0644 root sys $DATADIR/templates/et templates/et/*.tmpl
+#%subpackage fr
+#d 0755 root sys $DATADIR/templates/fr
+#f 0644 root sys $DATADIR/templates/fr templates/fr/*.tmpl
+#%subpackage he
+#d 0755 root sys $DATADIR/templates/he
+#f 0644 root sys $DATADIR/templates/he templates/he/*.tmpl
+#%subpackage it
+#d 0755 root sys $DATADIR/templates/it
+#f 0644 root sys $DATADIR/templates/it templates/it/*.tmpl
+#%subpackage ja
+#d 0755 root sys $DATADIR/templates/ja
+#f 0644 root sys $DATADIR/templates/ja templates/ja/*.tmpl
+#%subpackage pl
+#d 0755 root sys $DATADIR/templates/pl
+#f 0644 root sys $DATADIR/templates/pl templates/pl/*.tmpl
+#%subpackage sv
+#d 0755 root sys $DATADIR/templates/sv
+#f 0644 root sys $DATADIR/templates/sv templates/sv/*.tmpl
+#%subpackage zh
+#d 0755 root sys $DATADIR/templates/zh_TW
+#f 0644 root sys $DATADIR/templates/zh_TW templates/zh_TW/*.tmpl
+#%subpackage
 
 # Config files
 d 0755 root sys $SERVERROOT -
@@ -640,12 +640,6 @@ f 0644 root sys $AMANDIR/man$MAN8DIR/cups-lpd.$MAN8EXT man/cups-lpd.$MAN8EXT
 # Startup scripts
 %system darwin
 f 0644 root sys /System/Library/LaunchDaemons/org.cups.cupsd.plist init/org.cups.cupsd.plist
-d 0755 root sys /System/Library/StartupItems/PrintingServices -
-f 0644 root sys /System/Library/StartupItems/PrintingServices/PrintingServices init/PrintingServices.launchd
-f 0644 root sys /System/Library/StartupItems/PrintingServices/StartupParamters.plist init/StartupParameters.plist
-d 0755 root sys /System/Library/StartupItems/PrintingServices/Resources -
-d 0755 root sys /System/Library/StartupItems/PrintingServices/Resources/English.lproj -
-f 0644 root sys /System/Library/StartupItems/PrintingServices/Resources/English.lproj/Localizable.strings init/Localizable.strings
 %preremove <attrs, "port-monitor-supported",
-                                 IPP_TAG_KEYWORD);
+                                 IPP_TAG_NAME);
     for (i = 0; i < supported->num_values; i ++)
       if (!strcmp(supported->values[i].string.text,
                   attr->values[0].string.text))
diff --git a/scheduler/main.c b/scheduler/main.c
index 9cb8439bb..f3836b785 100644
--- a/scheduler/main.c
+++ b/scheduler/main.c
@@ -146,6 +146,10 @@ main(int  argc,				/* I - Number of command-line args */
   cups_file_t		*fp;		/* Fake lpsched lock file */
   struct stat		statbuf;	/* Needed for checking lpsched FIFO */
 #endif /* __sgi */
+#ifdef __APPLE__
+  int			run_as_child = 0;
+					/* Needed for Mac OS X fork/exec */
+#endif /* __APPLE__ */
 #if HAVE_LAUNCHD
   int			launchd_idle_exit;
 					/* Idle exit on select timeout? */
@@ -183,6 +187,12 @@ main(int  argc,				/* I - Number of command-line args */
       for (opt = argv[i] + 1; *opt != '\0'; opt ++)
         switch (*opt)
 	{
+#ifdef __APPLE__
+	  case 'C' : /* Run as child with config file */
+              run_as_child = 1;
+	      fg           = -1;
+#endif /* __APPLE__ */
+
 	  case 'c' : /* Configuration file */
 	      i ++;
 	      if (i >= argc)
@@ -339,6 +349,18 @@ main(int  argc,				/* I - Number of command-line args */
 	return (3);
       }
     }
+
+#ifdef __APPLE__
+   /*
+    * Since CoreFoundation has an overly-agressive check for whether a
+    * process has forked but not exec'd (whether CF has been called or
+    * not...), we now have to exec ourselves with the "-f" option to
+    * eliminate their bogus warning messages.
+    */
+
+    execlp(argv[0], argv[0], "-C", ConfigurationFile, (char *)0);
+    exit(errno);
+#endif /* __APPLE__ */
   }
 
   if (fg < 1)
@@ -502,7 +524,11 @@ main(int  argc,				/* I - Number of command-line args */
   */
 
   if (krb5_init_context(&KerberosContext))
+  {
+    KerberosContext = NULL;
+
     cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to initialize Kerberos context");
+  }
 #endif /* HAVE_GSSAPI */
 
  /*
@@ -583,7 +609,11 @@ main(int  argc,				/* I - Number of command-line args */
   * we are up and running...
   */
 
+#ifdef __APPLE__
+  if (!fg || run_as_child)
+#else
   if (!fg)
+#endif /* __APPLE__ */
   {
    /*
     * Send a signal to the parent process, but only if the parent is
@@ -968,7 +998,9 @@ main(int  argc,				/* I - Number of command-line args */
     if (LastEvent)
     {
 #ifdef HAVE_NOTIFY_POST
-      if (LastEvent & CUPSD_EVENT_PRINTER_CHANGED)
+      if (LastEvent & (CUPSD_EVENT_PRINTER_ADDED |
+                       CUPSD_EVENT_PRINTER_DELETED |
+                       CUPSD_EVENT_PRINTER_MODIFIED))
       {
         cupsdLogMessage(CUPSD_LOG_DEBUG2,
 	                "notify_post(\"com.apple.printerListChange\")");
@@ -1052,7 +1084,8 @@ main(int  argc,				/* I - Number of command-line args */
 
   if (krb5_init_context != NULL)
 #  endif /* __APPLE__ */
-  krb5_free_context(KerberosContext);
+  if (KerberosContext)
+    krb5_free_context(KerberosContext);
 #endif /* HAVE_GSSAPI */
 
 #ifdef __APPLE__
diff --git a/scheduler/sysman.c b/scheduler/sysman.c
index a67b4fa7f..03aa8d035 100644
--- a/scheduler/sysman.c
+++ b/scheduler/sysman.c
@@ -286,7 +286,7 @@ cupsdUpdateSystemMonitor(void)
            p;
 	   p = (cupsd_printer_t *)cupsArrayNext(Printers))
       {
-	if (p->type & CUPS_PRINTER_REMOTE)
+	if (p->type & CUPS_PRINTER_DISCOVERED)
 	{
 	  cupsdLogMessage(CUPSD_LOG_DEBUG,
 	                  "Deleting remote destination \"%s\"", p->name);
diff --git a/systemv/lpadmin.c b/systemv/lpadmin.c
index 8625f5a15..e0e3ad9ff 100644
--- a/systemv/lpadmin.c
+++ b/systemv/lpadmin.c
@@ -1815,10 +1815,10 @@ set_printer_options(
   if ((protocol = cupsGetOption("protocol", num_options, options)) != NULL)
   {
     if (!strcasecmp(protocol, "bcp"))
-      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "port-monitor",
+      ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME, "port-monitor",
                    NULL, "bcp");
     else if (!strcasecmp(protocol, "tbcp"))
-      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "port-monitor",
+      ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME, "port-monitor",
                    NULL, "tbcp");
   }
 
diff --git a/tools/testosx b/tools/testosx
index fe44a364c..36ee26612 100755
--- a/tools/testosx
+++ b/tools/testosx
@@ -99,7 +99,7 @@ for file in packaging/cups-desc.plist packaging/cups-info.plist \
 	echo Updating $file...
 	sed -e '1,$s/@CUPS_VERSION@/'$version'/g' \
 		-e '1,$s/@CUPS_REVISION@//g' \
-		-e '1,$s/@CUPS_RELEASE@/1.3.'$rev'/g' \
+		-e '1,$s/@CUPS_RELEASE@/1.4.'$rev'/g' \
 		<$file.in >$file
 done
 
-- 
2.39.2