diff --git a/.codacy.yml b/.codacy.yml deleted file mode 100644 index 2a58bd4..0000000 --- a/.codacy.yml +++ /dev/null @@ -1,7 +0,0 @@ -engines: - cppcheck: - exclude_paths: - - **/* - shellcheck: - exclude_paths: - - **/* diff --git a/.lgtm.yml b/.lgtm.yml deleted file mode 100644 index 9777ebc..0000000 --- a/.lgtm.yml +++ /dev/null @@ -1,11 +0,0 @@ -path_classifiers: - test: - - exclude: 'locale/*.c' - -queries: - - exclude: cpp/integer-multiplication-cast-to-long - - exclude: cpp/missing-header-guard - - exclude: cpp/short-global-name - - exclude: cpp/tainted-format-string - - exclude: cpp/toctou-race-condition - - exclude: cpp/cleartext-transmission diff --git a/CHANGES.md b/CHANGES.md index dd8edc6..78a9a94 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,8 +1,265 @@ -CHANGES - OpenPrinting CUPS 2.4.2 - 2022-05-26 -============================================== +CHANGES - OpenPrinting CUPS +=========================== -Changes in CUPS v2.4.2 (26th May 2022) --------------------------------------- + +Changes in CUPS v2.4.16 (2025-12-04) +------------------------------------ + +- `cupsUTF8ToCharset` didn't validate 2-byte UTF-8 sequences, potentially + reading past the end of the source string (Issue #1438) +- The web interface did not support domain usernames fully (Issue #1441) +- Fixed an infinite loop issue in the GTK+ print dialog (Issue #1439) +- Fixed stopping scheduler on unknown directive in configuration (Issue #1443) + + +Changes in CUPS v2.4.15 (2025-11-27) +------------------------------------ + +- Fix various cupsd issues which cause local DoS (CVE-2025-61915) +- Fix unresponsive cupsd process caused by slow client (CVE-2025-58436) +- Fixed potential crash in `cups-driverd` when there are duplicate PPDs + (Issue #1355) +- Fixed error recovery when scanning for PPDs in `cups-driverd` (Issue #1416) + + +Changes in CUPS v2.4.14 (2025-09-11) +------------------------------------ + +- Fixed installation of localized index.html and templates (Issue #1362) + + +Changes in CUPS v2.4.13 (2025-09-11) +------------------------------------ + +- Blocked authentication using alternate methods in cupsd (CVE-2025-58060) +- Fixed extension tag handling in `ipp_read_io()` in libcups (CVE-2025-58364) +- Added `print-as-raster` printer and job attributes for forcing rasterization + (Issue #1282) +- Updated documentation (Issue #1086) +- Updated IPP backend to try a sanitized user name if the printer/server does + not like the value (Issue #1145) +- Updated the scheduler to send the "printer-added" or "printer-modified" events + whenever an IPP Everywhere PPD is installed (Issue #1244) +- Updated the scheduler to send the "printer-modified" event whenever the system + default printer is changed (Issue #1246) +- Fixed a memory leak in `httpClose` (Issue #1223) +- Fixed missing commas in `ippCreateRequestedArray` (Issue #1234) +- Fixed subscription issues in the scheduler and D-Bus notifier (Issue #1235) +- Fixed media-default reporting for custom sizes (Issue #1238) +- Fixed support for IPP/PPD options with periods or underscores (Issue #1249) +- Fixed parsing of real numbers in PPD compiler source files (Issue #1263) +- Fixed scheduler freezing with zombie clients (Issue #1264) +- Fixed support for the server name in the ErrorLog filename (Issue #1277) +- Fixed job cleanup after daemon restart (Issue #1315) +- Fixed handling of buggy DYMO USB printer serial numbers (Issue #1338) +- Fixed unreachable block in IPP backend (Issue #1351) +- Fixed memory leak in _cupsConvertOptions (Issue #1354) + + +Changes in CUPS v2.4.12 (2025-04-08) +------------------------------------ + +- GnuTLS follows system crypto policies now (Issue #1105) +- Added `NoSystem` SSLOptions value (Issue #1130) +- Now we raise alert for certificate issues (Issue #1194) +- Added Kyocera USB quirk (Issue #1198) +- The scheduler now logs a job's debugging history if the backend fails + (Issue #1205) +- Fixed a potential timing issue with `cupsEnumDests` (Issue #1084) +- Fixed a potential "lost PPD" condition in the scheduler (Issue #1109) +- Fixed a compressed file error handling bug (Issue #1070) +- Fixed a bug in the make-and-model whitespace trimming code (Issue #1096) +- Fixed a removal of IPP Everywhere permanent queue if installation failed + (Issue #1102) +- Fixed `ServerToken None` in scheduler (Issue #1111) +- Fixed invalid IPP keyword values created from PPD option names (Issue #1118) +- Fixed handling of "media" and "PageSize" in the same print request + (Issue #1125) +- Fixed client raster printing from macOS (Issue #1143) +- Fixed the default User-Agent string. +- Fixed a recursion issue in `ippReadIO`. +- Fixed handling incorrect radix in `scan_ps()` (Issue #1188) +- Fixed validation of dateTime values with time zones more than UTC+11 + (Issue #1201) +- Fixed attributes returned by the Create-Xxx-Subscriptions requests + (Issue #1204) +- Fixed `ippDateToTime` when using a non GMT/UTC timezone (Issue #1208) +- Fixed `job-completed` event notifications for jobs that are cancelled before + started (Issue #1209) +- Fixed DNS-SD discovery with `ippfind` (Issue #1211) + + +Changes in CUPS v2.4.11 (2024-09-30) +------------------------------------ + +- Updated the maximum file descriptor limit for `cupsd` to 64k-1 (Issue #989) +- Fixed `lpoptions -d` with a discovered but not added printer (Issue #833) +- Fixed incorrect error message for HTTP/IPP errors (Issue #893) +- Fixed JobPrivateAccess and SubscriptionPrivateAccess support for "all" + (Issue #990) +- Fixed issues with cupsGetDestMediaByXxx (Issue #993) +- Fixed adding and modifying of printers via the web interface (Issue #998) +- Fixed HTTP PeerCred authentication for domain users (Issue #1001) +- Fixed checkbox support (Issue #1008) +- Fixed printer state notifications (Issue #1013) +- Fixed IPP Everywhere printer setup (Issue #1033) + + +Changes in CUPS v2.4.10 (2024-06-18) +------------------------------------ + +- Fixed error handling when reading a mixed `1setOf` attribute. +- Fixed scheduler start if there is only domain socket to listen on (Issue #985) + + +Changes in CUPS v2.4.9 (2024-06-11) +----------------------------------- + +- Fixed domain socket handling (CVE-2024-35235) +- Fixed creating of `cupsUrfSupported` PPD keyword (Issue #952) +- Fixed searching for destinations in web ui (Issue #954) +- Fixed TLS negotiation using OpenSSL with servers that require the TLS SNI + extension. +- Really raised `cups_enum_dests()` timeout for listing available IPP printers + (Issue #751)... +- Fixed `Host` header regression (Issue #967) +- Fixed DNS-SD lookups of local services with Avahi (Issue #970) +- Fixed listing jobs in destinations in web ui. (Apple issue #6204) +- Fixed showing search query in web ui help page. (Issue #977) + + +Changes in CUPS v2.4.8 (2024-04-26) +----------------------------------- + +- Added warning if the device has to be asked for 'all,media-col-database' + separately (Issue #829) +- Added new value for 'lpstat' option '-W' - successfull - for getting + successfully printed jobs (Issue #830) +- Added support for PAM modules password-auth and system-auth (Issue #892) +- Updated IPP Everywhere printer creation error reporting (Issue #347) +- Updated and documented the MIME typing buffering limit (Issue #925) +- Now report an error for temporary printer defaults with lpadmin (Issue #237) +- Fixed mapping of PPD InputSlot, MediaType, and OutputBin values (Issue #238) +- Fixed "document-unprintable-error" handling (Issue #391) +- Fixed the web interface not showing an error for a non-existent printer + (Issue #423) +- Fixed printing of jobs with job name longer than 255 chars on older printers + (Issue #644) +- Really backported fix for Issue #742 +- Fixed `cupsCopyDestInfo` device connection detection (Issue #586) +- Fixed "Upgrade" header handling when there is no TLS support (Issue #775) +- Fixed memory leak when unloading a job (Issue #813) +- Fixed memory leak when creating color profiles (Issue #815) +- Fixed a punch finishing bug in the IPP Everywhere support (Issue #821) +- Fixed crash in `scan_ps()` if incoming argument is NULL (Issue #831) +- Fixed setting job state reasons for successful jobs (Issue #832) +- Fixed infinite loop in IPP backend if hostname is IP address with Kerberos + (Issue #838) +- Added additional check on socket if `revents` from `poll()` returns POLLHUP + together with POLLIN or POLLOUT in `httpAddrConnect2()` (Issue #839) +- Fixed crash in `ppdEmitString()` if `size` is NULL (Issue #850) +- Fixed reporting `media-source-supported` when sharing printer which has + numbers as strings instead of keywords as `InputSlot` values (Issue #859) +- Fixed IPP backend to support the "print-scaling" option with IPP printers + (Issue #862) +- Fixed potential race condition for the creation of temporary queues + (Issue #871) +- Fixed `httpGets` timeout handling (Issue #879) +- Fixed checking for required attributes during PPD generation (Issue #890) +- Fixed encoding of IPv6 addresses in HTTP requests (Issue #903) +- Fixed sending response headers to client (Issue #927) +- Fixed CGI program initialization and validation of form checkbox and text + fields. + + +Changes in CUPS v2.4.7 (2023-09-20) +----------------------------------- + +- CVE-2023-4504 - Fixed Heap-based buffer overflow when reading Postscript + in PPD files +- Added OpenSSL support for cupsHashData (Issue #762) +- Fixed delays in lpd backend (Issue #741) +- Fixed extensive logging in scheduler (Issue #604) +- Fixed hanging of `lpstat` on IBM AIX (Issue #773) +- Fixed hanging of `lpstat` on Solaris (Issue #156) +- Fixed printing to stderr if we can't open cups-files.conf (Issue #777) +- Fixed purging job files via `cancel -x` (Issue #742) +- Fixed RFC 1179 port reserving behavior in LPD backend (Issue #743) +- Fixed a bug in the PPD command interpretation code (Issue #768) +- Fixed Oki 407 freeze when printing larger jobs (Issue #877) + + +Changes in CUPS v2.4.6 (2023-06-22) +----------------------------------- + +- CVE-2023-34241: Fixed use-after-free when logging warnings in case of failures + in `cupsdAcceptClient()`. +- Fixed linking error on old MacOS (Issue #715) +- Fixed printing multiple files on specific printers (Issue #643) + + +Changes in CUPS v2.4.5 (2023-06-13) +----------------------------------- + +- Fixed corruption of locally saved certificates (Issue #724) + + +Changes in CUPS v2.4.4 (2023-06-06) +----------------------------------- + +- Fixed segfault in `cupsGetNamedDest()` when trying to get default printer, but + the default printer is not set (Issue #719) + + +Changes in CUPS v2.4.3 (2023-06-01) +----------------------------------- + +- CVE-2023-32360: Fixed default policy for CUPS-Get-Document operation +- CVE-2023-32324: Fixed possible heap buffer overflow in `_cups_strlcpy()`. +- Added a title with device uri for found network printers (Issues #402, #393) +- Added new media sizes defined by IANA (Issues #501) +- Added quirk for GoDEX label printers (Issue #440) +- Fixed `--enable-libtool-unsupported` (Issue #394) +- Fixed configuration on RISC-V machines (Issue #404) +- Fixed the `device_uri` invalid pointer for driverless printers with `.local` + hostname (Issue #419) +- Fixed an OpenSSL crash bug (Issue #409) +- Fixed a potential SNMP OID value overflow issue (Issue #431) +- Fixed an OpenSSL certificate loading issue (Issue #465) +- Fixed Brazilian Portuguese translations (Issue #288) +- Fixed `cupsd` default keychain location when building with OpenSSL + (Issue #529) +- Fixed default color settings for CMYK printers as well (Issue #500) +- Fixed duplicate PPD2IPP media-type names (Issue #688) +- Fixed InputSlot heuristic for photo sizes smaller than 5x7" if there is no + media-source in the request (Issue #569) +- Fixed invalid memory access during generating IPP Everywhere queue + (Issue #466) +- Fixed lprm if no destination is provided (Issue #457) +- Fixed memory leaks in `create_local_bg_thread()` (Issue #466) +- Fixed media size tolerance in `ippeveprinter` (Issue #487) +- Fixed passing command name without path into `ippeveprinter` (Issue #629) +- Fixed saving strings file path in `printers.conf` (Issue #710) +- Fixed TLS certificate generation bugs (Issue #652) +- `ippDeleteValues` would not delete the last value (Issue #556) +- Ignore some of IPP defaults if the application sends its PPD alternative + (Issue #484) +- Make `Letter` the default size in `ippevepcl` (Issue #543) +- Now accessing Admin page in Web UI requires authentication (Issue #518) +- Now look for default printer on network if needed (Issue #452) +- Now we poll `media-col-database` separately if we fail at first (Issue #599) +- Now report fax attributes and values as needed (Issue #459) +- Now localize HTTP responses using the Content-Language value (Issue #426) +- Raised file size limit for importing PPD via Web UI (Issue #433) +- Raised maximum listen backlog size to INT MAX (Issue #626) +- Update print-color-mode if the printer is modified via ColorModel PPD option + (Issue #451) +- Use localhost when printing via printer application (Issue #353) +- Write defaults into /etc/cups/lpoptions if we're root (Issue #456) + + +Changes in CUPS v2.4.2 (2022-05-26) +----------------------------------- - Fixed certificate strings comparison for Local authorization (CVE-2022-26691) - The `cupsFileOpen` function no longer opens files for append in read-write @@ -13,7 +270,7 @@ Changes in CUPS v2.4.2 (26th May 2022) - Fixed conditional jump based on uninitialized value in cups/ppd.c (Issue #329) - Fixed CSS related issues in CUPS Web UI (Issue #344) - Fixed copyright in CUPS Web UI trailer template (Issue #346) -- mDNS hostname in device uri is not resolved when installaling a permanent +- mDNS hostname in device uri is not resolved when installing a permanent IPP Everywhere queue (Issues #340, #343) - The `lpstat` command now reports when the scheduler is not running (Issue #352) @@ -37,8 +294,8 @@ Changes in CUPS v2.4.2 (26th May 2022) interface. -Changes in CUPS v2.4.1 (27th January 2020) ------------------------------------------- +Changes in CUPS v2.4.1 (2022-01-27) +----------------------------------- - The default color mode now is now configurable and defaults to the printer's reported default mode (Issue #277) @@ -53,8 +310,8 @@ Changes in CUPS v2.4.1 (27th January 2020) - Removed `purge-jobs` legacy code from CGI scripts and templates (Issue #325) -Changes in CUPS v2.4.0 (29th November 2021) -------------------------------------------- +Changes in CUPS v2.4.0 (2021-11-29) +----------------------------------- - Added configure option --with-idle-exit-timeout (Issue #294) - Added --with-systemd-timeoutstartsec configure option (Issue #298) @@ -64,16 +321,16 @@ Changes in CUPS v2.4.0 (29th November 2021) - Fixed and improved German translations (Issue #296, Issue #297) -Changes in CUPS v2.4rc1 (12th November 2021) --------------------------------------------- +Changes in CUPS v2.4rc1 (2021-11-12) +------------------------------------ - Added warning and debug messages when loading printers if the queue is raw or with driver (Issue #286) - Compilation now uses -fstack-protector-strong if available (Issue #285) -Changes in CUPS v2.4b1 (27th October 2021) ------------------------------------------- +Changes in CUPS v2.4b1 (2021-10-27) +----------------------------------- - Added support for CUPS running in a Snapcraft snap. - Added basic OAuth 2.0 client support (Issue #100) @@ -136,6 +393,8 @@ Changes in CUPS v2.4b1 (27th October 2021) - Fixed support for "job-hold-until" with the Restart-Job operation (Issue #250) - Fixed the default color/grayscale presets for IPP Everywhere PPDs (Issue #262) - Fixed support for the 'offline-report' state for all USB backends (Issue #264) +- Fixed an integer overflow in the PWG media size name formatting code + (Issue #668) - Documentation fixes (Issue #92, Issue #163, Issue #177, Issue #184) - Localization updates (Issue #123, Issue #129, Issue #134, Issue #146, Issue #164) @@ -151,94 +410,3 @@ Changes in CUPS v2.4b1 (27th October 2021) `SMBConfigFile` directives in `cupsd.conf` and `cups-files.conf`. - Stubbed out deprecated `httpMD5` functions. - Add test for undefined page ranges during printing. - - -CUPS v2.3.3op2 (February 1, 2021) ---------------------------------- - -- Security: Fixed a buffer (read) overflow in the `ippReadIO` function - (CVE-2020-10001) -- Clarified the documentation for the "Listen" directive (Issue #53) -- Fixed duplicate ColorModel entries for AirPrint printers (Issue 59) -- Fixed directory/permission defaults for Debian kfreebsd-based systems - (Issue #60, Issue #61) -- Fixed crash bug in `ppdOpen` (Issue #64, Issue #78) -- Fixed regression in `snprintf` emulation function (Issue #67) -- The scheduler's systemd service file now waits for the nslcd service to start - (Issue #69) -- The libusb-based USB backend now uses a simpler read timer implementation to - avoid a regression in a previous change (Issue #72) -- The PPD caching code now only tracks the `APPrinterIconPath` value on macOS - (Issue #73) -- Fixed segfault in help.cgi when searching in man pages (Issue #81) -- Root certificates were incorrectly stored in "~/.cups/ssl". - - -CUPS v2.3.3op1 (November 27, 2020) ----------------------------------- - -- The automated test suite can now be activated using `make test` for - consistency with other projects and CI environments - the old `make check` - continues to work as well, and the previous test server behavior can be - accessed by running `make testserver`. -- ippeveprinter now supports multiple icons and strings files. -- ippeveprinter now uses the system's FQDN with Avahi. -- ippeveprinter now supports Get-Printer-Attributes on "/". -- ippeveprinter now uses a deterministic "printer-uuid" value. -- ippeveprinter now uses system sounds on macOS for Identify-Printer. -- Updated ippfind to look for files in "~/Desktop" on Windows. -- Updated ippfind to honor `SKIP-XXX` directives with `PAUSE`. -- Updated IPP Everywhere support to work around printers that only advertise - color raster support but really also support grayscale (Issue #1) -- ipptool now supports DNS-SD URIs like `ipps://My%20Printer._ipps._tcp.local` - (Issue #5) -- The scheduler now allows root backends to have world read permissions but not - world execute permissions (Issue #21) -- Failures to bind IPv6 listener sockets no longer cause errors if IPv6 is - disabled on the host (Issue #25) -- The SNMP backend now supports the HP and Ricoh vendor MIBs (Issue #28) -- The scheduler no longer includes a timestamp in files it writes (Issue #29) -- The systemd service names are now "cups.service" and "cups-lpd.service" - (Issue #30, Issue #31) -- The scheduler no longer adds the local hostname to the ServerAlias list - (Issue #32) -- Added `LogFileGroup` directive in "cups-files.conf" to control the group - owner of log files (Issue #34) -- Added `--with-max-log-size` configure option (Issue #35) -- Added `--enable-sync-on-close` configure option (Issue #37) -- Added `--with-error-policy` configure option (Issue #38) -- IPP Everywhere PPDs could have an "unknown" default InputSlot (Issue #44) -- The `httpAddrListen` function now uses a listen backlog of 128. -- Added USB quirks (Apple issue #5789, #5823, #5831) -- Fixed IPP Everywhere v1.1 conformance issues in ippeveprinter. -- Fixed DNS-SD name collision support in ippeveprinter. -- Fixed compiler and code analyzer warnings. -- Fixed TLS support on Windows. -- Fixed ippfind sub-type searches with Avahi. -- Fixed the default hostname used by ippeveprinter on macOS. -- Fixed resolution of local IPP-USB printers with Avahi. -- Fixed coverity issues (Issue #2) -- Fixed `httpAddrConnect` issues (Issue #3) -- Fixed web interface device URI issue (Issue #4) -- Fixed lp/lpr "printer/class not found" error reporting (Issue #6) -- Fixed xinetd support for LPD clients (Issue #7) -- Fixed libtool build issue (Issue #11) -- Fixed a memory leak in the scheduler (Issue #12) -- Fixed a potential integer overflow in the PPD hashing code (Issue #13) -- Fixed output-bin and print-quality handling issues (Issue #18) -- Fixed PPD options getting mapped to odd IPP values like "tray---4" (Issue #23) -- Fixed remote access to the cupsd.conf and log files (Issue #24) -- Fixed the automated test suite when running in certain build/CI environments - (Issue #25) -- Fixed a logging regression caused by a previous change for Apple issue #5604 - (Issue #25) -- Fixed fax phone number handling with GNOME (Issue #40) -- Fixed potential rounding error in rastertopwg filter (Issue #41) -- Fixed the "uri-security-supported" value from the scheduler (Issue #42) -- Fixed IPP backend crash bug with "printer-alert" values (Issue #43) -- Removed old Solaris inetconv(1m) reference in cups-lpd man page (Issue #46) -- Fixed default options that incorrectly use the "custom" prefix (Issue #48) -- Fixed a memory leak when resolving DNS-SD URIs (Issue #49) -- Fixed systemd status reporting by adopting the notify interface (Issue #51) -- Fixed crash in rastertopwg (Apple issue #5773) -- Fixed cupsManualCopies values in IPP Everywhere PPDs (Apple issue #5807) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5d6dc68..f20e309 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,5 +6,5 @@ the Apache License, Version 2.0 with exceptions to allow linking to GPL2/LGPL2 code. Contributions should be submitted either as pull requests or as attachments -(unified diffs) to bug reports on the OpenPrinting CUPS Github project at +(unified diffs) to bug reports on the OpenPrinting CUPS GitHub project at . diff --git a/CREDITS.md b/CREDITS.md index 0fee643..665125e 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -16,7 +16,7 @@ to thank the following individuals for their contributions: fixes. Bjoern Jacke - I18N stuff. Wang Jian - CUPS RPM corrections. - Roderick Johnstone - Beta tester of the millenium. + Roderick Johnstone - Beta tester of the millennium. Till Kamppeter - Bug fixes, beta testing, evangelism. Tomohiro Kato - Japanese localization. Kiko - Bug fixes. diff --git a/DEVELOPING.md b/DEVELOPING.md index c5e9887..087a7f6 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -120,6 +120,16 @@ Manual, which is generated using the [codedoc](https://www.msweet.org/codedoc) software. +### Copyright notice + +If there are changes for a file, which contains copyright notice already +and the notice is not updated for the current year, update the year of copyright +notice to include the current year. + +Only the following files must have copyright notice updated every year: README.md, +NOTICE, index.html.in, and header.html.in. + + ### Source Files All source files names must consist of lowercase ASCII letters, numbers, dash @@ -137,7 +147,7 @@ the source file and the copyright and licensing notice: /* * Description of file contents. * - * Copyright © 2021-2022 by OpenPrinting + * Copyright © 2021-2023 by OpenPrinting * * Licensed under Apache License v2.0. See the file "LICENSE" for more * information. @@ -379,7 +389,7 @@ of the file, and CUPS copyright and license notice: # # Makefile for ... # - # Copyright © 2021-2022 by OpenPrinting + # Copyright © 2021-2023 by OpenPrinting # # Licensed under Apache License v2.0. See the file "LICENSE" for more # information. diff --git a/INSTALL.md b/INSTALL.md index 3ab3972..452baad 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -39,6 +39,12 @@ prerequisites: libsystemd-dev libusb-1.0-0-dev zlib1g-dev +For Fedora you can install these packages: + + sudo dnf install autoconf make automake gcc gcc-c++ krb5-devel avahi-devel \ + gnutls-devel krb5-libs nss-mdns pam-devel \ + systemd-devel libusb1-devel zlib-devel + Configuration ------------- diff --git a/Makedefs.in b/Makedefs.in index 07010f0..6158e61 100644 --- a/Makedefs.in +++ b/Makedefs.in @@ -1,7 +1,7 @@ # # Common makefile definitions for CUPS. # -# Copyright © 2021 by OpenPrinting. +# Copyright © 2020-2025 by OpenPrinting. # Copyright © 2007-2019 by Apple Inc. # Copyright © 1997-2007 by Easy Software Products, all rights reserved. # @@ -77,8 +77,6 @@ CUPS_LOG_FILE_PERM = @CUPS_LOG_FILE_PERM@ # LANGUAGES = @LANGUAGES@ -INSTALL_LANGUAGES = @INSTALL_LANGUAGES@ -UNINSTALL_LANGUAGES = @UNINSTALL_LANGUAGES@ # # Cross-compilation support: "local" target is used for any tools that are @@ -223,7 +221,6 @@ top_srcdir = @top_srcdir@ BUILDROOT = $(DSTROOT)$(DESTDIR) BINDIR = $(BUILDROOT)@bindir@ -BUNDLEDIR = @CUPS_BUNDLEDIR@ CACHEDIR = $(BUILDROOT)@CUPS_CACHEDIR@ DATADIR = $(BUILDROOT)@CUPS_DATADIR@ DOCDIR = $(BUILDROOT)@CUPS_DOCROOT@ @@ -239,7 +236,6 @@ RCLEVELS = @RCLEVELS@ RCSTART = @RCSTART@ RCSTOP = @RCSTOP@ REQUESTS = $(BUILDROOT)@CUPS_REQUESTS@ -RESOURCEDIR = @CUPS_RESOURCEDIR@ SBINDIR = $(BUILDROOT)@sbindir@ SERVERBIN = $(BUILDROOT)@CUPS_SERVERBIN@ SERVERROOT = $(BUILDROOT)@CUPS_SERVERROOT@ diff --git a/Makefile b/Makefile index a28d7f2..01321d5 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # # Top-level Makefile for CUPS. # -# Copyright © 2020-2022 by OpenPrinting +# Copyright © 2020-2023 by OpenPrinting # Copyright © 2007-2019 by Apple Inc. # Copyright © 1997-2007 by Easy Software Products, all rights reserved. # diff --git a/NOTICE b/NOTICE index 72a2f1b..4f08f01 100644 --- a/NOTICE +++ b/NOTICE @@ -1,6 +1,6 @@ CUPS -Copyright © 2020-2022 by OpenPrinting +Copyright © 2020-2025 by OpenPrinting Copyright © 2007-2019 by Apple Inc. Copyright © 1997-2007 by Easy Software Products. diff --git a/README.md b/README.md index a27aa44..7791ee9 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,10 @@ -OpenPrinting CUPS v2.4.2 -======================== +OpenPrinting CUPS v2.4.16 +========================= ![Version](https://img.shields.io/github/v/release/openprinting/cups?include_prereleases) ![Apache 2.0](https://img.shields.io/github/license/openprinting/cups) [![Build and Test](https://github.com/OpenPrinting/cups/workflows/Build%20and%20Test/badge.svg)](https://github.com/OpenPrinting/cups/actions/workflows/build.yml) [![Coverity Scan](https://img.shields.io/coverity/scan/23806)](https://scan.coverity.com/projects/openprinting-cups) -[![Codacy Badge](https://app.codacy.com/project/badge/Grade/4ea68dc02692436b82541b6f232eba66)](https://www.codacy.com/gh/OpenPrinting/cups/dashboard?utm_source=github.com&utm_medium=referral&utm_content=OpenPrinting/cups&utm_campaign=Badge_Grade) -[![LGTM Grade](https://img.shields.io/lgtm/grade/cpp/github/OpenPrinting/cups)](https://lgtm.com/projects/g/OpenPrinting/cups/?mode=list) Introduction @@ -51,6 +49,7 @@ the CUPS sources: - `LICENSE`: The CUPS license agreement (Apache 2.0). - `NOTICE`: Copyright notices and exceptions to the CUPS license agreement. - `README.md`: This file. +- `REPORTING_ISSUES.md`: Instructions what information to provide when reporting an issue. Once you have installed the software you can access the documentation (and a bunch of other stuff) online at and using the `man` @@ -62,15 +61,6 @@ the `doc/help` and `man` directories. *Please read the documentation before asking questions.* -Getting Support and Other Resources ------------------------------------ - -In addition to the OpenPrinting CUPS home page at -, we provide a mailing list for CUPS users -and developers to ask questions and discuss issues at -. - - Setting Up Printers ------------------- @@ -163,7 +153,7 @@ This will prevent the filters from misinterpreting your print file. Legal Stuff ----------- -Copyright © 2020-2022 by OpenPrinting +Copyright © 2020-2025 by OpenPrinting Copyright © 2007-2020 by Apple Inc. diff --git a/REPORTING_ISSUES.md b/REPORTING_ISSUES.md new file mode 100644 index 0000000..a2a5001 --- /dev/null +++ b/REPORTING_ISSUES.md @@ -0,0 +1,176 @@ +# REPORTING ISSUES FOR CUPS PROJECT + +> Disclaimer: We provide only best effort support for CUPS releases older than the latest release. This means we try to reproduce the issue on the latest release if it is possible, and if we can't reproduce, we can give a hint what can be the problem and ask you to contact your distribution support. + +> All commands are written from point of view of user which has superuser rights (f.e. he is in `wheel` on Linux system) or he is in a group defined in SystemGroup directive in `/etc/cups/cups-files.conf`. Other users will have to use `sudo` with certain commands. + +The steps you are asked to do differ based on how your printer is connected (USB/network) and whether you use driverless printing or not. Since the connection is obvious for the user, the paragraph below will tell you how to find out whether driverless printing is used. + + +## HOW TO FIND OUT THAT I USE DRIVERLESS PRINTING + +For network printers: +* your printer is seen by `lpstat -e`, but not by `lpstat -a` - this means you print via temporary queue, which works only via driverless means, + +or + +* your printer is seen by `lpstat -a`, its PPD file at `/etc/cups/ppd` has `IPP Everywhere` or `driverless` in its `Nickname` entry and its connection is `ipp` or `ipps` when you check the connection uri (f.e. by `lpstat -v `) + +If any of them apply, your device works in driverless mode. + +For USB printers: +* your printer is listed if you enter: + +``` + $ sudo ipp-usb check +``` + +in case the printer is not listed or the command is not found, your device doesn't work in driverless mode. + + +## HOW TO REPORT THE ISSUE TO CUPS PROJECT + +Please do the steps below and provide the mentioned information (**use attachments for blocks of text longer than 10 lines** - put the text into a file, rename it to have .txt suffix and click on `pasting them` string under comment box in the issue) in your initial comment if you file an issue: + +1. tell us what is **your OS** +2. tell us your **CUPS version** +3. in case you compile CUPS by yourself, tell us **all configuration options** you pass into `./configure` +4. **describe** the problem +5. mention your **printer model** +6. try to **narrow the issue if possible**: + + 1. check how the printing works via CUPS CLI tools, f.e.: + + See whether the printer is available (f.e. in case the printer is not shown in application) - shows both temporary and permanent queues: + + ``` + $ lpstat -e + HP_LaserJet_M1536dnf_MFP_42307C + ``` + + See whether there are installed printers which accept jobs: + + ``` + $ lpstat -a + ``` + + See its available options (in case an application doesn't show some options): + + ``` + $ lpoptions -p HP_LaserJet_M1536dnf_MFP_42307C -l + PageSize/Media Size: 184x260mm 195x270mm *A4 A5 B5 DoublePostcardRotated Env10 EnvC5 EnvDL EnvMonarch Executive FanFoldGermanLegal ISOB5 Legal Letter Postcard roc16k + MediaType/Media Type: *Stationery StationeryLightweight Midweight StationeryHeavyweight ExtraHeavy ColorTransparency Labels StationeryLetterhead Envelope StationeryPreprinted StationeryPrepunched Color Bond Recycled Rough Vellum + cupsPrintQuality/cupsPrintQuality: Draft *Normal + ColorModel/Output Mode: *Gray + Duplex/Duplex: *None DuplexNoTumble DuplexTumble + OutputBin/OutputBin: *FaceDown + ``` + + Print a file to a printer with specific options (in case the printout from application is incorrect - print the same file and set the same options as you did in application, in case they are seen in `lpoptions`), f.e. to check duplex printing on a document you want to print (put the path to the document instead of ): + + ``` + $ lp -d HP_LaserJet_M1536dnf_MFP_42307C -o Duplex=DuplexNoTumble + ``` + + For more info check `man lp`, `man lpstat`, `man lpoptions`. + + 2. check if the issue happens with different documents + 3. check if the issue happens when using different applications + 4. in case you use mDNS hostnames (hostnames with `.local`), check mDNS resolution by pinging such hostname - mDNS is used for temporary queues (printers which are seen by `lpstat -e`, but not by `lpstat -a`) or for permanent queues which have `.local` in its URI (check `lpstat -a`). However the hostname from URI is not resolvable as it is, you need to get usual printer's mDNS hostname from `hostname` entry in `avahi-browse -avrt` output. + + Rule of thumb: + 1. in case printing works from CUPS CLI tools or CUPS Web UI, but not via an application, file the issue to the application for the initial investigation. + 2. in case mDNS resolution doesn't work and you use driverless printing or mDNS hostnames in CUPS, file the issue to your mDNS resolution provider - it can be `nss-mdns` or `systemd-resolved` depending on your configuration. + +7. turn on **CUPS debug logging**: + +``` + $ cupsctl LogLevel=debug2 +``` + +8. **reproduce the issue** +9. **collect the logs** - the logs can be in `/var/log/cups/error_log` or in `journalctl`: + + For `error_log`: + ``` + $ sudo cp /var/log/cups/error_log ~/error_log.txt + $ sudo chmod 666 ~/error_log.txt + ``` + + For `journalctl`: + ``` + $ journalctl -u cups --since=today > log.txt + ``` + + and attach the file to the GitHub issue. + +10. provide output of **lpstat -e**, **lpstat -t** and **lpinfo -v** +11. provide **PPD file** from `/etc/cups/ppd` if exists for the printer +12. provide **the file you are trying to print**, if the issue happens with a specific file +13. provide **the d file from /var/spool/cups** - this is the file CUPS actually gets from the application +14. tell us the name of application where you experience the problem +15. if needed, turn off the debug logging by: + + ``` + $ cupsctl LogLevel=warn + ``` + +### INFORMATION REQUESTED FOR USB DEVICES + +* attach **output of `lsusb -v`** in a file as attachment +* in case of **communication issues with USB device**, it is helpful to **capture USB communication** - you have to know bus number where your device is connected to with `tcpdump`: + + ``` + $ lsusb + Bus 002 Device 010: ID 03f0:012a HP, Inc HP LaserJet M1536dnf MFP + = + $ sudo tcpdump -s0 -w usb.pcap -i usbmon2 + ``` + compress the `usb.pcap` with `zip` and attach it to the issue if the problem is with USB printer. + +#### INFORMATION REQUESTED FOR DRIVERLESS USB PRINTERS + +* **provide the file attr.log** from `ipptool` command if the command passes: + + ``` + $ ipptool --ippserver attr.log -v ipp://localhost:60000/ipp/print get-printer-attributes.test + ``` + +* compress **/var/log/ipp-usb** directory into `.zip` file and attach it to the issue + + +### INFORMATION REQUESTED FOR NETWORK DEVICES + +* **provide network.pcap.zip** which is network packet capture - **catch the network traffic** f.e. with tcpdump: + + ``` + $ sudo tcpdump -s0 -w network.pcap -i any host + ``` + +compress the `network.pcap` with `zip` and attach it to the issue. + +The communication can be encrypted - the person who investigates the issue can contact you off-issue for further data, because session keys will be needed as it is explained at [Wireshark wiki](https://wiki.wireshark.org/TLS) and a change in CUPS configuration (Wireshark is not able to decode IPPS directly, so the printer's connection has to be via HTTPS, which Wireshark can decrypt correctly). + +#### INFORMATION REQUESTED FOR DRIVERLESS NETWORK PRINTERS + +* **provide the file attr.log** from `ipptool` command, if the command passes: + +For network driverless printer: +``` + $ ipptool --ippserver attr.log -v ipp:///ipp/print get-printer-attributes.test +``` + +For driverless printer pointing to a printer at CUPS server: +``` + $ ipptool --ippserver attr.log -v ipp:///printers/ get-printer-attributes.test +``` + +For driverless printer installed in a printer application based on PAPPL: +``` + $ ipptool --ippserver attr.log -v ipp://localhost:8000/ipp/print/ get-printer-attributes.test +``` + + +## THANKS + +This document uses knowledge from documentation and tips written by Till Kamppeter, Brian Potkin, Mike R. Sweet, Johannes Meixner, Tim Waugh, Jiri Popelka and Zdenek Dohnal. Thank you for all your work! diff --git a/SECURITY.md b/SECURITY.md index 3db4e18..26fabbe 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -53,69 +53,10 @@ example: Reporting a Vulnerability ------------------------- -Report all security issues to "security AT msweet.org". Expect a response -within 5 business days. Any proposed embargo date should be at least 30 days -and no more than 90 days in the future. - - -PGP Public Key --------------- - -The following PGP public key can be used for signing security messages. - -``` ------BEGIN PGP PUBLIC KEY BLOCK----- -Comment: GPGTools - https://gpgtools.org - -mQINBF6L0RgBEAC8FTqc/1Al+pWW+ULE0OB2qdbiA2NBjEm0X0WhvpjkqihS1Oih -ij3fzFxKJ+DgutQyDb4QFD8tCFL0f0rtNL1Iz8TtiAJjvlhL4kG5cdq5HYEchO10 -qFeZ1DqvnHXB4pbKouEQ7Q/FqB1PG+m6y2q1ntgW+VPKm/nFUWBCmhTQicY3FOEG -q9r90enc8vhQGOX4p01KR0+izI/g+97pWgMMj5N4zHuXV/GrPhlVgo3Wn1OfEuX4 -9vmv7GX4G17Me3E3LOo0c6fmPHJsrRG5oifLpvEJXVZW/RhJR3/pKMPSI5gW8Sal -lKAkNeV7aZG3U0DCiIVL6E4FrqXP4PPj1KBixtxOHqzQW8EJwuqbszNN3vp9w6jM -GvGtl8w5Qrw/BwnGC6Dmw+Qv04p9JRY2lygzZYcKuwZbLzBdC2CYy7P2shoKiymX -ARv+i+bUl6OmtDe2aYaqRkNDgJkpuVInBlMHwOyLP6fN2o7ETXQZ+0a1vQsgjmD+ -Mngkc44HRnzsIJ3Ga4WwW8ggnAwUzJ/DgJFYOSbRUF/djBT4/EFoU+/kjXRqq8/d -c8HjZtz2L27njmMw68/bYmY1TliLp50PXGzJA/KeY90stwKtTI0ufwAyi9i9BaYq -cGbdq5jnfSNMDdKW2kLCNTQeUWSSytMTsdU0Av3Jrv5KQF8x5GaXcpCOTwARAQAB -tExNaWNoYWVsIFN3ZWV0IChzZWN1cml0eUBtc3dlZXQub3JnKSAoU2VjdXJpdHkg -UEdQIEtleSkgPHNlY3VyaXR5QG1zd2VldC5vcmc+iQJUBBMBCgA+FiEEOElfSXYU -h91AF0sBpZiItz2feQIFAl6L0RgCGwMFCQeGH4AFCwkIBwMFFQoJCAsFFgIDAQAC -HgECF4AACgkQpZiItz2feQIhjhAAqZHuQJkPBsAKUvJtPiyunpR6JENTUIDxnVXG -nue+Zev+B7PzQ7C4CAx7vXwuWTt/BXoyQFKRUrm+YGiBTvLYQ8fPqudDnycSaf/A -n01Ushdlhyg1wmCBGHTgt29IkEZphNj6BebRd675RTOSD5y14jrqUb+gxRNuNDa5 -ZiZBlBE4A8TV6nvlCyLP5oXyTvKQRFCh4dEiL5ZvpoxnhNvJpSe1ohL8iJ9aeAd5 -JdakOKi8MmidRPYC5IldXwduW7VC7dtqSiPqT5aSN0GJ8nIhSpn/ZkOEAPHAtxxa -0VgjltXwUDktu74MUUghdg2vC1df2Z+PqHLsGEqOmxoBIJYXroIqSEpO3Ma7hz0r -Xg1AWHMR/xxiLXLxgaZRvTp7AlaNjbqww8JDG8g+nDIeGsgIwWN/6uPczledvDQa -HtlMfN97i+rt6sCu13UMZHpBKOGg7eAGRhgpOwpUqmlW1b+ojRHGkmZ8oJSE7sFT -gzSGNkmfVgA1ILl0mi8OBVZ4jlUg6EgVsiPlzolH92iscK7g50PdjzpQe0m3gmcL -dpOmSL8Fti05dPfamJzIvJd28kMZ6yMnACKj9rq/VpfgYBLK8dbNUjEOQ2oq7PyR -Ye/LE1OmAJwfZQkyQNI8yAFXoRJ8u3/bRb3SPvGGWquGBDKHv2K1XiCW65uyLe5B -RNJWmme5Ag0EXovRGAEQAJZMFeIMt/ocLskrp89ZyBTTiavFKn9+QW7C2Mb36A73 -J2g9vRFBSRizb+t8lSzP/T1GbKS0cEmfEpQppWImTbOMV6ZgxrM0IUy1Yd7Kyc0K -oNMZvykRYwVMzxB5hiQ88kCLfqTNCveIvu1xcB9pWkf+cuDmGCxA3I+yc3Eh/SOP -urDsHObt7fyEmJpSxCXlMFHRCuWyGXhMNvhR186t9mANW0PyxKJ8efr+2Vhm1+pA -Vk9JESac/lREvx9PVFmlPdqgqRkQ0TQB5+ROo9Wy77cxQr5+rvSZZff630I1YgZf -Ph6xOV1/q6vJ3RBNA2nPSTjPeeWQ7pTn7PZGJwCjIUjhMbO+EJVKUJNOAEg033mG -tLfbFUYdhA/dRgFuKz90loCMfsnf3e4o/TFydSHUuwBUtOWkL1BBWEbk95M/Zr00 -w5fD9knas1u5Lc4ogXzTFPnvJ6hM1RAFJEd+FYzJZIvzwrIx4Ag1DOKViVBpeLTu -HWj+xckEgvxEBglplALzfSIJ0CLQSNL8iMFbzCnPeUoQfPkqu37KHrB9syAA06Tb -qw1Ax0qBqKInGIgBd0w6dFLF3s04xVcPAXWyJ0w4I7h2bs+aD6YwwK6xxCtXxtN5 -Q1LQM8s3tKNXER3mZ8zfwgwjsdLVwhXhysFi6Dlkvk/Vrbn1QDfJnzq+F9LsGRGb -ABEBAAGJAjwEGAEKACYWIQQ4SV9JdhSH3UAXSwGlmIi3PZ95AgUCXovRGAIbDAUJ -B4YfgAAKCRClmIi3PZ95AhDZD/40fShzDS/smZZL0oXN4GgZ62FrXWBdLjontkXo -d8hDh1wJZwqsLVbtO2Gu0CPeH9GclQ3bYsR19sGMM4FDgjMu57O/TU6GZl2Ywcjh -ayhRTHyAq/BKZn71AM0N7LS8MdNTaLbTbzEu5oGbAmOVv5f0SUnQoGxbeF8ih5bo -hR3ZcORujWMgnymL3+cerNyIDQAtfMAUTfpVcwem4CvquA9Wjtur8YN1t+N7I3o2 -eMTNSyNUL9Yx3NxbyJ0yrrMvASo+ZVRaPW5+ET9Iqd68ILSY04Gnar3URJssggX8 -+cuyEbP9bAG8qYqcr2aSC2dW84mL/RnZGR//1dfS0Ugk6Osj0LSF5i+mz0CbIjYQ -PKgLlgpycuGZBC5kG3RWWfanM0HxPDx10a7vEWA1A5Q+csx4yi3CW/giC1zAdhUO -cJ1l4Uj/oxpGeLN7BnT/2NzU/px2fpbaG+xU4HlwjzFM2cIOUIohHFhdvFZbFIIA -mePqTBnEB3HtXYRTgMoYDXLWhlOXjyVnMR45WDfvEA3KqbAz6sNMtaOJ6rHBWnR1 -1YbpvDWUeaGSLXBoGyo3RgTrN9jON8lE/oUxFobnEdfZGD+uwIniylc5rw3+VkBU -+QGZDfgPgxjSmKsWq1cK6rNfBacGYrdyqf90VemEsvR8r0Ump0RPzBMlAAq0Xkup -WkiKlA== -=0GzT ------END PGP PUBLIC KEY BLOCK----- -``` +Github supports private security advisories and OpenPrinting CUPS enabled +their usage, report all security issue via them. Reporters can file a security +advisory by clicking on `New issue` at tab `Issues` and choose `Report a vulnerability`. +Provide details, impact, reproducer, affected versions, workarounds and patch +for the vulnerability if there are any and estimate severity when creating the advisory. +Expect a response within 5 business days. Once OpenPrinting group agree on the patch +and announce it on `distros@vs.openwall.org`, there is embargo period 7-10 days long. diff --git a/backend/Makefile b/backend/Makefile index e5dd761..cd5f447 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -1,7 +1,7 @@ # # Backend makefile for CUPS. # -# Copyright © 2021-2022 by OpenPrinting. +# Copyright © 2020-2024 by OpenPrinting. # Copyright © 2007-2019 by Apple Inc. # Copyright © 1997-2007 by Easy Software Products, all rights reserved. # diff --git a/backend/backend-private.h b/backend/backend-private.h index d19b06b..72b454a 100644 --- a/backend/backend-private.h +++ b/backend/backend-private.h @@ -268,7 +268,7 @@ extern "C" { #define CUPS_TC_hours 11 #define CUPS_TC_thousandthsOfOunces 12 #define CUPS_TC_tenthsOfGrams 13 -#define CUPS_TC_hundrethsOfFluidOunces 14 +#define CUPS_TC_hundredthsOfFluidOunces 14 #define CUPS_TC_tenthsOfMilliliters 15 #define CUPS_TC_feet 16 #define CUPS_TC_meters 17 diff --git a/backend/dnssd.c b/backend/dnssd.c index 81e5af3..be24e0a 100644 --- a/backend/dnssd.c +++ b/backend/dnssd.c @@ -1,7 +1,7 @@ /* * DNS-SD discovery backend for CUPS. * - * Copyright © 2021-2022 by OpenPrinting. + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2008-2018 by Apple Inc. * * Licensed under Apache License v2.0. See the file "LICENSE" for more @@ -553,7 +553,7 @@ browse_callback( void *context) /* I - Devices array */ { fprintf(stderr, "DEBUG2: browse_callback(sdRef=%p, flags=%x, " - "interfaceIndex=%d, errorCode=%d, serviceName=\"%s\", " + "interfaceIndex=%u, errorCode=%d, serviceName=\"%s\", " "regtype=\"%s\", replyDomain=\"%s\", context=%p)\n", sdRef, flags, interfaceIndex, errorCode, serviceName, regtype, replyDomain, context); @@ -592,7 +592,7 @@ browse_local_callback( fprintf(stderr, "DEBUG2: browse_local_callback(sdRef=%p, flags=%x, " - "interfaceIndex=%d, errorCode=%d, serviceName=\"%s\", " + "interfaceIndex=%u, errorCode=%d, serviceName=\"%s\", " "regtype=\"%s\", replyDomain=\"%s\", context=%p)\n", sdRef, flags, interfaceIndex, errorCode, serviceName, regtype, replyDomain, context); @@ -887,7 +887,7 @@ get_device(cups_array_t *devices, /* I - Device array */ * Yes, add the device... */ - if ((device = calloc(sizeof(cups_device_t), 1)) == NULL) + if ((device = calloc(1, sizeof(cups_device_t))) == NULL) { perror("DEBUG: Out of memory adding a device"); return (NULL); @@ -1010,7 +1010,7 @@ query_callback( # ifdef HAVE_MDNSRESPONDER fprintf(stderr, "DEBUG2: query_callback(sdRef=%p, flags=%x, " - "interfaceIndex=%d, errorCode=%d, fullName=\"%s\", " + "interfaceIndex=%u, errorCode=%d, fullName=\"%s\", " "rrtype=%u, rrclass=%u, rdlen=%u, rdata=%p, ttl=%u, " "context=%p)\n", sdRef, flags, interfaceIndex, errorCode, fullName, rrtype, rrclass, rdlen, rdata, ttl, context); @@ -1023,7 +1023,7 @@ query_callback( return; # else - fprintf(stderr, "DEBUG2: query_callback(browser=%p, interfaceIndex=%d, " + fprintf(stderr, "DEBUG2: query_callback(browser=%p, interfaceIndex=%u, " "protocol=%d, event=%d, fullName=\"%s\", rrclass=%u, " "rrtype=%u, rdata=%p, rdlen=%u, flags=%x, context=%p)\n", browser, interfaceIndex, protocol, event, fullName, rrclass, rrtype, rdata, (unsigned)rdlen, flags, context); diff --git a/backend/ieee1284.c b/backend/ieee1284.c index 821315f..7e44319 100644 --- a/backend/ieee1284.c +++ b/backend/ieee1284.c @@ -1,6 +1,7 @@ /* * IEEE-1284 support functions for CUPS. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2015 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * @@ -157,7 +158,7 @@ backendGetDeviceID( * bytes. The 1284 spec says the length is stored MSB first... */ - length = (int)((((unsigned)device_id[0] & 255) << 8) + ((unsigned)device_id[1] & 255)); + length = (int)((((unsigned)device_id[0] & 255) << 8) | ((unsigned)device_id[1] & 255)); /* * Check to see if the length is larger than our buffer; first @@ -166,7 +167,7 @@ backendGetDeviceID( */ if (length > device_id_size || length < 14) - length = (int)((((unsigned)device_id[1] & 255) << 8) + ((unsigned)device_id[0] & 255)); + length = (int)((((unsigned)device_id[1] & 255) << 8) | ((unsigned)device_id[0] & 255)); if (length > device_id_size) length = device_id_size; diff --git a/backend/ipp.c b/backend/ipp.c index 619bbb7..08a41ef 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -1,7 +1,7 @@ /* * IPP backend for CUPS. * - * Copyright © 2021-2022 by OpenPrinting + * Copyright © 2021-2025 by OpenPrinting * Copyright © 2007-2021 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * @@ -9,10 +9,6 @@ * information. */ -/* - * Include necessary headers. - */ - #include "backend-private.h" #include #include @@ -70,9 +66,6 @@ typedef struct _cups_monitor_s /**** Monitoring data ****/ /* * Globals... */ - -static const char *auth_info_required; - /* New auth-info-required value */ #if defined(HAVE_GSSAPI) && defined(HAVE_XPC) static pid_t child_pid = 0; /* Child process ID */ #endif /* HAVE_GSSAPI && HAVE_XPC */ @@ -90,9 +83,9 @@ static int job_canceled = 0, /* Job cancelled? */ uri_credentials = 0; /* Credentials supplied in URI? */ -static char username[256] = "", +static char device_username[256] = "", /* Username for device URI */ - *password = NULL; + *device_password = NULL; /* Password for device URI */ static const char * const pattrs[] = /* Printer attributes we want */ { @@ -114,6 +107,7 @@ static const char * const pattrs[] = /* Printer attributes we want */ "multiple-document-handling-supported", "operations-supported", "print-color-mode-supported", + "print-scaling-supported", "printer-alert", "printer-alert-description", "printer-is-accepting-jobs", @@ -149,6 +143,7 @@ static char mandatory_attrs[1024] = ""; * Local functions... */ +static void adjust_options(int num_options, cups_option_t *options); static void cancel_job(http_t *http, const char *uri, int id, const char *resource, const char *user, int version); @@ -165,7 +160,8 @@ static ipp_t *new_request(ipp_op_t op, int version, const char *uri, ppd_file_t *ppd, ipp_attribute_t *media_col_sup, ipp_attribute_t *doc_handling_sup, - ipp_attribute_t *print_color_mode_sup); + ipp_attribute_t *print_color_mode_sup, + ipp_attribute_t *print_scaling_sup); static const char *password_cb(const char *prompt, http_t *http, const char *method, const char *resource, int *user_data); @@ -202,6 +198,7 @@ main(int argc, /* I - Number of command-line args */ hostname[1024], /* Hostname */ resource[1024], /* Resource info (printer name) */ addrname[256], /* Address name */ + username[IPP_MAX_NAME], /* Requesting user name */ *optptr, /* Pointer to URI options */ *name, /* Name of option */ *value, /* Value of option */ @@ -219,7 +216,7 @@ main(int argc, /* I - Number of command-line args */ off_t compatsize = 0; /* Size of compatibility file */ int port; /* Port number (not used) */ char uri[HTTP_MAX_URI]; /* Updated URI without user/pass */ - char print_job_name[1024]; /* Update job-name for Print-Job */ + char print_job_name[256]; /* Update job-name for Print-Job */ http_status_t http_status; /* Status of HTTP request */ ipp_status_t ipp_status; /* Status of IPP request */ http_t *http; /* HTTP connection */ @@ -253,6 +250,7 @@ main(int argc, /* I - Number of command-line args */ ipp_attribute_t *printer_state; /* printer-state attribute */ ipp_attribute_t *printer_accepting; /* printer-is-accepting-jobs */ ipp_attribute_t *print_color_mode_sup;/* Does printer support print-color-mode? */ + ipp_attribute_t *print_scaling_sup; /* print-scaling-supported */ int create_job = 0, /* Does printer support Create-Job? */ get_job_attrs = 0, /* Does printer support Get-Job-Attributes? */ send_document = 0, /* Does printer support Send-Document? */ @@ -260,7 +258,8 @@ main(int argc, /* I - Number of command-line args */ validate_retried = 0, /* Was Validate-Job request retried? */ copies, /* Number of copies for job */ copies_remaining; /* Number of copies remaining */ - const char *content_type, /* CONTENT_TYPE environment variable */ + const char *auth_info_required, /* New auth-info-required value */ + *content_type, /* CONTENT_TYPE environment variable */ *final_content_type, /* FINAL_CONTENT_TYPE environment var */ *document_format; /* document-format value */ int fd; /* File descriptor */ @@ -328,6 +327,8 @@ main(int argc, /* I - Number of command-line args */ return (CUPS_BACKEND_STOP); } + strlcpy(username, argv[2], sizeof(username)); + /* * Get the device URI... */ @@ -354,11 +355,11 @@ main(int argc, /* I - Number of command-line args */ if (!getuid() && (value = getenv("AUTH_UID")) != NULL) { - uid_t uid = (uid_t)atoi(value); + uid_t uid = (uid_t)strtoul(value, NULL, 10); /* User ID */ # ifdef HAVE_XPC - if (uid > 0) + if (uid) { if (argc == 6) return (run_as_user(argv, uid, device_uri, 0)); @@ -385,7 +386,7 @@ main(int argc, /* I - Number of command-line args */ } # else /* No XPC, just try to run as the user ID */ - if (uid > 0) + if (uid) setuid(uid); # endif /* HAVE_XPC */ } @@ -411,7 +412,7 @@ main(int argc, /* I - Number of command-line args */ */ httpSeparateURI(HTTP_URI_CODING_ALL, device_uri, scheme, sizeof(scheme), - username, sizeof(username), hostname, sizeof(hostname), &port, + device_username, sizeof(device_username), hostname, sizeof(hostname), &port, resource, sizeof(resource)); if (!port) @@ -422,6 +423,19 @@ main(int argc, /* I - Number of command-line args */ else cupsSetEncryption(HTTP_ENCRYPTION_IF_REQUESTED); + if (!strcmp(auth_info_required, "negotiate") && + (isdigit(hostname[0] & 255) || hostname[0] == '[')) + { + /* + * IP addresses are not allowed with Kerberos... + */ + + _cupsLangPrintFilter(stderr, "ERROR", + _("IP address is not allowed as hostname when using Negotiate - use FQDN.")); + update_reasons(NULL, "-connecting-to-device"); + return (CUPS_BACKEND_FAILED); + } + /* * See if there are any options... */ @@ -567,12 +581,13 @@ main(int argc, /* I - Number of command-line args */ #endif /* HAVE_LIBZ */ else if (!_cups_strcasecmp(name, "contimeout")) { + int value_int = atoi(value); /* * Set the connection timeout... */ - if (atoi(value) > 0) - contimeout = atoi(value); + if (value_int > 0) + contimeout = value_int; } else { @@ -622,16 +637,16 @@ main(int argc, /* I - Number of command-line args */ cupsSetPasswordCB2((cups_password_cb2_t)password_cb, &password_tries); - if (username[0]) + if (device_username[0]) { /* * Use authentication information in the device URI... */ - if ((password = strchr(username, ':')) != NULL) - *password++ = '\0'; + if ((device_password = strchr(device_username, ':')) != NULL) + *device_password++ = '\0'; - cupsSetUser(username); + cupsSetUser(device_username); uri_credentials = 1; } else @@ -644,11 +659,11 @@ main(int argc, /* I - Number of command-line args */ if (ptr) { - strlcpy(username, ptr, sizeof(username)); + strlcpy(device_username, ptr, sizeof(device_username)); cupsSetUser(ptr); } - password = getenv("AUTH_PASSWORD"); + device_password = getenv("AUTH_PASSWORD"); } /* @@ -789,8 +804,6 @@ main(int argc, /* I - Number of command-line args */ if (job_canceled) return (CUPS_BACKEND_OK); - else if (!http) - return (CUPS_BACKEND_FAILED); if (httpIsEncrypted(http)) { @@ -807,12 +820,12 @@ main(int argc, /* I - Number of command-line args */ /* Trust keywords */ static const char * const trust_msgs[] = { - "Credentials are OK/trusted", - "Credentials are invalid", - "Credentials have changed", - "Credentials are expired", - "Credentials have been renewed", - "Credentials are unknown/new" + _("Credentials are OK/trusted"), + _("Credentials are invalid"), + _("Credentials have changed"), + _("Credentials are expired"), + _("Credentials have been renewed"), + _("Credentials are unknown/new") }; fputs("DEBUG: Connection is encrypted.\n", stderr); @@ -837,6 +850,7 @@ main(int argc, /* I - Number of command-line args */ if (trusts[trust]) { update_reasons(NULL, trusts[trust]); + _cupsLangPrintFilter(stderr, "ALERT", "%s", trust_msgs[trust]); return (CUPS_BACKEND_STOP); } @@ -895,6 +909,7 @@ main(int argc, /* I - Number of command-line args */ operations_sup = NULL; doc_handling_sup = NULL; print_color_mode_sup = NULL; + print_scaling_sup = NULL; do { @@ -1165,6 +1180,15 @@ main(int argc, /* I - Number of command-line args */ print_color_mode_sup = ippFindAttribute(supported, "print-color-mode-supported", IPP_TAG_KEYWORD); + if ((print_scaling_sup = ippFindAttribute(supported, "print-scaling-supported", IPP_TAG_KEYWORD)) != NULL) + { + int count = ippGetCount(print_scaling_sup); + + fprintf(stderr, "DEBUG: print-scaling-supported (%d values)\n", count); + for (i = 0; i < count; i ++) + fprintf(stderr, "DEBUG: [%d] = %s\n", i, ippGetString(print_scaling_sup, i, NULL)); + } + if ((operations_sup = ippFindAttribute(supported, "operations-supported", IPP_TAG_ENUM)) != NULL) { @@ -1354,12 +1378,13 @@ main(int argc, /* I - Number of command-line args */ * the printer... */ - for (i = 0; i < (int)(sizeof(hashes) / sizeof(hashes[0])); i ++) - if (ippContainsString(encryption_sup, hashes[i])) + size_t j; + for (j = 0; j < (sizeof(hashes) / sizeof(hashes[0])); j ++) + if (ippContainsString(encryption_sup, hashes[j])) + { + num_options = cupsAddOption("job-password-encryption", hashes[j], num_options, &options); break; - - if (i < (int)(sizeof(hashes) / sizeof(hashes[0]))) - num_options = cupsAddOption("job-password-encryption", hashes[i], num_options, &options); + } } } } @@ -1439,7 +1464,7 @@ main(int argc, /* I - Number of command-line args */ monitor.uri = uri; monitor.hostname = hostname; - monitor.user = argv[2]; + monitor.user = username; monitor.resource = resource; monitor.port = port; monitor.version = version; @@ -1459,6 +1484,10 @@ main(int argc, /* I - Number of command-line args */ } else { + /* + * TODO: make this compatible with UTF-8 - possible UTF-8 truncation here.. + */ + snprintf(print_job_name, sizeof(print_job_name), "%s - %s", argv[1], argv[3]); monitor.job_name = print_job_name; @@ -1472,10 +1501,10 @@ main(int argc, /* I - Number of command-line args */ while (!job_canceled && validate_job) { - request = new_request(IPP_OP_VALIDATE_JOB, version, uri, argv[2], + request = new_request(IPP_OP_VALIDATE_JOB, version, uri, username, monitor.job_name, num_options, options, compression, copies_sup ? copies : 1, document_format, pc, ppd, - media_col_sup, doc_handling_sup, print_color_mode_sup); + media_col_sup, doc_handling_sup, print_color_mode_sup, print_scaling_sup); response = cupsDoRequest(http, request, resource); @@ -1512,6 +1541,28 @@ main(int argc, /* I - Number of command-line args */ } } } + else if ((ipp_status == IPP_STATUS_ERROR_BAD_REQUEST || ipp_status == IPP_STATUS_ERROR_INTERNAL) && !strcmp(username, argv[2])) + { + /* + * Issue #1145: Some printers have trouble with valid character in the + * requesting-user-name attribute. Sanitize the username and try again + * if so... + */ + + char *argptr = argv[2], /* Pointer into local username */ + *userptr = username; /* Pointer into requesting-user-name value */ + + fputs("DEBUG: Trying sanitized requesting-user-name value.\n", stderr); + + while (*argptr && userptr < (username + sizeof(username) - 1)) + { + if (isalnum(*argptr & 255)) + *userptr++ = *argptr; + argptr ++; + } + + *userptr = '\0'; + } ippDelete(response); @@ -1595,10 +1646,10 @@ main(int argc, /* I - Number of command-line args */ request = new_request((num_files > 1 || create_job) ? IPP_OP_CREATE_JOB : IPP_OP_PRINT_JOB, - version, uri, argv[2], monitor.job_name, num_options, + version, uri, username, monitor.job_name, num_options, options, compression, copies_sup ? copies : 1, document_format, pc, ppd, media_col_sup, - doc_handling_sup, print_color_mode_sup); + doc_handling_sup, print_color_mode_sup, print_scaling_sup); /* * Do the request... @@ -1807,9 +1858,9 @@ main(int argc, /* I - Number of command-line args */ ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", job_id); - if (argv[2][0]) + if (username[0]) ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, - "requesting-user-name", NULL, argv[2]); + "requesting-user-name", NULL, username); ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", (i + 1) >= num_files); @@ -1890,7 +1941,7 @@ main(int argc, /* I - Number of command-line args */ if (ippContainsString(reasons, "document-format-error")) ipp_status = IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR; - else if (ippContainsString(reasons, "document-unprintable")) + else if (ippContainsString(reasons, "document-unprintable-error")) ipp_status = IPP_STATUS_ERROR_DOCUMENT_UNPRINTABLE; ippDelete(response); @@ -1927,7 +1978,7 @@ main(int argc, /* I - Number of command-line args */ fputs("JOBSTATE: cups-retry-as-raster\n", stderr); if (job_id > 0) - cancel_job(http, uri, job_id, resource, argv[2], version); + cancel_job(http, uri, job_id, resource, username, version); goto cleanup; } @@ -1943,7 +1994,7 @@ main(int argc, /* I - Number of command-line args */ */ if (job_id > 0) - cancel_job(http, uri, job_id, resource, argv[2], version); + cancel_job(http, uri, job_id, resource, username, version); goto cleanup; } @@ -1982,7 +2033,7 @@ main(int argc, /* I - Number of command-line args */ ipp_status = IPP_STATUS_ERROR_INTERNAL; if (job_id > 0) - cancel_job(http, uri, job_id, resource, argv[2], version); + cancel_job(http, uri, job_id, resource, username, version); goto cleanup; } @@ -2030,7 +2081,7 @@ main(int argc, /* I - Number of command-line args */ * Check printer state... */ - check_printer_state(http, uri, resource, argv[2], version); + check_printer_state(http, uri, resource, username, version); if (cupsLastError() <= IPP_STATUS_OK_CONFLICTING) password_tries = 0; @@ -2048,9 +2099,9 @@ main(int argc, /* I - Number of command-line args */ ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", job_id); - if (argv[2][0]) + if (username[0]) ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, - "requesting-user-name", NULL, argv[2]); + "requesting-user-name", NULL, username); ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", sizeof(jattrs) / sizeof(jattrs[0]), @@ -2089,14 +2140,7 @@ main(int argc, /* I - Number of command-line args */ password_tries = 0; else { - if (ipp_status != IPP_STATUS_ERROR_SERVICE_UNAVAILABLE && - ipp_status != IPP_STATUS_ERROR_BUSY) - { - ippDelete(response); - ipp_status = IPP_STATUS_OK; - break; - } - else if (ipp_status == IPP_STATUS_ERROR_INTERNAL) + if (ipp_status == IPP_STATUS_ERROR_INTERNAL) { waitjob_tries ++; @@ -2107,6 +2151,13 @@ main(int argc, /* I - Number of command-line args */ break; } } + else if (ipp_status != IPP_STATUS_ERROR_SERVICE_UNAVAILABLE && + ipp_status != IPP_STATUS_ERROR_BUSY) + { + ippDelete(response); + ipp_status = IPP_STATUS_OK; + break; + } } if (response) @@ -2177,7 +2228,7 @@ main(int argc, /* I - Number of command-line args */ if (job_canceled > 0 && job_id > 0) { - cancel_job(http, uri, job_id, resource, argv[2], version); + cancel_job(http, uri, job_id, resource, username, version); if (cupsLastError() > IPP_STATUS_OK_CONFLICTING) _cupsLangPrintFilter(stderr, "ERROR", _("Unable to cancel print job.")); @@ -2187,7 +2238,7 @@ main(int argc, /* I - Number of command-line args */ * Check the printer state and report it if necessary... */ - check_printer_state(http, uri, resource, argv[2], version); + check_printer_state(http, uri, resource, username, version); if (cupsLastError() <= IPP_STATUS_OK_CONFLICTING) password_tries = 0; @@ -2288,6 +2339,59 @@ main(int argc, /* I - Number of command-line args */ } +/* + * 'adjust_options()' - Adjust options which have the same meaning. + * + * In case the backend gets PPD option and IPP attribute of the same meaning + * among options array, adjust their values to reflect the same choices, + * if the values differ (preferring PPD option values). + * + * Support for each PPD x IPP option pair is added adhoc, based on demand. + */ + +static void +adjust_options(int num_options, /* I - Number of options */ + cups_option_t *options) /* I - Array of job options */ +{ + const char *ppd_option_value = NULL; /* PPD option value */ + const char *ipp_attr_value = NULL; /* IPP attribute value */ + + + fprintf(stderr, "DEBUG: adjust_options()\n"); + + if (options == NULL || num_options < 2) + { + fprintf(stderr, "DEBUG: adjust_options(): Invalid values.\n"); + return; + } + + /* + * PPD option ColorModel and IPP attribute print-color-mode + */ + + ppd_option_value = cupsGetOption("ColorModel", num_options, options); + ipp_attr_value = cupsGetOption("print-color-mode", num_options, options); + + if (!ppd_option_value || !ipp_attr_value) + return; + + if (strcmp(ipp_attr_value, "monochrome") && (!strcmp(ppd_option_value, "Gray") + || !strcmp(ppd_option_value, "FastGray") + || !strcmp(ppd_option_value, "DeviceGray"))) + { + fprintf(stderr, "DEBUG: adjust_options(): Adjusting print-color-mode to monochrome.\n"); + num_options = cupsAddOption("print-color-mode", "monochrome", num_options, &options); + } + else if (strcmp(ipp_attr_value, "color") && (!strcmp(ppd_option_value, "CMY") + || !strcmp(ppd_option_value, "CMYK") + || !strcmp(ppd_option_value, "RGB"))) + { + fprintf(stderr, "DEBUG: adjust_options(): Adjusting print-color-mode to color.\n"); + num_options = cupsAddOption("print-color-mode", "color", num_options, &options); + } +} + + /* * 'cancel_job()' - Cancel a print job. */ @@ -2460,8 +2564,8 @@ monitor_printer( http = httpConnect2(monitor->hostname, monitor->port, NULL, AF_UNSPEC, monitor->encryption, 1, 0, NULL); httpSetTimeout(http, 30.0, timeout_cb, NULL); - if (username[0]) - cupsSetUser(username); + if (device_username[0]) + cupsSetUser(device_username); cupsSetPasswordCB2((cups_password_cb2_t)password_cb, &password_tries); @@ -2626,7 +2730,7 @@ monitor_printer( new_reasons |= _CUPS_JSR_JOB_RELEASE_WAIT; else if (!strcmp(attr->values[i].string.text, "document-format-error")) new_reasons |= _CUPS_JSR_DOCUMENT_FORMAT_ERROR; - else if (!strcmp(attr->values[i].string.text, "document-unprintable")) + else if (!strcmp(attr->values[i].string.text, "document-unprintable-error")) new_reasons |= _CUPS_JSR_DOCUMENT_UNPRINTABLE; if (!job_canceled && (!strncmp(attr->values[i].string.text, "job-canceled-", 13) || !strcmp(attr->values[i].string.text, "aborted-by-system"))) @@ -2747,8 +2851,9 @@ new_request( ppd_file_t *ppd, /* I - PPD file data */ ipp_attribute_t *media_col_sup, /* I - media-col-supported values */ ipp_attribute_t *doc_handling_sup, /* I - multiple-document-handling-supported values */ - ipp_attribute_t *print_color_mode_sup) - /* I - Printer supports print-color-mode */ + ipp_attribute_t *print_color_mode_sup, + /* I - Printer supports print-color-mode? */ + ipp_attribute_t *print_scaling_sup) /* I - print-scaling-supported values */ { ipp_t *request; /* Request data */ const char *keyword; /* PWG keyword */ @@ -2815,6 +2920,9 @@ new_request( copies = _cupsConvertOptions(request, ppd, pc, media_col_sup, doc_handling_sup, print_color_mode_sup, user, format, copies, num_options, options); + if ((keyword = cupsGetOption("print-scaling", num_options, options)) != NULL && ippContainsString(print_scaling_sup, keyword)) + ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "print-scaling", NULL, keyword); + /* * Map FaxOut options... */ @@ -2899,6 +3007,11 @@ new_request( */ fputs("DEBUG: Adding all operation/job attributes.\n", stderr); + adjust_options(num_options, options); + + if (format && (!strcmp(format, "image/pwg-raster") || !strcmp(format, "image/urf"))) + num_options = cupsRemoveOption("copies", num_options, &options); + cupsEncodeOptions2(request, num_options, options, IPP_TAG_OPERATION); cupsEncodeOptions2(request, num_options, options, IPP_TAG_JOB); } @@ -2929,9 +3042,9 @@ password_cb(const char *prompt, /* I - Prompt (not used) */ fprintf(stderr, "DEBUG: password_cb(prompt=\"%s\", http=%p, method=\"%s\", " - "resource=\"%s\", password_tries=%p(%d)), password=%p\n", - prompt, http, method, resource, password_tries, *password_tries, - password); + "resource=\"%s\", password_tries=%p(%d)), device_password=%p\n", + prompt, (void *)http, method, resource, (void *)password_tries, *password_tries, + (void *)device_password); (void)prompt; (void)method; @@ -2943,8 +3056,6 @@ password_cb(const char *prompt, /* I - Prompt (not used) */ * Remember that we need to authenticate... */ - auth_info_required = "username,password"; - if (httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "username", def_username)) { @@ -2956,13 +3067,13 @@ password_cb(const char *prompt, /* I - Prompt (not used) */ } } - if (password && *password && *password_tries < 3) + if (device_password && *device_password && *password_tries < 3) { (*password_tries) ++; - cupsSetUser(username); + cupsSetUser(device_username); - return (password); + return (device_password); } else { @@ -3244,16 +3355,16 @@ run_as_user(char *argv[], /* I - Command-line arguments */ int fd) /* I - File to print */ { const char *auth_negotiate,/* AUTH_NEGOTIATE env var */ - *content_type; /* [FINAL_]CONTENT_TYPE env vars */ + *content_type, /* [FINAL_]CONTENT_TYPE env vars */ + *auth_info_required; /* New auth-info-required value */ xpc_connection_t conn; /* Connection to XPC service */ xpc_object_t request; /* Request message dictionary */ __block xpc_object_t response; /* Response message dictionary */ - dispatch_semaphore_t sem; /* Semaphore for waiting for response */ int status = CUPS_BACKEND_FAILED; /* Status of request */ - fprintf(stderr, "DEBUG: Running IPP backend as UID %d.\n", (int)uid); + fprintf(stderr, "DEBUG: Running IPP backend as UID %u.\n", (unsigned)uid); /* * Connect to the user agent for the specified UID... @@ -3283,7 +3394,7 @@ run_as_user(char *argv[], /* I - Command-line arguments */ fprintf(stderr, "DEBUG: Connection invalid for service %s.\n", xpc_connection_get_name(conn)); else - fprintf(stderr, "DEBUG: Unxpected error for service %s: %s\n", + fprintf(stderr, "DEBUG: Unexpected error for service %s: %s\n", xpc_connection_get_name(conn), xpc_dictionary_get_string(event, XPC_ERROR_KEY_DESCRIPTION)); } @@ -3303,8 +3414,9 @@ run_as_user(char *argv[], /* I - Command-line arguments */ xpc_dictionary_set_string(request, "title", argv[3]); xpc_dictionary_set_string(request, "copies", argv[4]); xpc_dictionary_set_string(request, "options", argv[5]); - xpc_dictionary_set_string(request, "auth-info-required", - getenv("AUTH_INFO_REQUIRED")); + if ((auth_info_required = getenv("AUTH_INFO_REQUIRED")) != NULL) + xpc_dictionary_set_string(request, "auth-info-required", + auth_info_required); if ((auth_negotiate = getenv("AUTH_NEGOTIATE")) != NULL) xpc_dictionary_set_string(request, "auth-negotiate", auth_negotiate); if ((content_type = getenv("CONTENT_TYPE")) != NULL) @@ -3315,24 +3427,9 @@ run_as_user(char *argv[], /* I - Command-line arguments */ xpc_dictionary_set_fd(request, "stderr", 2); xpc_dictionary_set_fd(request, "side-channel", CUPS_SC_FD); - sem = dispatch_semaphore_create(0); - response = NULL; + response = xpc_connection_send_message_with_reply_sync(conn, request); - xpc_connection_send_message_with_reply(conn, request, - dispatch_get_global_queue(0,0), - ^(xpc_object_t reply) - { - /* Save the response and wake up */ - if (xpc_get_type(reply) - == XPC_TYPE_DICTIONARY) - response = xpc_retain(reply); - - dispatch_semaphore_signal(sem); - }); - - dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); xpc_release(request); - dispatch_release(sem); if (response) { @@ -3366,24 +3463,8 @@ run_as_user(char *argv[], /* I - Command-line arguments */ xpc_dictionary_set_int64(request, "command", kPMWaitForJob); xpc_dictionary_set_fd(request, "stderr", 2); - sem = dispatch_semaphore_create(0); - response = NULL; - - xpc_connection_send_message_with_reply(conn, request, - dispatch_get_global_queue(0,0), - ^(xpc_object_t reply) - { - /* Save the response and wake up */ - if (xpc_get_type(reply) - == XPC_TYPE_DICTIONARY) - response = xpc_retain(reply); - - dispatch_semaphore_signal(sem); - }); - - dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); + response = xpc_connection_send_message_with_reply_sync(conn, request); xpc_release(request); - dispatch_release(sem); if (response) { diff --git a/backend/lpd.c b/backend/lpd.c index c4aab8b..989986b 100644 --- a/backend/lpd.c +++ b/backend/lpd.c @@ -1,6 +1,7 @@ /* * Line Printer Daemon backend for CUPS. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2019 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * @@ -61,16 +62,16 @@ static int abort_job = 0; /* Non-zero if we get SIGTERM */ * What to reserve... */ -#define RESERVE_NONE 0 /* Don't reserve a priviledged port */ +#define RESERVE_NONE 0 /* Don't reserve a privileged port */ #define RESERVE_RFC1179 1 /* Reserve port 721-731 */ -#define RESERVE_ANY 2 /* Reserve port 1-1023 */ +#define RESERVE_ANY 2 /* Reserve port 512-1023 */ /* * Local functions... */ -static int cups_rresvport(int *port, int family); +static int cups_rresvport(int *port, int min, int family); static int lpd_command(int lpd_fd, char *format, ...) # ifdef __GNUC__ __attribute__ ((__format__ (__printf__, 2, 3))) @@ -101,8 +102,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ *options, /* Pointer to options */ *name, /* Name of option */ *value, /* Value of option */ - sep, /* Separator character */ - *filename, /* File to print */ + sep, /* Separator character */ title[256]; /* Title string */ int port; /* Port number */ http_addrlist_t *addrlist; /* List of addresses for printer */ @@ -114,7 +114,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ int banner; /* Print banner page? */ int format; /* Print format */ int order; /* Order of control/data files */ - int reserve; /* Reserve priviledged port? */ + int reserve; /* Reserve privileged port? */ int sanitize_title; /* Sanitize title string? */ int manual_copies, /* Do manual copies? */ timeout, /* Timeout */ @@ -166,7 +166,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ _cupsLangString(cupsLangDefault(), _("LPD/LPR Host or Printer"))); return (CUPS_BACKEND_OK); } - else if (argc < 6 || argc > 7) + else if (argc != 6 && argc != 7) { _cupsLangPrintf(stderr, _("Usage: %s job-id user title copies options [file]"), @@ -460,13 +460,11 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * Stream from stdin... */ - filename = NULL; fd = 0; } else { - filename = argv[6]; - fd = open(filename, O_RDONLY); + fd = open(argv[6], O_RDONLY); if (fd == -1) { @@ -555,6 +553,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ static int /* O - Socket or -1 on error */ cups_rresvport(int *port, /* IO - Port number to bind to */ + int min, /* I - Minimim port number use */ int family) /* I - Address family */ { http_addr_t addr; /* Socket address */ @@ -579,7 +578,7 @@ cups_rresvport(int *port, /* IO - Port number to bind to */ * Try to bind the socket to a reserved port... */ - while (*port > 511) + while (*port >= min) { /* * Set the port number... @@ -768,7 +767,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ return (CUPS_BACKEND_FAILED); /* - * Choose the next priviledged port... + * Choose the next privileged port... */ if (!addr) @@ -778,7 +777,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ if (lport < 721 && reserve == RESERVE_RFC1179) lport = 731; - else if (lport < 1) + else if (lport < 512) lport = 1023; #ifdef HAVE_GETEUID @@ -804,11 +803,14 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ else { /* - * We're running as root and want to comply with RFC 1179. Reserve a - * priviledged lport between 721 and 731... + * We're running as root and want to either: + * a) comply with RFC 1179 and reserve a lport between 721 and 731 + * b) just reserve a privileged port between 512 and 1023 */ - if ((fd = cups_rresvport(&lport, addr->addr.addr.sa_family)) < 0) + if ((fd = cups_rresvport(&lport, + reserve == RESERVE_RFC1179 ? 721 : 512, + addr->addr.addr.sa_family)) < 0) { perror("DEBUG: Unable to reserve port"); sleep(1); @@ -1046,7 +1048,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ * Send the control file... */ - if (lpd_command(fd, "\002%d cfA%03d%.15s\n", (int)strlen(control), + if (lpd_command(fd, "\002%u cfA%03d%.15s\n", (unsigned)strlen(control), (int)getpid() % 1000, localhost)) { close(fd); @@ -1179,7 +1181,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ * Send control file... */ - if (lpd_command(fd, "\002%d cfA%03d%.15s\n", (int)strlen(control), + if (lpd_command(fd, "\002%u cfA%03d%.15s\n", (unsigned)strlen(control), (int)getpid() % 1000, localhost)) { close(fd); @@ -1187,8 +1189,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ return (CUPS_BACKEND_FAILED); } - fprintf(stderr, "DEBUG: Sending control file (%lu bytes)\n", - (unsigned long)strlen(control)); + fprintf(stderr, "DEBUG: Sending control file (%u bytes)\n", + (unsigned)strlen(control)); if ((size_t)lpd_write(fd, control, strlen(control) + 1) < (strlen(control) + 1)) { diff --git a/backend/network.c b/backend/network.c index f7ee2fb..064975b 100644 --- a/backend/network.c +++ b/backend/network.c @@ -1,6 +1,7 @@ /* * Common backend network APIs for CUPS. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2016 by Apple Inc. * Copyright © 2006-2007 by Easy Software Products, all rights reserved. * diff --git a/backend/org.cups.usb-quirks b/backend/org.cups.usb-quirks index 5aa0d41..83a7803 100644 --- a/backend/org.cups.usb-quirks +++ b/backend/org.cups.usb-quirks @@ -327,6 +327,9 @@ # Lexmark C540n (Apple #4778) 0x043d 0x0139 no-reattach +# Kyocera KM-1635 +0x0482 0x033e soft-reset + # Kyocera Ecosys P6026cdn (Apple #4900) 0x0482 0x063f no-reattach @@ -371,3 +374,9 @@ # HP DesignJet 130 (Apple #5838) 0x03f0 0x0314 no-reattach + +# GoDEX label printers (https://github.com/OpenPrinting/cups/issues/440) +0x195f 0x0001 unidir no-reattach + +# Oki Data Corp. OKIPOS 407II (https://github.com/OpenPrinting/cups/issues/877) +0x06bc 0x0183 unidir diff --git a/backend/pseudo b/backend/pseudo index e64c946..7e8094a 100644 --- a/backend/pseudo +++ b/backend/pseudo @@ -2,7 +2,7 @@ # # Psuedo-backend for CUPS testing purposes. # -# Copyright © 2022 by OpenPrinting. +# Copyright © 2020-2024 by OpenPrinting. # Copyright © 2011 by Apple Inc. # # Licensed under Apache License v2.0. See the file "LICENSE" for more diff --git a/backend/runloop.c b/backend/runloop.c index 418ab25..e61ba96 100644 --- a/backend/runloop.c +++ b/backend/runloop.c @@ -1,6 +1,7 @@ /* * Common run loop APIs for CUPS backends. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2014 by Apple Inc. * Copyright © 2006-2007 by Easy Software Products, all rights reserved. * diff --git a/backend/snmp-supplies.c b/backend/snmp-supplies.c index 687e7ae..41bee50 100644 --- a/backend/snmp-supplies.c +++ b/backend/snmp-supplies.c @@ -1,6 +1,7 @@ /* * SNMP supplies functions for CUPS. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2008-2015 by Apple Inc. * * Licensed under Apache License v2.0. See the file "LICENSE" for more diff --git a/backend/snmp.c b/backend/snmp.c index b552ecc..a2fddee 100644 --- a/backend/snmp.c +++ b/backend/snmp.c @@ -1,7 +1,7 @@ /* * SNMP discovery backend for CUPS. * - * Copyright © 2021-2022 by OpenPrinting. + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2014 by Apple Inc. * Copyright © 2006-2007 by Easy Software Products, all rights reserved. * diff --git a/backend/socket.c b/backend/socket.c index 68379e9..3e63248 100644 --- a/backend/socket.c +++ b/backend/socket.c @@ -1,6 +1,7 @@ /* * AppSocket backend for CUPS. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2018 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * @@ -113,7 +114,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ _cupsLangString(cupsLangDefault(), _("AppSocket/HP JetDirect"))); return (CUPS_BACKEND_OK); } - else if (argc < 6 || argc > 7) + else if (argc != 6 && argc != 7) { _cupsLangPrintf(stderr, _("Usage: %s job-id user title copies options [file]"), diff --git a/backend/test1284.c b/backend/test1284.c index 2da1086..2d58450 100644 --- a/backend/test1284.c +++ b/backend/test1284.c @@ -1,6 +1,7 @@ /* * IEEE-1284 support functions test program for CUPS. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2010 by Apple Inc. * Copyright © 1997-2006 by Easy Software Products, all rights reserved. * diff --git a/backend/testbackend.c b/backend/testbackend.c index 6412a02..fa630e9 100644 --- a/backend/testbackend.c +++ b/backend/testbackend.c @@ -1,6 +1,7 @@ /* * Backend test program for CUPS. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2014 by Apple Inc. * Copyright © 1997-2005 by Easy Software Products, all rights reserved. * @@ -503,7 +504,7 @@ main(int argc, /* I - Number of command-line args */ if (do_side_tests) { int length; /* Length of buffer */ - char buffer[2049]; /* Buffer for reponse */ + char buffer[2049]; /* Buffer for response */ cups_sc_status_t scstatus; /* Status of side-channel command */ static const char * const statuses[] = { diff --git a/backend/testsupplies.c b/backend/testsupplies.c index 5643ea6..105dce0 100644 --- a/backend/testsupplies.c +++ b/backend/testsupplies.c @@ -1,6 +1,7 @@ /* * SNMP supplies test program for CUPS. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2008-2011 by Apple Inc. * * Licensed under Apache License v2.0. See the file "LICENSE" for more diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c index f0d04ab..5c6c15c 100644 --- a/backend/usb-darwin.c +++ b/backend/usb-darwin.c @@ -1,6 +1,7 @@ /* * USB backend for macOS. * + * Copyright © 2022-2024 by OpenPrinting. * Copyright © 2005-2021 Apple Inc. All rights reserved. * * IMPORTANT: This Apple software is supplied to you by Apple Computer, @@ -772,7 +773,7 @@ print_device(const char *uri, /* I - Device URI */ } else if (bytes > 0) { - fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n", (int)bytes); + fprintf(stderr, "DEBUG: Wrote %u bytes of print data...\n", (unsigned)bytes); g.print_bytes -= bytes; print_ptr += bytes; @@ -955,7 +956,7 @@ static void *read_thread(void *reference) fputs("DEBUG: Got USB return aborted during read\n", stderr); /* - * Make sure this loop executes no more than once every 250 miliseconds... + * Make sure this loop executes no more than once every 250 milliseconds... */ if ((readstatus != kIOReturnSuccess || rbytes == 0) && (g.wait_eof || !g.read_thread_stop)) @@ -978,7 +979,7 @@ static void *read_thread(void *reference) if (readstatus == kIOReturnSuccess && rbytes > 0 && readbuffer[rbytes-1] == 0x4) break; - /* Make sure this loop executes no more than once every 250 miliseconds... */ + /* Make sure this loop executes no more than once every 250 milliseconds... */ mach_wait_until(start + delay); } } @@ -1128,7 +1129,7 @@ static void iterate_printers(iterator_callback_t callBack, void *userdata) iterator_reference_t reference = { callBack, userdata, true }; - IONotificationPortRef addNotification = IONotificationPortCreate(kIOMasterPortDefault); + IONotificationPortRef addNotification = IONotificationPortCreate(kIOMainPortDefault); int printingClass = kUSBPrintingClass; int printingSubclass = kUSBPrintingSubclass; @@ -1438,23 +1439,23 @@ static kern_return_t load_classdriver(CFStringRef driverPath, * Try loading the class driver... */ - url = CFURLCreateWithFileSystemPath(NULL, bundle, kCFURLPOSIXPathStyle, true); + url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, bundle, kCFURLPOSIXPathStyle, true); - if (url) - { - plugin = CFPlugInCreate(NULL, url); - CFRelease(url); - } - else - plugin = NULL; + if (url == NULL) + return (kr); + + plugin = CFPlugInCreate(kCFAllocatorDefault, url); + CFRelease(url); if (plugin) { CFArrayRef factories = CFPlugInFindFactoriesForPlugInTypeInPlugIn(kUSBPrinterClassTypeID, plugin); - if (factories != NULL && CFArrayGetCount(factories) > 0) + if (factories == NULL) + return (kr); + if (CFArrayGetCount(factories) > 0) { CFUUIDRef factoryID = CFArrayGetValueAtIndex(factories, 0); - IUnknownVTbl **iunknown = CFPlugInInstanceCreate(NULL, factoryID, kUSBPrinterClassTypeID); + IUnknownVTbl **iunknown = CFPlugInInstanceCreate(kCFAllocatorDefault, factoryID, kUSBPrinterClassTypeID); if (iunknown != NULL) { kr = (*iunknown)->QueryInterface(iunknown, CFUUIDGetUUIDBytes(kUSBPrinterClassInterfaceID), (LPVOID *)&driver); @@ -1476,8 +1477,8 @@ static kern_return_t load_classdriver(CFStringRef driverPath, } (*iunknown)->Release(iunknown); } - CFRelease(factories); } + CFRelease(factories); } fprintf(stderr, "DEBUG: load_classdriver(%s) (kr:0x%08x)\n", bundlestr, (int)kr); @@ -1592,7 +1593,7 @@ static CFStringRef copy_printer_interface_deviceid(printer_interface_t printer, request.wLength = HostToUSBWord(size); request.pData = buffer; - berr = (*printer)->ControlRequestTO(printer, (UInt8)0, &request); + berr = (*printer)->ControlRequestTO(printer, 0, &request); return berr; }; @@ -1655,7 +1656,7 @@ static CFStringRef copy_printer_interface_deviceid(printer_interface_t printer, err = (*printer)->ControlRequestTO(printer, 0, &request); if (err == kIOReturnSuccess) { - CFMutableStringRef extras = CFStringCreateMutable(NULL, 0); + CFMutableStringRef extras = CFStringCreateMutable(kCFAllocatorDefault, 0); if (manufacturer == NULL) { manufacturer = copy_printer_interface_indexed_description(printer, desc.iManufacturer, kUSBLanguageEnglish); @@ -1682,7 +1683,7 @@ static CFStringRef copy_printer_interface_deviceid(printer_interface_t printer, { // 1284 serial number doesn't match USB serial number, so replace the existing SERN: in device ID CFRange range = CFStringFind(ret, serial, 0); - CFMutableStringRef deviceIDString = CFStringCreateMutableCopy(NULL, 0, ret); + CFMutableStringRef deviceIDString = CFStringCreateMutableCopy(kCFAllocatorDefault, 0, ret); CFStringReplace(deviceIDString, range, userial); CFRelease(ret); ret = deviceIDString; @@ -1717,7 +1718,7 @@ static CFStringRef copy_printer_interface_deviceid(printer_interface_t printer, { range = CFStringFind(ret, serial, 0); - CFMutableStringRef deviceIDString = CFStringCreateMutableCopy(NULL, 0, ret); + CFMutableStringRef deviceIDString = CFStringCreateMutableCopy(kCFAllocatorDefault, 0, ret); CFRelease(ret); ret = deviceIDString; @@ -1749,7 +1750,7 @@ static CFStringRef copy_printer_interface_indexed_description(printer_interface_ UInt8 description[256]; // Max possible descriptor length IOUSBDevRequestTO request; - memset(description, 0, 2); + description[0] = description[1] = 0; request.bmRequestType = USBmakebmRequestType(kUSBIn, kUSBStandard, kUSBDevice); request.bRequest = kUSBRqGetDescriptor; @@ -1758,7 +1759,7 @@ static CFStringRef copy_printer_interface_indexed_description(printer_interface_ request.wLength = 2; request.pData = &description; request.completionTimeout = 0; - request.noDataTimeout = 60L; + request.noDataTimeout = 60U; err = (*printer)->ControlRequestTO(printer, 0, &request); if (err != kIOReturnSuccess && err != kIOReturnOverrun) @@ -1777,16 +1778,16 @@ static CFStringRef copy_printer_interface_indexed_description(printer_interface_ request.wLength = sizeof description; request.pData = &description; request.completionTimeout = 0; - request.noDataTimeout = 60L; + request.noDataTimeout = 60U; err = (*printer)->ControlRequestTO(printer, 0, &request); if (err != kIOReturnSuccess && err != kIOReturnUnderrun) return NULL; } - unsigned int length = description[0]; + UInt8 length = description[0]; if (length == 0) - return CFStringCreateWithCString(NULL, "", kCFStringEncodingUTF8); + return CFSTR(""); if (description[1] != kUSBStringDesc) return NULL; @@ -1800,7 +1801,7 @@ static CFStringRef copy_printer_interface_indexed_description(printer_interface_ request.wLength = (UInt16)length; request.pData = &description; request.completionTimeout = 0; - request.noDataTimeout = 60L; + request.noDataTimeout = 60U; err = (*printer)->ControlRequestTO(printer, 0, &request); if (err != kIOReturnSuccess) @@ -1809,25 +1810,20 @@ static CFStringRef copy_printer_interface_indexed_description(printer_interface_ if (description[1] != kUSBStringDesc) return NULL; - if ((description[0] & 1) != 0) - description[0] &= 0xfe; + description[0] &= ~1; - char buffer[258] = {0}; - unsigned int maxLength = sizeof buffer; - if (description[0] > 1) - { - length = (description[0]-2)/2; + if (description[0] < 2) + return CFSTR(""); - if (length > maxLength - 1) - length = maxLength -1; + char buffer[(sizeof(description) - 2) / 2]; + length = (description[0] - 2) / 2; - for (unsigned i = 0; i < length; i++) - buffer[i] = (char) description[2*i+2]; + for (UInt8 i = 0; i < length; i++) + buffer[i] = (char) description[2 * i + 2]; - buffer[length] = 0; - } + buffer[length] = 0; - return CFStringCreateWithCString(NULL, buffer, kCFStringEncodingUTF8); + return CFStringCreateWithCString(kCFAllocatorDefault, buffer, kCFStringEncodingUTF8); } /* @@ -1888,50 +1884,58 @@ static kern_return_t registry_close(void) */ static CFStringRef copy_value_for_key(CFStringRef deviceID, - CFStringRef *keys) + CFStringRef *keys) { - CFStringRef value = NULL; - CFArrayRef kvPairs = deviceID != NULL ? CFStringCreateArrayBySeparatingStrings(NULL, deviceID, CFSTR(";")) : NULL; - CFIndex max = kvPairs != NULL ? CFArrayGetCount(kvPairs) : 0; - CFIndex idx = 0; + CFStringRef value = NULL; /* Value to return */ + CFArrayRef kvPairs; /* pairs derived from separating the device ID*/ + CFIndex max; /* The size of the array*/ + + if (deviceID == NULL) + return NULL; - while (idx < max && value == NULL) + kvPairs = CFStringCreateArrayBySeparatingStrings(kCFAllocatorDefault, deviceID, CFSTR(";")); + max = CFArrayGetCount(kvPairs); + + for (CFIndex idx = 0; idx < max; idx++) { CFStringRef kvpair = CFArrayGetValueAtIndex(kvPairs, idx); CFIndex idxx = 0; - while (keys[idxx] != NULL && value == NULL) + for (idxx = 0; keys[idxx] != NULL; idxx++) { CFRange range = CFStringFind(kvpair, keys[idxx], kCFCompareCaseInsensitive); - if (range.length != -1) + if (range.length != kCFNotFound) { if (range.location != 0) { - CFMutableStringRef theString = CFStringCreateMutableCopy(NULL, 0, kvpair); + CFMutableStringRef theString = CFStringCreateMutableCopy(kCFAllocatorDefault, 0, kvpair); CFStringTrimWhitespace(theString); range = CFStringFind(theString, keys[idxx], kCFCompareCaseInsensitive); if (range.location == 0) - value = CFStringCreateWithSubstring(NULL, theString, CFRangeMake(range.length, CFStringGetLength(theString) - range.length)); + value = CFStringCreateWithSubstring(kCFAllocatorDefault, theString, CFRangeMake(range.length, CFStringGetLength(theString) - range.length)); CFRelease(theString); } else { - CFStringRef theString = CFStringCreateWithSubstring(NULL, kvpair, CFRangeMake(range.length, CFStringGetLength(kvpair) - range.length)); - CFMutableStringRef theString2 = CFStringCreateMutableCopy(NULL, 0, theString); + CFStringRef theString = CFStringCreateWithSubstring(kCFAllocatorDefault, kvpair, CFRangeMake(range.length, CFStringGetLength(kvpair) - range.length)); + CFMutableStringRef theString2 = CFStringCreateMutableCopy(kCFAllocatorDefault, 0, theString); CFRelease(theString); CFStringTrimWhitespace(theString2); value = theString2; } } - idxx++; + + if (value != NULL) + { + CFRelease(kvPairs); + return value; + } } - idx++; } - if (kvPairs != NULL) - CFRelease(kvPairs); - return value; + CFRelease(kvPairs); + return NULL; } @@ -1944,9 +1948,9 @@ CFStringRef cfstr_create_trim(const char *cstr) CFStringRef cfstr; CFMutableStringRef cfmutablestr = NULL; - if ((cfstr = CFStringCreateWithCString(NULL, cstr, kCFStringEncodingUTF8)) != NULL) + if ((cfstr = CFStringCreateWithCString(kCFAllocatorDefault, cstr, kCFStringEncodingUTF8)) != NULL) { - if ((cfmutablestr = CFStringCreateMutableCopy(NULL, 1024, cfstr)) != NULL) + if ((cfmutablestr = CFStringCreateMutableCopy(kCFAllocatorDefault, 1024, cfstr)) != NULL) CFStringTrimWhitespace(cfmutablestr); CFRelease(cfstr); @@ -2051,26 +2055,28 @@ static void parse_options(char *options, */ static void setup_cfLanguage(void) { - CFStringRef lang[1] = {NULL}; - CFArrayRef langArray = NULL; - const char *requestedLang = NULL; + CFStringRef lang[1] = {NULL}; /* StringRef used to create the array */ + CFArrayRef langArray; /* The array used to set the language perference */ + const char *requestedLang; /* The language as retrived from the language + environment variable */ if ((requestedLang = getenv("APPLE_LANGUAGE")) == NULL) requestedLang = getenv("LANG"); - if (requestedLang != NULL) + if (requestedLang == NULL) { - lang[0] = CFStringCreateWithCString(kCFAllocatorDefault, requestedLang, kCFStringEncodingUTF8); - langArray = CFArrayCreate(kCFAllocatorDefault, (const void **)lang, sizeof(lang) / sizeof(lang[0]), &kCFTypeArrayCallBacks); + fputs("DEBUG: usb: LANG and APPLE_LANGUAGE environment variables missing.\n", stderr); + return; + } - CFPreferencesSetValue(CFSTR("AppleLanguages"), langArray, kCFPreferencesCurrentApplication, kCFPreferencesAnyUser, kCFPreferencesAnyHost); - fprintf(stderr, "DEBUG: usb: AppleLanguages=\"%s\"\n", requestedLang); + lang[0] = CFStringCreateWithCString(kCFAllocatorDefault, requestedLang, kCFStringEncodingUTF8); + langArray = CFArrayCreate(kCFAllocatorDefault, (const void **)lang, sizeof(lang) / sizeof(lang[0]), &kCFTypeArrayCallBacks); - CFRelease(lang[0]); - CFRelease(langArray); - } - else - fputs("DEBUG: usb: LANG and APPLE_LANGUAGE environment variables missing.\n", stderr); + CFPreferencesSetValue(CFSTR("AppleLanguages"), langArray, kCFPreferencesCurrentApplication, kCFPreferencesAnyUser, kCFPreferencesAnyHost); + fprintf(stderr, "DEBUG: usb: AppleLanguages=\"%s\"\n", requestedLang); + + CFRelease(lang[0]); + CFRelease(langArray); } #pragma mark - @@ -2088,7 +2094,7 @@ static void run_legacy_backend(int argc, char *argv[], int fd) { - int i; + size_t i; int exitstatus = 0; int childstatus; pid_t waitpid_status; @@ -2163,7 +2169,7 @@ static void run_legacy_backend(int argc, cups_serverbin = CUPS_SERVERBIN; snprintf(usbpath, sizeof(usbpath), "%s/backend/usb", cups_serverbin); - for (i = 0; i < argc && i < (int)(sizeof(my_argv) / sizeof(my_argv[0])) - 1; i ++) + for (i = 0; i < argc && i < (sizeof(my_argv) / sizeof(my_argv[0])) - 1; i++) my_argv[i] = argv[i]; my_argv[i] = NULL; @@ -2347,7 +2353,7 @@ static void parse_pserror(char *sockBuffer, if ((logstrlen = snprintf(logstr, sizeof(logstr), "%s: %s\n", logLevel, pCommentBegin)) >= sizeof(logstr)) { - /* If the string was trucnated make sure it has a linefeed before the nul */ + /* If the string was truncated make sure it has a linefeed before the nul */ logstrlen = sizeof(logstr) - 1; logstr[logstrlen - 1] = '\n'; } diff --git a/backend/usb-libusb.c b/backend/usb-libusb.c index 542a875..30b2a0c 100644 --- a/backend/usb-libusb.c +++ b/backend/usb-libusb.c @@ -1,17 +1,13 @@ /* * LIBUSB interface code for CUPS. * - * Copyright © 2021 by OpenPrinting. + * Copyright © 2020-2025 by OpenPrinting. * Copyright © 2007-2019 by Apple Inc. * * Licensed under Apache License v2.0. See the file "LICENSE" for more * information. */ -/* - * Include necessary headers... - */ - #include #include #include @@ -133,6 +129,7 @@ static usb_printer_t *find_device(usb_cb_t cb, const void *data); static unsigned find_quirks(int vendor_id, int product_id); static int get_device_id(usb_printer_t *printer, char *buffer, size_t bufsize); +static void get_serial_number(usb_printer_t *printer, uint8_t desc_index, char *buffer, size_t bufsize); static int list_cb(usb_printer_t *printer, const char *device_uri, const char *device_id, const void *data); static void load_quirks(void); @@ -473,7 +470,7 @@ print_device(const char *uri, /* I - Device URI */ { iostatus = libusb_bulk_transfer(g.printer->handle, g.printer->write_endp, - print_buffer, g.print_bytes, + print_ptr, g.print_bytes, &bytes, 0); /* * Ignore timeout errors, but retain the number of bytes written to @@ -496,7 +493,7 @@ print_device(const char *uri, /* I - Device URI */ iostatus = libusb_bulk_transfer(g.printer->handle, g.printer->write_endp, - print_buffer, g.print_bytes, + print_ptr, g.print_bytes, &bytes, 0); } @@ -511,7 +508,7 @@ print_device(const char *uri, /* I - Device URI */ iostatus = libusb_bulk_transfer(g.printer->handle, g.printer->write_endp, - print_buffer, g.print_bytes, + print_ptr, g.print_bytes, &bytes, 0); } @@ -1046,7 +1043,7 @@ get_device_id(usb_printer_t *printer, /* I - Printer */ char *buffer, /* I - String buffer */ size_t bufsize) /* I - Number of bytes in buffer */ { - int length; /* Length of device ID */ + size_t length; /* Length of device ID */ if (libusb_control_transfer(printer->handle, @@ -1065,7 +1062,7 @@ get_device_id(usb_printer_t *printer, /* I - Printer */ * bytes. The 1284 spec says the length is stored MSB first... */ - length = (int)((((unsigned)buffer[0] & 255) << 8) | ((unsigned)buffer[1] & 255)); + length = (((unsigned)buffer[0] & 255) << 8) | ((unsigned)buffer[1] & 255); /* * Check to see if the length is larger than our buffer or less than 14 bytes @@ -1076,7 +1073,7 @@ get_device_id(usb_printer_t *printer, /* I - Printer */ */ if (length > bufsize || length < 14) - length = (int)((((unsigned)buffer[1] & 255) << 8) | ((unsigned)buffer[0] & 255)); + length = (((unsigned)buffer[1] & 255) << 8) | ((unsigned)buffer[0] & 255); if (length > bufsize) length = bufsize; @@ -1098,13 +1095,123 @@ get_device_id(usb_printer_t *printer, /* I - Printer */ * nul-terminate. */ - memmove(buffer, buffer + 2, (size_t)length); + memmove(buffer, buffer + 2, length); buffer[length] = '\0'; return (0); } +/* + * 'get_serial_number()' - Get the USB device serial number. + * + * This function is necessary because some vendors (DYMO, others) don't know + * how to implement USB correctly and having a unique serial number is necessary + * to support connecting more than one USB printer of the same make and model. + * + * The first bit of this code duplicates the strategy employed by + * `libusb_get_string_descriptor_ascii()` - get the list of supported language + * IDs and use the first (and usually only) language ID (almost always US + * English or 0x0409) to get the specified iSerialNumber string descriptor as + * a series of 16-bit UCS-2 Little Endian characters - this word order is + * mandated in section 8.1 of the USB 2.0 specification. The libusb function + * then copies the string, replacing any characters greater than 127 with '?' + * and happily embedding any non-printable ASCII characters such as NULs. + * + * In the case of DYMO printers, the iSerialNumber string consists of the + * U+3030 ("Wavy Dash") character followed by the ASCII serial number digits + * as 16-bit *Big Endian* characters. Acknowledging that USB implementors have + * proven capable of making lots of mistakes like this, this function takes a + * more pragmatic approach and converts serial number descriptors to hexadecimal + * if they don't contain purely printable US ASCII characters. This preserves + * backwards compatibility with conforming printers while allowing non- + * conforming printers to work reliably for the first time. + * + * If we are not able to get a serial number at all (`desc_index` is 0 or the + * other calls fail), then we fall back on using the configuration and interface + * indices from libusb, as before. + * + * (This code adapted with permission from PAPPL project) + */ + +static void +get_serial_number( + usb_printer_t *printer, /* I - Printer */ + uint8_t desc_index, /* I - Serial number descriptor index */ + char *buffer, /* I - String buffer */ + size_t bufsize) /* I - Number of bytes in buffer */ +{ + uint8_t langbuf[4]; // Language code buffer + uint16_t langid; // Language code/ID + uint8_t snbuf[256]; // Raw serial number buffer + int snlen; // Length of response + uint16_t snchar; // Character from raw serial number buffer + int i; // Looping var + char *bufptr, // Pointer into string buffer + *bufend; // End of string buffer + + + // If there is no serial number string, fallback... + if (!desc_index) + goto fallback; + + // Get the first supported language code... + if (libusb_get_string_descriptor(printer->handle, 0, 0, langbuf, sizeof(langbuf)) < 4) + goto fallback; // Didn't get 4 bytes + else if (langbuf[0] < 4 || (langbuf[0] & 1)) + goto fallback; // Bad length + else if (langbuf[1] != LIBUSB_DT_STRING) + goto fallback; // Not a string + + langid = langbuf[2] | (langbuf[3] << 8); + + // Then try to get the serial number string... + if ((snlen = libusb_get_string_descriptor(printer->handle, desc_index, langid, snbuf, sizeof(snbuf))) < 10) + goto fallback; // Didn't get at least 10 bytes + else if (snbuf[0] != snlen || (snbuf[0] & 1)) + goto fallback; // Bad length + else if (snbuf[1] != LIBUSB_DT_STRING) + goto fallback; // Not a string + + // Loop through the string to determine whether it is valid... + for (i = 2, bufptr = buffer, bufend = buffer + bufsize - 1; i < snlen && bufptr < bufend; i += 2) + { + // Get the current UCS-2 character... + snchar = snbuf[i] | (snbuf[i + 1] << 8); + + // Abort if not printable ASCII... + if (snchar < 0x20 || snchar >= 0x7f) + break; + + // Otherwise copy... + *bufptr++ = (char)snchar; + } + + if (i >= snlen) + { + // Got a good string, return it... + *bufptr = '\0'; + return; + } + + // Convert string to HEX... + for (i = 2, bufptr = buffer, bufend = buffer + bufsize - 1; i < snlen && bufptr < bufend; i ++, bufptr += 2) + { + snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%02X", snbuf[i]); + } + + if (i >= snlen) + return; // Converted all bytes to HEX... + + + // If we get here then we were not able to get a serial number string at all + // and have to hope that the bus and interface indices will be enough... + fallback: + + snprintf(buffer, bufsize, "%d.%d", printer->conf, printer->iface); +} + + /* * 'list_cb()' - List USB printers for discovery. */ @@ -1254,17 +1361,15 @@ make_device_uri( { struct libusb_device_descriptor devdesc; /* Current device descriptor */ - char options[1024]; /* Device URI options */ int num_values; /* Number of 1284 parameters */ cups_option_t *values; /* 1284 parameters */ const char *mfg, /* Manufacturer */ *mdl, /* Model */ - *des = NULL, /* Description */ - *sern = NULL; /* Serial number */ + *des = NULL; /* Description */ size_t mfglen; /* Length of manufacturer string */ char tempmdl[256], /* Temporary model string */ tempmfg[256], /* Temporary manufacturer string */ - tempsern[256], /* Temporary serial number string */ + sern[256], /* Serial number string */ *tempptr; /* Pointer into temp string */ @@ -1276,33 +1381,8 @@ make_device_uri( memset(&devdesc, 0, sizeof(devdesc)); - if (libusb_get_device_descriptor(printer->device, &devdesc) >= 0 && devdesc.iSerialNumber) - { - // Try getting the serial number from the device itself... - int length = libusb_get_string_descriptor_ascii(printer->handle, devdesc.iSerialNumber, (unsigned char *)tempsern, sizeof(tempsern) - 1); - if (length > 0) - { - tempsern[length] = '\0'; - sern = tempsern; - - fprintf(stderr, "DEBUG2: iSerialNumber=\"%s\"\n", tempsern); - } - else - fputs("DEBUG2: iSerialNumber could not be read.\n", stderr); - } - else - fputs("DEBUG2: iSerialNumber is not present.\n", stderr); - -#if 0 - if (!sern) - { - // Fall back on serial number from IEEE-1284 device ID, which on some - // printers (Issue #170) is a bogus hardcoded number. - if ((sern = cupsGetOption("SERIALNUMBER", num_values, values)) == NULL) - if ((sern = cupsGetOption("SERN", num_values, values)) == NULL) - sern = cupsGetOption("SN", num_values, values); - } -#endif // 0 + libusb_get_device_descriptor(printer->device, &devdesc); + get_serial_number(printer, devdesc.iSerialNumber, sern, sizeof(sern)); if ((mfg = cupsGetOption("MANUFACTURER", num_values, values)) == NULL) { @@ -1390,21 +1470,12 @@ make_device_uri( * and interface number... */ - if (sern) - { - if (printer->iface > 0) - snprintf(options, sizeof(options), "?serial=%s&interface=%d", sern, - printer->iface); - else - snprintf(options, sizeof(options), "?serial=%s", sern); - } - else if (printer->iface > 0) - snprintf(options, sizeof(options), "?interface=%d", printer->iface); + if (printer->iface > 0) + httpAssembleURIf(HTTP_URI_CODING_ALL, uri, uri_size, "usb", NULL, mfg, 0, + "/%s?serial=%s&interface=%d", mdl, sern, printer->iface); else - options[0] = '\0'; - - httpAssembleURIf(HTTP_URI_CODING_ALL, uri, uri_size, "usb", NULL, mfg, 0, - "/%s%s", mdl, options); + httpAssembleURIf(HTTP_URI_CODING_ALL, uri, uri_size, "usb", NULL, mfg, 0, + "/%s?serial=%s", mdl, sern); cupsFreeOptions(num_values, values); @@ -1427,7 +1498,7 @@ open_device(usb_printer_t *printer, /* I - Printer */ int number1 = -1, /* Configuration/interface/altset */ number2 = -1, /* numbers */ errcode = 0; - char current; /* Current configuration */ + unsigned char current; /* Current configuration */ /* @@ -1504,7 +1575,7 @@ open_device(usb_printer_t *printer, /* I - Printer */ LIBUSB_REQUEST_TYPE_STANDARD | LIBUSB_ENDPOINT_IN | LIBUSB_RECIPIENT_DEVICE, 8, /* GET_CONFIGURATION */ - 0, 0, (unsigned char *)¤t, 1, 5000) < 0) + 0, 0, ¤t, 1, 5000) < 0) current = 0; /* Assume not configured */ printer->origconf = current; @@ -1748,7 +1819,7 @@ static void *read_thread(void *reference) fputs("DEBUG: Got USB return aborted during read.\n", stderr); /* - * Make sure this loop executes no more than once every 250 miliseconds... + * Make sure this loop executes no more than once every 250 milliseconds... */ if ((readstatus != LIBUSB_SUCCESS || rbytes == 0) && diff --git a/backend/usb-unix.c b/backend/usb-unix.c index d256a81..c2cfce2 100644 --- a/backend/usb-unix.c +++ b/backend/usb-unix.c @@ -3,6 +3,7 @@ * * This file is included from "usb.c" when compiled on UNIX/Linux. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2013 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * diff --git a/backend/usb.c b/backend/usb.c index e1b2c03..04c6202 100644 --- a/backend/usb.c +++ b/backend/usb.c @@ -1,6 +1,7 @@ /* * USB printer backend for CUPS. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2012 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * @@ -164,7 +165,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ list_devices(); return (CUPS_BACKEND_OK); } - else if (argc < 6 || argc > 7) + else if (argc != 6 && argc != 7) { _cupsLangPrintf(stderr, _("Usage: %s job-id user title copies options [file]"), diff --git a/berkeley/Makefile b/berkeley/Makefile index 9415b76..848d683 100644 --- a/berkeley/Makefile +++ b/berkeley/Makefile @@ -1,6 +1,7 @@ # # Berkeley commands makefile for CUPS. # +# Copyright © 2020-2024 by OpenPrinting. # Copyright 2007-2019 by Apple Inc. # Copyright 1997-2006 by Easy Software Products, all rights reserved. # diff --git a/berkeley/lpc.c b/berkeley/lpc.c index 7af1035..daf0ebf 100644 --- a/berkeley/lpc.c +++ b/berkeley/lpc.c @@ -1,6 +1,7 @@ /* * "lpc" command for CUPS. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright 2007-2014 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * diff --git a/berkeley/lpq.c b/berkeley/lpq.c index 153fe29..170ca6c 100644 --- a/berkeley/lpq.c +++ b/berkeley/lpq.c @@ -1,7 +1,7 @@ /* * "lpq" command for CUPS. * - * Copyright © 2021-2022 by OpenPrinting. + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2018 by Apple Inc. * Copyright © 1997-2006 by Easy Software Products. * diff --git a/berkeley/lpr.c b/berkeley/lpr.c index 8affd3c..e2b85a2 100644 --- a/berkeley/lpr.c +++ b/berkeley/lpr.c @@ -1,7 +1,7 @@ /* * "lpr" command for CUPS. * - * Copyright © 2021-2022 by OpenPrinting. + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2019 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products. * diff --git a/berkeley/lprm.c b/berkeley/lprm.c index 9da1165..8aa2f00 100644 --- a/berkeley/lprm.c +++ b/berkeley/lprm.c @@ -1,7 +1,7 @@ /* * "lprm" command for CUPS. * - * Copyright © 2021-2022 by OpenPrinting. + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2018 by Apple Inc. * Copyright © 1997-2006 by Easy Software Products. * @@ -82,6 +82,13 @@ main(int argc, /* I - Number of command-line arguments */ else { i ++; + + if (i >= argc) + { + _cupsLangPrintf(stderr, _("%s: Error - expected destination after \"-P\" option."), argv[0]); + usage(); + } + name = argv[i]; } diff --git a/cgi-bin/Makefile b/cgi-bin/Makefile index 803dc62..4256d8f 100644 --- a/cgi-bin/Makefile +++ b/cgi-bin/Makefile @@ -1,7 +1,7 @@ # # CGI makefile for CUPS. # -# Copyright © 2022 by OpenPrinting. +# Copyright © 2020-2024 by OpenPrinting. # Copyright © 2007-2019 by Apple Inc. # Copyright © 1997-2006 by Easy Software Products. # diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c index 37f93b5..90f0e2b 100644 --- a/cgi-bin/admin.c +++ b/cgi-bin/admin.c @@ -1,7 +1,7 @@ /* * Administration CGI for CUPS. * - * Copyright © 2021-2022 by OpenPrinting + * Copyright © 2021-2024 by OpenPrinting * Copyright © 2007-2021 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products. * @@ -9,10 +9,6 @@ * information. */ -/* - * Include necessary headers... - */ - #include "cgi-private.h" #include #include @@ -47,7 +43,6 @@ static void do_menu(http_t *http); static void do_set_allowed_users(http_t *http); static void do_set_default(http_t *http); static void do_set_options(http_t *http, int is_class); -static void do_set_sharing(http_t *http); static char *get_option_value(ppd_file_t *ppd, const char *name, char *buffer, size_t bufsize); static double get_points(double number, const char *uval); @@ -119,7 +114,7 @@ main(void) /* Printer or class name */ *server_port = getenv("SERVER_PORT"); /* Port number string */ - int port = atoi(server_port ? server_port : "0"); + int port = server_port ? atoi(server_port) : 0; /* Port number */ char uri[1024]; /* URL */ @@ -140,8 +135,6 @@ main(void) do_set_allowed_users(http); else if (!strcmp(op, "set-as-default")) do_set_default(http); - else if (!strcmp(op, "set-sharing")) - do_set_sharing(http); else if (!strcmp(op, "find-new-printers") || !strcmp(op, "list-available-printers")) do_list_printers(http); @@ -335,9 +328,9 @@ do_am_class(http_t *http, /* I - HTTP connection */ title = cgiText(modify ? _("Modify Class") : _("Add Class")); op = cgiGetVariable("OP"); - name = cgiGetVariable("PRINTER_NAME"); + name = cgiGetTextfield("PRINTER_NAME"); - if (cgiGetVariable("PRINTER_LOCATION") == NULL) + if (cgiGetTextfield("PRINTER_LOCATION") == NULL) { /* * Build a CUPS_GET_PRINTERS request, which requires the @@ -544,10 +537,10 @@ do_am_class(http_t *http, /* I - HTTP connection */ NULL, uri); ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-location", - NULL, cgiGetVariable("PRINTER_LOCATION")); + NULL, cgiGetTextfield("PRINTER_LOCATION")); ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-info", - NULL, cgiGetVariable("PRINTER_INFO")); + NULL, cgiGetTextfield("PRINTER_INFO")); ippAddBoolean(request, IPP_TAG_PRINTER, "printer-is-accepting-jobs", 1); @@ -664,7 +657,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", - cgiGetVariable("PRINTER_NAME")); + cgiGetTextfield("PRINTER_NAME")); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -687,7 +680,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ fprintf(stderr, "DEBUG: file->mimetype=%s\n", file->mimetype); } - if ((name = cgiGetVariable("PRINTER_NAME")) != NULL) + if ((name = cgiGetTextfield("PRINTER_NAME")) != NULL) { for (ptr = name; *ptr; ptr ++) if ((*ptr >= 0 && *ptr <= ' ') || *ptr == 127 || *ptr == '/' || *ptr == '\\' || *ptr == '?' || *ptr == '\'' || *ptr == '\"' || *ptr == '#') @@ -867,7 +860,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ else maxrate = 19200; - for (i = 0; i < 10; i ++) + for (i = 0; i < (int)(sizeof(baudrates)/sizeof(baudrates[0])); i ++) if (baudrates[i] > maxrate) break; else @@ -880,7 +873,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ cgiCopyTemplateLang("choose-serial.tmpl"); cgiEndHTML(); } - else if (!name || !cgiGetVariable("PRINTER_LOCATION")) + else if (!name || !cgiGetTextfield("PRINTER_LOCATION")) { cgiStartHTML(title); @@ -916,10 +909,10 @@ do_am_printer(http_t *http, /* I - HTTP connection */ #ifdef __APPLE__ if (!strncmp(var, "usb:", 4)) - cgiSetVariable("printer_is_shared", "1"); + cgiSetVariable("PRINTER_IS_SHARED", "1"); else #endif /* __APPLE__ */ - cgiSetVariable("printer_is_shared", "0"); + cgiSetVariable("PRINTER_IS_SHARED", "0"); cgiCopyTemplateLang("add-printer.tmpl"); } @@ -1119,7 +1112,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", - cgiGetVariable("PRINTER_NAME")); + cgiGetTextfield("PRINTER_NAME")); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -1132,10 +1125,10 @@ do_am_printer(http_t *http, /* I - HTTP connection */ } ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-location", - NULL, cgiGetVariable("PRINTER_LOCATION")); + NULL, cgiGetTextfield("PRINTER_LOCATION")); ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-info", - NULL, cgiGetVariable("PRINTER_INFO")); + NULL, cgiGetTextfield("PRINTER_INFO")); strlcpy(uri, cgiGetVariable("DEVICE_URI"), sizeof(uri)); @@ -1166,9 +1159,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ ippAddBoolean(request, IPP_TAG_PRINTER, "printer-is-accepting-jobs", 1); - var = cgiGetVariable("printer_is_shared"); - ippAddBoolean(request, IPP_TAG_PRINTER, "printer-is-shared", - var && (!strcmp(var, "1") || !strcmp(var, "on"))); + ippAddBoolean(request, IPP_TAG_PRINTER, "printer-is-shared", cgiGetCheckbox("PRINTER_IS_SHARED")); ippAddInteger(request, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state", IPP_PRINTER_IDLE); @@ -1307,37 +1298,39 @@ do_config_server(http_t *http) /* I - HTTP connection */ * Get the checkbox values from the form... */ - debug_logging = cgiGetVariable("DEBUG_LOGGING") ? "1" : "0"; - remote_admin = cgiGetVariable("REMOTE_ADMIN") ? "1" : "0"; - remote_any = cgiGetVariable("REMOTE_ANY") ? "1" : "0"; - share_printers = cgiGetVariable("SHARE_PRINTERS") ? "1" : "0"; - user_cancel_any = cgiGetVariable("USER_CANCEL_ANY") ? "1" : "0"; + debug_logging = cgiGetCheckbox("DEBUG_LOGGING") ? "1" : "0"; + remote_admin = cgiGetCheckbox("REMOTE_ADMIN") ? "1" : "0"; + remote_any = cgiGetCheckbox("REMOTE_ANY") ? "1" : "0"; + share_printers = cgiGetCheckbox("SHARE_PRINTERS") ? "1" : "0"; + user_cancel_any = cgiGetCheckbox("USER_CANCEL_ANY") ? "1" : "0"; - advanced = cgiGetVariable("ADVANCEDSETTINGS") != NULL; + advanced = cgiGetCheckbox("ADVANCEDSETTINGS"); if (advanced) { /* * Get advanced settings... */ - browse_web_if = cgiGetVariable("BROWSE_WEB_IF") ? "Yes" : "No"; - max_clients = cgiGetVariable("MAX_CLIENTS"); - max_log_size = cgiGetVariable("MAX_LOG_SIZE"); - preserve_jobs = cgiGetVariable("PRESERVE_JOBS"); + browse_web_if = cgiGetCheckbox("BROWSE_WEB_IF") ? "Yes" : "No"; + max_clients = cgiGetTextfield("MAX_CLIENTS"); + max_log_size = cgiGetTextfield("MAX_LOG_SIZE"); + preserve_jobs = cgiGetCheckbox("PRESERVE_JOBS") ? "1" : "0"; - if (preserve_jobs) + if (atoi(preserve_jobs)) { - max_jobs = cgiGetVariable("MAX_JOBS"); - preserve_job_history = cgiGetVariable("PRESERVE_JOB_HISTORY"); - preserve_job_files = cgiGetVariable("PRESERVE_JOB_FILES"); + max_jobs = cgiGetTextfield("MAX_JOBS"); + preserve_job_history = cgiGetTextfield("PRESERVE_JOB_HISTORY"); + preserve_job_files = cgiGetTextfield("PRESERVE_JOB_FILES"); if (!max_jobs || atoi(max_jobs) < 0) max_jobs = "500"; - if (!preserve_job_history) - preserve_job_history = "On"; + if (!preserve_job_history || !preserve_job_history[0] || + (strcasecmp(preserve_job_history, "yes") && strcasecmp(preserve_job_history, "no") && !atoi(preserve_job_history))) + preserve_job_history = "Yes"; - if (!preserve_job_files) + if (!preserve_job_files || !preserve_job_files[0] || + (strcasecmp(preserve_job_files, "yes") && strcasecmp(preserve_job_files, "no") && !atoi(preserve_job_files))) preserve_job_files = "1d"; } else @@ -1374,8 +1367,10 @@ do_config_server(http_t *http) /* I - HTTP connection */ * Get authentication settings... */ - if (cgiGetVariable("KERBEROS")) + if (cgiGetCheckbox("KERBEROS")) + { strlcpy(default_auth_type, "Negotiate", sizeof(default_auth_type)); + } else { val = cupsGetOption("DefaultAuthType", num_settings, settings); @@ -1795,7 +1790,7 @@ do_delete_class(http_t *http) /* I - HTTP connection */ return; } - if ((pclass = cgiGetVariable("PRINTER_NAME")) != NULL) + if ((pclass = cgiGetTextfield("PRINTER_NAME")) != NULL) httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/classes/%s", pclass); else @@ -1880,7 +1875,7 @@ do_delete_printer(http_t *http) /* I - HTTP connection */ return; } - if ((printer = cgiGetVariable("PRINTER_NAME")) != NULL) + if ((printer = cgiGetTextfield("PRINTER_NAME")) != NULL) httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", printer); else @@ -2171,22 +2166,32 @@ do_menu(http_t *http) /* I - HTTP connection */ if ((val = cupsGetOption(CUPS_SERVER_DEBUG_LOGGING, num_settings, settings)) != NULL && atoi(val)) cgiSetVariable("DEBUG_LOGGING", "CHECKED"); + else + cgiSetVariable("DEBUG_LOGGING", ""); if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ADMIN, num_settings, settings)) != NULL && atoi(val)) cgiSetVariable("REMOTE_ADMIN", "CHECKED"); + else + cgiSetVariable("REMOTE_ADMIN", ""); if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ANY, num_settings, settings)) != NULL && atoi(val)) cgiSetVariable("REMOTE_ANY", "CHECKED"); + else + cgiSetVariable("REMOTE_ANY", ""); if ((val = cupsGetOption(CUPS_SERVER_SHARE_PRINTERS, num_settings, settings)) != NULL && atoi(val)) cgiSetVariable("SHARE_PRINTERS", "CHECKED"); + else + cgiSetVariable("SHARE_PRINTERS", ""); if ((val = cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY, num_settings, settings)) != NULL && atoi(val)) cgiSetVariable("USER_CANCEL_ANY", "CHECKED"); + else + cgiSetVariable("USER_CANCEL_ANY", ""); #ifdef HAVE_GSSAPI cgiSetVariable("HAVE_GSSAPI", "1"); @@ -2205,6 +2210,8 @@ do_menu(http_t *http) /* I - HTTP connection */ if (!_cups_strcasecmp(val, "yes") || !_cups_strcasecmp(val, "on") || !_cups_strcasecmp(val, "true")) cgiSetVariable("BROWSE_WEB_IF", "CHECKED"); + else + cgiSetVariable("BROWSE_WEB_IF", ""); if ((val = cupsGetOption("PreserveJobHistory", num_settings, settings)) == NULL) @@ -2288,7 +2295,7 @@ do_set_allowed_users(http_t *http) /* I - HTTP connection */ is_class = cgiGetVariable("IS_CLASS"); - printer = cgiGetVariable("PRINTER_NAME"); + printer = cgiGetTextfield("PRINTER_NAME"); if (!printer) { @@ -2299,7 +2306,7 @@ do_set_allowed_users(http_t *http) /* I - HTTP connection */ return; } - users = cgiGetVariable("users"); + users = cgiGetTextfield("users"); type = cgiGetVariable("type"); if (!users || !type || @@ -2541,7 +2548,7 @@ do_set_default(http_t *http) /* I - HTTP connection */ is_class = cgiGetVariable("IS_CLASS"); - printer = cgiGetVariable("PRINTER_NAME"); + printer = cgiGetTextfield("PRINTER_NAME"); title = cgiText(_("Set As Server Default")); if (!printer) @@ -2651,7 +2658,7 @@ do_set_options(http_t *http, /* I - HTTP connection */ * Get the printer name... */ - if ((printer = cgiGetVariable("PRINTER_NAME")) != NULL) + if ((printer = cgiGetTextfield("PRINTER_NAME")) != NULL) httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, "localhost", 0, is_class ? "/classes/%s" : "/printers/%s", printer); @@ -3349,99 +3356,6 @@ do_set_options(http_t *http, /* I - HTTP connection */ } -/* - * 'do_set_sharing()' - Set printer-is-shared value. - */ - -static void -do_set_sharing(http_t *http) /* I - HTTP connection */ -{ - ipp_t *request, /* IPP request */ - *response; /* IPP response */ - char uri[HTTP_MAX_URI]; /* Printer URI */ - const char *printer, /* Printer name */ - *is_class, /* Is a class? */ - *shared; /* Sharing value */ - - - is_class = cgiGetVariable("IS_CLASS"); - printer = cgiGetVariable("PRINTER_NAME"); - shared = cgiGetVariable("SHARED"); - - if (!printer || !shared) - { - cgiSetVariable("ERROR", cgiText(_("Missing form variable"))); - cgiStartHTML(cgiText(_("Set Publishing"))); - cgiCopyTemplateLang("error.tmpl"); - cgiEndHTML(); - return; - } - - /* - * Build a CUPS-Add-Printer/CUPS-Add-Class request, which requires the - * following attributes: - * - * attributes-charset - * attributes-natural-language - * printer-uri - * printer-is-shared - */ - - request = ippNewRequest(is_class ? CUPS_ADD_CLASS : CUPS_ADD_PRINTER); - - httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, - "localhost", 0, is_class ? "/classes/%s" : "/printers/%s", - printer); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", - NULL, uri); - - ippAddBoolean(request, IPP_TAG_OPERATION, "printer-is-shared", (char)atoi(shared)); - - /* - * Do the request and get back a response... - */ - - if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) - { - cgiSetIPPVars(response, NULL, NULL, NULL, 0); - - ippDelete(response); - } - - if (cupsLastError() == IPP_NOT_AUTHORIZED) - { - puts("Status: 401\n"); - exit(0); - } - else if (cupsLastError() > IPP_OK_CONFLICT) - { - cgiStartHTML(cgiText(_("Set Publishing"))); - cgiShowIPPError(_("Unable to change printer-is-shared attribute")); - } - else - { - /* - * Redirect successful updates back to the printer page... - */ - - char url[1024], /* Printer/class URL */ - refresh[1024]; /* Refresh URL */ - - - cgiRewriteURL(uri, url, sizeof(url), NULL); - cgiFormEncode(uri, url, sizeof(uri)); - snprintf(refresh, sizeof(refresh), "5;URL=/admin/?OP=redirect&URL=%s", uri); - cgiSetVariable("refresh_page", refresh); - - cgiStartHTML(cgiText(_("Set Publishing"))); - cgiCopyTemplateLang(is_class ? "class-modified.tmpl" : - "printer-modified.tmpl"); - } - - cgiEndHTML(); -} - - /* * 'get_option_value()' - Return the value of an option. * @@ -3510,8 +3424,8 @@ get_option_value( uval = cgiGetVariable("PageSize.Units"); if (!val || !lval || !uval || - (width = strtod(val, NULL)) == 0.0 || - (length = strtod(lval, NULL)) == 0.0 || + (width = atof(val)) == 0.0 || + (length = atof(lval)) == 0.0 || (strcmp(uval, "pt") && strcmp(uval, "in") && strcmp(uval, "ft") && strcmp(uval, "cm") && strcmp(uval, "mm") && strcmp(uval, "m"))) return (NULL); @@ -3543,7 +3457,7 @@ get_option_value( case PPD_CUSTOM_CURVE : case PPD_CUSTOM_INVCURVE : case PPD_CUSTOM_REAL : - if ((number = strtod(val, NULL)) == 0.0 || + if ((number = atof(val)) == 0.0 || number < cparam->minimum.custom_real || number > cparam->maximum.custom_real) return (NULL); @@ -3564,7 +3478,7 @@ get_option_value( case PPD_CUSTOM_POINTS : snprintf(keyword, sizeof(keyword), "%s.Units", coption->keyword); - if ((number = strtod(val, NULL)) == 0.0 || + if ((number = atof(val)) == 0.0 || (uval = cgiGetVariable(keyword)) == NULL || (strcmp(uval, "pt") && strcmp(uval, "in") && strcmp(uval, "ft") && strcmp(uval, "cm") && strcmp(uval, "mm") && strcmp(uval, "m"))) @@ -3624,7 +3538,7 @@ get_option_value( case PPD_CUSTOM_CURVE : case PPD_CUSTOM_INVCURVE : case PPD_CUSTOM_REAL : - if ((number = strtod(val, NULL)) == 0.0 || + if ((number = atof(val)) == 0.0 || number < cparam->minimum.custom_real || number > cparam->maximum.custom_real) return (NULL); @@ -3645,7 +3559,7 @@ get_option_value( case PPD_CUSTOM_POINTS : snprintf(keyword, sizeof(keyword), "%s.Units", coption->keyword); - if ((number = strtod(val, NULL)) == 0.0 || + if ((number = atof(val)) == 0.0 || (uval = cgiGetVariable(keyword)) == NULL || (strcmp(uval, "pt") && strcmp(uval, "in") && strcmp(uval, "ft") && strcmp(uval, "cm") && @@ -3706,7 +3620,8 @@ get_option_value( if (bufptr == buffer || (bufend - bufptr) < 2) return (NULL); - memcpy(bufptr, "}", 2); + bufptr[0] = '}'; + bufptr[1] = '\0'; } return (buffer); diff --git a/cgi-bin/cgi-private.h b/cgi-bin/cgi-private.h index 5d14d81..ffc798f 100644 --- a/cgi-bin/cgi-private.h +++ b/cgi-bin/cgi-private.h @@ -1,10 +1,12 @@ /* * Private CGI definitions for CUPS. * - * Copyright 2007-2011 by Apple Inc. - * Copyright 1997-2006 by Easy Software Products. + * Copyright © 2020-2024 by OpenPrinting. + * Copyright © 2007-2011 by Apple Inc. + * Copyright © 1997-2006 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* diff --git a/cgi-bin/cgi.h b/cgi-bin/cgi.h index 11acb22..0f97727 100644 --- a/cgi-bin/cgi.h +++ b/cgi-bin/cgi.h @@ -1,6 +1,7 @@ /* * CGI support library definitions for CUPS. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2019 by Apple Inc. * Copyright © 1997-2006 by Easy Software Products. * @@ -69,11 +70,13 @@ extern char *cgiFormEncode(char *dst, const char *src, extern void cgiFreeSearch(void *search); extern char *cgiGetArray(const char *name, int element); extern void cgiGetAttributes(ipp_t *request, const char *tmpl); +extern int cgiGetCheckbox(const char *name); extern const char *cgiGetCookie(const char *name); extern const cgi_file_t *cgiGetFile(void); extern cups_array_t *cgiGetIPPObjects(ipp_t *response, void *search); extern int cgiGetSize(const char *name); extern char *cgiGetTemplateDir(void); +extern const char *cgiGetTextfield(const char *name); extern char *cgiGetVariable(const char *name); extern int cgiInitialize(void); extern int cgiIsPOST(void); diff --git a/cgi-bin/classes.c b/cgi-bin/classes.c index 718604a..d525879 100644 --- a/cgi-bin/classes.c +++ b/cgi-bin/classes.c @@ -1,10 +1,12 @@ /* * Class status CGI for CUPS. * - * Copyright 2007-2016 by Apple Inc. - * Copyright 1997-2006 by Easy Software Products. + * Copyright © 2020-2024 by OpenPrinting. + * Copyright © 2007-2016 by Apple Inc. + * Copyright © 1997-2006 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* @@ -333,7 +335,7 @@ show_all_classes(http_t *http, /* I - Connection to server */ * Get a list of matching job objects. */ - if ((var = cgiGetVariable("QUERY")) != NULL && + if ((var = cgiGetTextfield("QUERY")) != NULL && !cgiGetVariable("CLEAR")) search = cgiCompileSearch(var); else diff --git a/cgi-bin/help-index.c b/cgi-bin/help-index.c index 3da1010..1508cbc 100644 --- a/cgi-bin/help-index.c +++ b/cgi-bin/help-index.c @@ -1,6 +1,7 @@ /* * Online help index routines for CUPS. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2019 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products. * @@ -851,7 +852,7 @@ help_load_file( off_t offset; /* File offset */ char quote; /* Quote character */ help_word_t *word; /* Current word */ - int wordlen; /* Length of word */ + size_t wordlen; /* Length of word */ if ((fp = cupsFileOpen(filename, "r")) == NULL) @@ -1136,9 +1137,9 @@ help_load_file( for (text = ptr, ptr ++; *ptr && isalnum(*ptr & 255); ptr ++); - wordlen = (int)(ptr - text); + wordlen = (size_t)(ptr - text); - memcpy(temp, text, (size_t)wordlen); + memcpy(temp, text, wordlen); temp[wordlen] = '\0'; ptr --; diff --git a/cgi-bin/help-index.h b/cgi-bin/help-index.h index c486fba..21c07bd 100644 --- a/cgi-bin/help-index.h +++ b/cgi-bin/help-index.h @@ -1,10 +1,12 @@ /* * Online help index definitions for CUPS. * - * Copyright 2007-2011 by Apple Inc. - * Copyright 1997-2007 by Easy Software Products. + * Copyright © 2020-2024 by OpenPrinting. + * Copyright © 2007-2011 by Apple Inc. + * Copyright © 1997-2007 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ #ifndef _CUPS_HELP_INDEX_H_ diff --git a/cgi-bin/help.c b/cgi-bin/help.c index faa1993..a9511f9 100644 --- a/cgi-bin/help.c +++ b/cgi-bin/help.c @@ -1,10 +1,12 @@ /* * Online help CGI for CUPS. * - * Copyright 2007-2011 by Apple Inc. - * Copyright 1997-2006 by Easy Software Products. + * Copyright © 2020-2024 by OpenPrinting. + * Copyright © 2007-2011 by Apple Inc. + * Copyright © 1997-2006 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* @@ -26,7 +28,7 @@ main(int argc, /* I - Number of command-line arguments */ *si; /* Search index */ help_node_t *n; /* Current help node */ int i; /* Looping var */ - const char *query; /* Search query */ + const char *query = NULL; /* Search query */ const char *cache_dir; /* CUPS_CACHEDIR environment variable */ const char *docroot; /* CUPS_DOCROOT environment variable */ const char *helpfile, /* Current help file */ @@ -170,8 +172,9 @@ main(int argc, /* I - Number of command-line arguments */ if (cgiGetVariable("CLEAR")) cgiSetVariable("QUERY", ""); + else if ((query = cgiGetTextfield("QUERY")) != NULL) + query = strdup(query); - query = cgiGetVariable("QUERY"); si = helpSearchIndex(hi, query, topic, helpfile); cgiClearVariables(); diff --git a/cgi-bin/html.c b/cgi-bin/html.c index 4c9d822..41d7b09 100644 --- a/cgi-bin/html.c +++ b/cgi-bin/html.c @@ -1,10 +1,12 @@ /* * HTML support functions for CUPS. * - * Copyright 2007-2011 by Apple Inc. - * Copyright 1997-2006 by Easy Software Products. + * Copyright © 2020-2024 by OpenPrinting. + * Copyright © 2007-2011 by Apple Inc. + * Copyright © 1997-2006 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* diff --git a/cgi-bin/ipp-var.c b/cgi-bin/ipp-var.c index 939675e..099c754 100644 --- a/cgi-bin/ipp-var.c +++ b/cgi-bin/ipp-var.c @@ -1,10 +1,12 @@ /* * CGI <-> IPP variable routines for CUPS. * - * Copyright 2007-2016 by Apple Inc. - * Copyright 1997-2007 by Easy Software Products. + * Copyright © 2020-2024 by OpenPrinting. + * Copyright © 2007-2016 by Apple Inc. + * Copyright © 1997-2007 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* diff --git a/cgi-bin/jobs.c b/cgi-bin/jobs.c index d6da744..f9339a8 100644 --- a/cgi-bin/jobs.c +++ b/cgi-bin/jobs.c @@ -1,10 +1,12 @@ /* * Job status CGI for CUPS. * - * Copyright 2007-2014 by Apple Inc. - * Copyright 1997-2006 by Easy Software Products. + * Copyright © 2020-2024 by OpenPrinting. + * Copyright © 2007-2014 by Apple Inc. + * Copyright © 1997-2006 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* diff --git a/cgi-bin/printers.c b/cgi-bin/printers.c index 2a33b68..7ed21f4 100644 --- a/cgi-bin/printers.c +++ b/cgi-bin/printers.c @@ -1,10 +1,12 @@ /* * Printer status CGI for CUPS. * - * Copyright 2007-2016 by Apple Inc. - * Copyright 1997-2006 by Easy Software Products. + * Copyright © 2020-2024 by OpenPrinting. + * Copyright © 2007-2016 by Apple Inc. + * Copyright © 1997-2006 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* @@ -350,7 +352,7 @@ show_all_printers(http_t *http, /* I - Connection to server */ * Get a list of matching job objects. */ - if ((var = cgiGetVariable("QUERY")) != NULL && + if ((var = cgiGetTextfield("QUERY")) != NULL && !cgiGetVariable("CLEAR")) search = cgiCompileSearch(var); else diff --git a/cgi-bin/search.c b/cgi-bin/search.c index 8dc5b32..823d056 100644 --- a/cgi-bin/search.c +++ b/cgi-bin/search.c @@ -1,8 +1,9 @@ /* * Search routines for CUPS. * - * Copyright 2007-2018 by Apple Inc. - * Copyright 1997-2006 by Easy Software Products. + * Copyright © 2020-2025 by OpenPrinting. + * Copyright © 2007-2018 by Apple Inc. + * Copyright © 1997-2006 by Easy Software Products. * * Licensed under Apache License v2.0. See the file "LICENSE" for more * information. @@ -168,26 +169,27 @@ cgiCompileSearch(const char *query) /* I - Query string */ if (wlen > slen) { /* - * Expand the RE string buffer... + * Expand the RE string buffer... */ - char *temp; /* Temporary string pointer */ + char *temp; /* Temporary string pointer */ + const ptrdiff_t pos = sptr - s; /* Current pointer position (GCC workaround for use-after-free warning after realloc) */ slen = wlen + 128; - temp = (char *)realloc(s, slen); + temp = (char *)realloc(s, slen); if (!temp) { free(s); free(re); if (lword) - free(lword); + free(lword); return (NULL); } - sptr = temp + (sptr - s); + sptr = temp + pos; s = temp; } diff --git a/cgi-bin/template.c b/cgi-bin/template.c index 3300a88..fcf94a1 100644 --- a/cgi-bin/template.c +++ b/cgi-bin/template.c @@ -1,10 +1,12 @@ /* * CGI template function. * - * Copyright 2007-2015 by Apple Inc. - * Copyright 1997-2006 by Easy Software Products. + * Copyright © 2020-2024 by OpenPrinting. + * Copyright © 2007-2015 by Apple Inc. + * Copyright © 1997-2006 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ #include "cgi-private.h" @@ -397,6 +399,8 @@ cgi_copy(FILE *out, /* I - Output file */ * See if the terminating character requires another test... */ + fprintf(stderr, "DEBUG2: %*s\"{%s}\" mapped to \"%s\"...\n", indent, "", name, outptr); + if (ch == '}') { /* @@ -432,7 +436,7 @@ cgi_copy(FILE *out, /* I - Output file */ if (ch == '?') { /* - * Test for existance... + * Test for existence... */ if (name[0] == '?') diff --git a/cgi-bin/testcgi.c b/cgi-bin/testcgi.c index a2276f4..836a237 100644 --- a/cgi-bin/testcgi.c +++ b/cgi-bin/testcgi.c @@ -1,10 +1,12 @@ /* * CGI test program for CUPS. * - * Copyright 2007-2014 by Apple Inc. - * Copyright 1997-2005 by Easy Software Products. + * Copyright © 2020-2024 by OpenPrinting. + * Copyright © 2007-2014 by Apple Inc. + * Copyright © 1997-2005 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* diff --git a/cgi-bin/testhi.c b/cgi-bin/testhi.c index dec6bdf..61afae4 100644 --- a/cgi-bin/testhi.c +++ b/cgi-bin/testhi.c @@ -1,10 +1,12 @@ /* * Help index test program for CUPS. * - * Copyright 2007-2017 by Apple Inc. - * Copyright 1997-2007 by Easy Software Products. + * Copyright © 2020-2024 by OpenPrinting. + * Copyright © 2007-2017 by Apple Inc. + * Copyright © 1997-2007 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* diff --git a/cgi-bin/testtemplate.c b/cgi-bin/testtemplate.c index 930bd6c..a68a4b7 100644 --- a/cgi-bin/testtemplate.c +++ b/cgi-bin/testtemplate.c @@ -1,10 +1,12 @@ /* * CGI template test program for CUPS. * - * Copyright 2007-2011 by Apple Inc. - * Copyright 2006 by Easy Software Products. + * Copyright © 2020-2024 by OpenPrinting. + * Copyright © 2007-2011 by Apple Inc. + * Copyright © 2006 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* diff --git a/cgi-bin/var.c b/cgi-bin/var.c index 8c8387f..a4993ff 100644 --- a/cgi-bin/var.c +++ b/cgi-bin/var.c @@ -1,6 +1,7 @@ /* * CGI form variable and array functions for CUPS. * + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2019 by Apple Inc. * Copyright © 1997-2005 by Easy Software Products. * @@ -177,6 +178,44 @@ cgiGetArray(const char *name, /* I - Name of array variable */ } +/* + * 'cgiGetCheckbox()' - Get a checkbox value, deleting any invalid values. + */ + +int /* O - 1 if checked, 0 otherwise */ +cgiGetCheckbox(const char *name) /* I - Name of form field */ +{ + _cgi_var_t *var = cgi_find_variable(name); + /* Found variable */ + const char *value = var ? var->values[var->nvalues - 1] : NULL; + int ret; /* Return value */ + + + ret = value && !_cups_strcasecmp(value, "checked"); + + if (!ret && value) + { + /* + * Delete the invalid checkbox value... + */ + + int i = var - form_vars, j; + + form_count --; + + for (j = 0; j < var->nvalues; j ++) + free(var->values[j]); + free(var->name); + free(var->values); + + if (i < form_count) + memmove(var, var + 1, (size_t)(form_count - i) * sizeof(_cgi_var_t)); + } + + return (ret); +} + + /* * 'cgiGetCookie()' - Get a cookie value. */ @@ -216,6 +255,43 @@ cgiGetSize(const char *name) /* I - Name of variable */ } +/* + * 'cgiGetTextfield()' - Get a textfield value, deleting any invalid values. + */ + +const char * /* O - Value or NULL */ +cgiGetTextfield(const char *name) /* I - Name of form field */ +{ + _cgi_var_t *var = cgi_find_variable(name); + /* Found variable */ + const char *value = var ? var->values[var->nvalues - 1] : NULL; + + + if (value && strchr(value, '\"') != NULL) + { + /* + * Delete the invalid text field value... + */ + + int i = var - form_vars, j; + + form_count --; + + for (j = 0; j < var->nvalues; j ++) + free(var->values[j]); + free(var->name); + free(var->values); + + if (i < form_count) + memmove(var, var + 1, (size_t)(form_count - i) * sizeof(_cgi_var_t)); + + value = NULL; + } + + return (value ? strdup(value) : NULL); +} + + /* * 'cgiGetVariable()' - Get a CGI variable from the database. * @@ -553,14 +629,27 @@ cgi_add_variable(const char *name, /* I - Variable name */ if (!temp_vars) return; - form_vars = temp_vars; - form_alloc += 16; - } + var = temp_vars + form_count; - var = form_vars + form_count; + if ((var->values = calloc((size_t)element + 1, sizeof(char *))) == NULL) + { + /* + * Rollback changes + */ - if ((var->values = calloc((size_t)element + 1, sizeof(char *))) == NULL) - return; + if (form_alloc == 0) + free(temp_vars); + return; + } + form_vars = temp_vars; + form_alloc += 16; + } + else + { + var = form_vars + form_count; + if ((var->values = calloc((size_t)element + 1, sizeof(char *))) == NULL) + return; + } var->name = strdup(name); var->nvalues = element + 1; diff --git a/conf/Makefile b/conf/Makefile index e249e60..62aa0c6 100644 --- a/conf/Makefile +++ b/conf/Makefile @@ -1,6 +1,7 @@ # # Configuration file makefile for CUPS. # +# Copyright © 2020-2024 by OpenPrinting. # Copyright 2007-2015 by Apple Inc. # Copyright 1993-2006 by Easy Software Products. # diff --git a/conf/cups-files.conf.in b/conf/cups-files.conf.in index 93584a1..6db1392 100644 --- a/conf/cups-files.conf.in +++ b/conf/cups-files.conf.in @@ -6,6 +6,9 @@ # List of events that are considered fatal errors for the scheduler... #FatalErrors @CUPS_FATAL_ERRORS@ +# Strip domain in local username? +#StripUserDomain No + # Do we call fsync() after writing configuration or status files? #SyncOnClose @CUPS_SYNC_ON_CLOSE@ @@ -19,6 +22,9 @@ SystemGroup @CUPS_SYSTEM_GROUPS@ @CUPS_SYSTEM_AUTHKEY@ +# Are Unix domain socket peer credentials used for authorization? +PeerCred @CUPS_PEER_CRED@ + # User that is substituted for unauthenticated (remote) root accesses... #RemoteRoot remroot diff --git a/conf/cupsd.conf.in b/conf/cupsd.conf.in index b258849..31ecacb 100644 --- a/conf/cupsd.conf.in +++ b/conf/cupsd.conf.in @@ -38,6 +38,8 @@ IdleExitTimeout @EXIT_TIMEOUT@ # Restrict access to the admin pages... + AuthType Default + Require user @SYSTEM Order allow,deny @@ -68,7 +70,13 @@ IdleExitTimeout @EXIT_TIMEOUT@ Order deny,allow - + + Require user @OWNER @SYSTEM + Order deny,allow + + + + AuthType Default Require user @OWNER @SYSTEM Order deny,allow @@ -88,7 +96,13 @@ IdleExitTimeout @EXIT_TIMEOUT@ # Only the owner or an administrator can cancel or authenticate a job... - + + Require user @OWNER @CUPS_DEFAULT_PRINTOPERATOR_AUTH@ + Order deny,allow + + + + AuthType Default Require user @OWNER @CUPS_DEFAULT_PRINTOPERATOR_AUTH@ Order deny,allow diff --git a/conf/mime.convs.in b/conf/mime.convs.in index 57b459d..91f36e0 100644 --- a/conf/mime.convs.in +++ b/conf/mime.convs.in @@ -5,6 +5,7 @@ # # Base MIME conversions file for CUPS. # +# Copyright © 2020-2024 by OpenPrinting. # Copyright © 2007-2016 by Apple Inc. # Copyright © 1997-2007 by Easy Software Products. # diff --git a/conf/mime.types b/conf/mime.types index fcd6b6e..62c4889 100644 --- a/conf/mime.types +++ b/conf/mime.types @@ -5,6 +5,7 @@ # VERSIONS OF CUPS. Instead, create a "local.types" file that # reflects your local configuration changes. # +# Copyright © 2020-2024 by OpenPrinting. # Copyright © 2007-2017 by Apple Inc. # Copyright © 1997-2007 by Easy Software Products. # @@ -69,12 +70,12 @@ application/pdf pdf regex(0,^[\n\r]*%PDF) application/postscript ai eps ps string(0,%!) string(0,<04>%!) \ contains(0,128,<1B>%-12345X) + \ - (contains(0,4096,"LANGUAGE=POSTSCRIPT") \ - contains(0,4096,"LANGUAGE = Postscript") \ - contains(0,4096,"LANGUAGE = PostScript") \ - contains(0,4096,"LANGUAGE = POSTSCRIPT") \ - (contains(0,4096,<0a>%!) + \ - !contains(0,4096,"ENTER LANGUAGE"))) + (contains(0,8192,"LANGUAGE=POSTSCRIPT") \ + contains(0,8192,"LANGUAGE = Postscript") \ + contains(0,8192,"LANGUAGE = PostScript") \ + contains(0,8192,"LANGUAGE = POSTSCRIPT") \ + (contains(0,8192,<0a>%!) + \ + !contains(0,8192,"ENTER LANGUAGE"))) ######################################################################## @@ -155,8 +156,8 @@ application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR") \ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \ string(0,<1B>@) \ (contains(0,128,<1B>%-12345X) + \ - (contains(0,4096,"LANGUAGE=PCL") \ - contains(0,4096,"LANGUAGE = PCL"))) + (contains(0,8192,"LANGUAGE=PCL") \ + contains(0,8192,"LANGUAGE = PCL"))) ######################################################################## # diff --git a/conf/pam.password b/conf/pam.password new file mode 100644 index 0000000..6146a91 --- /dev/null +++ b/conf/pam.password @@ -0,0 +1,4 @@ +#%PAM-1.0 +# Use password-auth common PAM configuration for the daemon +auth include password-auth +account include password-auth diff --git a/conf/pam.system b/conf/pam.system new file mode 100644 index 0000000..9e7c820 --- /dev/null +++ b/conf/pam.system @@ -0,0 +1,3 @@ +#%PAM-1.0 +auth include system-auth +account include system-auth diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4 index 9a9d480..48602a8 100644 --- a/config-scripts/cups-common.m4 +++ b/config-scripts/cups-common.m4 @@ -1,7 +1,7 @@ dnl dnl Common configuration stuff for CUPS. dnl -dnl Copyright © 2021-2022 by OpenPrinting. +dnl Copyright © 2020-2025 by OpenPrinting. dnl Copyright © 2007-2019 by Apple Inc. dnl Copyright © 1997-2007 by Easy Software Products, all rights reserved. dnl @@ -207,6 +207,11 @@ AC_COMPILE_IFELSE([ AC_MSG_RESULT([no]) ]) +dnl See if we have the timegm function... +AC_CHECK_FUNC([timegm], [ + AC_DEFINE([HAVE_TIMEGM], [1], [Do we have the timegm function?]) +]) + dnl See if the stat structure has the st_gen member... AC_MSG_CHECKING([for st_gen member in stat structure]) AC_COMPILE_IFELSE([ @@ -483,7 +488,7 @@ AS_CASE(["$COMPONENTS"], [all], [ LIBHEADERS="\$(COREHEADERS)" LIBHEADERSPRIV="\$(COREHEADERSPRIV)" ], [*], [ - AC_MSG_ERROR([Bad build component "$COMPONENT" specified.]) + AC_MSG_ERROR([Bad build component "$COMPONENTS" specified.]) ]) AC_SUBST([BUILDDIRS]) diff --git a/config-scripts/cups-compiler.m4 b/config-scripts/cups-compiler.m4 index 91ca677..ecb7b2d 100644 --- a/config-scripts/cups-compiler.m4 +++ b/config-scripts/cups-compiler.m4 @@ -1,7 +1,7 @@ dnl dnl Compiler tests for CUPS. dnl -dnl Copyright © 2021-2022 by OpenPrinting. +dnl Copyright © 2020-2024 by OpenPrinting. dnl Copyright © 2007-2018 by Apple Inc. dnl Copyright © 1997-2007 by Easy Software Products, all rights reserved. dnl @@ -105,11 +105,13 @@ AS_IF([test -n "$GCC"], [ AS_IF([test x$enable_sanitizer = xyes], [ # Use -fsanitize=address with debugging... OPTIM="$OPTIM -g -fsanitize=address" + ], [echo "$CXXFLAGS $CFLAGS" | grep -q _FORTIFY_SOURCE], [ + # Don't add _FORTIFY_SOURCE if it is already there ], [ # Otherwise use the Fortify enhancements to catch any unbounded # string operations... - CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2" - CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2" + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=3" + CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=3" ]) # Default optimization options... @@ -200,7 +202,7 @@ AS_IF([test -n "$GCC"], [ ]) ], [ # Add vendor-specific compiler options... - AS_CASE([$host_os_name], [sunos*], [ + AS_CASE([$host_os_name], [sunos* | solaris*], [ # Solaris AS_IF([test -z "$OPTIM"], [ OPTIM="-xO2" @@ -212,9 +214,9 @@ AS_IF([test -n "$GCC"], [ ], [*], [ # Running some other operating system; inform the user # they should contribute the necessary options via - # Github... + # GitHub... echo "Building CUPS with default compiler optimizations." - echo "Contact the OpenPrinting CUPS developers on Github with the uname and compiler" + echo "Contact the OpenPrinting CUPS developers on GitHub with the uname and compiler" echo "options needed for your platform, or set the CFLAGS and LDFLAGS environment" echo "variables before running configure." echo "" diff --git a/config-scripts/cups-container.m4 b/config-scripts/cups-container.m4 index 7e345b5..526664d 100644 --- a/config-scripts/cups-container.m4 +++ b/config-scripts/cups-container.m4 @@ -39,12 +39,12 @@ AS_IF([test "x$PKGCONFIG" != x], [ APPARMORLIBS="$($PKGCONFIG --libs libapparmor)" AC_DEFINE([HAVE_LIBAPPARMOR], [1], [Have the apparmor library?]) - AC_MSG_CHECKING([for libsnapd-glib]) - AS_IF([$PKGCONFIG --exists snapd-glib glib-2.0 gio-2.0], [ + AC_MSG_CHECKING([for libsnapd-glib-2]) + AS_IF([$PKGCONFIG --exists snapd-glib-2 glib-2.0 gio-2.0], [ AC_MSG_RESULT([yes]) - CFLAGS="$CFLAGS $($PKGCONFIG --cflags snapd-glib glib-2.0 gio-2.0)" - SNAPDGLIBLIBS="$($PKGCONFIG --libs snapd-glib glib-2.0 gio-2.0)" - AC_DEFINE([HAVE_LIBSNAPDGLIB], [1], [Have the snapd-glib library?]) + CFLAGS="$CFLAGS $($PKGCONFIG --cflags snapd-glib-2 glib-2.0 gio-2.0)" + SNAPDGLIBLIBS="$($PKGCONFIG --libs snapd-glib-2 glib-2.0 gio-2.0)" + AC_DEFINE([HAVE_LIBSNAPDGLIB], [1], [Have the snapd-glib-2 library?]) SAVELIBS="$LIBS" LIBS="$SNAPDGLIBLIBS $LIBS" AC_CHECK_FUNC([snapd_client_run_snapctl2_sync], [ @@ -52,7 +52,21 @@ AS_IF([test "x$PKGCONFIG" != x], [ ]) LIBS="$SAVELIBS" ], [ - AC_MSG_RESULT([no]) + AC_MSG_CHECKING([for libsnapd-glib]) + AS_IF([$PKGCONFIG --exists snapd-glib glib-2.0 gio-2.0], [ + AC_MSG_RESULT([yes]) + CFLAGS="$CFLAGS $($PKGCONFIG --cflags snapd-glib glib-2.0 gio-2.0)" + SNAPDGLIBLIBS="$($PKGCONFIG --libs snapd-glib glib-2.0 gio-2.0)" + AC_DEFINE([HAVE_LIBSNAPDGLIB], [1], [Have the snapd-glib library?]) + SAVELIBS="$LIBS" + LIBS="$SNAPDGLIBLIBS $LIBS" + AC_CHECK_FUNC([snapd_client_run_snapctl2_sync], [ + AC_DEFINE([HAVE_SNAPD_CLIENT_RUN_SNAPCTL2_SYNC], [1], [Have the snapd_client_run_snapctl2_sync function?]) + ]) + LIBS="$SAVELIBS" + ], [ + AC_MSG_RESULT([no]) + ]) ]) ]) ]) diff --git a/config-scripts/cups-defaults.m4 b/config-scripts/cups-defaults.m4 index 2af98b2..fc9ba4a 100644 --- a/config-scripts/cups-defaults.m4 +++ b/config-scripts/cups-defaults.m4 @@ -1,7 +1,7 @@ dnl dnl Default cupsd configuration settings for CUPS. dnl -dnl Copyright © 2021-2022 by OpenPrinting. +dnl Copyright © 2020-2025 by OpenPrinting. dnl Copyright © 2007-2018 by Apple Inc. dnl Copyright © 2006-2007 by Easy Software Products, all rights reserved. dnl @@ -25,40 +25,6 @@ AC_ARG_WITH([languages], AS_HELP_STRING([--with-languages], [set installed langu ]) AC_SUBST([LANGUAGES]) -dnl macOS bundle-based localization support -AC_ARG_WITH([bundledir], AS_HELP_STRING([--with-bundledir], [set localization bundle directory]), [ - CUPS_BUNDLEDIR="$withval" -], [ - AS_IF([test "x$host_os_name" = xdarwin -a $host_os_version -ge 100], [ - CUPS_BUNDLEDIR="/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A" - LANGUAGES="" - ], [ - CUPS_BUNDLEDIR="" - ]) -]) - -AC_SUBST([CUPS_BUNDLEDIR]) -AS_IF([test "x$CUPS_BUNDLEDIR" != x], [ - AC_DEFINE_UNQUOTED([CUPS_BUNDLEDIR], ["$CUPS_BUNDLEDIR"], [macOS bundle directory.]) -]) - -AC_ARG_WITH([bundlelang], AS_HELP_STRING([--with-bundlelang], [set localization bundle base language (English or en)]), [ - cups_bundlelang="$withval" -], [ - AS_IF([test $host_os_version -ge 190], [ - cups_bundlelang="en" - ], [ - cups_bundlelang="English" - ]) -]) - -AS_IF([test "x$cups_bundlelang" != x -a "x$CUPS_BUNDLEDIR" != x], [ - CUPS_RESOURCEDIR="$CUPS_BUNDLEDIR/Resources/$cups_bundlelang.lproj" -], [ - CUPS_RESOURCEDIR="" -]) -AC_SUBST([CUPS_RESOURCEDIR]) - dnl Default executable file permissions AC_ARG_WITH([exe_file_perm], AS_HELP_STRING([--with-exe-file-perm], [set default executable permissions value, default=0755]), [ CUPS_EXE_FILE_PERM="$withval" @@ -129,6 +95,15 @@ AC_ARG_WITH([log_level], AS_HELP_STRING([--with-log-level], [set default LogLeve AC_SUBST([CUPS_LOG_LEVEL]) AC_DEFINE_UNQUOTED([CUPS_DEFAULT_LOG_LEVEL], ["$CUPS_LOG_LEVEL"], [Default LogLevel value.]) +dnl Default PeerCred +AC_ARG_WITH([peer_cred], AS_HELP_STRING([--with-peer-cred], [set default PeerCred value (on/off/root-only), default=on]), [ + CUPS_PEER_CRED="$withval" +], [ + CUPS_PEER_CRED="on" +]) +AC_SUBST([CUPS_PEER_CRED]) +AC_DEFINE_UNQUOTED([CUPS_DEFAULT_PEER_CRED], ["$CUPS_PEER_CRED"], [Default PeerCred value.]) + dnl Default AccessLogLevel AC_ARG_WITH(access_log_level, [ --with-access-log-level set default AccessLogLevel value, default=none], CUPS_ACCESS_LOG_LEVEL="$withval", @@ -335,7 +310,7 @@ AS_IF([test x$default_printcap != xno], [ AS_IF([test "x$default_printcap" = "xdefault"], [ AS_CASE([$host_os_name], [darwin*], [ CUPS_DEFAULT_PRINTCAP="/Library/Preferences/org.cups.printers.plist" - ], [sunos*], [ + ], [sunos* | solaris*], [ CUPS_DEFAULT_PRINTCAP="/etc/printers.conf" ], [*], [ CUPS_DEFAULT_PRINTCAP="/etc/printcap" diff --git a/config-scripts/cups-directories.m4 b/config-scripts/cups-directories.m4 index e92d622..069ee7b 100644 --- a/config-scripts/cups-directories.m4 +++ b/config-scripts/cups-directories.m4 @@ -1,7 +1,7 @@ dnl dnl Directory stuff for CUPS. dnl -dnl Copyright © 2021-2022 by OpenPrinting. +dnl Copyright © 2020-2024 by OpenPrinting. dnl Copyright © 2007-2017 by Apple Inc. dnl Copyright © 1997-2007 by Easy Software Products, all rights reserved. dnl @@ -184,7 +184,7 @@ AC_SUBST([CUPS_DOCROOT]) # Locale data AS_IF([test "$localedir" = "\${datarootdir}/locale"], [ - AS_CASE(["$host_os_name"], [linux* | gnu* | *bsd* | darwin*], [ + AS_CASE(["$host_os_name"], [linux* | gnu* | *bsd* | darwin* | solaris*], [ CUPS_LOCALEDIR="$datarootdir/locale" ], [*], [ # This is the standard System V location... @@ -266,6 +266,12 @@ AC_ARG_WITH([rundir], AS_HELP_STRING([--with-rundir], [set transient run-time st AS_CASE(["$host_os_name"], [darwin*], [ # Darwin (macOS) CUPS_STATEDIR="$CUPS_SERVERROOT" + ], [sunos* | solaris*], [ + AS_IF([test -d /system/volatile], [ + CUPS_STATEDIR="/system/volatile/cups" + ], [ + CUPS_STATEDIR="$localstatedir/run/cups" + ]) ], [*], [ # All others CUPS_STATEDIR="$localstatedir/run/cups" diff --git a/config-scripts/cups-dnssd.m4 b/config-scripts/cups-dnssd.m4 index 0cee27b..d42198c 100644 --- a/config-scripts/cups-dnssd.m4 +++ b/config-scripts/cups-dnssd.m4 @@ -1,7 +1,7 @@ dnl dnl DNS Service Discovery (aka Bonjour) stuff for CUPS. dnl -dnl Copyright © 2021-2022 by OpenPrinting. +dnl Copyright © 2020-2024 by OpenPrinting. dnl Copyright © 2007-2019 by Apple Inc. dnl dnl Licensed under Apache License v2.0. See the file "LICENSE" for more diff --git a/config-scripts/cups-gssapi.m4 b/config-scripts/cups-gssapi.m4 index 3a76fcb..0e78025 100644 --- a/config-scripts/cups-gssapi.m4 +++ b/config-scripts/cups-gssapi.m4 @@ -1,7 +1,7 @@ dnl dnl GSSAPI/Kerberos library detection for CUPS. dnl -dnl Copyright © 2021-2022 by OpenPrinting. +dnl Copyright © 2020-2024 by OpenPrinting. dnl Copyright @ 2007-2017 by Apple Inc. dnl Copyright @ 2006-2007 by Easy Software Products. dnl @@ -30,7 +30,7 @@ AS_IF([test x$enable_gssapi = xyes], [ ], [ AC_MSG_RESULT([no]) ]) - ], [sunos*], [ + ], [sunos* | solaris*], [ # Solaris has a non-standard krb5-config, don't use it! SAVELIBS="$LIBS" AC_CHECK_LIB([gss], [gss_display_status], [ diff --git a/config-scripts/cups-largefile.m4 b/config-scripts/cups-largefile.m4 index 4bf0ec1..1537b05 100644 --- a/config-scripts/cups-largefile.m4 +++ b/config-scripts/cups-largefile.m4 @@ -1,7 +1,7 @@ dnl dnl Large file support stuff for CUPS. dnl -dnl Copyright © 2021 by OpenPrinting. +dnl Copyright © 2020-2024 by OpenPrinting. dnl Copyright © 2007-2011 by Apple Inc. dnl Copyright © 1997-2005 by Easy Software Products, all rights reserved. dnl diff --git a/config-scripts/cups-libtool.m4 b/config-scripts/cups-libtool.m4 index e603c06..aa93784 100644 --- a/config-scripts/cups-libtool.m4 +++ b/config-scripts/cups-libtool.m4 @@ -1,7 +1,7 @@ dnl -dnl Libtool stuff for CUPS. +dnl GNU libtool stuff for CUPS. dnl -dnl Copyright © 2021-2022 by OpenPrinting. +dnl Copyright © 2020-2024 by OpenPrinting. dnl Copyright © 2007-2018 by Apple Inc. dnl Copyright © 1997-2005 by Easy Software Products, all rights reserved. dnl @@ -9,20 +9,23 @@ dnl Licensed under Apache License v2.0. See the file "LICENSE" for more dnl information. dnl -AC_ARG_ENABLE([libtool_unsupported], AS_HELP_STRING([--enable-libtool-unsupported=/path/to/libtool], [build with libtool (UNSUPPORTED)]), [ - AS_IF([test x$enable_libtool_unsupported != xno], [ - AS_IF([test x$enable_libtool_unsupported = xyes], [ - AC_MSG_ERROR([Use --enable-libtool-unsupported=/path/to/libtool.]) - ]) - LIBTOOL="$enable_libtool_unsupported" - enable_shared="no" - AC_MSG_WARN([WARNING: libtool is not supported.]) - ], [ - LIBTOOL="" - ]) +AC_ARG_ENABLE([libtool_unsupported], [ + AS_HELP_STRING([--enable-libtool-unsupported=/path/to/libtool], [build with libtool (UNSUPPORTED)]) +], [ +], [ + enable_libtool_unsupported=no ]) -AS_IF([test x$LIBTOOL != x], [ +AS_IF([test x$enable_libtool_unsupported != xno], [ + AS_IF([test "x$enable_libtool_unsupported" = xyes], [ + AC_MSG_ERROR([Use '--enable-libtool-unsupported=/path/to/libtool'.]) + ],[ + AC_MSG_WARN([libtool is not supported.]) + ]) + + LIBTOOL="$enable_libtool_unsupported" + enable_shared="no" + DSO="\$(LIBTOOL) --mode=link --tag=CC ${CC}" DSOXX="\$(LIBTOOL) --mode=link --tag=CXX ${CXX}" diff --git a/config-scripts/cups-manpages.m4 b/config-scripts/cups-manpages.m4 index a92f4f6..bd169a2 100644 --- a/config-scripts/cups-manpages.m4 +++ b/config-scripts/cups-manpages.m4 @@ -1,7 +1,7 @@ dnl dnl Manpage stuff for CUPS. dnl -dnl Copyright © 2021-2022 by OpenPrinting. +dnl Copyright © 2020-2024 by OpenPrinting. dnl Copyright © 2007-2019 by Apple Inc. dnl Copyright © 1997-2006 by Easy Software Products, all rights reserved. dnl diff --git a/config-scripts/cups-network.m4 b/config-scripts/cups-network.m4 index 6cbffa4..57790a7 100644 --- a/config-scripts/cups-network.m4 +++ b/config-scripts/cups-network.m4 @@ -1,7 +1,7 @@ dnl dnl Networking stuff for CUPS. dnl -dnl Copyright © 2021 by OpenPrinting. +dnl Copyright © 2020-2024 by OpenPrinting. dnl Copyright © 2007-2016 by Apple Inc. dnl Copyright © 1997-2005 by Easy Software Products, all rights reserved. dnl diff --git a/config-scripts/cups-opsys.m4 b/config-scripts/cups-opsys.m4 index 36e000e..7f4259b 100644 --- a/config-scripts/cups-opsys.m4 +++ b/config-scripts/cups-opsys.m4 @@ -1,7 +1,7 @@ dnl dnl Operating system stuff for CUPS. dnl -dnl Copyright © 2021-2022 by OpenPrinting. +dnl Copyright © 2020-2024 by OpenPrinting. dnl Copyright © 2007-2019 by Apple Inc. dnl Copyright © 1997-2006 by Easy Software Products, all rights reserved. dnl diff --git a/config-scripts/cups-pam.m4 b/config-scripts/cups-pam.m4 index 5663c1f..f4d6ecb 100644 --- a/config-scripts/cups-pam.m4 +++ b/config-scripts/cups-pam.m4 @@ -1,7 +1,7 @@ dnl dnl PAM stuff for CUPS. dnl -dnl Copyright © 2021 by OpenPrinting. +dnl Copyright © 2020-2024 by OpenPrinting. dnl Copyright © 2007-2017 by Apple Inc. dnl Copyright © 1997-2005 by Easy Software Products, all rights reserved. dnl @@ -71,6 +71,10 @@ AS_IF([test x$enable_pam != xno], [ PAMMOD="pam_${with_pam_module}.so" ], [test -f /etc/pam.d/common-auth], [ PAMFILE="pam.common" + ], [test -f /etc/pam.d/password-auth], [ + PAMFILE="pam.password" + ], [test -f /etc/pam.d/system-auth], [ + PAMFILE="pam.system" ], [ moddir="" for dir in /lib/security /lib64/security /lib/x86_64-linux-gnu/security /var/lib/pam; do diff --git a/config-scripts/cups-poll.m4 b/config-scripts/cups-poll.m4 index 5923426..30b0a83 100644 --- a/config-scripts/cups-poll.m4 +++ b/config-scripts/cups-poll.m4 @@ -1,7 +1,7 @@ dnl dnl Select/poll stuff for CUPS. dnl -dnl Copyright © 2021-2022 by OpenPrinting. +dnl Copyright © 2021-2023 by OpenPrinting. dnl Copyright © 2007-2011 by Apple Inc. dnl Copyright © 2006 by Easy Software Products, all rights reserved. dnl diff --git a/config-scripts/cups-sharedlibs.m4 b/config-scripts/cups-sharedlibs.m4 index 6e1e092..d4fb939 100644 --- a/config-scripts/cups-sharedlibs.m4 +++ b/config-scripts/cups-sharedlibs.m4 @@ -1,7 +1,7 @@ dnl dnl Shared library support for CUPS. dnl -dnl Copyright © 2021 by OpenPrinting. +dnl Copyright © 2020-2024 by OpenPrinting. dnl Copyright © 2007-2018 by Apple Inc. dnl Copyright © 1997-2005 by Easy Software Products, all rights reserved. dnl @@ -28,7 +28,7 @@ AS_IF([test x$enable_shared != xno], [ DSO="\$(CC)" DSOXX="\$(CXX)" DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G" - ], [linux* | gnu* | *bsd*], [ + ], [linux* | gnu* | *bsd* | solaris*], [ LIBCUPS="lib$cupsbase.so.2" AS_IF([test "x$cupsimagebase" != x], [ LIBCUPSIMAGE="lib$cupsimagebase.so.2" @@ -84,6 +84,9 @@ AC_SUBST([LIBCUPSSTATIC]) AS_IF([test x$enable_shared = xno], [ LINKCUPS="../cups/lib$cupsbase.a \$(LIBS)" EXTLINKCUPS="-lcups \$LIBS" +], [test "$host_os_name" = aix], [ + LINKCUPS="-L../cups -l${cupsbase} \$(LIBS)" + EXTLINKCUPS="-lcups \$LIBS" ], [ LINKCUPS="-L../cups -l${cupsbase}" EXTLINKCUPS="-lcups" @@ -99,7 +102,7 @@ AS_IF([test "$DSO" != ":"], [ # Tell the run-time linkers where to find a DSO. Some platforms # need this option, even when the library is installed in a # standard location... - AS_CASE([$host_os_name], [sunos*], [ + AS_CASE([$host_os_name], [sunos* | solaris*], [ # Solaris... AS_IF([test $exec_prefix != /usr], [ DSOFLAGS="-R$libdir $DSOFLAGS" diff --git a/config-scripts/cups-startup.m4 b/config-scripts/cups-startup.m4 index fb08286..6d06a5a 100644 --- a/config-scripts/cups-startup.m4 +++ b/config-scripts/cups-startup.m4 @@ -1,7 +1,7 @@ dnl dnl Launch-on-demand/startup stuff for CUPS. dnl -dnl Copyright © 2021 by OpenPrinting. +dnl Copyright © 2020-2024 by OpenPrinting. dnl Copyright © 2007-2017 by Apple Inc. dnl Copyright © 1997-2005 by Easy Software Products, all rights reserved. dnl diff --git a/config-scripts/cups-threads.m4 b/config-scripts/cups-threads.m4 index 8699f7d..9ee993f 100644 --- a/config-scripts/cups-threads.m4 +++ b/config-scripts/cups-threads.m4 @@ -1,7 +1,7 @@ dnl dnl Threading stuff for CUPS. dnl -dnl Copyright © 2021 by OpenPrinting. +dnl Copyright © 2020-2024 by OpenPrinting. dnl Copyright © 2007-2017 by Apple Inc. dnl Copyright © 1997-2005 by Easy Software Products, all rights reserved. dnl @@ -38,7 +38,7 @@ AS_IF([test x$ac_cv_header_pthread_h = xyes], [ # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to be POSIX- # compliant... :( - AS_IF([test $host_os_name = sunos], [ + AS_IF([test $host_os_name = sunos -o $host_os_name = solaris], [ PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS" ]) break diff --git a/config-scripts/cups-tls.m4 b/config-scripts/cups-tls.m4 index e9320f7..97c6fa2 100644 --- a/config-scripts/cups-tls.m4 +++ b/config-scripts/cups-tls.m4 @@ -1,7 +1,7 @@ dnl dnl TLS stuff for CUPS. dnl -dnl Copyright © 2021-2022 by OpenPrinting. +dnl Copyright © 2020-2024 by OpenPrinting. dnl Copyright © 2007-2019 by Apple Inc. dnl Copyright © 1997-2007 by Easy Software Products, all rights reserved. dnl diff --git a/config.guess b/config.guess index 9afd676..980b020 100755 --- a/config.guess +++ b/config.guess @@ -1,12 +1,14 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright 1992-2022 Free Software Foundation, Inc. -timestamp='2013-11-29' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-09-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -15,7 +17,7 @@ timestamp='2013-11-29' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -24,12 +26,20 @@ timestamp='2013-11-29' # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # -# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# Please send patches to . + + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` @@ -39,7 +49,7 @@ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. -Operation modes: +Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -50,7 +60,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -84,7 +94,8 @@ if test $# != 0; then exit 1 fi -trap 'exit 1' 1 2 15 +# Just in case it came from the environment. +GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires @@ -96,66 +107,90 @@ trap 'exit 1' 1 2 15 # Portable tmp directory creation inspired by the Autoconf team. -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then +if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_SYSTEM}" in +case $UNAME_SYSTEM in Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu + LIBC=unknown - eval $set_cc_for_build - cat <<-EOF > $dummy.c + set_cc_for_build + cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc - #else + #elif defined(__GLIBC__) LIBC=gnu + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" + + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu + fi ;; esac # Note: order is significant - the case branches are not exclusive. -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -167,22 +202,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)` + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in + # to ELF recently (or will in the future) and ABI. + case $UNAME_MACHINE_ARCH in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build + set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then @@ -197,45 +242,80 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in os=netbsd ;; esac + # Determine ABI tags. + case $UNAME_MACHINE_ARCH in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in + case $UNAME_VERSION in Debian*) release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; + GUESS=$machine-${os}${release}${abi-} + ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; + *:MidnightBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; + *:OS108:*:*) + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; + *:Sortix:*:*) + GUESS=$UNAME_MACHINE-unknown-sortix + ;; + *:Twizzler:*:*) + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; + *:Redox:*:*) + GUESS=$UNAME_MACHINE-unknown-redox + ;; + mips:OSF1:*.*) + GUESS=mips-dec-osf1 + ;; alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -249,163 +329,158 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in + case $ALPHA_CPU_TYPE in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; + GUESS=m68k-unknown-sysv4 + ;; *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; + GUESS=$UNAME_MACHINE-unknown-morphos + ;; *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; + GUESS=i370-ibm-openedition + ;; *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; + GUESS=s390-ibm-zvmoe + ;; *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; + GUESS=powerpc-ibm-os400 + ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; + GUESS=arm-unknown-riscos + ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; + GUESS=hppa1.1-hitachi-hiuxmpp + ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; + GUESS=pyramid-pyramid-svr4 + ;; DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; + GUESS=sparc-icl-nx6 + ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" + set_cc_for_build + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in + case `/usr/bin/arch -k` in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + case `/bin/arch` in sun3) - echo m68k-sun-sunos${UNAME_RELEASE} + GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) - echo sparc-sun-sunos${UNAME_RELEASE} + GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac - exit ;; + ;; aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -415,44 +490,44 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; + GUESS=mips-dec-mach_bsd4.3 + ;; RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { @@ -461,95 +536,96 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; + GUESS=powerpc-motorola-powermax + ;; Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; + GUESS=powerpc-harris-powerunix + ;; m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; + GUESS=m88k-harris-cxux7 + ;; m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; + GUESS=m88k-motorola-sysv4 + ;; m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x then - echo m88k-dg-dgux${UNAME_RELEASE} + GUESS=m88k-dg-dgux$UNAME_RELEASE else - echo m88k-dg-dguxbcs${UNAME_RELEASE} + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else - echo i586-dg-dgux${UNAME_RELEASE} + GUESS=i586-dg-dgux$UNAME_RELEASE fi - exit ;; + ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; + GUESS=m88k-dolphin-sysv3 + ;; M88*:*:R3*:*) # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; + GUESS=m88k-tektronix-sysv3 + ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; + GUESS=m68k-tektronix-bsd + ;; *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; + GUESS=i386-ibm-aix + ;; ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then + if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #include main() @@ -560,76 +636,77 @@ EOF exit(0); } EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then - echo "$SYSTEM_NAME" + GUESS=$SYSTEM_NAME else - echo rs6000-ibm-aix3.2.5 + GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 + GUESS=rs6000-ibm-aix3.2.4 else - echo rs6000-ibm-aix3.2 + GUESS=rs6000-ibm-aix3.2 fi - exit ;; + ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if test -x /usr/bin/lslpp ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; + GUESS=rs6000-ibm-aix + ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + GUESS=romp-ibm-bsd4.4 + ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; + GUESS=rs6000-bull-bosx + ;; DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; + GUESS=m68k-bull-sysv3 + ;; 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; + GUESS=m68k-hp-bsd + ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; + GUESS=m68k-hp-bsd4.4 + ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then + if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + case $sc_cpu_version in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + case $sc_kernel_bits in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + if test "$HP_ARCH" = ""; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include @@ -662,13 +739,13 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if test "$HP_ARCH" = hppa2.0w then - eval $set_cc_for_build + set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler @@ -679,23 +756,23 @@ EOF # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #include int main () @@ -720,38 +797,38 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; + GUESS=unknown-hitachi-hiuxwe2 + ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + GUESS=hppa1.1-hp-bsd + ;; 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; + GUESS=hppa1.0-hp-bsd + ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; + GUESS=hppa1.0-hp-mpeix + ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + GUESS=hppa1.1-hp-osf + ;; hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; + GUESS=hppa1.0-hp-osf + ;; i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk else - echo ${UNAME_MACHINE}-unknown-osf1 + GUESS=$UNAME_MACHINE-unknown-osf1 fi - exit ;; + ;; parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; + GUESS=hppa1.1-hp-lites + ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; + GUESS=c1-convex-bsd + ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd @@ -759,139 +836,154 @@ EOF fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; + GUESS=c34-convex-bsd + ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; + GUESS=c38-convex-bsd + ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; + GUESS=c4-convex-bsd + ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi + else + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf + fi + ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in + case $UNAME_PROCESSOR in amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; esac - exit ;; + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; + GUESS=$UNAME_MACHINE-pc-cygwin + ;; *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; + *:MSYS*:*) + GUESS=$UNAME_MACHINE-pc-msys + ;; i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; *:Interix*:*) - case ${UNAME_MACHINE} in + case $UNAME_MACHINE in x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; + GUESS=i586-pc-interix$UNAME_RELEASE + ;; authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; + GUESS=$UNAME_MACHINE-pc-uwin + ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; + GUESS=x86_64-pc-cygwin + ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-pc-managarm-mlibc" + ;; + *:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" + ;; + *:Minix:*:*) + GUESS=$UNAME_MACHINE-unknown-minix + ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; @@ -901,172 +993,237 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; arm*:Linux:*:*) - eval $set_cc_for_build + set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi - exit ;; + ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + e2k:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + k1om:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el + MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} + MIPS_ENDIAN= #else - CPU= + MIPS_ENDIAN= #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + openrisc*:Linux:*:*) + GUESS=or1k-unknown-linux-$LIBC + ;; + or32:Linux:*:* | or1k*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; - or1k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} - exit ;; + GUESS=sparc-unknown-linux-$LIBC + ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} - exit ;; + GUESS=hppa64-unknown-linux-$LIBC + ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; esac - exit ;; + ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} - exit ;; + GUESS=powerpc64-unknown-linux-$LIBC + ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} - exit ;; + GUESS=powerpc-unknown-linux-$LIBC + ;; ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} - exit ;; + GUESS=powerpc64le-unknown-linux-$LIBC + ;; ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} - exit ;; + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __i386__ + ABI=x86 + #else + #ifdef __ILP32__ + ABI=x32 + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + x86) CPU=i686 ;; + x32) LIBCABI=${LIBC}x32 ;; + esac + fi + GUESS=$CPU-pc-linux-$LIBCABI + ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; + GUESS=i386-sequent-sysv4 + ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; + GUESS=$UNAME_MACHINE-unknown-stop + ;; i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; + GUESS=$UNAME_MACHINE-unknown-atheos + ;; i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; + GUESS=$UNAME_MACHINE-pc-syllable + ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi - exit ;; + ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in @@ -1074,12 +1231,12 @@ EOF *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 @@ -1089,43 +1246,43 @@ EOF && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else - echo ${UNAME_MACHINE}-pc-sysv32 + GUESS=$UNAME_MACHINE-pc-sysv32 fi - exit ;; + ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; + GUESS=i586-pc-msdosdjgpp + ;; Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; + GUESS=i386-pc-mach3 + ;; paragon:*:*:*) - echo i860-intel-osf1 - exit ;; + GUESS=i860-intel-osf1 + ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi - exit ;; + ;; mini*:CTIX:SYS*5:*) # "miniframe" - echo m68010-convergent-sysv - exit ;; + GUESS=m68010-convergent-sysv + ;; mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; + GUESS=m68k-convergent-sysv + ;; M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; + GUESS=m68k-diab-dnix + ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) @@ -1133,9 +1290,9 @@ EOF test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; @@ -1144,238 +1301,287 @@ EOF test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; + GUESS=m68k-atari-sysv4 + ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 + GUESS=$UNAME_MACHINE-sni-sysv4 else - echo ns32k-sni-sysv + GUESS=ns32k-sni-sysv fi - exit ;; + ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says - echo i586-unisys-sysv4 - exit ;; + GUESS=i586-unisys-sysv4 + ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; + GUESS=hppa1.1-stratus-sysv4 + ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; + GUESS=i860-stratus-sysv4 + ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; + GUESS=$UNAME_MACHINE-stratus-vos + ;; *:VOS:*:*) # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; + GUESS=hppa1.1-stratus-vos + ;; mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; + GUESS=mips-sony-newsos6 + ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE else - echo mips-unknown-sysv${UNAME_RELEASE} + GUESS=mips-unknown-sysv$UNAME_RELEASE fi - exit ;; + ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; + GUESS=powerpc-be-beos + ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; + GUESS=powerpc-apple-beos + ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; + GUESS=i586-pc-beos + ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; + GUESS=i586-pc-haiku + ;; + ppc:Haiku:*:*) # Haiku running on Apple PowerPC + GUESS=powerpc-apple-haiku + ;; + *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) + GUESS=$UNAME_MACHINE-unknown-haiku + ;; SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; + SX-ACE:SUPER-UX:*:*) + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval $set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build fi - if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE fi - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; + GUESS=i386-pc-qnx + ;; + NEO-*:NONSTOP_KERNEL:*:*) + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; + NSR-*:NONSTOP_KERNEL:*:*) + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; + NSV-*:NONSTOP_KERNEL:*:*) + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; + NSX-*:NONSTOP_KERNEL:*:*) + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; + GUESS=mips-compaq-nonstopux + ;; BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; + GUESS=bs2000-siemens-sysv + ;; DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "${cputype-}" = 386; then UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; + GUESS=pdp10-unknown-tops10 + ;; *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; + GUESS=pdp10-unknown-tenex + ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; + GUESS=pdp10-dec-tops20 + ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; + GUESS=pdp10-xkl-tops20 + ;; *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; + GUESS=pdp10-unknown-tops20 + ;; *:ITS:*:*) - echo pdp10-unknown-its - exit ;; + GUESS=pdp10-unknown-its + ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; + GUESS=i386-pc-xenix + ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; x86_64:VMkernel:*:*) - echo ${UNAME_MACHINE}-unknown-esx - exit ;; + GUESS=$UNAME_MACHINE-unknown-esx + ;; + amd64:Isilon\ OneFS:*:*) + GUESS=x86_64-unknown-onefs + ;; + *:Unleashed:*:*) + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; esac -eval $set_cc_for_build -cat >$dummy.c < "$dummy.c" < -# include +#include +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif #endif main () { @@ -1388,22 +1594,14 @@ main () #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" + "" #endif - ); exit (0); + ); exit (0); #endif #endif -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" @@ -1443,39 +1641,54 @@ main () #endif #if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); + struct utsname un; + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif +#if !defined (ultrix) +#include +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif #endif #if defined (alliant) && defined (i860) @@ -1486,54 +1699,46 @@ main () } EOF -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } +echo "$0: unable to guess system type" >&2 -# Convex versions that predate uname can use getsysinfo(1) +case $UNAME_MACHINE:$UNAME_SYSTEM in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 < in order to provide the needed -information to handle your system. +our_year=`echo $timestamp | sed 's,-.*,,'` +thisyear=`date +%Y` +# shellcheck disable=SC2003 +script_age=`expr "$thisyear" - "$our_year"` +if test "$script_age" -lt 3 ; then + cat >&2 </dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" EOF +fi exit 1 # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/config.h.in b/config.h.in index 62ea2ff..37c2790 100644 --- a/config.h.in +++ b/config.h.in @@ -1,7 +1,7 @@ /* * Configuration file for CUPS. * - * Copyright © 2020-2022 by OpenPrinting + * Copyright © 2020-2025 by OpenPrinting * Copyright © 2007-2019 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products. * @@ -86,6 +86,13 @@ #define CUPS_DEFAULT_ERROR_POLICY "stop-printer" +/* + * Default PeerCred value... + */ + +#define CUPS_DEFAULT_PEER_CRED "on" + + /* * Default MaxCopies value... */ @@ -380,6 +387,13 @@ #undef HAVE_TM_GMTOFF +/* + * Do we have the timegm function? + */ + +#undef HAVE_TIMEGM + + /* * Do we have rresvport_af()? */ @@ -652,13 +666,6 @@ #undef HAVE_SYS_VFS_H -/* - * Location of macOS localization bundle, if any. - */ - -#undef CUPS_BUNDLEDIR - - /* * Do we have XPC? */ diff --git a/config.sub b/config.sub index 61cb4bc..baf1512 100755 --- a/config.sub +++ b/config.sub @@ -1,12 +1,14 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright 1992-2022 Free Software Foundation, Inc. -timestamp='2013-10-01' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-09-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -15,7 +17,7 @@ timestamp='2013-10-01' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -25,7 +27,7 @@ timestamp='2013-10-01' # of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -33,7 +35,7 @@ timestamp='2013-10-01' # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -50,15 +52,21 @@ timestamp='2013-10-01' # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. -Operation modes: +Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -68,7 +76,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -90,12 +98,12 @@ while test $# -gt 0 ; do - ) # Use stdin as input. break ;; -* ) - echo "$me: invalid option $1$help" + echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. - echo $1 + echo "$1" exit ;; * ) @@ -111,1211 +119,1186 @@ case $# in exit 1;; esac -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac ;; - -psos*) - os=-psos + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ + | convergent* | ncr* | news | 32* | 3600* | 3100* \ + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ + | ultra | tti* | harris | dolphin | highlevel | gould \ + | cbm | ns | masscomp | apple | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac ;; esac -# Decode aliases for certain CPU-COMPANY combinations. +# Decode 1-component or ad-hoc basic machines case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 \ - | or1k | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + cpu=hppa1.1 + vendor=winbond ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown + op50n) + cpu=hppa1.1 + vendor=oki ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none + op60c) + cpu=hppa1.1 + vendor=oki ;; - xscaleeb) - basic_machine=armeb-unknown + ibm*) + cpu=i370 + vendor=ibm ;; - - xscaleel) - basic_machine=armel-unknown + orion105) + cpu=clipper + vendor=highlevel ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | k1om-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown + pmac | pmac-mpw) + cpu=powerpc + vendor=apple ;; + # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att + cpu=m68000 + vendor=att ;; 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux + cpu=we32k + vendor=att ;; bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec + cpu=powerpc + vendor=ibm + basic_os=cnk ;; decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 + cpu=pdp10 + vendor=dec + basic_os=tops10 ;; decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 + cpu=pdp10 + vendor=dec + basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx + cpu=m68k + vendor=motorola ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 ;; encore | umax | mmax) - basic_machine=ns32k-encore + cpu=ns32k + vendor=encore ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} ;; fx2800) - basic_machine=i860-alliant + cpu=i860 + vendor=alliant ;; genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 + cpu=ns32k + vendor=ns ;; h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp + cpu=hppa1.0 + vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp + cpu=m68000 + vendor=hp ;; hp9k3[2-9][0-9]) - basic_machine=m68k-hp + cpu=m68k + vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp + cpu=hppa1.0 + vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm + cpu=hppa1.0 + vendor=hp ;; i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 ;; i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 ;; i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv ;; i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} ;; iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) + cpu=mips + vendor=sgi + case $basic_os in + irix*) ;; *) - os=-irix4 + basic_os=irix4 ;; esac ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + cpu=m68000 + vendor=convergent ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint ;; news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) ;; - -ns2*) - os=-nextstep2 + ns2*) + basic_os=nextstep2 ;; *) - os=-nextstep3 + basic_os=nextstep3 ;; esac ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem + cpu=np1 + vendor=gould ;; op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k + cpu=hppa1.1 + vendor=oki + basic_os=proelf ;; pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 ;; pbd) - basic_machine=sparc-tti + cpu=sparc + vendor=tti ;; pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc + cpu=m68k + vendor=tti ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + pc532) + cpu=ns32k + vendor=pc532 ;; pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown + cpu=pn + vendor=gould ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + power) + cpu=power + vendor=ibm ;; ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff + cpu=i386 + vendor=ibm ;; rm[46]00) - basic_machine=mips-siemens + cpu=mips + vendor=siemens ;; rtpc | rtpc-*) - basic_machine=romp-ibm + cpu=romp + vendor=ibm ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} ;; - sb1) - basic_machine=mipsisa64sb1-unknown + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown + tower | tower-32) + cpu=m68k + vendor=ncr ;; - sde) - basic_machine=mipsisa32-sde - os=-elf + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu ;; - sei) - basic_machine=mips-sei - os=-seiux + w65) + cpu=w65 + vendor=wdc ;; - sequent) - basic_machine=i386-sequent + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf ;; - sh) - basic_machine=sh-hitachi - os=-hms + none) + cpu=none + vendor=none ;; - sh5el) - basic_machine=sh5le-unknown + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine ;; - sh64) - basic_machine=sh64-unknown + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <&2 - exit 1 + # Recognize the canonical CPU types that are allowed with any + # company name. + case $cpu in + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | abacus \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ + | alphapca5[67] | alpha64pca5[67] \ + | am33_2.0 \ + | amdgcn \ + | arc | arceb | arc32 | arc64 \ + | arm | arm[lb]e | arme[lb] | armv* \ + | avr | avr32 \ + | asmjs \ + | ba \ + | be32 | be64 \ + | bfin | bpf | bs2000 \ + | c[123]* | c30 | [cjt]90 | c4x \ + | c8051 | clipper | craynv | csky | cydra \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | elxsi | epiphany \ + | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ + | h8300 | h8500 \ + | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i*86 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | loongarch32 | loongarch64 \ + | m32c | m32r | m32rle \ + | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64eb | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r3 | mipsisa32r3el \ + | mipsisa32r5 | mipsisa32r5el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r3 | mipsisa64r3el \ + | mipsisa64r5 | mipsisa64r5el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mmix \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nfp \ + | nios | nios2 | nios2eb | nios2el \ + | none | np1 | ns16k | ns32k | nvptx \ + | open8 \ + | or1k* \ + | or32 \ + | orion \ + | picochip \ + | pdp10 | pdp11 | pj | pjl | pn | power \ + | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ + | pru \ + | pyramid \ + | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ + | rl78 | romp | rs6000 | rx \ + | s390 | s390x \ + | score \ + | sh | shl \ + | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ + | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ + | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ + | spu \ + | tahoe \ + | thumbv7* \ + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ + | tron \ + | ubicom32 \ + | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ + | vax \ + | visium \ + | w65 \ + | wasm32 | wasm64 \ + | we32k \ + | x86 | x86_64 | xc16x | xgate | xps100 \ + | xstormy16 | xtensa* \ + | ymp \ + | z8k | z80) + ;; + + *) + echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 + exit 1 + ;; + esac ;; esac # Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` +case $vendor in + digital*) + vendor=dec ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + commodore*) + vendor=cbm ;; *) ;; @@ -1323,200 +1306,219 @@ esac # Decode manufacturer-specific aliases for certain operating systems. -if [ x"$os" != x"" ] +if test x$basic_os != x then + +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just +# set os. +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` + ;; + nto-qnx*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read kernel os <&2 - exit 1 + # No normalization, but not necessarily accepted, that comes below. ;; esac + else # Here we handle the default operating systems that come with various machines. @@ -1529,264 +1531,376 @@ else # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. -case $basic_machine in +kernel= +case $cpu-$vendor in score-*) - os=-elf + os=elf ;; spu-*) - os=-elf + os=elf ;; *-acorn) - os=-riscix1.2 + os=riscix1.2 ;; arm*-rebel) - os=-linux + kernel=linux + os=gnu ;; arm*-semi) - os=-aout + os=aout ;; c4x-* | tic4x-*) - os=-coff + os=coff ;; c8051-*) - os=-elf + os=elf + ;; + clipper-intergraph) + os=clix ;; hexagon-*) - os=-elf + os=elf ;; tic54x-*) - os=-coff + os=coff ;; tic55x-*) - os=-coff + os=coff ;; tic6x-*) - os=-coff + os=coff ;; # This must come before the *-dec entry. pdp10-*) - os=-tops20 + os=tops20 ;; pdp11-*) - os=-none + os=none ;; *-dec | vax-*) - os=-ultrix4.2 + os=ultrix4.2 ;; m68*-apollo) - os=-domain + os=domain ;; i386-sun) - os=-sunos4.0.2 + os=sunos4.0.2 ;; m68000-sun) - os=-sunos3 + os=sunos3 ;; m68*-cisco) - os=-aout + os=aout ;; mep-*) - os=-elf + os=elf ;; mips*-cisco) - os=-elf + os=elf ;; mips*-*) - os=-elf - ;; - or1k-*) - os=-elf + os=elf ;; or32-*) - os=-coff + os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 + os=sysv3 ;; sparc-* | *-sun) - os=-sunos4.1.1 + os=sunos4.1.1 ;; - *-be) - os=-beos + pru-*) + os=elf ;; - *-haiku) - os=-haiku + *-be) + os=beos ;; *-ibm) - os=-aix + os=aix ;; *-knuth) - os=-mmixware + os=mmixware ;; *-wec) - os=-proelf + os=proelf ;; *-winbond) - os=-proelf + os=proelf ;; *-oki) - os=-proelf + os=proelf ;; *-hp) - os=-hpux + os=hpux ;; *-hitachi) - os=-hiux + os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv + os=sysv ;; *-cbm) - os=-amigaos + os=amigaos ;; *-dg) - os=-dgux + os=dgux ;; *-dolphin) - os=-sysv3 + os=sysv3 ;; m68k-ccur) - os=-rtu + os=rtu ;; m88k-omron*) - os=-luna + os=luna ;; - *-next ) - os=-nextstep + *-next) + os=nextstep ;; *-sequent) - os=-ptx + os=ptx ;; *-crds) - os=-unos + os=unos ;; *-ns) - os=-genix + os=genix ;; i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 + os=mvs ;; *-gould) - os=-sysv + os=sysv ;; *-highlevel) - os=-bsd + os=bsd ;; *-encore) - os=-bsd + os=bsd ;; *-sgi) - os=-irix + os=irix ;; *-siemens) - os=-sysv4 + os=sysv4 ;; *-masscomp) - os=-rtu + os=rtu ;; f30[01]-fujitsu | f700-fujitsu) - os=-uxpv + os=uxpv ;; *-rom68k) - os=-coff + os=coff ;; *-*bug) - os=-coff + os=coff ;; *-apple) - os=-macos + os=macos ;; *-atari*) - os=-mint + os=mint + ;; + *-wrs) + os=vxworks ;; *) - os=-none + os=none ;; esac + fi +# Now, validate our (potentially fixed-up) OS. +case $os in + # Sometimes we do "kernel-libc", so those need to count as OSes. + musl* | newlib* | relibc* | uclibc*) + ;; + # Likewise for "kernel-abi" + eabi* | gnueabi*) + ;; + # VxWorks passes extra cpu info in the 4th filed. + simlinux | simwindows | spe) + ;; + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. + gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ + | hiux* | abug | nacl* | netware* | windows* \ + | os9* | macos* | osx* | ios* \ + | mpw* | magic* | mmixware* | mon960* | lnews* \ + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ + | aos* | aros* | cloudabi* | sortix* | twizzler* \ + | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ + | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ + | mirbsd* | netbsd* | dicos* | openedition* | ose* \ + | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ + | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ + | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ + | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ + | udi* | lites* | ieee* | go32* | aux* | hcos* \ + | chorusrdb* | cegcc* | glidix* | serenity* \ + | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ + | midipix* | mingw32* | mingw64* | mint* \ + | uxpv* | beos* | mpeix* | udk* | moxiebox* \ + | interix* | uwin* | mks* | rhapsody* | darwin* \ + | openstep* | oskit* | conix* | pw32* | nonstopux* \ + | storm-chaos* | tops10* | tenex* | tops20* | its* \ + | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ + | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ + | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ + | fiwix* | mlibc* ) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + ;; + none) + ;; + kernel* ) + # Restricted further below + ;; + *) + echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ + | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* ) + ;; + uclinux-uclibc* ) + ;; + managarm-mlibc* | managarm-kernel* ) + ;; + -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + -kernel* ) + echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + *-kernel* ) + echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + vxworks-simlinux | vxworks-simwindows | vxworks-spe) + ;; + nto-qnx*) + ;; + os2-emx) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) vendor=acorn ;; - -sunos*) + *-sunos*) vendor=sun ;; - -cnk*|-aix*) + *-cnk* | *-aix*) vendor=ibm ;; - -beos*) + *-beos*) vendor=be ;; - -hpux*) + *-hpux*) vendor=hp ;; - -mpeix*) + *-mpeix*) vendor=hp ;; - -hiux*) + *-hiux*) vendor=hitachi ;; - -unos*) + *-unos*) vendor=crds ;; - -dgux*) + *-dgux*) vendor=dg ;; - -luna*) + *-luna*) vendor=omron ;; - -genix*) + *-genix*) vendor=ns ;; - -mvs* | -opened*) + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) vendor=ibm ;; - -os400*) + s390-* | s390x-*) vendor=ibm ;; - -ptx*) + *-ptx*) vendor=sequent ;; - -tpf*) + *-tpf*) vendor=ibm ;; - -vxsim* | -vxworks* | -windiss*) + *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; - -aux*) + *-aux*) vendor=apple ;; - -hms*) + *-hms*) vendor=hitachi ;; - -mpw* | -macos*) + *-mpw* | *-macos*) vendor=apple ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; - -vos*) + *-vos*) vendor=stratus ;; esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac -echo $basic_machine$os +echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/configure b/configure index 792f99c..68ef04b 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for CUPS 2.4.2. +# Generated by GNU Autoconf 2.71 for CUPS 2.4.16. # # Report bugs to . # @@ -610,8 +610,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='CUPS' PACKAGE_TARNAME='cups' -PACKAGE_VERSION='2.4.2' -PACKAGE_STRING='CUPS 2.4.2' +PACKAGE_VERSION='2.4.16' +PACKAGE_STRING='CUPS 2.4.16' PACKAGE_BUGREPORT='https://github.com/openprinting/cups/issues' PACKAGE_URL='https://openprinting.github.io/cups' @@ -650,8 +650,6 @@ ac_header_c_list= ac_default_prefix=/ ac_subst_vars='LTLIBOBJS LIBOBJS -UNINSTALL_LANGUAGES -INSTALL_LANGUAGES TIMEOUTSTARTSEC EXIT_TIMEOUT SYSTEMD_WANTED_BY @@ -672,6 +670,7 @@ CUPS_BROWSING CUPS_SYNC_ON_CLOSE CUPS_PAGE_LOG_FORMAT CUPS_ACCESS_LOG_LEVEL +CUPS_PEER_CRED CUPS_LOG_LEVEL CUPS_FATAL_ERRORS CUPS_ERROR_POLICY @@ -680,8 +679,6 @@ CUPS_LOG_FILE_PERM CUPS_CUPSD_FILE_PERM CUPS_CONFIG_FILE_PERM CUPS_EXE_FILE_PERM -CUPS_RESOURCEDIR -CUPS_BUNDLEDIR LANGUAGES XINETD RCSTOP @@ -915,8 +912,6 @@ with_rcstart with_rcstop with_xinetd with_languages -with_bundledir -with_bundlelang with_exe_file_perm with_config_file_perm with_cupsd_file_perm @@ -925,6 +920,7 @@ with_max_log_size with_error_policy with_fatal_errors with_log_level +with_peer_cred with_access_log_level enable_page_logging enable_sync_on_close @@ -1504,7 +1500,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures CUPS 2.4.2 to adapt to many kinds of systems. +\`configure' configures CUPS 2.4.16 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1570,7 +1566,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of CUPS 2.4.2:";; + short | recursive ) echo "Configuration of CUPS 2.4.16:";; esac cat <<\_ACEOF @@ -1586,8 +1582,10 @@ Optional Features: --enable-acl build with POSIX ACL support --disable-dbus build without DBUS support --disable-shared do not create shared libraries - --enable-libtool-unsupported=/path/to/libtool + + --enable-libtool-unsupported=/path/to/libtool build with libtool (UNSUPPORTED) + --enable-debug build with debugging symbols --enable-debug-guards build with memory allocation guards --enable-debug-printfs build with CUPS_DEBUG_LOG support @@ -1647,9 +1645,6 @@ Optional Packages: --with-rcstop set stop number for rc scripts --with-xinetd set path for xinetd config files --with-languages set installed languages, default=all - --with-bundledir set localization bundle directory - --with-bundlelang set localization bundle base language (English or - en) --with-exe-file-perm set default executable permissions value, default=0755 --with-config-file-perm set default ConfigFilePerm value, default=0640 @@ -1659,6 +1654,8 @@ Optional Packages: --with-error-policy set default ErrorPolicy value, default=stop-printer --with-fatal-errors set default FatalErrors value, default=config --with-log-level set default LogLevel value, default=warn + --with-peer-cred set default PeerCred value (on/off/root-only), + default=on --with-access-log-level set default AccessLogLevel value, default=none --with-local-protocols set default BrowseLocalProtocols, default="" --with-cups-user set default user for CUPS @@ -1756,7 +1753,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -CUPS configure 2.4.2 +CUPS configure 2.4.16 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2111,7 +2108,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by CUPS $as_me 2.4.2, which was +It was created by CUPS $as_me 2.4.16, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3242,8 +3239,8 @@ done ac_config_headers="$ac_config_headers config.h" -CUPS_VERSION="2.4.2" -CUPS_API_VERSION="$(echo 2.4.2 | awk -F. '{print $1 "." $2}')" +CUPS_VERSION="2.4.16" +CUPS_API_VERSION="$(echo 2.4.16 | awk -F. '{print $1 "." $2}')" CUPS_BUILD="cups-$CUPS_VERSION" @@ -6420,6 +6417,17 @@ printf "%s\n" "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_fn_c_check_func "$LINENO" "timegm" "ac_cv_func_timegm" +if test "x$ac_cv_func_timegm" = xyes +then : + + +printf "%s\n" "#define HAVE_TIMEGM 1" >>confdefs.h + + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for st_gen member in stat structure" >&5 printf %s "checking for st_gen member in stat structure... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7131,7 +7139,7 @@ printf "%s\n" "#define CUPS_LITE 1" >>confdefs.h ;; #( *) : - as_fn_error $? "Bad build component \"$COMPONENT\" specified." "$LINENO" 5 + as_fn_error $? "Bad build component \"$COMPONENTS\" specified." "$LINENO" 5 ;; #( *) : ;; @@ -7467,7 +7475,7 @@ if test "$localedir" = "\${datarootdir}/locale" then : case "$host_os_name" in #( - linux* | gnu* | *bsd* | darwin*) : + linux* | gnu* | *bsd* | darwin* | solaris*) : CUPS_LOCALEDIR="$datarootdir/locale" ;; #( @@ -7614,6 +7622,19 @@ else $as_nop # Darwin (macOS) CUPS_STATEDIR="$CUPS_SERVERROOT" ;; #( + sunos* | solaris*) : + + if test -d /system/volatile +then : + + CUPS_STATEDIR="/system/volatile/cups" + +else $as_nop + + CUPS_STATEDIR="$localstatedir/run/cups" + +fi + ;; #( *) : # All others @@ -7694,7 +7715,7 @@ fi DSOXX="\$(CXX)" DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G" ;; #( - linux* | gnu* | *bsd*) : + linux* | gnu* | *bsd* | solaris*) : LIBCUPS="lib$cupsbase.so.2" if test "x$cupsimagebase" != x @@ -7782,6 +7803,12 @@ then : LINKCUPS="../cups/lib$cupsbase.a \$(LIBS)" EXTLINKCUPS="-lcups \$LIBS" +elif test "$host_os_name" = aix +then : + + LINKCUPS="-L../cups -l${cupsbase} \$(LIBS)" + EXTLINKCUPS="-lcups \$LIBS" + else $as_nop LINKCUPS="-L../cups -l${cupsbase}" @@ -7801,7 +7828,7 @@ then : # need this option, even when the library is installed in a # standard location... case $host_os_name in #( - sunos*) : + sunos* | solaris*) : # Solaris... if test $exec_prefix != /usr @@ -7850,31 +7877,31 @@ fi if test ${enable_libtool_unsupported+y} then : enableval=$enable_libtool_unsupported; - if test x$enable_libtool_unsupported != xno -then : - if test x$enable_libtool_unsupported = xyes -then : +else $as_nop - as_fn_error $? "Use --enable-libtool-unsupported=/path/to/libtool." "$LINENO" 5 + enable_libtool_unsupported=no fi - LIBTOOL="$enable_libtool_unsupported" - enable_shared="no" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: WARNING: libtool is not supported." >&5 -printf "%s\n" "$as_me: WARNING: WARNING: libtool is not supported." >&2;} -else $as_nop - LIBTOOL="" +if test x$enable_libtool_unsupported != xno +then : -fi + if test "x$enable_libtool_unsupported" = xyes +then : -fi + as_fn_error $? "Use '--enable-libtool-unsupported=/path/to/libtool'." "$LINENO" 5 +else $as_nop -if test x$LIBTOOL != x -then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libtool is not supported." >&5 +printf "%s\n" "$as_me: WARNING: libtool is not supported." >&2;} + +fi + + LIBTOOL="$enable_libtool_unsupported" + enable_shared="no" DSO="\$(LIBTOOL) --mode=link --tag=CC ${CC}" DSOXX="\$(LIBTOOL) --mode=link --tag=CXX ${CXX}" @@ -8090,12 +8117,17 @@ then : # Use -fsanitize=address with debugging... OPTIM="$OPTIM -g -fsanitize=address" +elif echo "$CXXFLAGS $CFLAGS" | grep -q _FORTIFY_SOURCE +then : + + # Don't add _FORTIFY_SOURCE if it is already there + else $as_nop # Otherwise use the Fortify enhancements to catch any unbounded # string operations... - CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2" - CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2" + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=3" + CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=3" fi @@ -8308,7 +8340,7 @@ else $as_nop # Add vendor-specific compiler options... case $host_os_name in #( - sunos*) : + sunos* | solaris*) : # Solaris if test -z "$OPTIM" @@ -8329,9 +8361,9 @@ fi # Running some other operating system; inform the user # they should contribute the necessary options via - # Github... + # GitHub... echo "Building CUPS with default compiler optimizations." - echo "Contact the OpenPrinting CUPS developers on Github with the uname and compiler" + echo "Contact the OpenPrinting CUPS developers on GitHub with the uname and compiler" echo "options needed for your platform, or set the CFLAGS and LDFLAGS environment" echo "variables before running configure." echo "" @@ -9266,7 +9298,7 @@ printf "%s\n" "no" >&6; } fi ;; #( - sunos*) : + sunos* | solaris*) : # Solaris has a non-standard krb5-config, don't use it! SAVELIBS="$LIBS" @@ -9639,7 +9671,7 @@ then : # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to be POSIX- # compliant... :( - if test $host_os_name = sunos + if test $host_os_name = sunos -o $host_os_name = solaris then : PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS" @@ -10370,6 +10402,16 @@ then : PAMFILE="pam.common" +elif test -f /etc/pam.d/password-auth +then : + + PAMFILE="pam.password" + +elif test -f /etc/pam.d/system-auth +then : + + PAMFILE="pam.system" + else $as_nop moddir="" @@ -10961,15 +11003,15 @@ printf "%s\n" "yes" >&6; } printf "%s\n" "#define HAVE_LIBAPPARMOR 1" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libsnapd-glib" >&5 -printf %s "checking for libsnapd-glib... " >&6; } - if $PKGCONFIG --exists snapd-glib glib-2.0 gio-2.0 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libsnapd-glib-2" >&5 +printf %s "checking for libsnapd-glib-2... " >&6; } + if $PKGCONFIG --exists snapd-glib-2 glib-2.0 gio-2.0 then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - CFLAGS="$CFLAGS $($PKGCONFIG --cflags snapd-glib glib-2.0 gio-2.0)" - SNAPDGLIBLIBS="$($PKGCONFIG --libs snapd-glib glib-2.0 gio-2.0)" + CFLAGS="$CFLAGS $($PKGCONFIG --cflags snapd-glib-2 glib-2.0 gio-2.0)" + SNAPDGLIBLIBS="$($PKGCONFIG --libs snapd-glib-2 glib-2.0 gio-2.0)" printf "%s\n" "#define HAVE_LIBSNAPDGLIB 1" >>confdefs.h @@ -10989,7 +11031,35 @@ fi else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libsnapd-glib" >&5 +printf %s "checking for libsnapd-glib... " >&6; } + if $PKGCONFIG --exists snapd-glib glib-2.0 gio-2.0 +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + CFLAGS="$CFLAGS $($PKGCONFIG --cflags snapd-glib glib-2.0 gio-2.0)" + SNAPDGLIBLIBS="$($PKGCONFIG --libs snapd-glib glib-2.0 gio-2.0)" + +printf "%s\n" "#define HAVE_LIBSNAPDGLIB 1" >>confdefs.h + + SAVELIBS="$LIBS" + LIBS="$SNAPDGLIBLIBS $LIBS" + ac_fn_c_check_func "$LINENO" "snapd_client_run_snapctl2_sync" "ac_cv_func_snapd_client_run_snapctl2_sync" +if test "x$ac_cv_func_snapd_client_run_snapctl2_sync" = xyes +then : + + +printf "%s\n" "#define HAVE_SNAPD_CLIENT_RUN_SNAPCTL2_SYNC 1" >>confdefs.h + + +fi + + LIBS="$SAVELIBS" + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi @@ -10998,6 +11068,8 @@ fi fi +fi + ONDEMANDFLAGS="" ONDEMANDLIBS="" @@ -11445,75 +11517,6 @@ fi -# Check whether --with-bundledir was given. -if test ${with_bundledir+y} -then : - withval=$with_bundledir; - CUPS_BUNDLEDIR="$withval" - -else $as_nop - - if test "x$host_os_name" = xdarwin -a $host_os_version -ge 100 -then : - - CUPS_BUNDLEDIR="/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A" - LANGUAGES="" - -else $as_nop - - CUPS_BUNDLEDIR="" - -fi - -fi - - - -if test "x$CUPS_BUNDLEDIR" != x -then : - - -printf "%s\n" "#define CUPS_BUNDLEDIR \"$CUPS_BUNDLEDIR\"" >>confdefs.h - - -fi - - -# Check whether --with-bundlelang was given. -if test ${with_bundlelang+y} -then : - withval=$with_bundlelang; - cups_bundlelang="$withval" - -else $as_nop - - if test $host_os_version -ge 190 -then : - - cups_bundlelang="en" - -else $as_nop - - cups_bundlelang="English" - -fi - -fi - - -if test "x$cups_bundlelang" != x -a "x$CUPS_BUNDLEDIR" != x -then : - - CUPS_RESOURCEDIR="$CUPS_BUNDLEDIR/Resources/$cups_bundlelang.lproj" - -else $as_nop - - CUPS_RESOURCEDIR="" - -fi - - - # Check whether --with-exe_file_perm was given. if test ${with_exe_file_perm+y} then : @@ -11652,6 +11655,24 @@ printf "%s\n" "#define CUPS_DEFAULT_LOG_LEVEL \"$CUPS_LOG_LEVEL\"" >>confdefs.h +# Check whether --with-peer_cred was given. +if test ${with_peer_cred+y} +then : + withval=$with_peer_cred; + CUPS_PEER_CRED="$withval" + +else $as_nop + + CUPS_PEER_CRED="on" + +fi + + + +printf "%s\n" "#define CUPS_DEFAULT_PEER_CRED \"$CUPS_PEER_CRED\"" >>confdefs.h + + + # Check whether --with-access_log_level was given. if test ${with_access_log_level+y} then : @@ -12060,7 +12081,7 @@ then : CUPS_DEFAULT_PRINTCAP="/Library/Preferences/org.cups.printers.plist" ;; #( - sunos*) : + sunos* | solaris*) : CUPS_DEFAULT_PRINTCAP="/etc/printers.conf" ;; #( @@ -12292,14 +12313,10 @@ fi -INSTALL_LANGUAGES="" -UNINSTALL_LANGUAGES="" LANGFILES="" if test "x$LANGUAGES" != x then : - INSTALL_LANGUAGES="install-languages" - UNINSTALL_LANGUAGES="uninstall-languages" for lang in $LANGUAGES; do if test -f doc/$lang/index.html.in then : @@ -12316,17 +12333,8 @@ then : fi done -elif test "x$CUPS_BUNDLEDIR" != x -then : - - INSTALL_LANGUAGES="install-langbundle" - UNINSTALL_LANGUAGES="uninstall-langbundle" - fi - - - ac_config_files="$ac_config_files Makedefs conf/cups-files.conf conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf cups.pc cups-config desktop/cups.desktop doc/index.html scheduler/cups-lpd.xinetd scheduler/cups.sh scheduler/cups.xml scheduler/org.cups.cups-lpd.plist scheduler/cups-lpdAT.service scheduler/cups.path scheduler/cups.service scheduler/cups.socket templates/header.tmpl packaging/cups.list $LANGFILES" cat >confcache <<\_ACEOF @@ -12828,7 +12836,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by CUPS $as_me 2.4.2, which was +This file was extended by CUPS $as_me 2.4.16, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12893,7 +12901,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -CUPS config.status 2.4.2 +CUPS config.status 2.4.16 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 76793ce..d83884b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl dnl Configuration script for CUPS. dnl -dnl Copyright © 2020-2022 by OpenPrinting +dnl Copyright © 2020-2025 by OpenPrinting dnl Copyright © 2007-2020 by Apple Inc. dnl Copyright © 1997-2007 by Easy Software Products, all rights reserved. dnl @@ -13,7 +13,7 @@ dnl We need at least autoconf 2.71... AC_PREREQ([2.71]) dnl Package name and version... -AC_INIT([CUPS],[2.4.2],[https://github.com/openprinting/cups/issues],[cups],[https://openprinting.github.io/cups]) +AC_INIT([CUPS],[2.4.16],[https://github.com/openprinting/cups/issues],[cups],[https://openprinting.github.io/cups]) dnl This line is provided to ensure that you don't run the autoheader program dnl against this project. Doing so is completely unsupported and WILL cause @@ -42,12 +42,8 @@ sinclude(config-scripts/cups-defaults.m4) dnl See what languages are available and make sure we generate the localization dnl files as needed... -INSTALL_LANGUAGES="" -UNINSTALL_LANGUAGES="" LANGFILES="" AS_IF([test "x$LANGUAGES" != x], [ - INSTALL_LANGUAGES="install-languages" - UNINSTALL_LANGUAGES="uninstall-languages" for lang in $LANGUAGES; do AS_IF([test -f doc/$lang/index.html.in], [ LANGFILES="$LANGFILES doc/$lang/index.html" @@ -57,14 +53,8 @@ AS_IF([test "x$LANGUAGES" != x], [ LANGFILES="$LANGFILES templates/$lang/header.tmpl" ]) done -], [test "x$CUPS_BUNDLEDIR" != x], [ - INSTALL_LANGUAGES="install-langbundle" - UNINSTALL_LANGUAGES="uninstall-langbundle" ]) -AC_SUBST([INSTALL_LANGUAGES]) -AC_SUBST([UNINSTALL_LANGUAGES]) - dnl Provide autoconf with a list of files to generate and output them... AC_CONFIG_FILES([ Makedefs diff --git a/cups-config.in b/cups-config.in index d081df9..5d850a6 100755 --- a/cups-config.in +++ b/cups-config.in @@ -2,7 +2,7 @@ # # CUPS configuration utility. # -# Copyright © 2021-2022 by OpenPrinting. +# Copyright © 2020-2024 by OpenPrinting. # Copyright © 2007-2019 by Apple Inc. # Copyright © 2001-2006 by Easy Software Products, all rights reserved. # diff --git a/cups.pc.in b/cups.pc.in index e98d467..9781b8b 100644 --- a/cups.pc.in +++ b/cups.pc.in @@ -1,7 +1,7 @@ # # CUPS pkg-config file # -# Copyright © 2021-2022 by OpenPrinting. +# Copyright © 2020-2024 by OpenPrinting. # # Licensed under Apache License v2.0. See the file "LICENSE" for more # information. diff --git a/cups/Makefile b/cups/Makefile index 4110b98..cf7b8f4 100644 --- a/cups/Makefile +++ b/cups/Makefile @@ -1,7 +1,7 @@ # # Library Makefile for CUPS. # -# Copyright © 2021-2022 by OpenPrinting. +# Copyright © 2022-2025 by OpenPrinting. # Copyright © 2007-2021 by Apple Inc. # Copyright © 1997-2006 by Easy Software Products, all rights reserved. # @@ -19,6 +19,7 @@ include ../Makedefs COREOBJS = \ array.o \ auth.o \ + clock.o \ debug.o \ dest.o \ dest-job.o \ diff --git a/cups/adminutil.c b/cups/adminutil.c index d66918c..e3f1dee 100644 --- a/cups/adminutil.c +++ b/cups/adminutil.c @@ -1,7 +1,7 @@ /* * Administration utility API definitions for CUPS. * - * Copyright © 2021-2022 by OpenPrinting. + * Copyright © 2020-2024 by OpenPrinting. * Copyright © 2007-2019 by Apple Inc. * Copyright © 2001-2007 by Easy Software Products. * @@ -839,7 +839,7 @@ cupsAdminSetServerSettings( if (remote_admin) cupsFilePuts(temp, " # Allow remote administration...\n"); - else if (remote_admin == 0) + else cupsFilePuts(temp, " # Restrict access to the admin pages...\n"); cupsFilePuts(temp, " Order allow,deny\n"); diff --git a/cups/adminutil.h b/cups/adminutil.h index c3c0dc3..4c68dc5 100644 --- a/cups/adminutil.h +++ b/cups/adminutil.h @@ -1,6 +1,7 @@ /* * Administration utility API definitions for CUPS. * + * Copyright 2020-2024 by OpenPrinting. * Copyright 2007-2016 by Apple Inc. * Copyright 2001-2007 by Easy Software Products. * diff --git a/cups/api-admin.header b/cups/api-admin.header index 73625c6..8ef311d 100644 --- a/cups/api-admin.header +++ b/cups/api-admin.header @@ -1,6 +1,7 @@ ] " "[ I ]" msgstr "" -"B [ B<-h >I[B<:>I] ] [ B<-E> ] [ B<-U> I ] [ B<-c> ] [ B<-d >I[BI] ] [ B<-m> ] [ B<-n> I ] [ B<-o >I