The Common Unix Printing System (CUPS) is a modular computer printing system for Unix-like operating systems that allows a computer to act as a powerful print server. A computer running CUPS is a host which can accept print jobs from client computers, process them, and send them to the appropriate printer.
CUPS consists of a Unix print spooler and scheduler, a filter system that converts the print data to a format that the printer will understand, and a backend system that sends this data to the print device. CUPS uses the Internet Printing Protocol (IPP) as the basis for managing print jobs and queues. It also provides the traditional System V and Berkeley command line interfaces, along with limited support for the server message block protocol (SMB). The device drivers CUPS supplies can be configured by using text files in Adobe's PostScript Printer Description (PPD) format. There are a number of user interfaces for different platforms that can configure CUPS, and it has a built-in web-based interface. CUPS is provided under the GNU General Public License and GNU Lesser General Public License, Version 2.
The primary advantage of CUPS is that it is a standard and modularised printing system that can process numerous data formats on the print server. Before CUPS, it was difficult to find a standard printer management system that would accommodate the very wide variety of printers on the market using their own printer languages and formats. For instance, the System V and Berkeley printing systems were largely incompatible with each other, and they required setting up complicated scripts and workarounds to convert from the program's data format to a format the printer understood. They often didn't know how to detect the file format that was being sent to the printer and thus could not automatically and correctly convert the data stream. They also did their data conversion on workstation rather than a central server.
With CUPS, it is far easier than before for printer manufacturers and printer driver developers to create drivers that work natively on the print server. As the processing is done on the server, it's also far easier to allow for network based printing than it had been with other Unix printing systems. One advantage is that when used with Samba, printers can be used on remote Windows computers and in fact generic PostScript drivers can be used for printing across the network.
The scheduler has an authorization module which controls what IPP and HTTP messages can pass through the system. Once the IPP/HTTP packets are authorised they are sent to the client module, which listens for and processes incoming connections. The client module is also responsible for executing external CGI programs as needed to support web-based printers, classes, and job status monitoring and administration. Once the client module has processed its requests, it sends them to the IPP module for further processing. This module does Uniform Resource Identifier (URI) validation to prevent a client from sidestepping any access controls or authentication on the HTTP server. The URI is a text string that indicates a name or address that can be used to refer to an abstract or physical resource on a network.
The scheduler allows for classes of printers. This is a method of grouping printers together to allow applications to send jobs to the class, which then means the scheduler will pick the first available printer in the class and direct the job to that printer. A jobs module manages print jobs, sending them to the filter and backend processes for final conversions and printing. It also monitors status messages from those filters and backends.
The scheduler has a configuration module it uses to access CUPS configuration files. It parses configuration files as well as initailizes CUPS data structures, and starts the CUPS program. The configuration module will stop CUPS services while it processes the configuration files and then restarts the service when it has finished processing them.
A logging module handles logging scheduler events for access, error, and page log files, whilst the main module handles timeouts and the dispatching of I/O requests for client connections; watches for signals and reloads the server configuration files as needed and handles child process errors and exits.
Other modules used by the scheduler are: the MIME module, which handles a Multipurpose Internet Mail Extensions (MIME) type and conversion database that is used in the filtering process while converting print data to a format the print device can understand; a PPD module that handles a list of Postscript Printer Description (PPD) files, a devices module that manages a list of devices that are available in the system, and a printers module that handles printers and PPDs within CUPS.
mime.types and mime.convs. mime.types defines the known file types that CUPS can accept data for, and mime.convs defines the program that processes that particular MIME type.
The mime.types file has the syntax:
mimetype { | [pattern-match }
For example, to detect an HTML file, you could use:
text/html html htm \
printable(0,1024) + (string(0,"
The second line matches the file contents to a MIME type by determining that the first kilobyte of text in the file holds printable characters and that those characters include html markup. If it determines that this matches it marks the file as of the MIME type text/html.
The mime.convs file has the syntax:
source destination cost program
The source field is the MIME type that is determined by looking up the mime.types file, while the destination field determines what output is requested and determines what program should be used. This is also looked up in mime.types. The cost field helps determine between different sets of filters when converting a file. The last field, program, determines what filter program to use to do the data conversion.
Some examples follow:
text/plain application/postscript 50 texttops
application/vnd.cups-postscript application/vnd.cups-raster 50 pstoraster
image/* application/vnd.cups-postscript 50 imagetops
image/* application/vnd.cups-raster 50 imagetoraster
Further information on these databases can be found at http://www.cups.org/sam.html#FILE_TYPING_FILTERING
This data can then be either converted into PostScript data or directly into raster data. If it is converted into postscript data an additional filter is applied called a prefilter, which runs the PostScript data through another PostScript converter so that it can add printer specific options like selecting page ranges to print, setting n-up mode and other device specific things.
After the pre-filtering is done, the data is sent directly to a CUPS backend (if using a PostScript printer), is passed to another filter (like Foomatic by linuxprinting.org), or is passed to Ghostscript, which coverts the PostScript into an intermediary CUPS-raster format (the MIME type is application/vnd.cups-raster).
The intermediary raster format is then passed onto a final filter which coverts the raster data to a printer specific format. The default filters that are included with CUPS are: raster to PCL, raster to ESC/P or ESC/P2 (an Epson printer language, now largely superseded by their new ESC/P-Raster format) and raster to Dymo (another printer company).
However, there are several other alternatives that can be used with CUPS. Easy Software Products (ESP), the creators of CUPS, have released their own CUPS filters; Gimp-Print is a range of high-quality printer drivers for (mostly) inkjet printers, and Turbo-Print for Linux has another range of quality printer drivers for a wide range of printers.
lp System V printing system command and the lpr Berkeley printing system commands are installed as compatible programs. This allows a standard interface to CUPS and allows maximum compatibility with existing applications that rely on these printing systems.
Apple Computer is using CUPS as printing system in their operating system Mac OS X from Version 10.2 (Jaguar) on.
The widget toolkit GTK+, on which GNOME is based, will include integrated printing support based on CUPS on its version 2.10, scheduled for a Q3 2006 release.
KDEPrint supports several different printing platforms, amongst which CUPS is one of the best supported. It replaced a previous version of printing support in KDE, qtcups and is backwards compatible with this module of KDE. kprinter, a dialogue box program, is now the main tool for sending jobs to the print device; it can also be started from the command line. KDEPrint includes a system to pre-filter any jobs before they are handed over to CUPS, or to handle jobs all on itself (such as converting files to PDF); these filters are described by a pair of Desktop/XML files.
KDEPrint's main components are a Print Dialog box, which allows printer properties to be modified, a Print Manager, which allows management of printers (adding and removing printers), an Add Printer Wizard, and a Job Viewer/Manager, which manages printer jobs (such as hold/release, cancel, move to another printer). There is also a CUPS configuration module that is integrated into KDE.
Before KDE 2.2, KDE used Kups, a GUI-tool that was a CUPS front-end and allowed the administration of classes, print queues and print jobs; it had a printer wizard to assist with adding new printers amongst other features.
This system was criticised by Eric Raymond in his piece The Luxury of Ignorance. Raymond had attempted to install CUPS using the Fedora Core 1 print manager and found it non-intuitive and criticised the interface designers for not designing with the user's point of view in mind. He found the idea of printer queues was not obvious because users create queues on their local computer but these queues are actually created on the CUPS server.
He also found the plethora of queue type options confusing as he could choose from between networked CUPS (IPP), networked Unix (LPD), networked Windows (SMB), networked Novell (NCP) or networked JetDirect. He found the help file singularly unhelpful and largely irrelevant to a user's needs. Raymond used CUPS as a general topic to show that user interface design on Linux desktops needs rethinking and more careful design. He stated:
The meta-problem here is that the configuration wizard does all the approved rituals (GUI with standardized clicky buttons, help popping up in a browser, etc. etc.) but doesn't have the central attribute these are supposed to achieve: discoverability. That is, the quality that every point in the interface has prompts and actions attached to it from which you can learn what to do next. Does your project have this quality?
—"The Luxury of Ignorance: An Open-Source Horror Story"
ESP Print Pro is a complete printing solution that prints international text, Adobe PostScript, PDF, HP-GL/2, GIF(SM), TIFF, PNG, JPEG/JFIF, SGI RGB, Sun Raster, PhotoCD, PBM, PGM, and PPM files transparently to over 5400 printers via serial, parallel, and network connections. ESP Print Pro is based on the Common UNIX Printing System and provides PostScript and image file RIPs to support non-PostScript printers.
CUPS 1.0 provided a simple class, job, and printer monitoring interface for web browsers. CUPS 1.1 replaced this interface with an enhanced administration interface that allows you to add, modify, delete, configure, and control classes, jobs, and printers.
CUPS 1.2 provides a revamped web interface, which features improved readability and design, support for automatically discovered printers and a better access to system logs and advanced setting.
The latest vulnerability is a denial of service exploit in the way that CUPS processes HTTP GET requests on the server. If CUPS receives a GET request with the string '/..'. then it can cause an error that can be remotely exploited. This issue was introduced in the 1.1.21 release.
On December 23, 2002, security firm iDefense found a security vulnerability in CUPS version 1.1.14-5 (or more specifically, xpdf 2.01). It involved passing an integer larger than 32-bits to CUPS in a PDF file, which is then processed by the pdftops filter (which comes with xpdf). This causes an integer overflow in the pdftops program and could cause CUPS to crash as pdftops tries to access an invalid memory address. An attacker could exploit this to create a denial of service attack. The security advisory also noted that if enough data was sent to CUPS then a buffer overflow attack could be exploited. iDefense successfully created a proof of concept program that exploited the vulnerability. The organisation SecuriTeam also created several proof of concept programs that exploited the bug. They also provided the lines of code that were exploitable in their security advisory.
Common Unix Printing System | CUPS | Common Unix Printing System | Common unix printing system | Common Unix Printing System | CUPS | CUPS
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Common Unix Printing System".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world