Comparar commits
2 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| d3331249b0 | |||
| bc05464ada |
+41
-1
@@ -1,6 +1,46 @@
|
||||
CHANGES.txt - 2.1.0 - 2015-08-31
|
||||
CHANGES.txt - 2.1.2 - 2015-12-02
|
||||
--------------------------------
|
||||
|
||||
CHANGES IN CUPS V2.1.2
|
||||
|
||||
- Re-release of CUPS 2.1.1 as CUPS 2.1.2 due to error in tagging of the
|
||||
2.1.1 release (pulled content from the 2.2.x tree instead)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.1.1
|
||||
|
||||
- Security hardening fixes (<rdar://problem/23131948>,
|
||||
<rdar://problem/23132108>, <rdar://problem/23132353>,
|
||||
<rdar://problem/23132803>, <rdar://problem/23133230>,
|
||||
<rdar://problem/23133393>, <rdar://problem/23133466>,
|
||||
<rdar://problem/23133833>, <rdar://problem/23133998>,
|
||||
<rdar://problem/23134228>, <rdar://problem/23134299>,
|
||||
<rdar://problem/23134356>, <rdar://problem/23134415>,
|
||||
<rdar://problem/23134506>, <rdar://problem/23135066>,
|
||||
<rdar://problem/23135122>, <rdar://problem/23135207>,
|
||||
<rdar://problem/23144290>, <rdar://problem/23144358>,
|
||||
<rdar://problem/23144461>)
|
||||
- The cupsGetPPD* functions did not work with IPP printers (STR #4725)
|
||||
- Some older HP LaserJet printers need a delayed close when printing
|
||||
using the libusb-based USB backend (STR #4549)
|
||||
- The libusb-based USB backend did not unload the kernel usblp module
|
||||
if it was preventing the backend from accessing the printer
|
||||
(STR #4707)
|
||||
- Current Primera printers were incorrectly reported as Fargo printers
|
||||
(STR #4708)
|
||||
- The IPP backend did not always handle jobs getting canceled at the
|
||||
printer (<rdar://problem/22716820>)
|
||||
- Scheduler logging change (STR #4728)
|
||||
- Added USB quirk for Canon MP530 (STR #4730)
|
||||
- The scheduler did not deliver job notifications for jobs submitted to
|
||||
classes (STR #4733)
|
||||
- Changing the printer-is-shared value for a remote queue did not
|
||||
produce an error (STR #4738)
|
||||
- The IPP backend incorrectly included the job-password attribute in
|
||||
Validate-Job requests (<rdar://problem/23531939>)
|
||||
- Updated localizations (STR #4709)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.1.0
|
||||
|
||||
- Fixed more scheduler crash bugs in the new logging code (STR #4687,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
INSTALL - CUPS v2.1.0 - 2015-08-31
|
||||
INSTALL - CUPS v2.1.2 - 2015-12-02
|
||||
----------------------------------
|
||||
|
||||
This file describes how to compile and install CUPS from source code. For more
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
README - CUPS v2.1.0 - 2015-08-31
|
||||
README - CUPS v2.1.2 - 2015-12-02
|
||||
---------------------------------
|
||||
|
||||
Looking for compile instructions? Read the file "INSTALL.txt" instead...
|
||||
|
||||
+3
-11
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: dnssd.c 12818 2015-07-31 13:29:25Z msweet $"
|
||||
* "$Id: dnssd.c 12970 2015-11-13 20:02:51Z msweet $"
|
||||
*
|
||||
* DNS-SD discovery backend for CUPS.
|
||||
*
|
||||
@@ -921,13 +921,6 @@ get_device(cups_array_t *devices, /* I - Device array */
|
||||
* Yes, add the device...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DNSSD
|
||||
DNSServiceConstructFullName(fullName, serviceName, regtype, replyDomain);
|
||||
#else /* HAVE_AVAHI */
|
||||
avahi_service_name_join(fullName, kDNSServiceMaxDomainName,
|
||||
serviceName, regtype, replyDomain);
|
||||
#endif /* HAVE_DNSSD */
|
||||
|
||||
device = calloc(sizeof(cups_device_t), 1);
|
||||
device->name = strdup(serviceName);
|
||||
device->domain = strdup(replyDomain);
|
||||
@@ -943,8 +936,7 @@ get_device(cups_array_t *devices, /* I - Device array */
|
||||
#ifdef HAVE_DNSSD
|
||||
DNSServiceConstructFullName(fullName, serviceName, regtype, replyDomain);
|
||||
#else /* HAVE_AVAHI */
|
||||
avahi_service_name_join(fullName, kDNSServiceMaxDomainName,
|
||||
serviceName, regtype, replyDomain);
|
||||
avahi_service_name_join(fullName, kDNSServiceMaxDomainName, serviceName, regtype, replyDomain);
|
||||
#endif /* HAVE_DNSSD */
|
||||
|
||||
device->fullName = strdup(fullName);
|
||||
@@ -1330,5 +1322,5 @@ unquote(char *dst, /* I - Destination buffer */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: dnssd.c 12818 2015-07-31 13:29:25Z msweet $".
|
||||
* End of "$Id: dnssd.c 12970 2015-11-13 20:02:51Z msweet $".
|
||||
*/
|
||||
|
||||
+24
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: ipp.c 12757 2015-06-24 19:55:31Z msweet $"
|
||||
* "$Id: ipp.c 12896 2015-10-09 13:15:22Z msweet $"
|
||||
*
|
||||
* IPP backend for CUPS.
|
||||
*
|
||||
@@ -1800,7 +1800,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
fprintf(stderr, "DEBUG: Send-Document: %s (%s)\n",
|
||||
ippErrorString(cupsLastError()), cupsLastErrorString());
|
||||
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
if (cupsLastError() > IPP_OK_CONFLICT && !job_canceled)
|
||||
{
|
||||
ipp_status = cupsLastError();
|
||||
|
||||
@@ -1818,6 +1818,9 @@ main(int argc, /* I - Number of command-line args */
|
||||
}
|
||||
}
|
||||
|
||||
if (job_canceled)
|
||||
break;
|
||||
|
||||
if (ipp_status <= IPP_OK_CONFLICT && argc > 6)
|
||||
{
|
||||
fprintf(stderr, "PAGE: 1 %d\n", copies_sup ? atoi(argv[4]) : 1);
|
||||
@@ -2444,6 +2447,17 @@ monitor_printer(
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: (monitor) job-state = %s\n",
|
||||
ippEnumString("job-state", monitor->job_state));
|
||||
|
||||
if (!job_canceled &&
|
||||
(monitor->job_state == IPP_JOB_CANCELED ||
|
||||
monitor->job_state == IPP_JOB_ABORTED))
|
||||
{
|
||||
job_canceled = -1;
|
||||
fprintf(stderr, "DEBUG: (monitor) job_canceled = -1\n");
|
||||
}
|
||||
|
||||
if ((attr = ippFindAttribute(response, "job-state-reasons",
|
||||
IPP_TAG_KEYWORD)) != NULL)
|
||||
{
|
||||
@@ -2465,7 +2479,8 @@ monitor_printer(
|
||||
new_reasons |= _CUPS_JSR_JOB_PASSWORD_WAIT;
|
||||
else if (!strcmp(attr->values[i].string.text, "job-release-wait"))
|
||||
new_reasons |= _CUPS_JSR_JOB_RELEASE_WAIT;
|
||||
else if (!strncmp(attr->values[i].string.text, "job-canceled-", 13) || !strcmp(attr->values[i].string.text, "aborted-by-system"))
|
||||
if (!job_canceled &&
|
||||
(!strncmp(attr->values[i].string.text, "job-canceled-", 13) || !strcmp(attr->values[i].string.text, "aborted-by-system")))
|
||||
job_canceled = 1;
|
||||
}
|
||||
|
||||
@@ -2492,7 +2507,7 @@ monitor_printer(
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
fprintf(stderr, "DEBUG: (monitor) job-state=%s\n",
|
||||
fprintf(stderr, "DEBUG: (monitor) job-state = %s\n",
|
||||
ippEnumString("job-state", monitor->job_state));
|
||||
|
||||
if (!job_canceled &&
|
||||
@@ -2530,7 +2545,10 @@ monitor_printer(
|
||||
monitor->user, monitor->version);
|
||||
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: (monitor) cancel_job() = %s\n", cupsLastErrorString());
|
||||
_cupsLangPrintFilter(stderr, "ERROR", _("Unable to cancel print job."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3258,7 +3276,7 @@ sigterm_handler(int sig) /* I - Signal */
|
||||
* Flag that the job should be canceled...
|
||||
*/
|
||||
|
||||
write(2, "DEBUG: job_canceled = 1.\n", 25);
|
||||
write(2, "DEBUG: sigterm_handler: job_canceled = 1.\n", 25);
|
||||
|
||||
job_canceled = 1;
|
||||
return;
|
||||
@@ -3484,5 +3502,5 @@ update_reasons(ipp_attribute_t *attr, /* I - printer-state-reasons or NULL */
|
||||
}
|
||||
|
||||
/*
|
||||
* End of "$Id: ipp.c 12757 2015-06-24 19:55:31Z msweet $".
|
||||
* End of "$Id: ipp.c 12896 2015-10-09 13:15:22Z msweet $".
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
# product ID (omit for all vendor products), and a list of known issues:
|
||||
#
|
||||
# blacklist The printer is not functional with the USB backend.
|
||||
# delay-close Delay close/reset of selected interface
|
||||
# no-reattach Do no re-attach usblp kernel module after printing.
|
||||
# soft-reset Do a soft reset after printing for cleanup.
|
||||
# unidir Only supported unidirectional I/O
|
||||
@@ -227,3 +228,16 @@
|
||||
|
||||
# All Intermec devices (STR #4553)
|
||||
0x067e no-reattach
|
||||
|
||||
# HP LaserJet 1150 (STR #4549)
|
||||
0x03f0 0x0f17 delay-close
|
||||
|
||||
# HP LaserJet 1300 (STR #4549)
|
||||
0x03f0 0x1017 delay-close
|
||||
0x03f0 0x1117 delay-close
|
||||
|
||||
# HP LaserJet 1320 (STR #4549)
|
||||
0x03f0 0x1d17 delay-close
|
||||
|
||||
# Canon, Inc. MP530 Printer
|
||||
0x04a9 0x1712 unidir
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: usb-darwin.c 12818 2015-07-31 13:29:25Z msweet $"
|
||||
* "$Id: usb-darwin.c 12928 2015-10-23 21:31:58Z msweet $"
|
||||
*
|
||||
* Copyright 2005-2015 Apple Inc. All rights reserved.
|
||||
*
|
||||
@@ -1654,7 +1654,7 @@ static CFStringRef copy_printer_interface_deviceid(printer_interface_t printer,
|
||||
{
|
||||
ret = CFStringCreateWithBytes(NULL, (const UInt8 *) &request.pData[2], actualLength - 2, kCFStringEncodingUTF8, false);
|
||||
}
|
||||
else {
|
||||
else if (actualLength > 2) {
|
||||
err = sendRequest(actualLength);
|
||||
if (err == kIOReturnSuccess && request.wLenDone > 0)
|
||||
{
|
||||
@@ -2537,5 +2537,5 @@ log_usb_class_driver(int is_64bit) /* I - Is the USB class driver 64-bit? */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: usb-darwin.c 12818 2015-07-31 13:29:25Z msweet $".
|
||||
* End of "$Id: usb-darwin.c 12928 2015-10-23 21:31:58Z msweet $".
|
||||
*/
|
||||
|
||||
+20
-3
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id: usb-libusb.c 12348 2014-12-09 22:10:45Z msweet $"
|
||||
* "$Id: usb-libusb.c 12881 2015-09-15 21:20:02Z msweet $"
|
||||
*
|
||||
* LIBUSB interface code for CUPS.
|
||||
*
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -103,6 +103,7 @@ typedef struct usb_globals_s /* Global USB printer information */
|
||||
#define USB_QUIRK_USB_INIT 0x0010 /* Needs vendor USB init string */
|
||||
#define USB_QUIRK_VENDOR_CLASS 0x0020 /* Descriptor uses vendor-specific
|
||||
Class or SubClass */
|
||||
#define USB_QUIRK_DELAY_CLOSE 0x0040 /* Delay close */
|
||||
#define USB_QUIRK_WHITELIST 0x0000 /* no quirks */
|
||||
|
||||
|
||||
@@ -641,6 +642,9 @@ print_device(const char *uri, /* I - Device URI */
|
||||
* Close the connection and input file and general clean up...
|
||||
*/
|
||||
|
||||
if (g.printer->quirks & USB_QUIRK_DELAY_CLOSE)
|
||||
sleep(1);
|
||||
|
||||
close_device(g.printer);
|
||||
|
||||
/*
|
||||
@@ -1211,6 +1215,9 @@ load_quirks(void)
|
||||
if (strstr(line, " blacklist"))
|
||||
quirk->quirks |= USB_QUIRK_BLACKLIST;
|
||||
|
||||
if (strstr(line, " delay-close"))
|
||||
quirk->quirks |= USB_QUIRK_DELAY_CLOSE;
|
||||
|
||||
if (strstr(line, " no-reattach"))
|
||||
quirk->quirks |= USB_QUIRK_NO_REATTACH;
|
||||
|
||||
@@ -1522,6 +1529,16 @@ open_device(usb_printer_t *printer, /* I - Printer */
|
||||
|
||||
goto error;
|
||||
}
|
||||
else if ((errcode = libusb_detach_kernel_driver(printer->handle, printer->iface)) < 0)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"DEBUG: Failed to detach \"usblp\" module from %04x:%04x\n",
|
||||
devdesc.idVendor, devdesc.idProduct);
|
||||
|
||||
goto error;
|
||||
}
|
||||
|
||||
sleep (1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2004,6 +2021,6 @@ soft_reset_printer(
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: usb-libusb.c 12348 2014-12-09 22:10:45Z msweet $".
|
||||
* End of "$Id: usb-libusb.c 12881 2015-09-15 21:20:02Z msweet $".
|
||||
*/
|
||||
|
||||
|
||||
@@ -39,6 +39,13 @@ WebInterface @CUPS_WEBIF@
|
||||
Order allow,deny
|
||||
</Location>
|
||||
|
||||
# Restrict access to log files...
|
||||
<Location /admin/log>
|
||||
AuthType Default
|
||||
Require user @SYSTEM
|
||||
Order allow,deny
|
||||
</Location>
|
||||
|
||||
# Set the default printer/job policies...
|
||||
<Policy default>
|
||||
# Job/subscription privacy...
|
||||
|
||||
@@ -17,7 +17,7 @@ dnl Set the name of the config header file...
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl Version number information...
|
||||
CUPS_VERSION=2.1.0
|
||||
CUPS_VERSION=2.1.2
|
||||
|
||||
case "$CUPS_VERSION" in
|
||||
*svn)
|
||||
|
||||
externo
+10
-10
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.68 for CUPS 2.1.0.
|
||||
# Generated by GNU Autoconf 2.68 for CUPS 2.1.2.
|
||||
#
|
||||
# Report bugs to <https://www.cups.org/str.php>.
|
||||
#
|
||||
@@ -560,8 +560,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='CUPS'
|
||||
PACKAGE_TARNAME='cups'
|
||||
PACKAGE_VERSION='2.1.0'
|
||||
PACKAGE_STRING='CUPS 2.1.0'
|
||||
PACKAGE_VERSION='2.1.2'
|
||||
PACKAGE_STRING='CUPS 2.1.2'
|
||||
PACKAGE_BUGREPORT='https://www.cups.org/str.php'
|
||||
PACKAGE_URL='https://www.cups.org/'
|
||||
|
||||
@@ -1447,7 +1447,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.1.0 to adapt to many kinds of systems.
|
||||
\`configure' configures CUPS 2.1.2 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1508,7 +1508,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of CUPS 2.1.0:";;
|
||||
short | recursive ) echo "Configuration of CUPS 2.1.2:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1687,7 +1687,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
CUPS configure 2.1.0
|
||||
CUPS configure 2.1.2
|
||||
generated by GNU Autoconf 2.68
|
||||
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
@@ -2151,7 +2151,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.1.0, which was
|
||||
It was created by CUPS $as_me 2.1.2, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -2526,7 +2526,7 @@ esac
|
||||
ac_config_headers="$ac_config_headers config.h"
|
||||
|
||||
|
||||
CUPS_VERSION=2.1.0
|
||||
CUPS_VERSION=2.1.2
|
||||
|
||||
case "$CUPS_VERSION" in
|
||||
*svn)
|
||||
@@ -10765,7 +10765,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.1.0, which was
|
||||
This file was extended by CUPS $as_me 2.1.2, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -10828,7 +10828,7 @@ _ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
CUPS config.status 2.1.0
|
||||
CUPS config.status 2.1.2
|
||||
configured by $0, generated by GNU Autoconf 2.68,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: configure.ac 12831 2015-08-05 14:24:32Z msweet $"
|
||||
dnl "$Id: configure.ac 12998 2015-12-02 15:09:04Z msweet $"
|
||||
dnl
|
||||
dnl Configuration script for CUPS.
|
||||
dnl
|
||||
@@ -17,7 +17,7 @@ dnl We need at least autoconf 2.60...
|
||||
AC_PREREQ(2.60)
|
||||
|
||||
dnl Package name and version...
|
||||
AC_INIT([CUPS], [2.1.0], [https://www.cups.org/str.php], [cups], [https://www.cups.org/])
|
||||
AC_INIT([CUPS], [2.1.2], [https://www.cups.org/str.php], [cups], [https://www.cups.org/])
|
||||
|
||||
sinclude(config-scripts/cups-opsys.m4)
|
||||
sinclude(config-scripts/cups-common.m4)
|
||||
@@ -95,5 +95,5 @@ AC_OUTPUT(Makedefs
|
||||
chmod +x cups-config
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: configure.ac 12831 2015-08-05 14:24:32Z msweet $".
|
||||
dnl End of "$Id: configure.ac 12998 2015-12-02 15:09:04Z msweet $".
|
||||
dnl
|
||||
|
||||
+47
-4
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id: adminutil.c 11598 2014-02-18 18:58:19Z msweet $"
|
||||
* "$Id: adminutil.c 12945 2015-10-26 19:46:02Z msweet $"
|
||||
*
|
||||
* Administration utility API definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 2001-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -1175,6 +1175,7 @@ cupsAdminSetServerSettings(
|
||||
in_cancel_job, /* In a cancel-job section? */
|
||||
in_admin_location, /* In the /admin location? */
|
||||
in_conf_location, /* In the /admin/conf location? */
|
||||
in_log_location, /* In the /admin/log location? */
|
||||
in_root_location; /* In the / location? */
|
||||
const char *val; /* Setting value */
|
||||
int share_printers, /* Share local printers */
|
||||
@@ -1188,6 +1189,7 @@ cupsAdminSetServerSettings(
|
||||
wrote_loglevel, /* Wrote the LogLevel line? */
|
||||
wrote_admin_location, /* Wrote the /admin location? */
|
||||
wrote_conf_location, /* Wrote the /admin/conf location? */
|
||||
wrote_log_location, /* Wrote the /admin/log location? */
|
||||
wrote_root_location; /* Wrote the / location? */
|
||||
int indent; /* Indentation */
|
||||
int cupsd_num_settings; /* New number of settings */
|
||||
@@ -1401,12 +1403,14 @@ cupsAdminSetServerSettings(
|
||||
in_conf_location = 0;
|
||||
in_default_policy = 0;
|
||||
in_location = 0;
|
||||
in_log_location = 0;
|
||||
in_policy = 0;
|
||||
in_root_location = 0;
|
||||
linenum = 0;
|
||||
wrote_admin_location = 0;
|
||||
wrote_browsing = 0;
|
||||
wrote_conf_location = 0;
|
||||
wrote_log_location = 0;
|
||||
wrote_loglevel = 0;
|
||||
wrote_policy = 0;
|
||||
wrote_port_listen = 0;
|
||||
@@ -1550,8 +1554,10 @@ cupsAdminSetServerSettings(
|
||||
indent += 2;
|
||||
if (!strcmp(value, "/admin"))
|
||||
in_admin_location = 1;
|
||||
if (!strcmp(value, "/admin/conf"))
|
||||
else if (!strcmp(value, "/admin/conf"))
|
||||
in_conf_location = 1;
|
||||
else if (!strcmp(value, "/admin/log"))
|
||||
in_log_location = 1;
|
||||
else if (!strcmp(value, "/"))
|
||||
in_root_location = 1;
|
||||
|
||||
@@ -1593,6 +1599,23 @@ cupsAdminSetServerSettings(
|
||||
cupsFilePrintf(temp, " Allow %s\n",
|
||||
remote_any > 0 ? "all" : "@LOCAL");
|
||||
}
|
||||
else if (in_log_location && remote_admin >= 0)
|
||||
{
|
||||
wrote_log_location = 1;
|
||||
|
||||
if (remote_admin)
|
||||
cupsFilePuts(temp, " # Allow remote access to the log "
|
||||
"files...\n");
|
||||
else
|
||||
cupsFilePuts(temp, " # Restrict access to the log "
|
||||
"files...\n");
|
||||
|
||||
cupsFilePuts(temp, " Order allow,deny\n");
|
||||
|
||||
if (remote_admin)
|
||||
cupsFilePrintf(temp, " Allow %s\n",
|
||||
remote_any > 0 ? "all" : "@LOCAL");
|
||||
}
|
||||
else if (in_root_location &&
|
||||
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
|
||||
{
|
||||
@@ -1619,6 +1642,7 @@ cupsAdminSetServerSettings(
|
||||
|
||||
in_admin_location = 0;
|
||||
in_conf_location = 0;
|
||||
in_log_location = 0;
|
||||
in_root_location = 0;
|
||||
|
||||
cupsFilePuts(temp, "</Location>\n");
|
||||
@@ -1867,6 +1891,25 @@ cupsAdminSetServerSettings(
|
||||
cupsFilePuts(temp, "</Location>\n");
|
||||
}
|
||||
|
||||
if (!wrote_log_location && remote_admin >= 0)
|
||||
{
|
||||
if (remote_admin)
|
||||
cupsFilePuts(temp,
|
||||
"# Allow remote access to the log files...\n");
|
||||
else
|
||||
cupsFilePuts(temp, "# Restrict access to the log files...\n");
|
||||
|
||||
cupsFilePuts(temp, "<Location /admin/log>\n"
|
||||
" AuthType Default\n"
|
||||
" Require user @SYSTEM\n"
|
||||
" Order allow,deny\n");
|
||||
|
||||
if (remote_admin)
|
||||
cupsFilePrintf(temp, " Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
|
||||
|
||||
cupsFilePuts(temp, "</Location>\n");
|
||||
}
|
||||
|
||||
if (!wrote_policy && user_cancel_any >= 0)
|
||||
{
|
||||
cupsFilePuts(temp, "<Policy default>\n"
|
||||
@@ -2326,5 +2369,5 @@ write_option(cups_file_t *dstfp, /* I - PPD file */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: adminutil.c 11598 2014-02-18 18:58:19Z msweet $".
|
||||
* End of "$Id: adminutil.c 12945 2015-10-26 19:46:02Z msweet $".
|
||||
*/
|
||||
|
||||
+10
-24
@@ -1,22 +1,16 @@
|
||||
/*
|
||||
* "$Id: attr.c 10996 2013-05-29 11:51:34Z msweet $"
|
||||
* "$Id: attr.c 12867 2015-09-13 23:49:19Z msweet $"
|
||||
*
|
||||
* PPD model-specific attribute routines for CUPS.
|
||||
* PPD model-specific attribute routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* ppdFindAttr() - Find the first matching attribute.
|
||||
* ppdFindNextAttr() - Find the next matching attribute.
|
||||
* _ppdNormalizeMakeAndModel() - Normalize a product/make-and-model string.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -229,14 +223,6 @@ _ppdNormalizeMakeAndModel(
|
||||
|
||||
snprintf(buffer, bufsize, "Canon %s", make_and_model);
|
||||
}
|
||||
else if (!_cups_strncasecmp(make_and_model, "primera", 7))
|
||||
{
|
||||
/*
|
||||
* Fargo...
|
||||
*/
|
||||
|
||||
snprintf(buffer, bufsize, "Fargo %s", make_and_model);
|
||||
}
|
||||
else if (!_cups_strncasecmp(make_and_model, "designjet", 9) ||
|
||||
!_cups_strncasecmp(make_and_model, "deskjet", 7))
|
||||
{
|
||||
@@ -331,5 +317,5 @@ _ppdNormalizeMakeAndModel(
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: attr.c 10996 2013-05-29 11:51:34Z msweet $".
|
||||
* End of "$Id: attr.c 12867 2015-09-13 23:49:19Z msweet $".
|
||||
*/
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: cups.h 12733 2015-06-12 01:21:05Z msweet $"
|
||||
* "$Id: cups.h 12998 2015-12-02 15:09:04Z msweet $"
|
||||
*
|
||||
* API definitions for CUPS.
|
||||
*
|
||||
@@ -58,10 +58,10 @@ extern "C" {
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define CUPS_VERSION 2.0100
|
||||
# define CUPS_VERSION 2.0102
|
||||
# define CUPS_VERSION_MAJOR 2
|
||||
# define CUPS_VERSION_MINOR 1
|
||||
# define CUPS_VERSION_PATCH 0
|
||||
# define CUPS_VERSION_PATCH 2
|
||||
|
||||
# define CUPS_BC_FD 3
|
||||
/* Back-channel file descriptor for
|
||||
@@ -636,5 +636,5 @@ extern int cupsSetServerCredentials(const char *path, const char *common_name,
|
||||
#endif /* !_CUPS_CUPS_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: cups.h 12733 2015-06-12 01:21:05Z msweet $".
|
||||
* End of "$Id: cups.h 12998 2015-12-02 15:09:04Z msweet $".
|
||||
*/
|
||||
|
||||
+253
-251
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id: debug.c 12327 2014-12-09 20:38:39Z msweet $"
|
||||
* "$Id: debug.c 12928 2015-10-23 21:31:58Z msweet $"
|
||||
*
|
||||
* Debugging functions for CUPS.
|
||||
*
|
||||
* Copyright 2008-2014 by Apple Inc.
|
||||
* Copyright 2008-2015 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -82,14 +82,258 @@ debug_thread_id(void)
|
||||
|
||||
|
||||
/*
|
||||
* 'debug_vsnprintf()' - Format a string into a fixed size buffer.
|
||||
* '_cups_debug_printf()' - Write a formatted line to the log.
|
||||
*/
|
||||
|
||||
static ssize_t /* O - Number of bytes formatted */
|
||||
debug_vsnprintf(char *buffer, /* O - Output buffer */
|
||||
size_t bufsize, /* O - Size of output buffer */
|
||||
const char *format, /* I - printf-style format string */
|
||||
va_list ap) /* I - Pointer to additional arguments */
|
||||
void DLLExport
|
||||
_cups_debug_printf(const char *format, /* I - Printf-style format string */
|
||||
...) /* I - Additional arguments as needed */
|
||||
{
|
||||
va_list ap; /* Pointer to arguments */
|
||||
struct timeval curtime; /* Current time */
|
||||
char buffer[2048]; /* Output buffer */
|
||||
ssize_t bytes; /* Number of bytes in buffer */
|
||||
int level; /* Log level in message */
|
||||
|
||||
|
||||
/*
|
||||
* See if we need to do any logging...
|
||||
*/
|
||||
|
||||
if (!debug_init)
|
||||
_cups_debug_set(getenv("CUPS_DEBUG_LOG"), getenv("CUPS_DEBUG_LEVEL"),
|
||||
getenv("CUPS_DEBUG_FILTER"), 0);
|
||||
|
||||
if (_cups_debug_fd < 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Filter as needed...
|
||||
*/
|
||||
|
||||
if (isdigit(format[0]))
|
||||
level = *format++ - '0';
|
||||
else
|
||||
level = 0;
|
||||
|
||||
if (level > _cups_debug_level)
|
||||
return;
|
||||
|
||||
if (debug_filter)
|
||||
{
|
||||
int result; /* Filter result */
|
||||
|
||||
_cupsMutexLock(&debug_init_mutex);
|
||||
result = regexec(debug_filter, format, 0, NULL, 0);
|
||||
_cupsMutexUnlock(&debug_init_mutex);
|
||||
|
||||
if (result)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the message...
|
||||
*/
|
||||
|
||||
gettimeofday(&curtime, NULL);
|
||||
snprintf(buffer, sizeof(buffer), "T%03d %02d:%02d:%02d.%03d ",
|
||||
debug_thread_id(), (int)((curtime.tv_sec / 3600) % 24),
|
||||
(int)((curtime.tv_sec / 60) % 60),
|
||||
(int)(curtime.tv_sec % 60), (int)(curtime.tv_usec / 1000));
|
||||
|
||||
va_start(ap, format);
|
||||
bytes = _cups_safe_vsnprintf(buffer + 19, sizeof(buffer) - 20, format, ap) + 19;
|
||||
va_end(ap);
|
||||
|
||||
if ((size_t)bytes >= (sizeof(buffer) - 1))
|
||||
{
|
||||
buffer[sizeof(buffer) - 2] = '\n';
|
||||
bytes = sizeof(buffer) - 1;
|
||||
}
|
||||
else if (buffer[bytes - 1] != '\n')
|
||||
{
|
||||
buffer[bytes++] = '\n';
|
||||
buffer[bytes] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* Write it out...
|
||||
*/
|
||||
|
||||
_cupsMutexLock(&debug_log_mutex);
|
||||
write(_cups_debug_fd, buffer, (size_t)bytes);
|
||||
_cupsMutexUnlock(&debug_log_mutex);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cups_debug_puts()' - Write a single line to the log.
|
||||
*/
|
||||
|
||||
void DLLExport
|
||||
_cups_debug_puts(const char *s) /* I - String to output */
|
||||
{
|
||||
struct timeval curtime; /* Current time */
|
||||
char buffer[2048]; /* Output buffer */
|
||||
ssize_t bytes; /* Number of bytes in buffer */
|
||||
int level; /* Log level in message */
|
||||
|
||||
|
||||
/*
|
||||
* See if we need to do any logging...
|
||||
*/
|
||||
|
||||
if (!debug_init)
|
||||
_cups_debug_set(getenv("CUPS_DEBUG_LOG"), getenv("CUPS_DEBUG_LEVEL"),
|
||||
getenv("CUPS_DEBUG_FILTER"), 0);
|
||||
|
||||
if (_cups_debug_fd < 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Filter as needed...
|
||||
*/
|
||||
|
||||
if (isdigit(s[0]))
|
||||
level = *s++ - '0';
|
||||
else
|
||||
level = 0;
|
||||
|
||||
if (level > _cups_debug_level)
|
||||
return;
|
||||
|
||||
if (debug_filter)
|
||||
{
|
||||
int result; /* Filter result */
|
||||
|
||||
_cupsMutexLock(&debug_init_mutex);
|
||||
result = regexec(debug_filter, s, 0, NULL, 0);
|
||||
_cupsMutexUnlock(&debug_init_mutex);
|
||||
|
||||
if (result)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the message...
|
||||
*/
|
||||
|
||||
gettimeofday(&curtime, NULL);
|
||||
bytes = snprintf(buffer, sizeof(buffer), "T%03d %02d:%02d:%02d.%03d %s",
|
||||
debug_thread_id(), (int)((curtime.tv_sec / 3600) % 24),
|
||||
(int)((curtime.tv_sec / 60) % 60),
|
||||
(int)(curtime.tv_sec % 60), (int)(curtime.tv_usec / 1000),
|
||||
s);
|
||||
|
||||
if ((size_t)bytes >= (sizeof(buffer) - 1))
|
||||
{
|
||||
buffer[sizeof(buffer) - 2] = '\n';
|
||||
bytes = sizeof(buffer) - 1;
|
||||
}
|
||||
else if (buffer[bytes - 1] != '\n')
|
||||
{
|
||||
buffer[bytes++] = '\n';
|
||||
buffer[bytes] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* Write it out...
|
||||
*/
|
||||
|
||||
_cupsMutexLock(&debug_log_mutex);
|
||||
write(_cups_debug_fd, buffer, (size_t)bytes);
|
||||
_cupsMutexUnlock(&debug_log_mutex);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cups_debug_set()' - Enable or disable debug logging.
|
||||
*/
|
||||
|
||||
void DLLExport
|
||||
_cups_debug_set(const char *logfile, /* I - Log file or NULL */
|
||||
const char *level, /* I - Log level or NULL */
|
||||
const char *filter, /* I - Filter string or NULL */
|
||||
int force) /* I - Force initialization */
|
||||
{
|
||||
_cupsMutexLock(&debug_init_mutex);
|
||||
|
||||
if (!debug_init || force)
|
||||
{
|
||||
/*
|
||||
* Restore debug settings to defaults...
|
||||
*/
|
||||
|
||||
if (_cups_debug_fd != -1)
|
||||
{
|
||||
close(_cups_debug_fd);
|
||||
_cups_debug_fd = -1;
|
||||
}
|
||||
|
||||
if (debug_filter)
|
||||
{
|
||||
regfree((regex_t *)debug_filter);
|
||||
debug_filter = NULL;
|
||||
}
|
||||
|
||||
_cups_debug_level = 1;
|
||||
|
||||
/*
|
||||
* Open logs, set log levels, etc.
|
||||
*/
|
||||
|
||||
if (!logfile)
|
||||
_cups_debug_fd = -1;
|
||||
else if (!strcmp(logfile, "-"))
|
||||
_cups_debug_fd = 2;
|
||||
else
|
||||
{
|
||||
char buffer[1024]; /* Filename buffer */
|
||||
|
||||
snprintf(buffer, sizeof(buffer), logfile, getpid());
|
||||
|
||||
if (buffer[0] == '+')
|
||||
_cups_debug_fd = open(buffer + 1, O_WRONLY | O_APPEND | O_CREAT, 0644);
|
||||
else
|
||||
_cups_debug_fd = open(buffer, O_WRONLY | O_TRUNC | O_CREAT, 0644);
|
||||
}
|
||||
|
||||
if (level)
|
||||
_cups_debug_level = atoi(level);
|
||||
|
||||
if (filter)
|
||||
{
|
||||
if ((debug_filter = (regex_t *)calloc(1, sizeof(regex_t))) == NULL)
|
||||
fputs("Unable to allocate memory for CUPS_DEBUG_FILTER - results not "
|
||||
"filtered!\n", stderr);
|
||||
else if (regcomp(debug_filter, filter, REG_EXTENDED))
|
||||
{
|
||||
fputs("Bad regular expression in CUPS_DEBUG_FILTER - results not "
|
||||
"filtered!\n", stderr);
|
||||
free(debug_filter);
|
||||
debug_filter = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
debug_init = 1;
|
||||
}
|
||||
|
||||
_cupsMutexUnlock(&debug_init_mutex);
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/*
|
||||
* '_cups_safe_vsnprintf()' - Format a string into a fixed size buffer,
|
||||
* quoting special characters.
|
||||
*/
|
||||
|
||||
ssize_t /* O - Number of bytes formatted */
|
||||
_cups_safe_vsnprintf(
|
||||
char *buffer, /* O - Output buffer */
|
||||
size_t bufsize, /* O - Size of output buffer */
|
||||
const char *format, /* I - printf-style format string */
|
||||
va_list ap) /* I - Pointer to additional arguments */
|
||||
{
|
||||
char *bufptr, /* Pointer to position in buffer */
|
||||
*bufend, /* Pointer to end of buffer */
|
||||
@@ -401,247 +645,5 @@ debug_vsnprintf(char *buffer, /* O - Output buffer */
|
||||
|
||||
|
||||
/*
|
||||
* '_cups_debug_printf()' - Write a formatted line to the log.
|
||||
*/
|
||||
|
||||
void DLLExport
|
||||
_cups_debug_printf(const char *format, /* I - Printf-style format string */
|
||||
...) /* I - Additional arguments as needed */
|
||||
{
|
||||
va_list ap; /* Pointer to arguments */
|
||||
struct timeval curtime; /* Current time */
|
||||
char buffer[2048]; /* Output buffer */
|
||||
ssize_t bytes; /* Number of bytes in buffer */
|
||||
int level; /* Log level in message */
|
||||
|
||||
|
||||
/*
|
||||
* See if we need to do any logging...
|
||||
*/
|
||||
|
||||
if (!debug_init)
|
||||
_cups_debug_set(getenv("CUPS_DEBUG_LOG"), getenv("CUPS_DEBUG_LEVEL"),
|
||||
getenv("CUPS_DEBUG_FILTER"), 0);
|
||||
|
||||
if (_cups_debug_fd < 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Filter as needed...
|
||||
*/
|
||||
|
||||
if (isdigit(format[0]))
|
||||
level = *format++ - '0';
|
||||
else
|
||||
level = 0;
|
||||
|
||||
if (level > _cups_debug_level)
|
||||
return;
|
||||
|
||||
if (debug_filter)
|
||||
{
|
||||
int result; /* Filter result */
|
||||
|
||||
_cupsMutexLock(&debug_init_mutex);
|
||||
result = regexec(debug_filter, format, 0, NULL, 0);
|
||||
_cupsMutexUnlock(&debug_init_mutex);
|
||||
|
||||
if (result)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the message...
|
||||
*/
|
||||
|
||||
gettimeofday(&curtime, NULL);
|
||||
snprintf(buffer, sizeof(buffer), "T%03d %02d:%02d:%02d.%03d ",
|
||||
debug_thread_id(), (int)((curtime.tv_sec / 3600) % 24),
|
||||
(int)((curtime.tv_sec / 60) % 60),
|
||||
(int)(curtime.tv_sec % 60), (int)(curtime.tv_usec / 1000));
|
||||
|
||||
va_start(ap, format);
|
||||
bytes = debug_vsnprintf(buffer + 19, sizeof(buffer) - 20, format, ap) + 19;
|
||||
va_end(ap);
|
||||
|
||||
if ((size_t)bytes >= (sizeof(buffer) - 1))
|
||||
{
|
||||
buffer[sizeof(buffer) - 2] = '\n';
|
||||
bytes = sizeof(buffer) - 1;
|
||||
}
|
||||
else if (buffer[bytes - 1] != '\n')
|
||||
{
|
||||
buffer[bytes++] = '\n';
|
||||
buffer[bytes] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* Write it out...
|
||||
*/
|
||||
|
||||
_cupsMutexLock(&debug_log_mutex);
|
||||
write(_cups_debug_fd, buffer, (size_t)bytes);
|
||||
_cupsMutexUnlock(&debug_log_mutex);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cups_debug_puts()' - Write a single line to the log.
|
||||
*/
|
||||
|
||||
void DLLExport
|
||||
_cups_debug_puts(const char *s) /* I - String to output */
|
||||
{
|
||||
struct timeval curtime; /* Current time */
|
||||
char buffer[2048]; /* Output buffer */
|
||||
ssize_t bytes; /* Number of bytes in buffer */
|
||||
int level; /* Log level in message */
|
||||
|
||||
|
||||
/*
|
||||
* See if we need to do any logging...
|
||||
*/
|
||||
|
||||
if (!debug_init)
|
||||
_cups_debug_set(getenv("CUPS_DEBUG_LOG"), getenv("CUPS_DEBUG_LEVEL"),
|
||||
getenv("CUPS_DEBUG_FILTER"), 0);
|
||||
|
||||
if (_cups_debug_fd < 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Filter as needed...
|
||||
*/
|
||||
|
||||
if (isdigit(s[0]))
|
||||
level = *s++ - '0';
|
||||
else
|
||||
level = 0;
|
||||
|
||||
if (level > _cups_debug_level)
|
||||
return;
|
||||
|
||||
if (debug_filter)
|
||||
{
|
||||
int result; /* Filter result */
|
||||
|
||||
_cupsMutexLock(&debug_init_mutex);
|
||||
result = regexec(debug_filter, s, 0, NULL, 0);
|
||||
_cupsMutexUnlock(&debug_init_mutex);
|
||||
|
||||
if (result)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the message...
|
||||
*/
|
||||
|
||||
gettimeofday(&curtime, NULL);
|
||||
bytes = snprintf(buffer, sizeof(buffer), "T%03d %02d:%02d:%02d.%03d %s",
|
||||
debug_thread_id(), (int)((curtime.tv_sec / 3600) % 24),
|
||||
(int)((curtime.tv_sec / 60) % 60),
|
||||
(int)(curtime.tv_sec % 60), (int)(curtime.tv_usec / 1000),
|
||||
s);
|
||||
|
||||
if ((size_t)bytes >= (sizeof(buffer) - 1))
|
||||
{
|
||||
buffer[sizeof(buffer) - 2] = '\n';
|
||||
bytes = sizeof(buffer) - 1;
|
||||
}
|
||||
else if (buffer[bytes - 1] != '\n')
|
||||
{
|
||||
buffer[bytes++] = '\n';
|
||||
buffer[bytes] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* Write it out...
|
||||
*/
|
||||
|
||||
_cupsMutexLock(&debug_log_mutex);
|
||||
write(_cups_debug_fd, buffer, (size_t)bytes);
|
||||
_cupsMutexUnlock(&debug_log_mutex);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cups_debug_set()' - Enable or disable debug logging.
|
||||
*/
|
||||
|
||||
void DLLExport
|
||||
_cups_debug_set(const char *logfile, /* I - Log file or NULL */
|
||||
const char *level, /* I - Log level or NULL */
|
||||
const char *filter, /* I - Filter string or NULL */
|
||||
int force) /* I - Force initialization */
|
||||
{
|
||||
_cupsMutexLock(&debug_init_mutex);
|
||||
|
||||
if (!debug_init || force)
|
||||
{
|
||||
/*
|
||||
* Restore debug settings to defaults...
|
||||
*/
|
||||
|
||||
if (_cups_debug_fd != -1)
|
||||
{
|
||||
close(_cups_debug_fd);
|
||||
_cups_debug_fd = -1;
|
||||
}
|
||||
|
||||
if (debug_filter)
|
||||
{
|
||||
regfree((regex_t *)debug_filter);
|
||||
debug_filter = NULL;
|
||||
}
|
||||
|
||||
_cups_debug_level = 1;
|
||||
|
||||
/*
|
||||
* Open logs, set log levels, etc.
|
||||
*/
|
||||
|
||||
if (!logfile)
|
||||
_cups_debug_fd = -1;
|
||||
else if (!strcmp(logfile, "-"))
|
||||
_cups_debug_fd = 2;
|
||||
else
|
||||
{
|
||||
char buffer[1024]; /* Filename buffer */
|
||||
|
||||
snprintf(buffer, sizeof(buffer), logfile, getpid());
|
||||
|
||||
if (buffer[0] == '+')
|
||||
_cups_debug_fd = open(buffer + 1, O_WRONLY | O_APPEND | O_CREAT, 0644);
|
||||
else
|
||||
_cups_debug_fd = open(buffer, O_WRONLY | O_TRUNC | O_CREAT, 0644);
|
||||
}
|
||||
|
||||
if (level)
|
||||
_cups_debug_level = atoi(level);
|
||||
|
||||
if (filter)
|
||||
{
|
||||
if ((debug_filter = (regex_t *)calloc(1, sizeof(regex_t))) == NULL)
|
||||
fputs("Unable to allocate memory for CUPS_DEBUG_FILTER - results not "
|
||||
"filtered!\n", stderr);
|
||||
else if (regcomp(debug_filter, filter, REG_EXTENDED))
|
||||
{
|
||||
fputs("Bad regular expression in CUPS_DEBUG_FILTER - results not "
|
||||
"filtered!\n", stderr);
|
||||
free(debug_filter);
|
||||
debug_filter = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
debug_init = 1;
|
||||
}
|
||||
|
||||
_cupsMutexUnlock(&debug_init_mutex);
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: debug.c 12327 2014-12-09 20:38:39Z msweet $".
|
||||
* End of "$Id: debug.c 12928 2015-10-23 21:31:58Z msweet $".
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: http-support.c 12752 2015-06-24 19:30:47Z msweet $"
|
||||
* "$Id: http-support.c 12970 2015-11-13 20:02:51Z msweet $"
|
||||
*
|
||||
* HTTP support routines for CUPS.
|
||||
*
|
||||
@@ -1233,6 +1233,12 @@ httpSeparateURI(
|
||||
|
||||
*port = (int)strtol(uri + 1, (char **)&uri, 10);
|
||||
|
||||
if (*port <= 0 || *port > 65535)
|
||||
{
|
||||
*port = 0;
|
||||
return (HTTP_URI_STATUS_BAD_PORT);
|
||||
}
|
||||
|
||||
if (*uri != '/' && *uri)
|
||||
{
|
||||
*port = 0;
|
||||
@@ -2544,5 +2550,5 @@ http_resolve_cb(
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: http-support.c 12752 2015-06-24 19:30:47Z msweet $".
|
||||
* End of "$Id: http-support.c 12970 2015-11-13 20:02:51Z msweet $".
|
||||
*/
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: http.c 12848 2015-08-26 18:51:57Z msweet $"
|
||||
* "$Id: http.c 12970 2015-11-13 20:02:51Z msweet $"
|
||||
*
|
||||
* HTTP routines for CUPS.
|
||||
*
|
||||
@@ -3003,7 +3003,7 @@ _httpUpdate(http_t *http, /* I - HTTP connection */
|
||||
*status = http->status;
|
||||
return (0);
|
||||
}
|
||||
else if (!strncmp(line, "HTTP/", 5))
|
||||
else if (!strncmp(line, "HTTP/", 5) && http->mode == _HTTP_MODE_CLIENT)
|
||||
{
|
||||
/*
|
||||
* Got the beginning of a response...
|
||||
@@ -4850,5 +4850,5 @@ http_write_chunk(http_t *http, /* I - HTTP connection */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: http.c 12848 2015-08-26 18:51:57Z msweet $".
|
||||
* End of "$Id: http.c 12970 2015-11-13 20:02:51Z msweet $".
|
||||
*/
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: ppd-cache.c 12733 2015-06-12 01:21:05Z msweet $"
|
||||
* "$Id: ppd-cache.c 12980 2015-11-17 21:23:32Z msweet $"
|
||||
*
|
||||
* PPD cache implementation for CUPS.
|
||||
*
|
||||
@@ -85,7 +85,7 @@ _cupsConvertOptions(ipp_t *request, /* I - IPP request */
|
||||
* Send standard IPP attributes...
|
||||
*/
|
||||
|
||||
if (pc->password && (keyword = cupsGetOption("job-password", num_options, options)) != NULL)
|
||||
if (pc->password && (keyword = cupsGetOption("job-password", num_options, options)) != NULL && ippGetOperation(request) != IPP_OP_VALIDATE_JOB)
|
||||
{
|
||||
ippAddOctetString(request, IPP_TAG_OPERATION, "job-password", keyword, (int)strlen(keyword));
|
||||
|
||||
@@ -3811,5 +3811,5 @@ pwg_unppdize_name(const char *ppd, /* I - PPD keyword */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: ppd-cache.c 12733 2015-06-12 01:21:05Z msweet $".
|
||||
* End of "$Id: ppd-cache.c 12980 2015-11-17 21:23:32Z msweet $".
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id: string-private.h 11889 2014-05-22 13:54:15Z msweet $"
|
||||
* "$Id: string-private.h 12928 2015-10-23 21:31:58Z msweet $"
|
||||
*
|
||||
* Private string definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -147,6 +147,7 @@ extern int _cups_toupper(int ch);
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
extern ssize_t _cups_safe_vsnprintf(char *, size_t, const char *, va_list);
|
||||
extern void _cups_strcpy(char *dst, const char *src);
|
||||
|
||||
# ifndef HAVE_STRDUP
|
||||
@@ -218,5 +219,5 @@ extern char *_cupsStrDate(char *buf, size_t bufsize, time_t timeval);
|
||||
#endif /* !_CUPS_STRING_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: string-private.h 11889 2014-05-22 13:54:15Z msweet $".
|
||||
* End of "$Id: string-private.h 12928 2015-10-23 21:31:58Z msweet $".
|
||||
*/
|
||||
|
||||
+5
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: util.c 12448 2015-01-29 20:32:07Z msweet $"
|
||||
* "$Id: util.c 12884 2015-10-07 20:31:46Z msweet $"
|
||||
*
|
||||
* Printing utilities for CUPS.
|
||||
*
|
||||
@@ -1528,10 +1528,9 @@ cups_get_printer_uri(
|
||||
}
|
||||
|
||||
if (device_uri &&
|
||||
(!strncmp(device_uri, "ipp://", 6) ||
|
||||
!strncmp(device_uri, "ipps://", 7) ||
|
||||
((strstr(device_uri, "._ipp.") != NULL ||
|
||||
strstr(device_uri, "._ipps.") != NULL) &&
|
||||
(((!strncmp(device_uri, "ipp://", 6) || !strncmp(device_uri, "ipps://", 7)) &&
|
||||
(strstr(device_uri, "/printers/") != NULL || strstr(device_uri, "/classes/") != NULL)) ||
|
||||
((strstr(device_uri, "._ipp.") != NULL || strstr(device_uri, "._ipps.") != NULL) &&
|
||||
!strcmp(device_uri + strlen(device_uri) - 5, "/cups"))))
|
||||
{
|
||||
/*
|
||||
@@ -1655,5 +1654,5 @@ cups_get_printer_uri(
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: util.c 12448 2015-01-29 20:32:07Z msweet $".
|
||||
* End of "$Id: util.c 12884 2015-10-07 20:31:46Z msweet $".
|
||||
*/
|
||||
|
||||
+26
-9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: raster.c 12747 2015-06-24 15:55:05Z msweet $"
|
||||
* "$Id: raster.c 12945 2015-10-26 19:46:02Z msweet $"
|
||||
*
|
||||
* Raster file routines for CUPS.
|
||||
*
|
||||
@@ -64,7 +64,7 @@ static ssize_t cups_raster_io(cups_raster_t *r, unsigned char *buf, size_t bytes
|
||||
static unsigned cups_raster_read_header(cups_raster_t *r);
|
||||
static ssize_t cups_raster_read(cups_raster_t *r, unsigned char *buf,
|
||||
size_t bytes);
|
||||
static void cups_raster_update(cups_raster_t *r);
|
||||
static int cups_raster_update(cups_raster_t *r);
|
||||
static ssize_t cups_raster_write(cups_raster_t *r,
|
||||
const unsigned char *pixels);
|
||||
static ssize_t cups_read_fd(void *ctx, unsigned char *buf, size_t bytes);
|
||||
@@ -566,7 +566,8 @@ cupsRasterWriteHeader(
|
||||
memset(&(r->header), 0, sizeof(r->header));
|
||||
memcpy(&(r->header), h, sizeof(cups_page_header_t));
|
||||
|
||||
cups_raster_update(r);
|
||||
if (!cups_raster_update(r))
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Write the raster header...
|
||||
@@ -682,7 +683,8 @@ cupsRasterWriteHeader2(
|
||||
|
||||
memcpy(&(r->header), h, sizeof(cups_page_header2_t));
|
||||
|
||||
cups_raster_update(r);
|
||||
if (!cups_raster_update(r))
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Write the raster header...
|
||||
@@ -1015,11 +1017,12 @@ cups_raster_read_header(
|
||||
* Update the header and row count...
|
||||
*/
|
||||
|
||||
cups_raster_update(r);
|
||||
if (!cups_raster_update(r))
|
||||
return (0);
|
||||
|
||||
DEBUG_printf(("4cups_raster_read_header: cupsBitsPerPixel=%u, cupsBitsPerColor=%u, cupsBytesPerLine=%u, cupsWidth=%u, cupsHeight=%u, r->bpp=%d", r->header.cupsBitsPerPixel, r->header.cupsBitsPerColor, r->header.cupsBytesPerLine, r->header.cupsWidth, r->header.cupsHeight, r->bpp));
|
||||
|
||||
return (r->header.cupsBitsPerPixel != 0 && r->header.cupsBitsPerColor != 0 && r->header.cupsBytesPerLine != 0 && r->header.cupsHeight != 0 && (r->header.cupsBytesPerLine % r->bpp) == 0);
|
||||
return (r->header.cupsBitsPerPixel > 0 && r->header.cupsBitsPerPixel <= 240 && r->header.cupsBitsPerColor > 0 && r->header.cupsBitsPerColor <= 16 && r->header.cupsBytesPerLine > 0 && r->header.cupsBytesPerLine <= 0x7fffffff && r->header.cupsHeight != 0 && (r->header.cupsBytesPerLine % r->bpp) == 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1219,7 +1222,7 @@ cups_raster_read(cups_raster_t *r, /* I - Raster stream */
|
||||
* current page.
|
||||
*/
|
||||
|
||||
static void
|
||||
static int /* O - 1 on success, 0 on failure */
|
||||
cups_raster_update(cups_raster_t *r) /* I - Raster stream */
|
||||
{
|
||||
if (r->sync == CUPS_RASTER_SYNCv1 || r->sync == CUPS_RASTER_REVSYNCv1 ||
|
||||
@@ -1300,6 +1303,10 @@ cups_raster_update(cups_raster_t *r) /* I - Raster stream */
|
||||
r->header.cupsNumColors = r->header.cupsColorSpace -
|
||||
CUPS_CSPACE_DEVICE1 + 1;
|
||||
break;
|
||||
|
||||
default :
|
||||
/* Unknown color space */
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1333,11 +1340,21 @@ cups_raster_update(cups_raster_t *r) /* I - Raster stream */
|
||||
if (r->pixels != NULL)
|
||||
free(r->pixels);
|
||||
|
||||
r->pixels = calloc(r->header.cupsBytesPerLine, 1);
|
||||
if ((r->pixels = calloc(r->header.cupsBytesPerLine, 1)) == NULL)
|
||||
{
|
||||
r->pcurrent = NULL;
|
||||
r->pend = NULL;
|
||||
r->count = 0;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
r->pcurrent = r->pixels;
|
||||
r->pend = r->pixels + r->header.cupsBytesPerLine;
|
||||
r->count = 0;
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1546,5 +1563,5 @@ cups_write_fd(void *ctx, /* I - File descriptor pointer */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: raster.c 12747 2015-06-24 15:55:05Z msweet $".
|
||||
* End of "$Id: raster.c 12945 2015-10-26 19:46:02Z msweet $".
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: rastertoepson.c 12617 2015-05-06 20:28:22Z msweet $"
|
||||
* "$Id: rastertoepson.c 12945 2015-10-26 19:46:02Z msweet $"
|
||||
*
|
||||
* EPSON ESC/P and ESC/P2 filter for CUPS.
|
||||
*
|
||||
@@ -119,6 +119,30 @@ StartPage(
|
||||
unsigned plane; /* Looping var */
|
||||
|
||||
|
||||
/*
|
||||
* Show page device dictionary...
|
||||
*/
|
||||
|
||||
fprintf(stderr, "DEBUG: StartPage...\n");
|
||||
fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex);
|
||||
fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], header->HWResolution[1]);
|
||||
fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]);
|
||||
fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], header->Margins[1]);
|
||||
fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed);
|
||||
fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition);
|
||||
fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies);
|
||||
fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation);
|
||||
fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], header->PageSize[1]);
|
||||
fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth);
|
||||
fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight);
|
||||
fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType);
|
||||
fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", header->cupsBitsPerColor);
|
||||
fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", header->cupsBitsPerPixel);
|
||||
fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", header->cupsBytesPerLine);
|
||||
fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder);
|
||||
fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace);
|
||||
fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression);
|
||||
|
||||
/*
|
||||
* Send a reset sequence.
|
||||
*/
|
||||
@@ -263,7 +287,7 @@ StartPage(
|
||||
* Allocate memory for a line/row of graphics...
|
||||
*/
|
||||
|
||||
if ((Planes[0] = malloc(header->cupsBytesPerLine)) == NULL)
|
||||
if ((Planes[0] = malloc(header->cupsBytesPerLine + NumPlanes)) == NULL)
|
||||
{
|
||||
fputs("ERROR: Unable to allocate memory\n", stderr);
|
||||
exit(1);
|
||||
@@ -1150,5 +1174,5 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: rastertoepson.c 12617 2015-05-06 20:28:22Z msweet $".
|
||||
* End of "$Id: rastertoepson.c 12945 2015-10-26 19:46:02Z msweet $".
|
||||
*/
|
||||
|
||||
+6
-30
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: rastertohp.c 12574 2015-03-26 16:36:18Z msweet $"
|
||||
* "$Id: rastertohp.c 12945 2015-10-26 19:46:02Z msweet $"
|
||||
*
|
||||
* Hewlett-Packard Page Control Language filter for CUPS.
|
||||
*
|
||||
@@ -90,39 +90,15 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
|
||||
*/
|
||||
|
||||
fprintf(stderr, "DEBUG: StartPage...\n");
|
||||
fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass);
|
||||
fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor);
|
||||
fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType);
|
||||
fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType);
|
||||
|
||||
fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance);
|
||||
fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia);
|
||||
fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate);
|
||||
fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia);
|
||||
fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex);
|
||||
fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0],
|
||||
header->HWResolution[1]);
|
||||
fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n",
|
||||
header->ImagingBoundingBox[0], header->ImagingBoundingBox[1],
|
||||
header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]);
|
||||
fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet);
|
||||
fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog);
|
||||
fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge);
|
||||
fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0],
|
||||
header->Margins[1]);
|
||||
fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], header->HWResolution[1]);
|
||||
fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]);
|
||||
fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], header->Margins[1]);
|
||||
fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed);
|
||||
fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition);
|
||||
fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight);
|
||||
fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint);
|
||||
fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint);
|
||||
fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies);
|
||||
fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation);
|
||||
fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp);
|
||||
fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0],
|
||||
header->PageSize[1]);
|
||||
fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations);
|
||||
fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch);
|
||||
fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble);
|
||||
fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], header->PageSize[1]);
|
||||
fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth);
|
||||
fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight);
|
||||
fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType);
|
||||
@@ -871,5 +847,5 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: rastertohp.c 12574 2015-03-26 16:36:18Z msweet $".
|
||||
* End of "$Id: rastertohp.c 12945 2015-10-26 19:46:02Z msweet $".
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id: rastertolabel.c 11755 2014-03-27 17:06:12Z msweet $"
|
||||
* "$Id: rastertolabel.c 12945 2015-10-26 19:46:02Z msweet $"
|
||||
*
|
||||
* Label printer filter for CUPS.
|
||||
*
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 2001-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -166,39 +166,15 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
|
||||
*/
|
||||
|
||||
fprintf(stderr, "DEBUG: StartPage...\n");
|
||||
fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass);
|
||||
fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor);
|
||||
fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType);
|
||||
fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType);
|
||||
|
||||
fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance);
|
||||
fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia);
|
||||
fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate);
|
||||
fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia);
|
||||
fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex);
|
||||
fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0],
|
||||
header->HWResolution[1]);
|
||||
fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n",
|
||||
header->ImagingBoundingBox[0], header->ImagingBoundingBox[1],
|
||||
header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]);
|
||||
fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet);
|
||||
fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog);
|
||||
fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge);
|
||||
fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0],
|
||||
header->Margins[1]);
|
||||
fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], header->HWResolution[1]);
|
||||
fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]);
|
||||
fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], header->Margins[1]);
|
||||
fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed);
|
||||
fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition);
|
||||
fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight);
|
||||
fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint);
|
||||
fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint);
|
||||
fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies);
|
||||
fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation);
|
||||
fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp);
|
||||
fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0],
|
||||
header->PageSize[1]);
|
||||
fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations);
|
||||
fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch);
|
||||
fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble);
|
||||
fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], header->PageSize[1]);
|
||||
fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth);
|
||||
fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight);
|
||||
fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType);
|
||||
@@ -208,9 +184,6 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
|
||||
fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder);
|
||||
fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace);
|
||||
fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression);
|
||||
fprintf(stderr, "DEBUG: cupsRowCount = %d\n", header->cupsRowCount);
|
||||
fprintf(stderr, "DEBUG: cupsRowFeed = %d\n", header->cupsRowFeed);
|
||||
fprintf(stderr, "DEBUG: cupsRowStep = %d\n", header->cupsRowStep);
|
||||
|
||||
switch (ModelNumber)
|
||||
{
|
||||
@@ -1294,5 +1267,5 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: rastertolabel.c 11755 2014-03-27 17:06:12Z msweet $".
|
||||
* End of "$Id: rastertolabel.c 12945 2015-10-26 19:46:02Z msweet $".
|
||||
*/
|
||||
|
||||
+35
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: rastertopwg.c 12609 2015-05-06 12:24:47Z msweet $"
|
||||
* "$Id: rastertopwg.c 12945 2015-10-26 19:46:02Z msweet $"
|
||||
*
|
||||
* CUPS raster to PWG raster format filter for CUPS.
|
||||
*
|
||||
@@ -89,6 +89,29 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
while (cupsRasterReadHeader2(inras, &inheader))
|
||||
{
|
||||
/*
|
||||
* Show page device dictionary...
|
||||
*/
|
||||
|
||||
fprintf(stderr, "DEBUG: Duplex = %d\n", inheader.Duplex);
|
||||
fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", inheader.HWResolution[0], inheader.HWResolution[1]);
|
||||
fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", inheader.ImagingBoundingBox[0], inheader.ImagingBoundingBox[1], inheader.ImagingBoundingBox[2], inheader.ImagingBoundingBox[3]);
|
||||
fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", inheader.Margins[0], inheader.Margins[1]);
|
||||
fprintf(stderr, "DEBUG: ManualFeed = %d\n", inheader.ManualFeed);
|
||||
fprintf(stderr, "DEBUG: MediaPosition = %d\n", inheader.MediaPosition);
|
||||
fprintf(stderr, "DEBUG: NumCopies = %d\n", inheader.NumCopies);
|
||||
fprintf(stderr, "DEBUG: Orientation = %d\n", inheader.Orientation);
|
||||
fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", inheader.PageSize[0], inheader.PageSize[1]);
|
||||
fprintf(stderr, "DEBUG: cupsWidth = %d\n", inheader.cupsWidth);
|
||||
fprintf(stderr, "DEBUG: cupsHeight = %d\n", inheader.cupsHeight);
|
||||
fprintf(stderr, "DEBUG: cupsMediaType = %d\n", inheader.cupsMediaType);
|
||||
fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", inheader.cupsBitsPerColor);
|
||||
fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", inheader.cupsBitsPerPixel);
|
||||
fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", inheader.cupsBytesPerLine);
|
||||
fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", inheader.cupsColorOrder);
|
||||
fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", inheader.cupsColorSpace);
|
||||
fprintf(stderr, "DEBUG: cupsCompression = %d\n", inheader.cupsCompression);
|
||||
|
||||
/*
|
||||
* Compute the real raster size...
|
||||
*/
|
||||
@@ -105,6 +128,13 @@ main(int argc, /* I - Number of command-line args */
|
||||
linesize = (page_width * inheader.cupsBitsPerPixel + 7) / 8;
|
||||
lineoffset = page_left * inheader.cupsBitsPerPixel / 8; /* Round down */
|
||||
|
||||
if (page_left > page_width || page_top > page_height || page_bottom > page_height)
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "ERROR", _("Unsupported raster data."));
|
||||
fprintf(stderr, "DEBUG: Bad bottom/left/top margin on page %d.\n", page);
|
||||
return (1);
|
||||
}
|
||||
|
||||
switch (inheader.cupsColorSpace)
|
||||
{
|
||||
case CUPS_CSPACE_W :
|
||||
@@ -184,7 +214,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
sizeof(outheader.OutputType));
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Unsupported print-content-type \"%s\".\n", val);
|
||||
fputs("DEBUG: Unsupported print-content-optimize value.\n", stderr);
|
||||
outheader.OutputType[0] = '\0';
|
||||
}
|
||||
}
|
||||
@@ -225,8 +255,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
sizeof(outheader.cupsRenderingIntent));
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Unsupported print-rendering-intent \"%s\".\n",
|
||||
val);
|
||||
fputs("DEBUG: Unsupported print-rendering-intent value.\n", stderr);
|
||||
outheader.cupsRenderingIntent[0] = '\0';
|
||||
}
|
||||
}
|
||||
@@ -360,7 +389,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Unsupported value...
|
||||
*/
|
||||
|
||||
fprintf(stderr, "DEBUG: Unsupported cupsBackSide \"%s\".\n", back->value);
|
||||
fputs("DEBUG: Unsupported cupsBackSide value.\n", stderr);
|
||||
|
||||
outheader.cupsInteger[1] = 1; /* CrossFeedTransform */
|
||||
outheader.cupsInteger[2] = 1; /* FeedTransform */
|
||||
@@ -459,5 +488,5 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: rastertopwg.c 12609 2015-05-06 12:24:47Z msweet $".
|
||||
* End of "$Id: rastertopwg.c 12945 2015-10-26 19:46:02Z msweet $".
|
||||
*/
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Message catalog template for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 2007-2009 by Apple Inc.
|
||||
# Copyright 2007-2015 by Apple Inc.
|
||||
# Copyright 2005-2007 by Easy Software Products.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -4371,7 +4371,7 @@ msgid "The printer is not connected."
|
||||
msgstr "La impressora no està connectada."
|
||||
|
||||
msgid "The printer is not responding."
|
||||
msgstr "La impressora no respòn."
|
||||
msgstr "La impressora no respon."
|
||||
|
||||
msgid "The printer is now connected."
|
||||
msgstr "Ara la impressora està connectada."
|
||||
|
||||
+11
-5
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id: rss.c 12128 2014-08-28 19:23:23Z msweet $"
|
||||
* "$Id: rss.c 12945 2015-10-26 19:46:02Z msweet $"
|
||||
*
|
||||
* RSS notifier for CUPS.
|
||||
*
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -641,15 +641,21 @@ save_rss(cups_array_t *rss, /* I - RSS messages */
|
||||
msg;
|
||||
msg = (_cups_rss_t *)cupsArrayPrev(rss))
|
||||
{
|
||||
char *subject = xml_escape(msg->subject);
|
||||
char *text = xml_escape(msg->text);
|
||||
|
||||
fputs(" <item>\n", fp);
|
||||
fprintf(fp, " <title>%s</title>\n", msg->subject);
|
||||
fprintf(fp, " <description>%s</description>\n", msg->text);
|
||||
fprintf(fp, " <title>%s</title>\n", subject);
|
||||
fprintf(fp, " <description>%s</description>\n", text);
|
||||
if (msg->link_url)
|
||||
fprintf(fp, " <link>%s</link>\n", msg->link_url);
|
||||
fprintf(fp, " <pubDate>%s</pubDate>\n",
|
||||
httpGetDateString2(msg->event_time, date, sizeof(date)));
|
||||
fprintf(fp, " <guid>%d</guid>\n", msg->sequence_number);
|
||||
fputs(" </item>\n", fp);
|
||||
|
||||
free(subject);
|
||||
free(text);
|
||||
}
|
||||
|
||||
fputs(" </channel>\n", fp);
|
||||
@@ -729,5 +735,5 @@ xml_escape(const char *s) /* I - String to escape */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: rss.c 12128 2014-08-28 19:23:23Z msweet $".
|
||||
* End of "$Id: rss.c 12945 2015-10-26 19:46:02Z msweet $".
|
||||
*/
|
||||
|
||||
@@ -45,12 +45,12 @@
|
||||
|
||||
Summary: CUPS
|
||||
Name: cups
|
||||
Version: 2.1.0
|
||||
Version: 2.1.2
|
||||
Release: 1
|
||||
Epoch: 1
|
||||
License: GPL
|
||||
Group: System Environment/Daemons
|
||||
Source: http://www.cups.org/software/2.1.0/cups-2.1.0-source.tar.bz2
|
||||
Source: http://www.cups.org/software/2.1.2/cups-2.1.2-source.tar.bz2
|
||||
Url: http://www.cups.org
|
||||
Packager: Anonymous <anonymous@foo.com>
|
||||
Vendor: Apple Inc.
|
||||
|
||||
+68
-193
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: auth.c 12602 2015-05-05 20:19:35Z msweet $"
|
||||
* "$Id: auth.c 12945 2015-10-26 19:46:02Z msweet $"
|
||||
*
|
||||
* Authorization routines for the CUPS scheduler.
|
||||
*
|
||||
@@ -111,12 +111,7 @@ cupsdAddIPMask(
|
||||
cupsd_authmask_t temp; /* New host/domain mask */
|
||||
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"cupsdAddIPMask(masks=%p(%p), address=%x:%x:%x:%x, "
|
||||
"netmask=%x:%x:%x:%x)",
|
||||
masks, *masks,
|
||||
address[0], address[1], address[2], address[3],
|
||||
netmask[0], netmask[1], netmask[2], netmask[3]);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddIPMask(masks=%p(%p), address=%x:%x:%x:%x, netmask=%x:%x:%x:%x)", masks, *masks, address[0], address[1], address[2], address[3], netmask[0], netmask[1], netmask[2], netmask[3]);
|
||||
|
||||
temp.type = CUPSD_AUTH_IP;
|
||||
memcpy(temp.mask.ip.address, address, sizeof(temp.mask.ip.address));
|
||||
@@ -156,8 +151,7 @@ cupsdAddLocation(cupsd_location_t *loc) /* I - Location to add */
|
||||
{
|
||||
cupsArrayAdd(Locations, loc);
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddLocation: Added location \"%s\"",
|
||||
loc->location ? loc->location : "(null)");
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddLocation: Added location \"%s\"", loc->location ? loc->location : "(null)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,8 +164,7 @@ void
|
||||
cupsdAddName(cupsd_location_t *loc, /* I - Location to add to */
|
||||
char *name) /* I - Name to add */
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddName(loc=%p, name=\"%s\")",
|
||||
loc, name);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddName(loc=%p, name=\"%s\")", loc, name);
|
||||
|
||||
if (!loc->names)
|
||||
loc->names = cupsArrayNew3(NULL, NULL, NULL, 0,
|
||||
@@ -201,9 +194,7 @@ cupsdAddNameMask(cups_array_t **masks, /* IO - Masks array (created as needed) *
|
||||
*ifptr; /* Pointer to end of name */
|
||||
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"cupsdAddNameMask(masks=%p(%p), name=\"%s\")",
|
||||
masks, *masks, name);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddNameMask(masks=%p(%p), name=\"%s\")", masks, *masks, name);
|
||||
|
||||
if (!_cups_strcasecmp(name, "@LOCAL"))
|
||||
{
|
||||
@@ -290,10 +281,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
con->best = cupsdFindBest(con->uri, httpGetState(con->http));
|
||||
con->type = CUPSD_AUTH_NONE;
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"[Client %d] con->uri=\"%s\", con->best=%p(%s)",
|
||||
con->number, con->uri, con->best,
|
||||
con->best ? con->best->location : "");
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "con->uri=\"%s\", con->best=%p(%s)", con->uri, con->best, con->best ? con->best->location : "");
|
||||
|
||||
if (con->best && con->best->type != CUPSD_AUTH_NONE)
|
||||
{
|
||||
@@ -311,9 +299,6 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
|
||||
authorization = httpGetField(con->http, HTTP_FIELD_AUTHORIZATION);
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "[Client %d] Authorization=\"%s\"",
|
||||
con->number, authorization);
|
||||
|
||||
username[0] = '\0';
|
||||
password[0] = '\0';
|
||||
|
||||
@@ -335,9 +320,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
* No authorization data provided, return early...
|
||||
*/
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"[Client %d] No authentication data provided.",
|
||||
con->number);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG, "No authentication data provided.");
|
||||
return;
|
||||
}
|
||||
#ifdef HAVE_AUTHORIZATION_H
|
||||
@@ -363,18 +346,13 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
|
||||
if (authlen != kAuthorizationExternalFormLength)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] External Authorization reference size is "
|
||||
"incorrect.", con->number);
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "External Authorization reference size is incorrect.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((status = AuthorizationCreateFromExternalForm((AuthorizationExternalForm *)authdata, &con->authref)) != 0)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] AuthorizationCreateFromExternalForm "
|
||||
"returned %d (%s)", con->number, (int)status,
|
||||
cssmErrorString(status));
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "AuthorizationCreateFromExternalForm returned %d (%s)", (int)status, cssmErrorString(status));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -388,9 +366,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
{
|
||||
strlcpy(username, authinfo->items[0].value, sizeof(username));
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"[Client %d] Authorized as \"%s\" using AuthRef",
|
||||
con->number, username);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Authorized as \"%s\" using AuthRef.", username);
|
||||
}
|
||||
|
||||
AuthorizationFreeItemSet(authinfo);
|
||||
@@ -410,26 +386,19 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
|
||||
if (getsockopt(httpGetFd(con->http), 0, LOCAL_PEERCRED, &peercred, &peersize))
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] Unable to get peer credentials - %s",
|
||||
con->number, strerror(errno));
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Unable to get peer credentials - %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((pwd = getpwuid(CUPSD_UCRED_UID(peercred))) == NULL)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] Unable to find UID %d for peer "
|
||||
"credentials.", con->number,
|
||||
(int)CUPSD_UCRED_UID(peercred));
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Unable to find UID %d for peer credentials.", (int)CUPSD_UCRED_UID(peercred));
|
||||
return;
|
||||
}
|
||||
|
||||
strlcpy(username, pwd->pw_name, sizeof(username));
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"[Client %d] Authorized as \"%s\" using "
|
||||
"AuthRef + PeerCred", con->number, username);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Authorized as \"%s\" using AuthRef + PeerCred.", username);
|
||||
}
|
||||
|
||||
con->type = CUPSD_AUTH_BASIC;
|
||||
@@ -474,18 +443,14 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
|
||||
if (no_peer)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] PeerCred authentication not allowed for "
|
||||
"resource per AUTHKEY policy.", con->number);
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "PeerCred authentication not allowed for resource per AUTHKEY policy.");
|
||||
return;
|
||||
}
|
||||
#endif /* HAVE_AUTHORIZATION_H */
|
||||
|
||||
if ((pwd = getpwnam(authorization + 9)) == NULL)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] User \"%s\" does not exist.", con->number,
|
||||
authorization + 9);
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "User \"%s\" does not exist.", authorization + 9);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -497,27 +462,18 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
if (getsockopt(httpGetFd(con->http), SOL_SOCKET, SO_PEERCRED, &peercred, &peersize))
|
||||
# endif /* __APPLE__ */
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] Unable to get peer credentials - %s",
|
||||
con->number, strerror(errno));
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Unable to get peer credentials - %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
if (pwd->pw_uid != CUPSD_UCRED_UID(peercred))
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] Invalid peer credentials for \"%s\" - got "
|
||||
"%d, expected %d!", con->number, authorization + 9,
|
||||
CUPSD_UCRED_UID(peercred), pwd->pw_uid);
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Invalid peer credentials for \"%s\" - got %d, expected %d.", authorization + 9, CUPSD_UCRED_UID(peercred), pwd->pw_uid);
|
||||
# ifdef HAVE_SYS_UCRED_H
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG, "[Client %d] cr_version=%d",
|
||||
con->number, peercred.cr_version);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG, "[Client %d] cr_uid=%d",
|
||||
con->number, peercred.cr_uid);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG, "[Client %d] cr_ngroups=%d",
|
||||
con->number, peercred.cr_ngroups);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG, "[Client %d] cr_groups[0]=%d",
|
||||
con->number, peercred.cr_groups[0]);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "cr_version=%d", peercred.cr_version);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "cr_uid=%d", peercred.cr_uid);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "cr_ngroups=%d", peercred.cr_ngroups);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "cr_groups[0]=%d", peercred.cr_groups[0]);
|
||||
# endif /* HAVE_SYS_UCRED_H */
|
||||
return;
|
||||
}
|
||||
@@ -528,9 +484,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
con->gss_uid = CUPSD_UCRED_UID(peercred);
|
||||
# endif /* HAVE_GSSAPI */
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"[Client %d] Authorized as %s using PeerCred", con->number,
|
||||
username);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Authorized as %s using PeerCred.", username);
|
||||
|
||||
con->type = CUPSD_AUTH_BASIC;
|
||||
}
|
||||
@@ -548,18 +502,14 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
|
||||
if ((localuser = cupsdFindCert(authorization)) == NULL)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] Local authentication certificate not found.",
|
||||
con->number);
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Local authentication certificate not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
strlcpy(username, localuser->username, sizeof(username));
|
||||
con->type = localuser->type;
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"[Client %d] Authorized as %s using Local", con->number,
|
||||
username);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Authorized as %s using Local.", username);
|
||||
}
|
||||
else if (!strncmp(authorization, "Basic", 5))
|
||||
{
|
||||
@@ -583,8 +533,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
|
||||
if ((ptr = strchr(username, ':')) == NULL)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR, "[Client %d] Missing Basic password.",
|
||||
con->number);
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Missing Basic password.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -596,8 +545,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
* Username must not be empty...
|
||||
*/
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR, "[Client %d] Empty Basic username.",
|
||||
con->number);
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Empty Basic username.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -607,8 +555,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
* Password must not be empty...
|
||||
*/
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR, "[Client %d] Empty Basic password.",
|
||||
con->number);
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Empty Basic password.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -650,9 +597,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
pamerr = pam_start("cups", username, &pamdata, &pamh);
|
||||
if (pamerr != PAM_SUCCESS)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] pam_start() returned %d (%s)",
|
||||
con->number, pamerr, pam_strerror(pamh, pamerr));
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "pam_start() returned %d (%s)", pamerr, pam_strerror(pamh, pamerr));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -660,28 +605,20 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
# ifdef PAM_RHOST
|
||||
pamerr = pam_set_item(pamh, PAM_RHOST, con->http->hostname);
|
||||
if (pamerr != PAM_SUCCESS)
|
||||
cupsdLogMessage(CUPSD_LOG_WARN,
|
||||
"[Client %d] pam_set_item(PAM_RHOST) "
|
||||
"returned %d (%s)", con->number, pamerr,
|
||||
pam_strerror(pamh, pamerr));
|
||||
cupsdLogClient(con, CUPSD_LOG_WARN, "pam_set_item(PAM_RHOST) returned %d (%s)", pamerr, pam_strerror(pamh, pamerr));
|
||||
# endif /* PAM_RHOST */
|
||||
|
||||
# ifdef PAM_TTY
|
||||
pamerr = pam_set_item(pamh, PAM_TTY, "cups");
|
||||
if (pamerr != PAM_SUCCESS)
|
||||
cupsdLogMessage(CUPSD_LOG_WARN,
|
||||
"[Client %d] pam_set_item(PAM_TTY) "
|
||||
"returned %d (%s)!", con->number, pamerr,
|
||||
pam_strerror(pamh, pamerr));
|
||||
cupsdLogClient(con, CUPSD_LOG_WARN, "pam_set_item(PAM_TTY) returned %d (%s)", pamerr, pam_strerror(pamh, pamerr));
|
||||
# endif /* PAM_TTY */
|
||||
# endif /* HAVE_PAM_SET_ITEM */
|
||||
|
||||
pamerr = pam_authenticate(pamh, PAM_SILENT);
|
||||
if (pamerr != PAM_SUCCESS)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] pam_authenticate() returned %d (%s)",
|
||||
con->number, pamerr, pam_strerror(pamh, pamerr));
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "pam_authenticate() returned %d (%s)", pamerr, pam_strerror(pamh, pamerr));
|
||||
pam_end(pamh, 0);
|
||||
return;
|
||||
}
|
||||
@@ -689,18 +626,13 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
# ifdef HAVE_PAM_SETCRED
|
||||
pamerr = pam_setcred(pamh, PAM_ESTABLISH_CRED | PAM_SILENT);
|
||||
if (pamerr != PAM_SUCCESS)
|
||||
cupsdLogMessage(CUPSD_LOG_WARN,
|
||||
"[Client %d] pam_setcred() returned %d (%s)",
|
||||
con->number, pamerr,
|
||||
pam_strerror(pamh, pamerr));
|
||||
cupsdLogClient(con, CUPSD_LOG_WARN, "pam_setcred() returned %d (%s)", pamerr, pam_strerror(pamh, pamerr));
|
||||
# endif /* HAVE_PAM_SETCRED */
|
||||
|
||||
pamerr = pam_acct_mgmt(pamh, PAM_SILENT);
|
||||
if (pamerr != PAM_SUCCESS)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] pam_acct_mgmt() returned %d (%s)",
|
||||
con->number, pamerr, pam_strerror(pamh, pamerr));
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "pam_acct_mgmt() returned %d (%s)", pamerr, pam_strerror(pamh, pamerr));
|
||||
pam_end(pamh, 0);
|
||||
return;
|
||||
}
|
||||
@@ -728,9 +660,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
* No such user...
|
||||
*/
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] Unknown username \"%s\".",
|
||||
con->number, username);
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Unknown username \"%s\".", username);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -744,9 +674,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
* Don't allow blank passwords!
|
||||
*/
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] Username \"%s\" has no shadow "
|
||||
"password.", con->number, username);
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Username \"%s\" has no shadow password.", username);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -759,9 +687,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
* Don't allow blank passwords!
|
||||
*/
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] Username \"%s\" has no password.",
|
||||
con->number, username);
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Username \"%s\" has no password.", username);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -772,10 +698,6 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
|
||||
pass = cups_crypt(password, pw->pw_passwd);
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"[Client %d] pw_passwd=\"%s\", crypt=\"%s\"",
|
||||
con->number, pw->pw_passwd, pass);
|
||||
|
||||
if (!pass || strcmp(pw->pw_passwd, pass))
|
||||
{
|
||||
# ifdef HAVE_SHADOW_H
|
||||
@@ -783,33 +705,23 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
{
|
||||
pass = cups_crypt(password, spw->sp_pwdp);
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"[Client %d] sp_pwdp=\"%s\", crypt=\"%s\"",
|
||||
con->number, spw->sp_pwdp, pass);
|
||||
|
||||
if (pass == NULL || strcmp(spw->sp_pwdp, pass))
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] Authentication failed for user "
|
||||
"\"%s\".", con->number, username);
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Authentication failed for user \"%s\".", username);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
# endif /* HAVE_SHADOW_H */
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] Authentication failed for user "
|
||||
"\"%s\".", con->number, username);
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Authentication failed for user \"%s\".", username);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_LIBPAM */
|
||||
}
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"[Client %d] Authorized as %s using Basic",
|
||||
con->number, username);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Authorized as \"%s\" using Basic.", username);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -837,10 +749,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
|
||||
if (&gss_init_sec_context == NULL)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_WARN,
|
||||
"[Client %d] GSSAPI/Kerberos authentication failed "
|
||||
"because the Kerberos framework is not present.",
|
||||
con->number);
|
||||
cupsdLogClient(con, CUPSD_LOG_WARN, "GSSAPI/Kerberos authentication failed because the Kerberos framework is not present.");
|
||||
return;
|
||||
}
|
||||
# endif /* __APPLE__ */
|
||||
@@ -855,9 +764,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
|
||||
if (!*authorization)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"[Client %d] No authentication data specified.",
|
||||
con->number);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "No authentication data specified.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -894,9 +801,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
|
||||
if (GSS_ERROR(major_status))
|
||||
{
|
||||
cupsdLogGSSMessage(CUPSD_LOG_DEBUG, major_status, minor_status,
|
||||
"[Client %d] Error accepting GSSAPI security context",
|
||||
con->number);
|
||||
cupsdLogGSSMessage(CUPSD_LOG_DEBUG, major_status, minor_status, "[Client %d] Error accepting GSSAPI security context.", con->number);
|
||||
|
||||
if (context != GSS_C_NO_CONTEXT)
|
||||
gss_delete_sec_context(&minor_status, &context, GSS_C_NO_BUFFER);
|
||||
@@ -910,8 +815,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
*/
|
||||
|
||||
if (major_status == GSS_S_CONTINUE_NEEDED)
|
||||
cupsdLogGSSMessage(CUPSD_LOG_DEBUG, major_status, minor_status,
|
||||
"[Client %d] Credentials not complete", con->number);
|
||||
cupsdLogGSSMessage(CUPSD_LOG_DEBUG, major_status, minor_status, "[Client %d] Credentials not complete.", con->number);
|
||||
else if (major_status == GSS_S_COMPLETE)
|
||||
{
|
||||
major_status = gss_display_name(&minor_status, client_name,
|
||||
@@ -919,8 +823,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
|
||||
if (GSS_ERROR(major_status))
|
||||
{
|
||||
cupsdLogGSSMessage(CUPSD_LOG_DEBUG, major_status, minor_status,
|
||||
"[Client %d] Error getting username", con->number);
|
||||
cupsdLogGSSMessage(CUPSD_LOG_DEBUG, major_status, minor_status, "[Client %d] Error getting username.", con->number);
|
||||
gss_release_name(&minor_status, &client_name);
|
||||
gss_delete_sec_context(&minor_status, &context, GSS_C_NO_BUFFER);
|
||||
return;
|
||||
@@ -928,9 +831,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
|
||||
strlcpy(username, output_token.value, sizeof(username));
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"[Client %d] Authorized as %s using Negotiate",
|
||||
con->number, username);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Authorized as \"%s\" using Negotiate.", username);
|
||||
|
||||
gss_release_name(&minor_status, &client_name);
|
||||
gss_release_buffer(&minor_status, &output_token);
|
||||
@@ -960,15 +861,11 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
&peersize))
|
||||
# endif /* __APPLE__ */
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] Unable to get peer credentials - %s",
|
||||
con->number, strerror(errno));
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Unable to get peer credentials - %s", strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"[Client %d] Using credentials for UID %d.",
|
||||
con->number, CUPSD_UCRED_UID(peercred));
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Using credentials for UID %d.", CUPSD_UCRED_UID(peercred));
|
||||
con->gss_uid = CUPSD_UCRED_UID(peercred);
|
||||
}
|
||||
}
|
||||
@@ -983,9 +880,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
if (sscanf(authorization, "%255s", scheme) != 1)
|
||||
strlcpy(scheme, "UNKNOWN", sizeof(scheme));
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"[Client %d] Bad authentication data \"%s ...\"",
|
||||
con->number, scheme);
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Bad authentication data \"%s ...\".", scheme);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1261,9 +1156,7 @@ cupsdCheckGroup(
|
||||
#endif /* HAVE_MBR_UID_TO_UUID */
|
||||
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"cupsdCheckGroup(username=\"%s\", user=%p, groupname=\"%s\")",
|
||||
username, user, groupname);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdCheckGroup(username=\"%s\", user=%p, groupname=\"%s\")", username, user, groupname);
|
||||
|
||||
/*
|
||||
* Validate input...
|
||||
@@ -1492,6 +1385,12 @@ cupsdFindBest(const char *path, /* I - Resource path */
|
||||
|
||||
strlcpy(uri, path, sizeof(uri));
|
||||
|
||||
if ((uriptr = strchr(uri, '?')) != NULL)
|
||||
*uriptr = '\0'; /* Drop trailing query string */
|
||||
|
||||
if ((uriptr = uri + strlen(uri) - 1) > uri && *uriptr == '/')
|
||||
*uriptr = '\0'; /* Remove trailing '/' */
|
||||
|
||||
if (!strncmp(uri, "/printers/", 10) ||
|
||||
!strncmp(uri, "/classes/", 9))
|
||||
{
|
||||
@@ -1505,12 +1404,6 @@ cupsdFindBest(const char *path, /* I - Resource path */
|
||||
*uriptr = '\0';
|
||||
}
|
||||
|
||||
if ((uriptr = strchr(uri, '?')) != NULL)
|
||||
*uriptr = '\0'; /* Drop trailing query string */
|
||||
|
||||
if ((uriptr = uri + strlen(uri) - 1) > uri && *uriptr == '/')
|
||||
*uriptr = '\0'; /* Remove trailing '/' */
|
||||
|
||||
/*
|
||||
* Loop through the list of locations to find a match...
|
||||
*/
|
||||
@@ -1519,7 +1412,7 @@ cupsdFindBest(const char *path, /* I - Resource path */
|
||||
best = NULL;
|
||||
bestlen = 0;
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindBest: uri = \"%s\", limit=%x...", uri, limit);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindBest: uri=\"%s\", limit=%x...", uri, limit);
|
||||
|
||||
|
||||
for (loc = (cupsd_location_t *)cupsArrayFirst(Locations);
|
||||
@@ -1564,8 +1457,7 @@ cupsdFindBest(const char *path, /* I - Resource path */
|
||||
* Return the match, if any...
|
||||
*/
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindBest: best = %s",
|
||||
best ? best->location : "NONE");
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindBest: best=%s", best ? best->location : "NONE");
|
||||
|
||||
return (best);
|
||||
}
|
||||
@@ -1640,13 +1532,9 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */
|
||||
};
|
||||
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"cupsdIsAuthorized: con->uri=\"%s\", con->best=%p(%s)",
|
||||
con->uri, con->best, con->best ? con->best->location ?
|
||||
con->best->location : "(null)" : "");
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: con->uri=\"%s\", con->best=%p(%s)", con->uri, con->best, con->best ? con->best->location ? con->best->location : "(null)" : "");
|
||||
if (owner)
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"cupsdIsAuthorized: owner=\"%s\"", owner);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: owner=\"%s\"", owner);
|
||||
|
||||
/*
|
||||
* If there is no "best" authentication rule for this request, then
|
||||
@@ -1669,15 +1557,10 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */
|
||||
if ((type = best->type) == CUPSD_AUTH_DEFAULT)
|
||||
type = cupsdDefaultAuthType();
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"cupsdIsAuthorized: level=CUPSD_AUTH_%s, type=%s, "
|
||||
"satisfy=CUPSD_AUTH_SATISFY_%s, num_names=%d",
|
||||
levels[best->level], types[type],
|
||||
best->satisfy ? "ANY" : "ALL", cupsArrayCount(best->names));
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: level=CUPSD_AUTH_%s, type=%s, satisfy=CUPSD_AUTH_SATISFY_%s, num_names=%d", levels[best->level], types[type], best->satisfy ? "ANY" : "ALL", cupsArrayCount(best->names));
|
||||
|
||||
if (best->limit == CUPSD_AUTH_LIMIT_IPP)
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: op=%x(%s)",
|
||||
best->op, ippOpString(best->op));
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: op=%x(%s)", best->op, ippOpString(best->op));
|
||||
|
||||
/*
|
||||
* Check host/ip-based accesses...
|
||||
@@ -1716,8 +1599,7 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */
|
||||
auth = cupsdCheckAccess(address, hostname, hostlen, best)
|
||||
? CUPSD_AUTH_ALLOW : CUPSD_AUTH_DENY;
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: auth=CUPSD_AUTH_%s...",
|
||||
auth ? "DENY" : "ALLOW");
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: auth=CUPSD_AUTH_%s...", auth ? "DENY" : "ALLOW");
|
||||
|
||||
if (auth == CUPSD_AUTH_DENY && best->satisfy == CUPSD_AUTH_SATISFY_ALL)
|
||||
return (HTTP_FORBIDDEN);
|
||||
@@ -1857,8 +1739,7 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */
|
||||
* allowed...
|
||||
*/
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"cupsdIsAuthorized: Checking user membership...");
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: Checking user membership...");
|
||||
|
||||
#ifdef HAVE_AUTHORIZATION_H
|
||||
/*
|
||||
@@ -1911,8 +1792,7 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */
|
||||
* Check to see if this user is in any of the named groups...
|
||||
*/
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"cupsdIsAuthorized: Checking group membership...");
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: Checking group membership...");
|
||||
|
||||
/*
|
||||
* Check to see if this user is in any of the named groups...
|
||||
@@ -1922,9 +1802,7 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */
|
||||
name;
|
||||
name = (char *)cupsArrayNext(best->names))
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"cupsdIsAuthorized: Checking group \"%s\" membership...",
|
||||
name);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: Checking group \"%s\" membership...", name);
|
||||
|
||||
if (!_cups_strcasecmp(name, "@SYSTEM"))
|
||||
{
|
||||
@@ -1940,8 +1818,7 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */
|
||||
* The user isn't part of the specified group, so deny access...
|
||||
*/
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"cupsdIsAuthorized: User not in group(s)!");
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdIsAuthorized: User not in group(s).");
|
||||
|
||||
return (con->username[0] ? HTTP_FORBIDDEN : HTTP_UNAUTHORIZED);
|
||||
}
|
||||
@@ -2031,9 +1908,7 @@ check_authref(cupsd_client_t *con, /* I - Connection */
|
||||
return (0);
|
||||
}
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"AuthorizationCopyRights(\"%s\") succeeded!",
|
||||
authright.name);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "AuthorizationCopyRights(\"%s\") succeeded.", authright.name);
|
||||
|
||||
return (1);
|
||||
}
|
||||
@@ -2336,5 +2211,5 @@ to64(char *s, /* O - Output string */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: auth.c 12602 2015-05-05 20:19:35Z msweet $".
|
||||
* End of "$Id: auth.c 12945 2015-10-26 19:46:02Z msweet $".
|
||||
*/
|
||||
|
||||
+38
-13
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id: cert.c 12034 2014-07-16 19:37:34Z msweet $"
|
||||
* "$Id: cert.c 12972 2015-11-13 20:30:37Z msweet $"
|
||||
*
|
||||
* Authentication certificate routines for the CUPS scheduler.
|
||||
*
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -26,6 +26,13 @@
|
||||
#endif /* HAVE_ACL_INIT */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int ctcompare(const char *a, const char *b);
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsdAddCert()' - Add a certificate.
|
||||
*/
|
||||
@@ -101,8 +108,7 @@ cupsdAddCert(int pid, /* I - Process ID */
|
||||
fchmod(fd, 0440);
|
||||
fchown(fd, RunUser, SystemGroupIDs[0]);
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddCert: NumSystemGroups=%d",
|
||||
NumSystemGroups);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddCert: NumSystemGroups=%d", NumSystemGroups);
|
||||
|
||||
#ifdef HAVE_ACL_INIT
|
||||
if (NumSystemGroups > 1)
|
||||
@@ -278,8 +284,7 @@ cupsdDeleteCert(int pid) /* I - Process ID */
|
||||
* Remove this certificate from the list...
|
||||
*/
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"cupsdDeleteCert: Removing certificate for PID %d", pid);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdDeleteCert: Removing certificate for PID %d.", pid);
|
||||
|
||||
DEBUG_printf(("DELETE pid=%d, username=%s, cert=%s\n", cert->pid,
|
||||
cert->username, cert->certificate));
|
||||
@@ -353,17 +358,15 @@ cupsdFindCert(const char *certificate) /* I - Certificate */
|
||||
cupsd_cert_t *cert; /* Current certificate */
|
||||
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindCert(certificate=%s)",
|
||||
certificate);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindCert(certificate=%s)", certificate);
|
||||
for (cert = Certs; cert != NULL; cert = cert->next)
|
||||
if (!_cups_strcasecmp(certificate, cert->certificate))
|
||||
if (!ctcompare(certificate, cert->certificate))
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindCert: Returning %s...",
|
||||
cert->username);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindCert: Returning \"%s\".", cert->username);
|
||||
return (cert);
|
||||
}
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindCert: Certificate not found!");
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindCert: Certificate not found.");
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
@@ -426,5 +429,27 @@ cupsdInitCerts(void)
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: cert.c 12034 2014-07-16 19:37:34Z msweet $".
|
||||
* 'ctcompare()' - Compare two strings in constant time.
|
||||
*/
|
||||
|
||||
static int /* O - 0 on match, non-zero on non-match */
|
||||
ctcompare(const char *a, /* I - First string */
|
||||
const char *b) /* I - Second string */
|
||||
{
|
||||
int result = 0; /* Result */
|
||||
|
||||
|
||||
while (*a && *b)
|
||||
{
|
||||
result |= *a ^ *b;
|
||||
a ++;
|
||||
b ++;
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: cert.c 12972 2015-11-13 20:30:37Z msweet $".
|
||||
*/
|
||||
|
||||
+104
-83
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: client.c 12751 2015-06-24 18:22:32Z msweet $"
|
||||
* "$Id: client.c 12978 2015-11-17 19:29:52Z msweet $"
|
||||
*
|
||||
* Client routines for the CUPS scheduler.
|
||||
*
|
||||
@@ -78,9 +78,7 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
|
||||
#endif /* HAVE_TCPD_H */
|
||||
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"cupsdAcceptClient(lis=%p(%d)) Clients=%d",
|
||||
lis, lis->fd, cupsArrayCount(Clients));
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAcceptClient(lis=%p(%d)) Clients=%d", lis, lis->fd, cupsArrayCount(Clients));
|
||||
|
||||
/*
|
||||
* Make sure we don't have a full set of clients already...
|
||||
@@ -383,8 +381,7 @@ cupsdCloseAllClients(void)
|
||||
cupsd_client_t *con; /* Current client */
|
||||
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdCloseAllClients() Clients=%d",
|
||||
cupsArrayCount(Clients));
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdCloseAllClients() Clients=%d", cupsArrayCount(Clients));
|
||||
|
||||
for (con = (cupsd_client_t *)cupsArrayFirst(Clients);
|
||||
con;
|
||||
@@ -564,22 +561,7 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
|
||||
|
||||
status = HTTP_STATUS_CONTINUE;
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2,
|
||||
"cupsdReadClient "
|
||||
"error=%d, "
|
||||
"used=%d, "
|
||||
"state=%s, "
|
||||
"data_encoding=HTTP_ENCODING_%s, "
|
||||
"data_remaining=" CUPS_LLFMT ", "
|
||||
"request=%p(%s), "
|
||||
"file=%d",
|
||||
httpError(con->http), (int)httpGetReady(con->http),
|
||||
httpStateString(httpGetState(con->http)),
|
||||
httpIsChunked(con->http) ? "CHUNKED" : "LENGTH",
|
||||
CUPS_LLCAST httpGetRemaining(con->http),
|
||||
con->request,
|
||||
con->request ? ippStateString(ippGetState(con->request)) : "",
|
||||
con->file);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "cupsdReadClient: error=%d, used=%d, state=%s, data_encoding=HTTP_ENCODING_%s, data_remaining=" CUPS_LLFMT ", request=%p(%s), file=%d", httpError(con->http), (int)httpGetReady(con->http), httpStateString(httpGetState(con->http)), httpIsChunked(con->http) ? "CHUNKED" : "LENGTH", CUPS_LLCAST httpGetRemaining(con->http), con->request, con->request ? ippStateString(ippGetState(con->request)) : "", con->file);
|
||||
|
||||
if (httpGetState(con->http) == HTTP_STATE_GET_SEND ||
|
||||
httpGetState(con->http) == HTTP_STATE_POST_SEND ||
|
||||
@@ -601,8 +583,7 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
|
||||
return;
|
||||
}
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing on unexpected HTTP read state %s.",
|
||||
httpStateString(httpGetState(con->http)));
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing on unexpected HTTP read state %s.", httpStateString(httpGetState(con->http)));
|
||||
cupsdCloseClient(con);
|
||||
return;
|
||||
}
|
||||
@@ -623,9 +604,7 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
|
||||
* Encrypt this connection...
|
||||
*/
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2,
|
||||
"Saw first byte %02X, auto-negotiating "
|
||||
"SSL/TLS session.", buf[0] & 255);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "Saw first byte %02X, auto-negotiating SSL/TLS session.", buf[0] & 255);
|
||||
|
||||
if (cupsd_start_tls(con, HTTP_ENCRYPTION_ALWAYS))
|
||||
cupsdCloseClient(con);
|
||||
@@ -1799,6 +1778,20 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
|
||||
{
|
||||
con->bytes += bytes;
|
||||
|
||||
if (MaxRequestSize > 0 && con->bytes > MaxRequestSize)
|
||||
{
|
||||
close(con->file);
|
||||
con->file = -1;
|
||||
unlink(con->filename);
|
||||
cupsdClearString(&con->filename);
|
||||
|
||||
if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
|
||||
{
|
||||
cupsdCloseClient(con);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (write(con->file, line, (size_t)bytes) < bytes)
|
||||
{
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR,
|
||||
@@ -1817,6 +1810,11 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (httpGetState(con->http) == HTTP_STATE_PUT_RECV)
|
||||
{
|
||||
cupsdCloseClient(con);
|
||||
return;
|
||||
}
|
||||
}
|
||||
while (httpGetState(con->http) == HTTP_STATE_PUT_RECV && httpGetReady(con->http));
|
||||
|
||||
@@ -1960,6 +1958,20 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
|
||||
{
|
||||
con->bytes += bytes;
|
||||
|
||||
if (MaxRequestSize > 0 && con->bytes > MaxRequestSize)
|
||||
{
|
||||
close(con->file);
|
||||
con->file = -1;
|
||||
unlink(con->filename);
|
||||
cupsdClearString(&con->filename);
|
||||
|
||||
if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
|
||||
{
|
||||
cupsdCloseClient(con);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (write(con->file, line, (size_t)bytes) < bytes)
|
||||
{
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR,
|
||||
@@ -2162,8 +2174,7 @@ cupsdSendError(cupsd_client_t *con, /* I - Connection */
|
||||
char location[HTTP_MAX_VALUE]; /* Location field */
|
||||
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "cupsdSendError code=%d, auth_type=%d",
|
||||
code, auth_type);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "cupsdSendError code=%d, auth_type=%d", code, auth_type);
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
/*
|
||||
@@ -2838,11 +2849,7 @@ check_if_modified(
|
||||
if (*ptr == '\0')
|
||||
return (1);
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2,
|
||||
"check_if_modified "
|
||||
"filestats=%p(" CUPS_LLFMT ", %d)) If-Modified-Since=\"%s\"",
|
||||
filestats, CUPS_LLCAST filestats->st_size,
|
||||
(int)filestats->st_mtime, ptr);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "check_if_modified: filestats=%p(" CUPS_LLFMT ", %d)) If-Modified-Since=\"%s\"", filestats, CUPS_LLCAST filestats->st_size, (int)filestats->st_mtime, ptr);
|
||||
|
||||
while (*ptr != '\0')
|
||||
{
|
||||
@@ -2909,7 +2916,7 @@ cupsd_start_tls(cupsd_client_t *con, /* I - Client connection */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_INFO, "Connection now encrypted.");
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Connection now encrypted.");
|
||||
return (0);
|
||||
}
|
||||
#endif /* HAVE_SSL */
|
||||
@@ -2928,7 +2935,8 @@ get_file(cupsd_client_t *con, /* I - Client connection */
|
||||
int status; /* Status of filesystem calls */
|
||||
char *ptr; /* Pointer info filename */
|
||||
size_t plen; /* Remaining length after pointer */
|
||||
char language[7]; /* Language subdirectory, if any */
|
||||
char language[7], /* Language subdirectory, if any */
|
||||
dest[1024]; /* Destination name */
|
||||
int perm_check = 1; /* Do permissions check? */
|
||||
|
||||
|
||||
@@ -2940,13 +2948,45 @@ get_file(cupsd_client_t *con, /* I - Client connection */
|
||||
|
||||
if (!strncmp(con->uri, "/ppd/", 5) && !strchr(con->uri + 5, '/'))
|
||||
{
|
||||
strlcpy(dest, con->uri + 5, sizeof(dest));
|
||||
ptr = dest + strlen(dest) - 4;
|
||||
|
||||
if (ptr <= dest || strcmp(ptr, ".ppd"))
|
||||
{
|
||||
cupsdLogClient(con, CUPSD_LOG_INFO, "Disallowed path \"%s\".", con->uri);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
*ptr = '\0';
|
||||
if (!cupsdFindPrinter(dest))
|
||||
{
|
||||
cupsdLogClient(con, CUPSD_LOG_INFO, "No printer \"%s\" found.", dest);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
snprintf(filename, len, "%s%s", ServerRoot, con->uri);
|
||||
|
||||
perm_check = 0;
|
||||
}
|
||||
else if (!strncmp(con->uri, "/icons/", 7) && !strchr(con->uri + 7, '/'))
|
||||
{
|
||||
snprintf(filename, len, "%s/%s", CacheDir, con->uri + 7);
|
||||
strlcpy(dest, con->uri + 7, sizeof(dest));
|
||||
ptr = dest + strlen(dest) - 4;
|
||||
|
||||
if (ptr <= dest || strcmp(ptr, ".png"))
|
||||
{
|
||||
cupsdLogClient(con, CUPSD_LOG_INFO, "Disallowed path \"%s\".", con->uri);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
*ptr = '\0';
|
||||
if (!cupsdFindDest(dest))
|
||||
{
|
||||
cupsdLogClient(con, CUPSD_LOG_INFO, "No printer \"%s\" found.", dest);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
snprintf(filename, len, "%s/%s.png", CacheDir, dest);
|
||||
if (access(filename, F_OK) < 0)
|
||||
snprintf(filename, len, "%s/images/generic.png", DocumentRoot);
|
||||
|
||||
@@ -3152,7 +3192,7 @@ get_file(cupsd_client_t *con, /* I - Client connection */
|
||||
}
|
||||
}
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "get_file filestats=%p, filename=%p, len=" CUPS_LLFMT ", returning \"%s\".", filestats, filename, CUPS_LLCAST len, status ? "(null)" : filename);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "get_file: filestats=%p, filename=%p, len=" CUPS_LLFMT ", returning \"%s\".", filestats, filename, CUPS_LLCAST len, status ? "(null)" : filename);
|
||||
|
||||
if (status)
|
||||
return (NULL);
|
||||
@@ -3183,7 +3223,7 @@ install_cupsd_conf(cupsd_client_t *con) /* I - Connection */
|
||||
{
|
||||
cupsdLogClient(con, CUPSD_LOG_ERROR, "Unable to open request file \"%s\": %s",
|
||||
con->filename, strerror(errno));
|
||||
return (HTTP_STATUS_SERVER_ERROR);
|
||||
goto server_error;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3193,7 +3233,7 @@ install_cupsd_conf(cupsd_client_t *con) /* I - Connection */
|
||||
if ((out = cupsdCreateConfFile(ConfigurationFile, ConfigFilePerm)) == NULL)
|
||||
{
|
||||
cupsFileClose(in);
|
||||
return (HTTP_STATUS_SERVER_ERROR);
|
||||
goto server_error;
|
||||
}
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_INFO, "Installing config file \"%s\"...",
|
||||
@@ -3216,7 +3256,7 @@ install_cupsd_conf(cupsd_client_t *con) /* I - Connection */
|
||||
snprintf(filename, sizeof(filename), "%s.N", ConfigurationFile);
|
||||
cupsdUnlinkOrRemoveFile(filename);
|
||||
|
||||
return (HTTP_STATUS_SERVER_ERROR);
|
||||
goto server_error;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3226,7 +3266,7 @@ install_cupsd_conf(cupsd_client_t *con) /* I - Connection */
|
||||
cupsFileClose(in);
|
||||
|
||||
if (cupsdCloseCreatedConfFile(out, ConfigurationFile))
|
||||
return (HTTP_STATUS_SERVER_ERROR);
|
||||
goto server_error;
|
||||
|
||||
/*
|
||||
* Remove the request file...
|
||||
@@ -3247,6 +3287,17 @@ install_cupsd_conf(cupsd_client_t *con) /* I - Connection */
|
||||
*/
|
||||
|
||||
return (HTTP_STATUS_CREATED);
|
||||
|
||||
/*
|
||||
* Common exit for errors...
|
||||
*/
|
||||
|
||||
server_error:
|
||||
|
||||
cupsdUnlinkOrRemoveFile(con->filename);
|
||||
cupsdClearString(&con->filename);
|
||||
|
||||
return (HTTP_STATUS_SERVER_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@@ -3279,11 +3330,7 @@ is_cgi(cupsd_client_t *con, /* I - Client connection */
|
||||
|
||||
if (!type || _cups_strcasecmp(type->super, "application"))
|
||||
{
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2,
|
||||
"is_cgi filename=\"%s\", filestats=%p, "
|
||||
"type=%s/%s, returning 0", filename,
|
||||
filestats, type ? type->super : "unknown",
|
||||
type ? type->type : "unknown");
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 0.", filename, filestats, type ? type->super : "unknown", type ? type->type : "unknown");
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -3299,10 +3346,7 @@ is_cgi(cupsd_client_t *con, /* I - Client connection */
|
||||
if (options)
|
||||
cupsdSetStringf(&con->options, " %s", options);
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2,
|
||||
"is_cgi filename=\"%s\", filestats=%p, "
|
||||
"type=%s/%s, returning 1", filename,
|
||||
filestats, type->super, type->type);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type);
|
||||
return (1);
|
||||
}
|
||||
#ifdef HAVE_JAVA
|
||||
@@ -3319,10 +3363,7 @@ is_cgi(cupsd_client_t *con, /* I - Client connection */
|
||||
else
|
||||
cupsdSetStringf(&con->options, " %s", filename);
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2,
|
||||
"is_cgi filename=\"%s\", filestats=%p, "
|
||||
"type=%s/%s, returning 1", filename,
|
||||
filestats, type->super, type->type);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type);
|
||||
return (1);
|
||||
}
|
||||
#endif /* HAVE_JAVA */
|
||||
@@ -3340,10 +3381,7 @@ is_cgi(cupsd_client_t *con, /* I - Client connection */
|
||||
else
|
||||
cupsdSetStringf(&con->options, " %s", filename);
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2,
|
||||
"is_cgi filename=\"%s\", filestats=%p, "
|
||||
"type=%s/%s, returning 1", filename,
|
||||
filestats, type->super, type->type);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type);
|
||||
return (1);
|
||||
}
|
||||
#endif /* HAVE_PERL */
|
||||
@@ -3361,10 +3399,7 @@ is_cgi(cupsd_client_t *con, /* I - Client connection */
|
||||
else
|
||||
cupsdSetStringf(&con->options, " %s", filename);
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2,
|
||||
"is_cgi filename=\"%s\", filestats=%p, "
|
||||
"type=%s/%s, returning 1", filename,
|
||||
filestats, type->super, type->type);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type);
|
||||
return (1);
|
||||
}
|
||||
#endif /* HAVE_PHP */
|
||||
@@ -3382,18 +3417,12 @@ is_cgi(cupsd_client_t *con, /* I - Client connection */
|
||||
else
|
||||
cupsdSetStringf(&con->options, " %s", filename);
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2,
|
||||
"is_cgi filename=\"%s\", filestats=%p, "
|
||||
"type=%s/%s, returning 1", filename,
|
||||
filestats, type->super, type->type);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type);
|
||||
return (1);
|
||||
}
|
||||
#endif /* HAVE_PYTHON */
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2,
|
||||
"is_cgi filename=\"%s\", filestats=%p, "
|
||||
"type=%s/%s, returning 0", filename,
|
||||
filestats, type->super, type->type);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 0.", filename, filestats, type->super, type->type);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -3500,11 +3529,7 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */
|
||||
* be consistent with Apache...
|
||||
*/
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2,
|
||||
"pipe_command infile=%d, outfile=%p, "
|
||||
"command=\"%s\", options=\"%s\", root=%d",
|
||||
infile, outfile, command,
|
||||
options ? options : "(null)", root);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "pipe_command: infile=%d, outfile=%p, command=\"%s\", options=\"%s\", root=%d", infile, outfile, command, options ? options : "(null)", root);
|
||||
|
||||
argv[0] = command;
|
||||
|
||||
@@ -4021,10 +4046,7 @@ write_file(cupsd_client_t *con, /* I - Client connection */
|
||||
{
|
||||
con->file = open(filename, O_RDONLY);
|
||||
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2,
|
||||
"write_file code=%d, filename=\"%s\" (%d), "
|
||||
"type=\"%s\", filestats=%p",
|
||||
code, filename, con->file, type ? type : "(null)", filestats);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "write_file: code=%d, filename=\"%s\" (%d), type=\"%s\", filestats=%p.", code, filename, con->file, type ? type : "(null)", filestats);
|
||||
|
||||
if (con->file < 0)
|
||||
return (0);
|
||||
@@ -4059,8 +4081,7 @@ write_file(cupsd_client_t *con, /* I - Client connection */
|
||||
static void
|
||||
write_pipe(cupsd_client_t *con) /* I - Client connection */
|
||||
{
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "write_pipe CGI output on fd %d",
|
||||
con->file);
|
||||
cupsdLogClient(con, CUPSD_LOG_DEBUG2, "write_pipe: CGI output on fd %d.", con->file);
|
||||
|
||||
con->file_ready = 1;
|
||||
|
||||
@@ -4072,5 +4093,5 @@ write_pipe(cupsd_client_t *con) /* I - Client connection */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: client.c 12751 2015-06-24 18:22:32Z msweet $".
|
||||
* End of "$Id: client.c 12978 2015-11-17 19:29:52Z msweet $".
|
||||
*/
|
||||
|
||||
+22
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: ipp.c 12851 2015-08-28 13:17:53Z msweet $"
|
||||
* "$Id: ipp.c 12978 2015-11-17 19:29:52Z msweet $"
|
||||
*
|
||||
* IPP routines for the CUPS scheduler.
|
||||
*
|
||||
@@ -978,6 +978,16 @@ add_class(cupsd_client_t *con, /* I - Client connection */
|
||||
if ((attr = ippFindAttribute(con->request, "printer-is-shared",
|
||||
IPP_TAG_BOOLEAN)) != NULL)
|
||||
{
|
||||
if (pclass->type & CUPS_PRINTER_REMOTE)
|
||||
{
|
||||
/*
|
||||
* Cannot re-share remote printers.
|
||||
*/
|
||||
|
||||
send_ipp_status(con, IPP_BAD_REQUEST, _("Cannot change printer-is-shared for remote queues."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (pclass->shared && !attr->values[0].boolean)
|
||||
cupsdDeregisterPrinter(pclass, 1);
|
||||
|
||||
@@ -2471,6 +2481,16 @@ add_printer(cupsd_client_t *con, /* I - Client connection */
|
||||
return;
|
||||
}
|
||||
|
||||
if (printer->type & CUPS_PRINTER_REMOTE)
|
||||
{
|
||||
/*
|
||||
* Cannot re-share remote printers.
|
||||
*/
|
||||
|
||||
send_ipp_status(con, IPP_BAD_REQUEST, _("Cannot change printer-is-shared for remote queues."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (printer->shared && !attr->values[0].boolean)
|
||||
cupsdDeregisterPrinter(printer, 1);
|
||||
|
||||
@@ -11149,5 +11169,5 @@ validate_user(cupsd_job_t *job, /* I - Job */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: ipp.c 12851 2015-08-28 13:17:53Z msweet $".
|
||||
* End of "$Id: ipp.c 12978 2015-11-17 19:29:52Z msweet $".
|
||||
*/
|
||||
|
||||
+3
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: log.c 12857 2015-08-31 15:00:45Z msweet $"
|
||||
* "$Id: log.c 12928 2015-10-23 21:31:58Z msweet $"
|
||||
*
|
||||
* Log file routines for the CUPS scheduler.
|
||||
*
|
||||
@@ -1476,7 +1476,7 @@ format_log_line(const char *message, /* I - Printf-style format string */
|
||||
* Format the log message...
|
||||
*/
|
||||
|
||||
len = vsnprintf(log_line, log_linesize, message, ap);
|
||||
len = _cups_safe_vsnprintf(log_line, log_linesize, message, ap);
|
||||
|
||||
/*
|
||||
* Resize the buffer as needed...
|
||||
@@ -1486,7 +1486,6 @@ format_log_line(const char *message, /* I - Printf-style format string */
|
||||
{
|
||||
char *temp; /* Temporary string pointer */
|
||||
|
||||
|
||||
len ++;
|
||||
|
||||
if (len < 8192)
|
||||
@@ -1510,5 +1509,5 @@ format_log_line(const char *message, /* I - Printf-style format string */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: log.c 12857 2015-08-31 15:00:45Z msweet $".
|
||||
* End of "$Id: log.c 12928 2015-10-23 21:31:58Z msweet $".
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: subscriptions.c 11558 2014-02-06 18:33:34Z msweet $"
|
||||
* "$Id: subscriptions.c 12978 2015-11-17 19:29:52Z msweet $"
|
||||
*
|
||||
* Subscription routines for the CUPS scheduler.
|
||||
*
|
||||
@@ -105,9 +105,7 @@ cupsdAddEvent(
|
||||
* Check if this subscription requires this event...
|
||||
*/
|
||||
|
||||
if ((sub->mask & event) != 0 &&
|
||||
(sub->dest == dest || !sub->dest) &&
|
||||
(sub->job == job || !sub->job))
|
||||
if ((sub->mask & event) != 0 && (sub->dest == dest || !sub->dest || sub->job == job))
|
||||
{
|
||||
/*
|
||||
* Need this event, so create a new event record...
|
||||
@@ -1617,5 +1615,5 @@ cupsd_update_notifier(void)
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: subscriptions.c 11558 2014-02-06 18:33:34Z msweet $".
|
||||
* End of "$Id: subscriptions.c 12978 2015-11-17 19:29:52Z msweet $".
|
||||
*/
|
||||
|
||||
+10
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: ippserver.c 12840 2015-08-09 02:10:23Z msweet $"
|
||||
* "$Id: ippserver.c 12947 2015-10-28 15:23:33Z msweet $"
|
||||
*
|
||||
* Sample IPP Everywhere server for CUPS.
|
||||
*
|
||||
@@ -1086,7 +1086,10 @@ create_job(_ipp_client_t *client) /* I - Client */
|
||||
ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-id", job->id);
|
||||
ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-uri", NULL, uri);
|
||||
ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-uuid", NULL, uuid);
|
||||
ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-printer-uri", NULL, client->printer->uri);
|
||||
if ((attr = ippFindAttribute(client->request, "printer-uri", IPP_TAG_URI)) != NULL)
|
||||
ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-printer-uri", NULL, ippGetString(attr, 0, NULL));
|
||||
else
|
||||
ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-printer-uri", NULL, client->printer->uri);
|
||||
ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_INTEGER, "time-at-creation", (int)(job->created - client->printer->start_time));
|
||||
|
||||
cupsArrayAdd(client->printer->jobs, job);
|
||||
@@ -1770,9 +1773,6 @@ create_printer(const char *servername, /* I - Server hostname (NULL for default)
|
||||
if (!ippFindAttribute(printer->attrs, "job-password-supported", IPP_TAG_ZERO))
|
||||
ippAddInteger(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "job-password-supported", 4);
|
||||
|
||||
/* job-preferred-attributes-supported */
|
||||
ippAddBoolean(printer->attrs, IPP_TAG_PRINTER, "job-preferred-attributes-supported", 0);
|
||||
|
||||
/* job-priority-default */
|
||||
if (!ippFindAttribute(printer->attrs, "job-priority-default", IPP_TAG_ZERO))
|
||||
ippAddInteger(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "job-priority-default", 50);
|
||||
@@ -1980,6 +1980,9 @@ create_printer(const char *servername, /* I - Server hostname (NULL for default)
|
||||
if (!ippFindAttribute(printer->attrs, "pdl-override-supported", IPP_TAG_ZERO))
|
||||
ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "pdl-override-supported", NULL, "attempted");
|
||||
|
||||
/* preferred-attributes-supported */
|
||||
ippAddBoolean(printer->attrs, IPP_TAG_PRINTER, "preferred-attributes-supported", 0);
|
||||
|
||||
/* print-color-mode-default */
|
||||
if (!ippFindAttribute(printer->attrs, "print-color-mode-default", IPP_TAG_ZERO))
|
||||
ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "print-color-mode-default", NULL, "auto");
|
||||
@@ -3681,7 +3684,7 @@ ipp_get_printer_attributes(
|
||||
{
|
||||
if (printer->state_reasons & bit)
|
||||
{
|
||||
snprintf(reason, sizeof(reason), "%s-%s", _ipp_preason_strings[0], printer->state == IPP_PSTATE_IDLE ? "report" : printer->state == IPP_PSTATE_PROCESSING ? "warning" : "error");
|
||||
snprintf(reason, sizeof(reason), "%s-%s", _ipp_preason_strings[i], printer->state == IPP_PSTATE_IDLE ? "report" : printer->state == IPP_PSTATE_PROCESSING ? "warning" : "error");
|
||||
if (attr)
|
||||
ippSetString(client->response, &attr, ippGetCount(attr), reason);
|
||||
else
|
||||
@@ -7388,5 +7391,5 @@ valid_job_attributes(
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: ippserver.c 12840 2015-08-09 02:10:23Z msweet $".
|
||||
* End of "$Id: ippserver.c 12947 2015-10-28 15:23:33Z msweet $".
|
||||
*/
|
||||
|
||||
+152
-39
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: ipptool.c 12644 2015-05-19 21:22:35Z msweet $"
|
||||
* "$Id: ipptool.c 12952 2015-10-28 17:22:39Z msweet $"
|
||||
*
|
||||
* ipptool command for CUPS.
|
||||
*
|
||||
@@ -153,31 +153,23 @@ static int PasswordTries = 0; /* Number of tries with password */
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void add_stringf(cups_array_t *a, const char *s, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
static void add_stringf(cups_array_t *a, const char *s, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
static int compare_vars(_cups_var_t *a, _cups_var_t *b);
|
||||
static int do_tests(FILE *outfile, _cups_vars_t *vars, const char *testfile);
|
||||
static void expand_variables(_cups_vars_t *vars, char *dst, const char *src,
|
||||
size_t dstsize) __attribute__((nonnull(1,2,3)));
|
||||
static void expand_variables(_cups_vars_t *vars, char *dst, const char *src, size_t dstsize) __attribute__((nonnull(1,2,3)));
|
||||
static int expect_matches(_cups_expect_t *expect, ipp_tag_t value_tag);
|
||||
static ipp_t *get_collection(FILE *outfile, _cups_vars_t *vars, FILE *fp, int *linenum);
|
||||
static char *get_filename(const char *testfile, char *dst, const char *src,
|
||||
size_t dstsize);
|
||||
static char *get_string(ipp_attribute_t *attr, int element, int flags,
|
||||
char *buffer, size_t bufsize);
|
||||
static char *get_token(FILE *fp, char *buf, int buflen,
|
||||
int *linenum);
|
||||
static char *get_filename(const char *testfile, char *dst, const char *src, size_t dstsize);
|
||||
static const char *get_string(ipp_attribute_t *attr, int element, int flags, char *buffer, size_t bufsize);
|
||||
static char *get_token(FILE *fp, char *buf, int buflen, int *linenum);
|
||||
static char *get_variable(_cups_vars_t *vars, const char *name);
|
||||
static char *iso_date(ipp_uchar_t *date);
|
||||
static const char *password_cb(const char *prompt);
|
||||
static void pause_message(const char *message);
|
||||
static void print_attr(FILE *outfile, int format, ipp_attribute_t *attr, ipp_tag_t *group);
|
||||
static void print_csv(FILE *outfile, ipp_attribute_t *attr, int num_displayed,
|
||||
char **displayed, size_t *widths);
|
||||
static void print_fatal_error(FILE *outfile, const char *s, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
static void print_line(FILE *outfile, ipp_attribute_t *attr, int num_displayed,
|
||||
char **displayed, size_t *widths);
|
||||
static void print_csv(FILE *outfile, ipp_attribute_t *attr, int num_displayed, char **displayed, size_t *widths);
|
||||
static void print_fatal_error(FILE *outfile, const char *s, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
static void print_line(FILE *outfile, ipp_attribute_t *attr, int num_displayed, char **displayed, size_t *widths);
|
||||
static void print_xml_header(FILE *outfile);
|
||||
static void print_xml_string(FILE *outfile, const char *element, const char *s);
|
||||
static void print_xml_trailer(FILE *outfile, int success, const char *message);
|
||||
@@ -188,9 +180,7 @@ static void sigterm_handler(int sig);
|
||||
static int timeout_cb(http_t *http, void *user_data);
|
||||
static void usage(void) __attribute__((noreturn));
|
||||
static int validate_attr(FILE *outfile, cups_array_t *errors, ipp_attribute_t *attr);
|
||||
static int with_value(FILE *outfile, cups_array_t *errors, char *value, int flags,
|
||||
ipp_attribute_t *attr, char *matchbuf,
|
||||
size_t matchlen);
|
||||
static int with_value(FILE *outfile, cups_array_t *errors, char *value, int flags, ipp_attribute_t *attr, char *matchbuf, size_t matchlen);
|
||||
static int with_value_from(cups_array_t *errors, ipp_attribute_t *fromattr, ipp_attribute_t *attr, char *matchbuf, size_t matchlen);
|
||||
|
||||
|
||||
@@ -1721,23 +1711,70 @@ do_tests(FILE *outfile, /* I - Output file */
|
||||
case IPP_TAG_INTEGER :
|
||||
case IPP_TAG_ENUM :
|
||||
if (!strchr(token, ','))
|
||||
attrptr = ippAddInteger(request, group, value, attr, (int)strtol(token, &tokenptr, 0));
|
||||
{
|
||||
if (isdigit(token[0] & 255) || token[0] == '-')
|
||||
attrptr = ippAddInteger(request, group, value, attr, (int)strtol(token, &tokenptr, 0));
|
||||
else
|
||||
{
|
||||
tokenptr = token;
|
||||
if ((i = ippEnumValue(attr, tokenptr)) >= 0)
|
||||
{
|
||||
attrptr = ippAddInteger(request, group, value, attr, i);
|
||||
tokenptr += strlen(tokenptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int values[100], /* Values */
|
||||
num_values = 1; /* Number of values */
|
||||
|
||||
values[0] = (int)strtol(token, &tokenptr, 10);
|
||||
if (!isdigit(token[0] & 255) && token[0] != '-' && value == IPP_TAG_ENUM)
|
||||
{
|
||||
char *ptr; /* Pointer to next terminator */
|
||||
|
||||
if ((ptr = strchr(token, ',')) != NULL)
|
||||
*ptr++ = '\0';
|
||||
else
|
||||
ptr = token + strlen(token);
|
||||
|
||||
if ((i = ippEnumValue(attr, token)) < 0)
|
||||
tokenptr = NULL;
|
||||
else
|
||||
tokenptr = ptr;
|
||||
}
|
||||
else
|
||||
i = (int)strtol(tokenptr, &tokenptr, 0);
|
||||
|
||||
values[0] = i;
|
||||
|
||||
while (tokenptr && *tokenptr &&
|
||||
num_values < (int)(sizeof(values) / sizeof(values[0])))
|
||||
{
|
||||
if (*tokenptr == ',')
|
||||
tokenptr ++;
|
||||
else if (!isdigit(*tokenptr & 255) && *tokenptr != '-')
|
||||
break;
|
||||
|
||||
values[num_values] = (int)strtol(tokenptr, &tokenptr, 0);
|
||||
num_values ++;
|
||||
if (!isdigit(*tokenptr & 255) && *tokenptr != '-')
|
||||
{
|
||||
char *ptr; /* Pointer to next terminator */
|
||||
|
||||
if (value != IPP_TAG_ENUM)
|
||||
break;
|
||||
|
||||
if ((ptr = strchr(tokenptr, ',')) != NULL)
|
||||
*ptr++ = '\0';
|
||||
else
|
||||
ptr = tokenptr + strlen(tokenptr);
|
||||
|
||||
if ((i = ippEnumValue(attr, tokenptr)) < 0)
|
||||
break;
|
||||
|
||||
tokenptr = ptr;
|
||||
}
|
||||
else
|
||||
i = (int)strtol(tokenptr, &tokenptr, 0);
|
||||
|
||||
values[num_values ++] = i;
|
||||
}
|
||||
|
||||
attrptr = ippAddIntegers(request, group, value, attr, num_values, values);
|
||||
@@ -3909,26 +3946,27 @@ get_filename(const char *testfile, /* I - Current test file */
|
||||
* 'get_string()' - Get a pointer to a string value or the portion of interest.
|
||||
*/
|
||||
|
||||
static char * /* O - Pointer to string */
|
||||
static const char * /* O - Pointer to string */
|
||||
get_string(ipp_attribute_t *attr, /* I - IPP attribute */
|
||||
int element, /* I - Element to fetch */
|
||||
int flags, /* I - Value ("with") flags */
|
||||
char *buffer, /* I - Temporary buffer */
|
||||
size_t bufsize) /* I - Size of temporary buffer */
|
||||
{
|
||||
char *ptr, /* Value */
|
||||
scheme[256], /* URI scheme */
|
||||
userpass[256], /* Username/password */
|
||||
hostname[256], /* Hostname */
|
||||
resource[1024]; /* Resource */
|
||||
int port; /* Port number */
|
||||
const char *value; /* Value */
|
||||
char *ptr, /* Pointer into value */
|
||||
scheme[256], /* URI scheme */
|
||||
userpass[256], /* Username/password */
|
||||
hostname[256], /* Hostname */
|
||||
resource[1024]; /* Resource */
|
||||
int port; /* Port number */
|
||||
|
||||
|
||||
ptr = attr->values[element].string.text;
|
||||
value = ippGetString(attr, element, NULL);
|
||||
|
||||
if (flags & _CUPS_WITH_HOSTNAME)
|
||||
{
|
||||
if (httpSeparateURI(HTTP_URI_CODING_ALL, ptr, scheme, sizeof(scheme), userpass, sizeof(userpass), buffer, (int)bufsize, &port, resource, sizeof(resource)) < HTTP_URI_STATUS_OK)
|
||||
if (httpSeparateURI(HTTP_URI_CODING_ALL, value, scheme, sizeof(scheme), userpass, sizeof(userpass), buffer, (int)bufsize, &port, resource, sizeof(resource)) < HTTP_URI_STATUS_OK)
|
||||
buffer[0] = '\0';
|
||||
|
||||
ptr = buffer + strlen(buffer) - 1;
|
||||
@@ -3939,20 +3977,46 @@ get_string(ipp_attribute_t *attr, /* I - IPP attribute */
|
||||
}
|
||||
else if (flags & _CUPS_WITH_RESOURCE)
|
||||
{
|
||||
if (httpSeparateURI(HTTP_URI_CODING_ALL, ptr, scheme, sizeof(scheme), userpass, sizeof(userpass), hostname, sizeof(hostname), &port, buffer, (int)bufsize) < HTTP_URI_STATUS_OK)
|
||||
if (httpSeparateURI(HTTP_URI_CODING_ALL, value, scheme, sizeof(scheme), userpass, sizeof(userpass), hostname, sizeof(hostname), &port, buffer, (int)bufsize) < HTTP_URI_STATUS_OK)
|
||||
buffer[0] = '\0';
|
||||
|
||||
return (buffer);
|
||||
}
|
||||
else if (flags & _CUPS_WITH_SCHEME)
|
||||
{
|
||||
if (httpSeparateURI(HTTP_URI_CODING_ALL, ptr, buffer, (int)bufsize, userpass, sizeof(userpass), hostname, sizeof(hostname), &port, resource, sizeof(resource)) < HTTP_URI_STATUS_OK)
|
||||
if (httpSeparateURI(HTTP_URI_CODING_ALL, value, buffer, (int)bufsize, userpass, sizeof(userpass), hostname, sizeof(hostname), &port, resource, sizeof(resource)) < HTTP_URI_STATUS_OK)
|
||||
buffer[0] = '\0';
|
||||
|
||||
return (buffer);
|
||||
}
|
||||
else if (ippGetValueTag(attr) == IPP_TAG_URI && (!strncmp(value, "ipp://", 6) || !strncmp(value, "http://", 7) || !strncmp(value, "ipps://", 7) || !strncmp(value, "https://", 8)))
|
||||
{
|
||||
http_uri_status_t status = httpSeparateURI(HTTP_URI_CODING_ALL, value, scheme, sizeof(scheme), userpass, sizeof(userpass), hostname, sizeof(hostname), &port, resource, sizeof(resource));
|
||||
|
||||
if (status < HTTP_URI_STATUS_OK)
|
||||
{
|
||||
/*
|
||||
* Bad URI...
|
||||
*/
|
||||
|
||||
buffer[0] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Normalize URI with no trailing dot...
|
||||
*/
|
||||
|
||||
if ((ptr = hostname + strlen(hostname) - 1) >= hostname && *ptr == '.')
|
||||
*ptr = '\0';
|
||||
|
||||
httpAssembleURI(HTTP_URI_CODING_ALL, buffer, (int)bufsize, scheme, userpass, hostname, port, resource);
|
||||
}
|
||||
|
||||
return (buffer);
|
||||
}
|
||||
else
|
||||
return (ptr);
|
||||
return (value);
|
||||
}
|
||||
|
||||
|
||||
@@ -5872,6 +5936,55 @@ with_value(FILE *outfile, /* I - Output file */
|
||||
|
||||
regfree(&re);
|
||||
}
|
||||
else if (ippGetValueTag(attr) == IPP_TAG_URI)
|
||||
{
|
||||
if (!strncmp(value, "ipp://", 6) || !strncmp(value, "http://", 7) || !strncmp(value, "ipps://", 7) || !strncmp(value, "https://", 8))
|
||||
{
|
||||
char scheme[256], /* URI scheme */
|
||||
userpass[256], /* username:password, if any */
|
||||
hostname[256], /* hostname */
|
||||
*hostptr, /* Pointer into hostname */
|
||||
resource[1024]; /* Resource path */
|
||||
int port; /* Port number */
|
||||
|
||||
if (httpSeparateURI(HTTP_URI_CODING_ALL, value, scheme, sizeof(scheme), userpass, sizeof(userpass), hostname, sizeof(hostname), &port, resource, sizeof(resource)) >= HTTP_URI_STATUS_OK && (hostptr = hostname + strlen(hostname) - 1) > hostname && *hostptr == '.')
|
||||
{
|
||||
/*
|
||||
* Strip trailing "." in hostname of URI...
|
||||
*/
|
||||
|
||||
*hostptr = '\0';
|
||||
httpAssembleURI(HTTP_URI_CODING_ALL, temp, sizeof(temp), scheme, userpass, hostname, port, resource);
|
||||
value = temp;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Value is a literal URI string, see if the value(s) match...
|
||||
*/
|
||||
|
||||
for (i = 0; i < attr->num_values; i ++)
|
||||
{
|
||||
if (!strcmp(value, get_string(attr, i, flags, temp, sizeof(temp))))
|
||||
{
|
||||
if (!matchbuf[0])
|
||||
strlcpy(matchbuf,
|
||||
get_string(attr, i, flags, temp, sizeof(temp)),
|
||||
matchlen);
|
||||
|
||||
if (!(flags & _CUPS_WITH_ALL))
|
||||
{
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (flags & _CUPS_WITH_ALL)
|
||||
{
|
||||
match = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
@@ -6078,5 +6191,5 @@ with_value_from(
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: ipptool.c 12644 2015-05-19 21:22:35Z msweet $".
|
||||
* End of "$Id: ipptool.c 12952 2015-10-28 17:22:39Z msweet $".
|
||||
*/
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: config.h 12831 2015-08-05 14:24:32Z msweet $"
|
||||
* "$Id: config.h 12998 2015-12-02 15:09:04Z msweet $"
|
||||
*
|
||||
* Configuration file for CUPS on Windows.
|
||||
*
|
||||
@@ -96,8 +96,8 @@ typedef unsigned long useconds_t;
|
||||
* Version of software...
|
||||
*/
|
||||
|
||||
#define CUPS_SVERSION "CUPS v2.1.0"
|
||||
#define CUPS_MINIMAL "CUPS/2.1.0"
|
||||
#define CUPS_SVERSION "CUPS v2.1.2"
|
||||
#define CUPS_MINIMAL "CUPS/2.1.2"
|
||||
|
||||
|
||||
/*
|
||||
@@ -799,5 +799,5 @@ static __inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
|
||||
#endif /* !_CUPS_CONFIG_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: config.h 12831 2015-08-05 14:24:32Z msweet $".
|
||||
* End of "$Id: config.h 12998 2015-12-02 15:09:04Z msweet $".
|
||||
*/
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: config.h 12831 2015-08-05 14:24:32Z msweet $"
|
||||
* "$Id: config.h 12998 2015-12-02 15:09:04Z msweet $"
|
||||
*
|
||||
* Configuration file for CUPS and Xcode.
|
||||
*
|
||||
@@ -22,8 +22,8 @@
|
||||
* Version of software...
|
||||
*/
|
||||
|
||||
#define CUPS_SVERSION "CUPS v2.1.0"
|
||||
#define CUPS_MINIMAL "CUPS/2.1.0"
|
||||
#define CUPS_SVERSION "CUPS v2.1.2"
|
||||
#define CUPS_MINIMAL "CUPS/2.1.2"
|
||||
|
||||
|
||||
/*
|
||||
@@ -738,5 +738,5 @@ static __inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
|
||||
#endif /* !_CUPS_CONFIG_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: config.h 12831 2015-08-05 14:24:32Z msweet $".
|
||||
* End of "$Id: config.h 12998 2015-12-02 15:09:04Z msweet $".
|
||||
*/
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário