]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Interface scripts are no longer supported for security reasons
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Mon, 19 Oct 2015 18:49:28 +0000 (18:49 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Mon, 19 Oct 2015 18:49:28 +0000 (18:49 +0000)
(<rdar://problem/23135640>)

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12904 a1ca3aef-8c08-0410-bb20-df032aa958be

20 files changed:
CHANGES.txt
doc/help/man-cups-lpd.html
doc/help/man-cups-snmp.html
doc/help/man-cupsaddsmb.html
doc/help/man-cupsd.html
doc/help/man-filter.html
doc/help/man-lpadmin.html
doc/help/man-lpoptions.html
doc/help/spec-design.html
doc/help/spec-ipp.html
man/filter.man
man/lpadmin.man
packaging/cups.list.in
packaging/cups.spec.in
scheduler/Makefile
scheduler/cups-driverd.cxx
scheduler/ipp.c
scheduler/printers.c
systemv/lpadmin.c
systemv/lpstat.c

index fda644dc5a389d1ca6f92f4fe7b59a6688fe3abe..05722be21f151c61f9970d6aa9ee925a8edc6339 100644 (file)
@@ -1,7 +1,9 @@
-CHANGES.txt - 2.2b1 - 2015-10-08
+CHANGES.txt - 2.2b1 - 2015-10-19
 --------------------------------
 
 CHANGES IN CUPS V2.2b1
 
        - The cupsd domain socket is no longer world-accessible on OS X
          (<rdar://problem/7542560>)
+       - Interface scripts are no longer supported for security reasons
+         (<rdar://problem/23135640>)
\ No newline at end of file
index b4f1184e04148f7fc66e2b13d7cc406075c17a82..697518ac0eda7d5f05df8d2eb6828f69f4dc3724 100644 (file)
@@ -108,7 +108,7 @@ service using the corresponding control program.
 CUPS Online Help (<a href="http://localhost:631/help)">http://localhost:631/help)</a>,
 RFC 2569
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2014 by Apple Inc.
+Copyright &copy; 2007-2015 by Apple Inc.
 
 </body>
 </html>
index 06a48133fff7ad7c208abdce8b061774a72f35fd..faa57639dcd5c0a862cfc1edd79951d05e0fcc00 100644 (file)
@@ -48,7 +48,7 @@ The CUPS SNMP backend uses the information from the Host, Printer, and Port Moni
 <a href="man-lpinfo.html?TOPIC=Man+Pages"><b>lpinfo</b>(8),</a>
 CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2014 by Apple Inc.
+Copyright &copy; 2007-2015 by Apple Inc.
 
 </body>
 </html>
index 622d30a7d2ea8e177b9e024a0212708ddf7a541c..cb2901e2761c57135d529d8c44740ad260b0ec29 100644 (file)
@@ -115,7 +115,7 @@ This is useful for debugging SAMBA configuration problems.
 <b>smb.conf</b>(5),
 CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2014 by Apple Inc.
+Copyright &copy; 2007-2015 by Apple Inc.
 
 </body>
 </html>
index 8f90f447c43057876f58865bbc48051979f3e0b8..de1294217030b249649f0f7d628fd855be815ebd 100644 (file)
@@ -14,7 +14,7 @@ cupsd - cups scheduler
 [
 <b>-c</b>
 <i>config-file</i>
-] [ 
+] [
 <b>-f</b>
 ] [
 <b>-F</b>
@@ -111,7 +111,7 @@ in the foreground with a test configuration file called
 <b>systemd</b>(8),
 CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2014 by Apple Inc.
+Copyright &copy; 2007-2015 by Apple Inc.
 
 </body>
 </html>
index bb4f620bcb9e41257fd7c03c344509a399e70b1b..33a35563e8e38a2d951ac46689462326e4c02ed4 100644 (file)
@@ -163,10 +163,7 @@ for a regular print file.
 <dd style="margin-left: 5.0em">The user executing the filter, typically "lp" or "root"; consult the <i>cups-files.conf</i> file for the current setting.
 </dl>
 <h2 class="title"><a name="CONFORMING_TO">Conforming To</a></h2>
-While the filter interface is compatible with System V interface
-scripts, it will only work with the System V interface script as the
-only filter.  Typically the interface script will be provided via the
-<i>lpadmin(8)</i> command using the <i>-i</i> option.
+While the filter interface is compatible with System V interface scripts, CUPS does not support System V interface scripts.
 <h2 class="title"><a name="NOTES">Notes</a></h2>
 CUPS filters are not meant to be run directly by the user.
 Aside from the legacy System V interface issues (<i>argv[0]</i> is the printer name), CUPS filters also expect specific environment variables and file descriptors, and typically run in a user session that (on OS X) has additional restrictions that affect how it runs.
index 2a74cf06c50dac046a7a606eaa4e2cfc84a36e73..775e7e9bcd52ee1901ce136be1b45a538fc53aa3 100644 (file)
@@ -71,15 +71,15 @@ The following options are recognized when configuring a printer queue:
 <dt><b>-c </b><i>class</i>
 <dd style="margin-left: 5.0em">Adds the named <i>printer</i> to <i>class</i>.
 If <i>class</i> does not exist it is created automatically.
-<dt><b>-i </b><i>interface</i>
-<dd style="margin-left: 5.0em">Sets a System V style interface script for the printer.
-This option cannot be specified with the <i>-P</i> option (PPD file) and is intended for providing support for legacy printer drivers.
+<dt><b>-i </b><i>ppd-file</i>
+<dd style="margin-left: 5.0em"><dt><b>-P </b><i>ppd-file</i>
+<dd style="margin-left: 5.0em">Specifies a PostScript Printer Description (PPD) file to use with the printer.
 <dt><b>-m </b><i>model</i>
-<dd style="margin-left: 5.0em">Sets a standard System V interface script or PPD file for the printer from the <i>model</i> directory or using one of the driver interfaces.
+<dd style="margin-left: 5.0em">Sets a standard PPD file for the printer from the <i>model</i> directory or using one of the driver interfaces.
 Use the <i>-m</i> option with the
 <a href="man-lpinfo.html?TOPIC=Man+Pages"><b>lpinfo</b>(8)</a>
 command to get a list of supported models.
-The model "raw" clears any existing interface script or PPD file and the model "everywhere" queries the printer referred to by the specified IPP <i>device-uri</i>.
+The model "raw" clears any existing PPD file and the model "everywhere" queries the printer referred to by the specified IPP <i>device-uri</i>.
 <dt><b>-o cupsIPPSupplies=true</b>
 <dd style="margin-left: 5.0em"><dt><b>-o cupsIPPSupplies=false</b>
 <dd style="margin-left: 5.0em">Specifies whether IPP supply level values should be reported.
@@ -151,9 +151,6 @@ and
 programs on the destination.
 <dt><b>-L "</b><i>location</i><b>"</b>
 <dd style="margin-left: 5.0em">Provides a textual location of the destination.
-<dt><b>-P </b><i>ppd-file</i>
-<dd style="margin-left: 5.0em">Specifies a PostScript Printer Description file to use with the printer.
-If specified, this option overrides the <i>-i</i> option (interface script).
 </dl>
 <h2 class="title"><a name="CONFORMING_TO">Conforming To</a></h2>
 Unlike the System V printing system, CUPS allows printer names to contain any printable character except SPACE, TAB, "/", or "#".
index 2e171296b5da1ee3e39e265c4f0f623be512b7b1..0aeed451da103343e6f76de69b48d01c9bdcabdc 100644 (file)
@@ -119,7 +119,7 @@ The <b>lpoptions</b> command is unique to CUPS.
 <a href="man-lprm.html?TOPIC=Man+Pages"><b>lprm</b>(1),</a>
 CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2014 by Apple Inc.
+Copyright &copy; 2007-2015 by Apple Inc.
 
 </body>
 </html>
index 76cbd9cab87908dd017de636b6cecd7890b281d6..73d07b8f46c9ccba638da9d14a78ea2ea5c47d33 100644 (file)
@@ -31,7 +31,7 @@ WIDTH="768" HEIGHT="768" ALT="CUPS Block Diagram"></TD></TR>
 
 <H4>Config Files</H4>
 
-<P>The scheduler uses several configuration files to store the server settings (<A HREF="man-cupsd.conf.html">cupsd.conf</A>), available classes (<A HREF="man-classes.conf.html">classes.conf</A>), available printers (<A HREF="man-printers.conf.html">printers.conf</A>), current notification subscriptions (<A HREF="man-subscriptions.conf.html">subscriptions.conf</A>), and supported file types and filters (<A HREF="man-mime.types.html">mime.types</A>, <A HREF="man-mime.convs.html">mime.convs</A>). In addition, PostScript Printer Description ("PPD") files or interface scripts are associated with each printer, and the scheduler has cache files for remote printers, PPD files, and current jobs to optimize the scheduler's startup speed and availability.</P>
+<P>The scheduler uses several configuration files to store the server settings (<A HREF="man-cupsd.conf.html">cupsd.conf</A>), available classes (<A HREF="man-classes.conf.html">classes.conf</A>), available printers (<A HREF="man-printers.conf.html">printers.conf</A>), current notification subscriptions (<A HREF="man-subscriptions.conf.html">subscriptions.conf</A>), and supported file types and filters (<A HREF="man-mime.types.html">mime.types</A>, <A HREF="man-mime.convs.html">mime.convs</A>). In addition, PostScript Printer Description ("PPD") files are associated with each printer, and the scheduler has cache files for remote printers, PPD files, and current jobs to optimize the scheduler's startup speed and availability.</P>
 
 <H4>Job Files</H4>
 
index 3a9fd6cfa1dee77cc73b40f85ada0d13353864a1..4766002f00a77bd576c142c9129d8032d06c8b37 100644 (file)
@@ -1098,10 +1098,7 @@ CUPS-Add-Modify-Printer request:
 
 </dl>
 
-<p>The CUPS-Add-Modify-Printer request can optionally be followed by a PPD
-file or System V interface script to be used for the printer. The
-"ppd-name" attribute overrides any file that is attached to the end of
-the request with a local CUPS PPD file.
+<p>The CUPS-Add-Modify-Printer request can optionally be followed by a PPD file to be used for the printer. The "ppd-name" attribute overrides any file that is attached to the end of the request with a local CUPS PPD file.
 
 <h4>CUPS-Add-Modify-Printer Response</h4>
 
index 356b3537d9e9079d44d3c7c9d055985b3ebe4c59..a12058526fb61c529f4cbef013089031507551dc 100644 (file)
@@ -12,7 +12,7 @@
 .\" which should have been included with this file.  If this file is
 .\" file is missing or damaged, see the license at "http://www.cups.org/".
 .\"
-.TH filter 7 "CUPS" "26 August 2015" "Apple Inc."
+.TH filter 7 "CUPS" "19 October 2015" "Apple Inc."
 .SH NAME
 filter \- cups file conversion filter interface
 .SH SYNOPSIS
@@ -202,10 +202,7 @@ The timezone of the server.
 .B USER
 The user executing the filter, typically "lp" or "root"; consult the \fIcups-files.conf\fR file for the current setting.
 .SH CONFORMING TO
-While the filter interface is compatible with System V interface
-scripts, it will only work with the System V interface script as the
-only filter.  Typically the interface script will be provided via the
-\fIlpadmin(8)\fR command using the \fI-i\fR option.
+While the filter interface is compatible with System V interface scripts, CUPS does not support System V interface scripts.
 .SH NOTES
 CUPS filters are not meant to be run directly by the user.
 Aside from the legacy System V interface issues (\fIargv[0]\fR is the printer name), CUPS filters also expect specific environment variables and file descriptors, and typically run in a user session that (on OS X) has additional restrictions that affect how it runs.
index f242b897030dd11a27025bb06a55aee844eca804..c0283f2da438760f25f15c60f046f5f7eb17623a 100644 (file)
@@ -12,7 +12,7 @@
 .\" which should have been included with this file.  If this file is
 .\" file is missing or damaged, see the license at "http://www.cups.org/".
 .\"
-.TH lpadmin 8 "CUPS" "11 February 2015" "Apple Inc."
+.TH lpadmin 8 "CUPS" "19 October 2015" "Apple Inc."
 .SH NAME
 lpadmin \- configure cups printers and classes
 .SH SYNOPSIS
@@ -82,16 +82,17 @@ The following options are recognized when configuring a printer queue:
 Adds the named \fIprinter\fR to \fIclass\fR.
 If \fIclass\fR does not exist it is created automatically.
 .TP 5
-\fB\-i \fIinterface\fR
-Sets a System V style interface script for the printer.
-This option cannot be specified with the \fI-P\fR option (PPD file) and is intended for providing support for legacy printer drivers.
+\fB\-i \fIppd-file\fR
+.TP 5
+\fB\-P \fIppd-file\fR
+Specifies a PostScript Printer Description (PPD) file to use with the printer.
 .TP 5
 \fB\-m \fImodel\fR
-Sets a standard System V interface script or PPD file for the printer from the \fImodel\fR directory or using one of the driver interfaces.
+Sets a standard PPD file for the printer from the \fImodel\fR directory or using one of the driver interfaces.
 Use the \fI-m\fR option with the
 .BR lpinfo (8)
 command to get a list of supported models.
-The model "raw" clears any existing interface script or PPD file and the model "everywhere" queries the printer referred to by the specified IPP \fIdevice-uri\fR.
+The model "raw" clears any existing PPD file and the model "everywhere" queries the printer referred to by the specified IPP \fIdevice-uri\fR.
 .TP 5
 \fB\-o cupsIPPSupplies=true\fR
 .TP 5
@@ -189,10 +190,6 @@ programs on the destination.
 .TP 5
 \fB\-L "\fIlocation\fB"\fR
 Provides a textual location of the destination.
-.TP 5
-\fB\-P \fIppd-file\fR
-Specifies a PostScript Printer Description file to use with the printer.
-If specified, this option overrides the \fI-i\fR option (interface script).
 .SH CONFORMING TO
 Unlike the System V printing system, CUPS allows printer names to contain any printable character except SPACE, TAB, "/", or "#".
 Also, printer and class names are \fInot\fR case-sensitive.
index efc4abc0e66c23029ccf066c73484ffaa7e371be..b1172230ccb330fd7d7a6f622e07c8cea747aa42 100644 (file)
@@ -3,7 +3,7 @@
 #
 # ESP Package Manager (EPM) file list for CUPS.
 #
-# Copyright 2007-2014 by Apple Inc.
+# Copyright 2007-2015 by Apple Inc.
 # Copyright 1997-2007 by Easy Software Products, all rights reserved.
 #
 # These coded instructions, statements, and computer programs are the
@@ -524,7 +524,6 @@ f 0444 root sys $DATADIR/templates templates/*.tmpl
 
 # Config files
 d 0755 root $CUPS_GROUP $SERVERROOT -
-d 0755 root $CUPS_GROUP $SERVERROOT/interfaces -
 d 0755 root $CUPS_GROUP $SERVERROOT/ppd -
 d 0700 root $CUPS_GROUP $SERVERROOT/ssl -
 c $CUPS_PERM root $CUPS_GROUP $SERVERROOT/cups-files.conf conf/cups-files.conf
index 481e20cfcc9c0d394de118da4b241dad6a1602c2..46faef2cc2b0a02dfc09f2daf4417820196705f5 100644 (file)
@@ -168,7 +168,6 @@ rm -rf $RPM_BUILD_ROOT
 /etc/cups/cups-files.conf.default
 /etc/cups/cupsd.conf.default
 /etc/cups/snmp.conf.default
-%dir /etc/cups/interfaces
 %dir /etc/cups/ppd
 %attr(0700,root,root) %dir /etc/cups/ssl
 
index d6e9dc2182c4414e7a0e6bcc4958f19e8321b206..14c8f1ab9cef3abba53176b491bcb326d1c0fc32 100644 (file)
@@ -149,8 +149,6 @@ install-data:
        $(INSTALL_DIR) -m 755 $(SERVERBIN)/driver
        echo Creating $(SERVERROOT)...
        $(INSTALL_DIR) -m 755 -g $(CUPS_GROUP) $(SERVERROOT)
-       echo Creating $(SERVERROOT)/interfaces...
-       $(INSTALL_DIR) -m 755 -g $(CUPS_GROUP) $(SERVERROOT)/interfaces
        echo Creating $(SERVERROOT)/ppd...
        $(INSTALL_DIR) -m 755 -g $(CUPS_GROUP) $(SERVERROOT)/ppd
        if test "x`uname`" != xDarwin; then \
index 73f3228d5fb3ee576b2745333abf60a2037c63a3..46ed9cffdfb056d1e5963cef66746adabc4e92cf 100644 (file)
@@ -448,6 +448,12 @@ cat_ppd(const char *name,          /* I - PPD name */
   * Figure out if this is a static or dynamic PPD file...
   */
 
+  if (strstr(name, "../"))
+  {
+    fputs("ERROR: Invalid PPD name.\n", stderr);
+    return (1);
+  }
+
   strlcpy(scheme, name, sizeof(scheme));
   if ((sptr = strchr(scheme, ':')) != NULL)
   {
index 624f219ad4d62e49c998794207c92eeff126d068..c0834c0a204e4872dabf3c2289f040fa456c8369 100644 (file)
@@ -2187,7 +2187,7 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
   char         srcfile[1024],          /* Source Script/PPD file */
                dstfile[1024];          /* Destination Script/PPD file */
   int          modify;                 /* Non-zero if we are modifying */
-  int          changed_driver,         /* Changed the PPD/interface script? */
+  int          changed_driver,         /* Changed the PPD? */
                need_restart_job,       /* Need to restart job? */
                set_device_uri,         /* Did we set the device URI? */
                set_port_monitor;       /* Did we set the port monitor? */
@@ -2572,7 +2572,7 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
     cupsdSetString(&printer->device_uri, "file:///dev/null");
 
  /*
-  * See if we have an interface script or PPD file attached to the request...
+  * See if we have a PPD file attached to the request...
   */
 
   if (con->filename)
@@ -2596,118 +2596,74 @@ add_printer(cupsd_client_t  *con,      /* I - Client connection */
       * Then see what kind of file it is...
       */
 
-      snprintf(dstfile, sizeof(dstfile), "%s/interfaces/%s", ServerRoot,
-               printer->name);
-
-      if (!strncmp(line, "*PPD-Adobe", 10))
+      if (strncmp(line, "*PPD-Adobe", 10))
       {
-       /*
-       * The new file is a PPD file, so remove any old interface script
-       * that might be lying around...
-       */
-
-       unlink(dstfile);
-      }
-      else
-      {
-       /*
-       * This must be an interface script, so move the file over to the
-       * interfaces directory and make it executable...
-       */
-
-       if (copy_file(srcfile, dstfile, ConfigFilePerm | 0110))
-       {
-          send_ipp_status(con, IPP_INTERNAL_ERROR,
-                         _("Unable to copy interface script - %s"),
-                         strerror(errno));
-         return;
-       }
-
-       cupsdLogMessage(CUPSD_LOG_DEBUG,
-                       "Copied interface script successfully");
+       send_ipp_status(con, IPP_STATUS_ERROR_DOCUMENT_FORMAT_NOT_SUPPORTED, _("Bad PPD file."));
+       return;
       }
 
       snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot,
                printer->name);
 
-      if (!strncmp(line, "*PPD-Adobe", 10))
-      {
-       /*
-       * The new file is a PPD file, so move the file over to the
-       * ppd directory and make it readable by all...
-       */
-
-       if (copy_file(srcfile, dstfile, ConfigFilePerm))
-       {
-          send_ipp_status(con, IPP_INTERNAL_ERROR,
-                         _("Unable to copy PPD file - %s"),
-                         strerror(errno));
-         return;
-       }
+     /*
+      * The new file is a PPD file, so move the file over to the ppd
+      * directory...
+      */
 
-       cupsdLogMessage(CUPSD_LOG_DEBUG,
-                       "Copied PPD file successfully");
-      }
-      else
+      if (copy_file(srcfile, dstfile, ConfigFilePerm))
       {
-       /*
-       * This must be an interface script, so remove any old PPD file that
-       * may be lying around...
-       */
-
-       unlink(dstfile);
+       send_ipp_status(con, IPP_INTERNAL_ERROR, _("Unable to copy PPD file - %s"), strerror(errno));
+       return;
       }
+
+      cupsdLogMessage(CUPSD_LOG_DEBUG, "Copied PPD file successfully");
     }
   }
-  else if ((attr = ippFindAttribute(con->request, "ppd-name",
-                                    IPP_TAG_NAME)) != NULL)
+  else if ((attr = ippFindAttribute(con->request, "ppd-name", IPP_TAG_NAME)) != NULL)
   {
+    const char *ppd_name = ippGetString(attr, 0, NULL);
+                                       /* ppd-name value */
+
     need_restart_job = 1;
     changed_driver   = 1;
 
-    if (!strcmp(attr->values[0].string.text, "raw"))
+    if (!strcmp(ppd_name, "raw"))
     {
      /*
-      * Raw driver, remove any existing PPD or interface script files.
+      * Raw driver, remove any existing PPD file.
       */
 
-      snprintf(dstfile, sizeof(dstfile), "%s/interfaces/%s", ServerRoot,
-               printer->name);
-      unlink(dstfile);
-
-      snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot,
-               printer->name);
+      snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot, printer->name);
       unlink(dstfile);
     }
+    else if (strstr(ppd_name, "../"))
+    {
+      send_ipp_status(con, IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES, _("Invalid ppd-name value."));
+      return;
+    }
     else
     {
      /*
       * PPD model file...
       */
 
-      snprintf(dstfile, sizeof(dstfile), "%s/interfaces/%s", ServerRoot,
-               printer->name);
-      unlink(dstfile);
-
-      snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot,
-               printer->name);
+      snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot, printer->name);
 
-      if (copy_model(con, attr->values[0].string.text, dstfile))
+      if (copy_model(con, ppd_name, dstfile))
       {
         send_ipp_status(con, IPP_INTERNAL_ERROR, _("Unable to copy PPD file."));
        return;
       }
 
-      cupsdLogMessage(CUPSD_LOG_DEBUG,
-                     "Copied PPD file successfully");
+      cupsdLogMessage(CUPSD_LOG_DEBUG, "Copied PPD file successfully");
     }
   }
 
   if (changed_driver)
   {
    /*
-    * If we changed the PPD/interface script, then remove the printer's cache
-    * file and clear the printer-state-reasons...
+    * If we changed the PPD, then remove the printer's cache file and clear the
+    * printer-state-reasons...
     */
 
     char cache_name[1024];             /* Cache filename for printer attrs */
@@ -4329,7 +4285,7 @@ copy_banner(cupsd_client_t *con,  /* I - Client connection */
 
 
 /*
- * 'copy_file()' - Copy a PPD file or interface script...
+ * 'copy_file()' - Copy a PPD file...
  */
 
 static int                             /* O - 0 = success, -1 = error */
@@ -4415,9 +4371,7 @@ copy_model(cupsd_client_t *con,           /* I - Client connection */
                                        /* cupsProtocol attribute */
 
 
-  cupsdLogMessage(CUPSD_LOG_DEBUG2,
-                 "copy_model(con=%p, from=\"%s\", to=\"%s\")",
-                 con, from, to);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "copy_model(con=%p, from=\"%s\", to=\"%s\")", con, from, to);
 
  /*
   * Run cups-driverd to get the PPD file...
@@ -5685,13 +5639,6 @@ delete_printer(cupsd_client_t  *con,     /* I - Client connection */
   * Remove any old PPD or script files...
   */
 
-  snprintf(filename, sizeof(filename), "%s/interfaces/%s", ServerRoot,
-           printer->name);
-  unlink(filename);
-  snprintf(filename, sizeof(filename), "%s/interfaces/%s.O", ServerRoot,
-           printer->name);
-  unlink(filename);
-
   snprintf(filename, sizeof(filename), "%s/ppd/%s.ppd", ServerRoot,
            printer->name);
   unlink(filename);
@@ -6699,16 +6646,17 @@ get_ppd(cupsd_client_t  *con,           /* I - Client connection */
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_ppd(%p[%d], %p[%s=%s])", con,
                   con->number, uri, uri->name, uri->values[0].string.text);
 
-  if (!strcmp(uri->name, "ppd-name"))
+  if (!strcmp(ippGetName(uri), "ppd-name"))
   {
    /*
     * Return a PPD file from cups-driverd...
     */
 
-    char       command[1024],  /* cups-driverd command */
-               options[1024],  /* Options to pass to command */
-               ppd_name[1024]; /* ppd-name */
-
+    const char *ppd_name = ippGetString(uri, 0, NULL);
+                                       /* ppd-name value */
+    char       command[1024],          /* cups-driverd command */
+               options[1024],          /* Options to pass to command */
+               oppd_name[1024];        /* Escaped ppd-name */
 
    /*
     * Check policy...
@@ -6720,14 +6668,23 @@ get_ppd(cupsd_client_t  *con,           /* I - Client connection */
       return;
     }
 
+   /*
+    * Check ppd-name value...
+    */
+
+    if (strstr(ppd_name, "../"))
+    {
+      send_ipp_status(con, IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES, _("Invalid ppd-name value."));
+      return;
+    }
+
    /*
     * Run cups-driverd command with the given options...
     */
 
     snprintf(command, sizeof(command), "%s/daemon/cups-driverd", ServerBin);
-    url_encode_string(uri->values[0].string.text, ppd_name, sizeof(ppd_name));
-    snprintf(options, sizeof(options), "get+%d+%s",
-             con->request->request.op.request_id, ppd_name);
+    url_encode_string(ppd_name, oppd_name, sizeof(oppd_name));
+    snprintf(options, sizeof(options), "get+%d+%s", ippGetRequestId(con->request), oppd_name);
 
     if (cupsdSendCommand(con, command, options, 0))
     {
@@ -6745,17 +6702,14 @@ get_ppd(cupsd_client_t  *con,           /* I - Client connection */
       * went wrong...
       */
 
-      send_ipp_status(con, IPP_INTERNAL_ERROR,
-                     _("cups-driverd failed to execute."));
+      send_ipp_status(con, IPP_INTERNAL_ERROR, _("cups-driverd failed to execute."));
     }
   }
-  else if (!strcmp(uri->name, "printer-uri") &&
-           cupsdValidateDest(uri->values[0].string.text, &dtype, &dest))
+  else if (!strcmp(ippGetName(uri), "printer-uri") && cupsdValidateDest(ippGetString(uri, 0, NULL), &dtype, &dest))
   {
     int        i;                      /* Looping var */
     char       filename[1024];         /* PPD filename */
 
-
    /*
     * Check policy...
     */
@@ -6770,14 +6724,12 @@ get_ppd(cupsd_client_t  *con,           /* I - Client connection */
     * See if we need the PPD for a class or remote printer...
     */
 
-    snprintf(filename, sizeof(filename), "%s/ppd/%s.ppd", ServerRoot,
-             dest->name);
+    snprintf(filename, sizeof(filename), "%s/ppd/%s.ppd", ServerRoot, dest->name);
 
     if ((dtype & CUPS_PRINTER_REMOTE) && access(filename, 0))
     {
-      con->response->request.status.status_code = CUPS_SEE_OTHER;
-      ippAddString(con->response, IPP_TAG_OPERATION, IPP_TAG_URI,
-                   "printer-uri", NULL, dest->uri);
+      send_ipp_status(con, IPP_STATUS_CUPS_SEE_OTHER, _("See remote printer."));
+      ippAddString(con->response, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, dest->uri);
       return;
     }
     else if (dtype & CUPS_PRINTER_CLASS)
@@ -6785,8 +6737,7 @@ get_ppd(cupsd_client_t  *con,             /* I - Client connection */
       for (i = 0; i < dest->num_printers; i ++)
         if (!(dest->printers[i]->type & CUPS_PRINTER_CLASS))
        {
-         snprintf(filename, sizeof(filename), "%s/ppd/%s.ppd", ServerRoot,
-                  dest->printers[i]->name);
+         snprintf(filename, sizeof(filename), "%s/ppd/%s.ppd", ServerRoot, dest->printers[i]->name);
 
           if (!access(filename, 0))
            break;
@@ -6796,9 +6747,8 @@ get_ppd(cupsd_client_t  *con,             /* I - Client connection */
         dest = dest->printers[i];
       else
       {
-        con->response->request.status.status_code = CUPS_SEE_OTHER;
-       ippAddString(con->response, IPP_TAG_OPERATION, IPP_TAG_URI,
-                    "printer-uri", NULL, dest->printers[0]->uri);
+       send_ipp_status(con, IPP_STATUS_CUPS_SEE_OTHER, _("See remote printer."));
+        ippAddString(con->response, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, dest->printers[0]->uri);
         return;
       }
     }
@@ -6809,9 +6759,7 @@ get_ppd(cupsd_client_t  *con,             /* I - Client connection */
 
     if ((con->file = open(filename, O_RDONLY)) < 0)
     {
-      send_ipp_status(con, IPP_NOT_FOUND,
-                      _("The PPD file \"%s\" could not be opened: %s"),
-                     uri->values[0].string.text, strerror(errno));
+      send_ipp_status(con, IPP_STATUS_ERROR_NOT_FOUND, _("The PPD file \"%s\" could not be opened: %s"), ippGetString(uri, 0, NULL), strerror(errno));
       return;
     }
 
@@ -6819,12 +6767,10 @@ get_ppd(cupsd_client_t  *con,           /* I - Client connection */
 
     con->pipe_pid = 0;
 
-    con->response->request.status.status_code = IPP_OK;
+    ippSetStatusCode(con->response, IPP_STATUS_OK);
   }
   else
-    send_ipp_status(con, IPP_NOT_FOUND,
-                    _("The PPD file \"%s\" could not be found."),
-                    uri->values[0].string.text);
+    send_ipp_status(con, IPP_STATUS_ERROR_NOT_FOUND, _("The PPD file \"%s\" could not be found."), ippGetString(uri, 0, NULL));
 }
 
 
index c80a0c6c180523e74fb90d7b48cae2b8fdee9b8c..ed733bc4d550cf99a69bba96879d9b1292a50483 100644 (file)
@@ -2344,37 +2344,19 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
     }
     else if (!(p->type & CUPS_PRINTER_REMOTE))
     {
-      char     interface[1024];        /* Interface script */
-
-
-      snprintf(interface, sizeof(interface), "%s/interfaces/%s", ServerRoot,
-              p->name);
-      if (!access(interface, X_OK))
-      {
-       /*
-       * Yes, we have a System V style interface script; use it!
-       */
-
-       snprintf(interface, sizeof(interface), "*/* 0 %s/interfaces/%s",
-                ServerRoot, p->name);
-       add_printer_filter(p, p->filetype, interface);
-      }
-      else
-      {
-       /*
-       * Add a filter from application/vnd.cups-raw to printer/name to
-       * handle "raw" printing by users.
-       */
+     /*
+      * Add a filter from application/vnd.cups-raw to printer/name to
+      * handle "raw" printing by users.
+      */
 
-       add_printer_filter(p, p->filetype, "application/vnd.cups-raw 0 -");
+      add_printer_filter(p, p->filetype, "application/vnd.cups-raw 0 -");
 
-       /*
-       * Add a PostScript filter, since this is still possibly PS printer.
-       */
+     /*
+      * Add a PostScript filter, since this is still possibly PS printer.
+      */
 
-       add_printer_filter(p, p->filetype,
-                          "application/vnd.cups-postscript 0 -");
-      }
+      add_printer_filter(p, p->filetype,
+                        "application/vnd.cups-postscript 0 -");
     }
 
     if (p->pc && p->pc->prefilters)
@@ -4881,32 +4863,13 @@ load_ppd(cupsd_printer_t *p)            /* I - Printer */
   }
   else
   {
-   /*
-    * If we have an interface script, add a filter entry for it...
-    */
-
-    char       interface[1024];        /* Interface script */
-
-
-    snprintf(interface, sizeof(interface), "%s/interfaces/%s", ServerRoot,
-            p->name);
-    if (!access(interface, X_OK))
-    {
-     /*
-      * Yes, we have a System V style interface script; use it!
-      */
-
-      ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
-                  "printer-make-and-model", NULL,
-                  "Local System V Printer");
-    }
-    else if (((!strncmp(p->device_uri, "ipp://", 6) ||
-               !strncmp(p->device_uri, "ipps://", 7)) &&
-             (strstr(p->device_uri, "/printers/") != NULL ||
-              strstr(p->device_uri, "/classes/") != NULL)) ||
-            ((strstr(p->device_uri, "._ipp.") != NULL ||
-              strstr(p->device_uri, "._ipps.") != NULL) &&
-             !strcmp(p->device_uri + strlen(p->device_uri) - 5, "/cups")))
+    if (((!strncmp(p->device_uri, "ipp://", 6) ||
+         !strncmp(p->device_uri, "ipps://", 7)) &&
+        (strstr(p->device_uri, "/printers/") != NULL ||
+         strstr(p->device_uri, "/classes/") != NULL)) ||
+       ((strstr(p->device_uri, "._ipp.") != NULL ||
+         strstr(p->device_uri, "._ipps.") != NULL) &&
+        !strcmp(p->device_uri + strlen(p->device_uri) - 5, "/cups")))
     {
      /*
       * Tell the client this is really a hard-wired remote printer.
index fa077b2b94c84b5c737261e674a0f1deef976b4b..eb7ce0fb2f33acec24c0d67e3307afb3f574378e 100644 (file)
@@ -58,7 +58,7 @@ main(int  argc,                       /* I - Number of command-line arguments */
                *val;           /* Pointer to allow/deny value */
   int          num_options;    /* Number of options */
   cups_option_t        *options;       /* Options */
-  char         *file,          /* New PPD file/interface script */
+  char         *file,          /* New PPD file */
                evefile[1024] = "";
                                /* IPP Everywhere PPD */
   const char   *ppd_name,      /* ppd-name value */
@@ -199,7 +199,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
            }
            break;
 
-        case 'i' : /* Use the specified interface script */
+        case 'P' : /* Use the specified PPD file */
+        case 'i' : /* Use the specified PPD file */
            if (argv[i][2])
              file = argv[i] + 2;
            else
@@ -208,9 +209,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
              if (i >= argc)
              {
-               _cupsLangPuts(stderr,
-                             _("lpadmin: Expected interface after \"-i\" "
-                               "option."));
+               _cupsLangPrintf(stderr, _("lpadmin: Expected PPD after \"-%c\" option."), argv[i - 1][1]);
                return (1);
              }
 
@@ -588,24 +587,6 @@ main(int  argc,                    /* I - Number of command-line arguments */
            }
            break;
 
-        case 'P' : /* Use the specified PPD file */
-           if (argv[i][2])
-             file = argv[i] + 2;
-           else
-           {
-             i ++;
-
-             if (i >= argc)
-             {
-               _cupsLangPuts(stderr,
-                             _("lpadmin: Expected PPD after \"-P\" option."));
-               return (1);
-             }
-
-             file = argv[i];
-           }
-           break;
-
        default :
            _cupsLangPrintf(stderr,
                            _("lpadmin: Unknown option \"%c\"."), argv[i][1]);
index 43e4c7a33098fbbb784b8dfcdde02f7c385bdece..7bfadeb12ba8355155e5d202aff077f92282b95b 100644 (file)
@@ -1835,11 +1835,7 @@ show_printers(const char  *printers,     /* I - Destinations */
          {
            _cupsLangPuts(stdout, _("\tConnection: direct"));
 
-           if (make_model && strstr(make_model, "System V Printer"))
-             _cupsLangPrintf(stdout,
-                             _("\tInterface: %s/interfaces/%s"),
-                             cg->cups_serverroot, printer);
-           else if (make_model && !strstr(make_model, "Raw Printer"))
+           if (make_model && !strstr(make_model, "Raw Printer"))
              _cupsLangPrintf(stdout,
                              _("\tInterface: %s/ppd/%s.ppd"),
                              cg->cups_serverroot, printer);
@@ -1958,11 +1954,7 @@ show_printers(const char  *printers,     /* I - Destinations */
              {
                _cupsLangPuts(stdout, _("\tConnection: direct"));
 
-               if (make_model && strstr(make_model, "System V Printer"))
-                 _cupsLangPrintf(stdout,
-                                 _("\tInterface: %s/interfaces/%s"),
-                                 cg->cups_serverroot, printer);
-               else if (make_model && !strstr(make_model, "Raw Printer"))
+               if (make_model && !strstr(make_model, "Raw Printer"))
                  _cupsLangPrintf(stdout,
                                  _("\tInterface: %s/ppd/%s.ppd"),
                                  cg->cups_serverroot, printer);