Comparar commits

..

34 Commits

Autor SHA1 Mensagem Data
Michael R Sweet e4a0aa86c9 Prep for 2.2.11 release. 2019-03-22 15:51:36 -04:00
Michael R Sweet ba9d68cc74 Fix an issue with and time values (Issue #5538) 2019-03-11 13:54:46 -04:00
Michael R Sweet 488ec102c1 Mirror test suite changes from master. 2019-03-11 12:06:05 -04:00
Michael R Sweet c7b37f21eb Fix PPD caching and IPP Everywhere PPDs (Issue #5535) 2019-02-27 15:35:32 -05:00
Michael R Sweet 88c131a16f Fix another compiler warning. 2019-02-25 15:12:29 -05:00
Michael R Sweet 74dece9c5a Use iterator for CRL (Issue #5532) 2019-02-25 15:09:04 -05:00
Michael R Sweet 17675b0d73 Fix compiler warning from newer GCC (Issue #5533) 2019-02-25 11:58:34 -05:00
Michael R Sweet 816b3bfd42 Media size matching now uses a tolerance of 0.5mm (rdar://33822024) 2019-02-21 12:46:09 -05:00
Michael R Sweet 1178267306 Fix typo. 2019-02-21 12:35:04 -05:00
Michael R Sweet 469b6abcd8 Rework the idle exit fix after some discussion. 2019-02-21 12:31:38 -05:00
Michael R Sweet 606cfe8cb9 The lpadmin command would hang with a bad PPD file (rdar://41495016) 2019-02-21 11:14:12 -05:00
Michael R Sweet 4c94126876 The scheduler did not always idle exit as quickly as it could... 2019-02-21 11:04:14 -05:00
Michael R Sweet 3a66aedf8a Don't stop a printer after a job is canceled/aborted (Issue #5517) 2019-02-21 10:44:23 -05:00
Michael R Sweet 534af3a30b Add a USB quirks rule for the DYMO 450 Turbo (Issue #5521) 2019-02-21 09:54:59 -05:00
Michael R Sweet f7d8c89ecc Add subject alternate names for self-signed certificates (Issue #5525) 2019-02-19 15:04:49 -05:00
Michael R Sweet 9f6cee7e3f Add USB quirks rule for Xerox printers (Issue #5523) 2019-02-19 11:11:54 -05:00
Michael R Sweet bafbb263f8 Non-Kerberized IPP printing to Windows was broken (Issue #5515) 2019-02-15 17:07:10 -05:00
Michael R Sweet 019198b76b Missing printer-uri when enabling printer (mirror fix from master). 2019-02-15 17:04:53 -05:00
Michael R Sweet 324a11611a Fix a GNU TLS certificate problem (Issue #5506) 2019-02-05 13:04:13 -05:00
Michael R Sweet 949c21788d Fix UTF-8 validation (Issue #5509) 2019-02-05 12:03:10 -05:00
Michael R Sweet b1648391cb Updated the USB quirks rule for Zebra label printers (Issue #5395)
Now all Zebra label printers use unidir and no-reattach.
2019-01-23 11:15:29 -05:00
Michael R Sweet ddcb034a2b Clean out some more _cupsStr cruft that might potentially cause an unaligned memory access (Issue #5474)
Don't directly use the string pool in the CGI programs or scheduler.
2019-01-21 16:08:16 -05:00
Michael R Sweet 6844678902 Fix potential unaligned accesses in the string pool (Issue #5474)
This set of changes makes the PPD functions use strdup and free - they were
modifying the contents of the string in places and doing other things that
were not safe for (immutable) strings in the pool.
2019-01-21 14:21:57 -05:00
Michael R Sweet 558bba72fe Stop parsing the Emulators keywords in PPD files (Issue #5475)
This also addresses a potential memory leak...
2019-01-21 13:44:43 -05:00
Michael R Sweet 6cf21c3b87 Switch to using "all" and "media-col-database" because some vendors apparently
do not know how to read (Issue #5484)
2019-01-21 12:02:19 -05:00
Michael R Sweet 328d863971 Fix compile error on Linux (Issue #5483) 2019-01-21 11:54:58 -05:00
Michael R Sweet 907afa29b7 Add a USB quirk rule for the Lexmark E120n (Issue #5478) 2019-01-21 11:32:42 -05:00
Michael R Sweet f3693bb315 Use the same requested-attributes values for all IPP Everywhere setup
requests (Issue #5484)
2019-01-21 11:28:24 -05:00
Michael R Sweet bad9fef486 Fix a performance regression with large PPDs (rdar://47040759)
Changes mirrored from master...
2019-01-10 17:15:47 -05:00
Michael R Sweet 21cbc2f292 Allow ippSetXxx from no-value and unknown to corresponding type. 2019-01-10 11:54:15 -05:00
Michael R Sweet 18518f3b94 Protect against continuing to read from a file at EOF (Issue #5473) 2019-01-09 13:26:37 -05:00
Michael R Sweet ddaef0f518 Fix potential crash in cups-driverd (rdar://46625579) 2018-12-14 14:29:57 -05:00
Michael R Sweet b7724e9966 Bump version. 2018-12-10 09:21:03 -05:00
Michael R Sweet f7d4caccaf Fix ppdmerge backup filename (Issue #5455) 2018-12-10 09:19:57 -05:00
36 arquivos alterados com 625 adições e 627 exclusões
+37 -1
Ver Arquivo
@@ -1,7 +1,43 @@
CHANGES - 2.2.10 - 2018-12-07
CHANGES - 2.2.11 - 2019-03-22
=============================
Changes in CUPS v2.2.11
-----------------------
- Running ppdmerge with the same input and output filenames did not work as
advertised (Issue #5455)
- Fixed a potential memory leak when reading at the end of a file (Issue #5473)
- Fixed potential unaligned accesses in the string pool (Issue #5474)
- Fixed a potential memory leak when loading a PPD file (Issue #5475)
- Added a USB quirks rule for the Lexmark E120n (Issue #5478)
- Updated the USB quirks rule for Zebra label printers (Issue #5395)
- Fixed a compile error on Linux (Issue #5483)
- The lpadmin command, web interface, and scheduler all queried an IPP
Everywhere printer differently, resulting in different PPDs for the same
printer (Issue #5484)
- Fixed an issue with the self-signed certificates generated by GNU TLS
(Issue #5506)
- The `ippValidateAttribute` function did not catch all instances of invalid
UTF-8 strings (Issue #5509)
- Non-Kerberized printing to Windows via IPP was broken (Issue #5515)
- The scheduler no longer stops a printer if an error occurs when a job is
canceled or aborted (Issue #5517)
- Added a USB quirks rule for the DYMO 450 Turbo (Issue #5521)
- Added a USB quirks rule for Xerox printers (Issue #5523)
- The scheduler's self-signed certificate did not include all of the alternate
names for the server when using GNU TLS (Issue #5525)
- Fixed compiler warnings with newer versions of GCC (Issue #5532, Issue #5533)
- Fixed some PPD caching and IPP Everywhere PPD accounting/password bugs
(Issue #5535)
- Fixed `PreserveJobHistory` bug with time values (Issue #5538)
- Media size matching now uses a tolerance of 0.5mm (rdar://33822024)
- The lpadmin command would hang with a bad PPD file (rdar://41495016)
- Fixed a potential crash bug in cups-driverd (rdar://46625579)
- Fixed a performance regression with large PPDs (rdar://47040759)
- The scheduler did not always idle exit as quickly as it could.
Changes in CUPS v2.2.10
-----------------------
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
INSTALL - CUPS v2.2.10 - 2018-12-07
INSTALL - CUPS v2.2.11 - 2019-03-22
===================================
This file describes how to compile and install CUPS from source code. For more
+2 -2
Ver Arquivo
@@ -1,4 +1,4 @@
README - CUPS v2.2.10 - 2018-12-07
README - CUPS v2.2.11 - 2019-03-22
==================================
Looking for compile instructions? Read the file `INSTALL.md` instead...
@@ -148,7 +148,7 @@ This will prevent the filters from misinterpreting your print file.
LEGAL STUFF
-----------
CUPS is copyright © 2007-2018 by Apple Inc. CUPS and the CUPS logo are
CUPS is copyright © 2007-2019 by Apple Inc. CUPS and the CUPS logo are
trademarks of Apple Inc.
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
+3 -2
Ver Arquivo
@@ -2217,8 +2217,9 @@ main(int argc, /* I - Number of command-line args */
else if (ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_AUTHORIZATION_FAILED)
fputs("JOBSTATE: account-authorization-failed\n", stderr);
if (ipp_status == IPP_STATUS_ERROR_NOT_AUTHORIZED || ipp_status == IPP_STATUS_ERROR_FORBIDDEN ||
ipp_status == IPP_STATUS_ERROR_CUPS_AUTHENTICATION_CANCELED)
if (job_canceled)
return (CUPS_BACKEND_OK);
else if (ipp_status == IPP_STATUS_ERROR_NOT_AUTHORIZED || ipp_status == IPP_STATUS_ERROR_FORBIDDEN || ipp_status == IPP_STATUS_ERROR_CUPS_AUTHENTICATION_CANCELED)
return (CUPS_BACKEND_AUTH_REQUIRED);
else if (ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_LIMIT_REACHED ||
ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_INFO_NEEDED ||
+10 -4
Ver Arquivo
@@ -140,8 +140,8 @@
# Samsung ML-2160 Series (https://bugzilla.redhat.com/show_bug.cgi?id=873123)
0x04e8 0x330f unidir
# All Zebra devices (https://bugs.launchpad.net/bugs/1001028)
0x0a5f unidir
# All Zebra devices (https://bugs.launchpad.net/bugs/1001028) (Issue #5395)
0x0a5f unidir no-reattach
# Canon CP-10
0x04a9 0x304a blacklist
@@ -291,5 +291,11 @@
# Star TSP743 (Issue #5443)
0x0519 0x0001 delay-close
# Zebra ZD420 (Issue #5395)
0x0a5f 0x0120 unidir no-reattach
# Lexmark E120n (Issue #5478)
0x043d 0x00cc no-reattach
# All Xerox printers (Issue #5523)
0x0924 no-reattach
# Dymo 450 Turbo (Issue #5521)
0x0922 0x0021 unidir
+14 -8
Ver Arquivo
@@ -1,8 +1,8 @@
/*
* Administration CGI for CUPS.
*
* Copyright 2007-2018 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
* Copyright © 2007-2019 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -767,7 +767,7 @@ do_am_class(http_t *http, /* I - HTTP connection */
attr = ippAddStrings(request, IPP_TAG_PRINTER, IPP_TAG_URI, "member-uris",
num_printers, NULL, NULL);
for (i = 0; i < num_printers; i ++)
attr->values[i].string.text = _cupsStrAlloc(cgiGetArray("MEMBER_URIS", i));
ippSetString(request, &attr, i, cgiGetArray("MEMBER_URIS", i));
}
/*
@@ -2413,7 +2413,7 @@ do_list_printers(http_t *http) /* I - HTTP connection */
attr;
attr = ippFindNextAttribute(response, "device-uri", IPP_TAG_URI))
{
cupsArrayAdd(printer_devices, _cupsStrAlloc(attr->values[0].string.text));
cupsArrayAdd(printer_devices, strdup(attr->values[0].string.text));
}
/*
@@ -2551,7 +2551,7 @@ do_list_printers(http_t *http) /* I - HTTP connection */
for (printer_device = (char *)cupsArrayFirst(printer_devices);
printer_device;
printer_device = (char *)cupsArrayNext(printer_devices))
_cupsStrFree(printer_device);
free(printer_device);
cupsArrayDelete(printer_devices);
}
@@ -2948,7 +2948,7 @@ do_set_allowed_users(http_t *http) /* I - HTTP connection */
* Add the name...
*/
attr->values[i].string.text = _cupsStrAlloc(ptr);
ippSetString(request, &attr, i, ptr);
/*
* Advance to the next name...
@@ -3757,8 +3757,8 @@ do_set_options(http_t *http, /* I - HTTP connection */
attr = ippAddStrings(request, IPP_TAG_PRINTER, IPP_TAG_NAME,
"job-sheets-default", 2, NULL, NULL);
attr->values[0].string.text = _cupsStrAlloc(cgiGetVariable("job_sheets_start"));
attr->values[1].string.text = _cupsStrAlloc(cgiGetVariable("job_sheets_end"));
ippSetString(request, &attr, 0, cgiGetVariable("job_sheets_start"));
ippSetString(request, &attr, 1, cgiGetVariable("job_sheets_end"));
if ((var = cgiGetVariable("printer_error_policy")) != NULL)
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME,
@@ -4220,6 +4220,11 @@ get_printer_ppd(const char *uri, /* I - Printer URI */
host[256], /* Hostname */
resource[256]; /* Resource path */
int port; /* Port number */
static const char * const pattrs[] = /* Printer attributes we need */
{
"all",
"media-col-database"
};
/*
@@ -4260,6 +4265,7 @@ get_printer_ppd(const char *uri, /* I - Printer URI */
request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", (int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
response = cupsDoRequest(http, request, resource);
if (!_ppdCreateFromIPP(buffer, bufsize, response))
+20 -22
Ver Arquivo
@@ -1,8 +1,8 @@
/*
* CGI form variable and array functions for CUPS.
*
* Copyright 2007-2015 by Apple Inc.
* Copyright 1997-2005 by Easy Software Products.
* Copyright © 2007-2019 by Apple Inc.
* Copyright © 1997-2005 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -33,10 +33,10 @@
typedef struct /**** Form variable structure ****/
{
const char *name; /* Name of variable */
char *name; /* Name of variable */
int nvalues, /* Number of values */
avalues; /* Number of values allocated */
const char **values; /* Value(s) of variable */
char **values; /* Value(s) of variable */
} _cgi_var_t;
@@ -139,10 +139,10 @@ cgiClearVariables(void)
for (v = form_vars, i = form_count; i > 0; v ++, i --)
{
_cupsStrFree(v->name);
free(v->name);
for (j = 0; j < v->nvalues; j ++)
if (v->values[j])
_cupsStrFree(v->values[j]);
free(v->values[j]);
}
form_count = 0;
@@ -168,7 +168,7 @@ cgiGetArray(const char *name, /* I - Name of array variable */
if (element < 0 || element >= var->nvalues)
return (NULL);
return (_cupsStrRetain(var->values[element]));
return (strdup(var->values[element]));
}
@@ -234,7 +234,7 @@ cgiGetVariable(const char *name) /* I - Name of variable */
var->values[var->nvalues - 1]));
#endif /* DEBUG */
return ((var == NULL) ? NULL : _cupsStrRetain(var->values[var->nvalues - 1]));
return ((var == NULL) ? NULL : strdup(var->values[var->nvalues - 1]));
}
@@ -382,10 +382,9 @@ cgiSetArray(const char *name, /* I - Name of variable */
{
if (element >= var->avalues)
{
const char **temp; /* Temporary pointer */
char **temp; /* Temporary pointer */
temp = (const char **)realloc((void *)(var->values),
sizeof(char *) * (size_t)(element + 16));
temp = (char **)realloc((void *)(var->values), sizeof(char *) * (size_t)(element + 16));
if (!temp)
return;
@@ -401,9 +400,9 @@ cgiSetArray(const char *name, /* I - Name of variable */
var->nvalues = element + 1;
}
else if (var->values[element])
_cupsStrFree((char *)var->values[element]);
free((char *)var->values[element]);
var->values[element] = _cupsStrAlloc(value);
var->values[element] = strdup(value);
}
}
@@ -460,10 +459,9 @@ cgiSetSize(const char *name, /* I - Name of variable */
if (size >= var->avalues)
{
const char **temp; /* Temporary pointer */
char **temp; /* Temporary pointer */
temp = (const char **)realloc((void *)(var->values),
sizeof(char *) * (size_t)(size + 16));
temp = (char **)realloc((void *)(var->values), sizeof(char *) * (size_t)(size + 16));
if (!temp)
return;
@@ -480,7 +478,7 @@ cgiSetSize(const char *name, /* I - Name of variable */
{
for (i = size; i < var->nvalues; i ++)
if (var->values[i])
_cupsStrFree((void *)(var->values[i]));
free((void *)(var->values[i]));
}
var->nvalues = size;
@@ -515,9 +513,9 @@ cgiSetVariable(const char *name, /* I - Name of variable */
{
for (i = 0; i < var->nvalues; i ++)
if (var->values[i])
_cupsStrFree((char *)var->values[i]);
free((char *)var->values[i]);
var->values[0] = _cupsStrAlloc(value);
var->values[0] = strdup(value);
var->nvalues = 1;
}
}
@@ -563,10 +561,10 @@ cgi_add_variable(const char *name, /* I - Variable name */
if ((var->values = calloc((size_t)element + 1, sizeof(char *))) == NULL)
return;
var->name = _cupsStrAlloc(name);
var->name = strdup(name);
var->nvalues = element + 1;
var->avalues = element + 1;
var->values[element] = _cupsStrAlloc(value);
var->values[element] = strdup(value);
form_count ++;
}
@@ -598,7 +596,7 @@ cgi_find_variable(const char *name) /* I - Name of variable */
if (form_count < 1 || name == NULL)
return (NULL);
key.name = name;
key.name = (char *)name;
return ((_cgi_var_t *)bsearch(&key, form_vars, (size_t)form_count, sizeof(_cgi_var_t),
(int (*)(const void *, const void *))cgi_compare_variables));
externo
+10 -10
Ver Arquivo
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for CUPS 2.2.10.
# Generated by GNU Autoconf 2.69 for CUPS 2.2.11.
#
# Report bugs to <https://github.com/apple/cups/issues>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='CUPS'
PACKAGE_TARNAME='cups'
PACKAGE_VERSION='2.2.10'
PACKAGE_STRING='CUPS 2.2.10'
PACKAGE_VERSION='2.2.11'
PACKAGE_STRING='CUPS 2.2.11'
PACKAGE_BUGREPORT='https://github.com/apple/cups/issues'
PACKAGE_URL='https://www.cups.org/'
@@ -1480,7 +1480,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.2.10 to adapt to many kinds of systems.
\`configure' configures CUPS 2.2.11 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1545,7 +1545,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of CUPS 2.2.10:";;
short | recursive ) echo "Configuration of CUPS 2.2.11:";;
esac
cat <<\_ACEOF
@@ -1726,7 +1726,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
CUPS configure 2.2.10
CUPS configure 2.2.11
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2190,7 +2190,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.2.10, which was
It was created by CUPS $as_me 2.2.11, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2711,7 +2711,7 @@ done
ac_config_headers="$ac_config_headers config.h"
CUPS_VERSION="2.2.10"
CUPS_VERSION="2.2.11"
CUPS_REVISION=""
CUPS_BUILD="cups-$CUPS_VERSION"
@@ -10832,7 +10832,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.2.10, which was
This file was extended by CUPS $as_me 2.2.11, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -10895,7 +10895,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.2.10
CUPS config.status 2.2.11
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
+1 -1
Ver Arquivo
@@ -15,7 +15,7 @@ dnl We need at least autoconf 2.60...
AC_PREREQ(2.60)
dnl Package name and version...
AC_INIT([CUPS], [2.2.10], [https://github.com/apple/cups/issues], [cups], [https://www.cups.org/])
AC_INIT([CUPS], [2.2.11], [https://github.com/apple/cups/issues], [cups], [https://www.cups.org/])
sinclude(config-scripts/cups-opsys.m4)
sinclude(config-scripts/cups-common.m4)
+54 -18
Ver Arquivo
@@ -52,6 +52,9 @@ static const char *cups_auth_param(const char *scheme, const char *name, char *v
static const char *cups_auth_scheme(const char *www_authenticate, char *scheme, size_t schemesize);
#ifdef HAVE_GSSAPI
# define CUPS_GSS_OK 0 /* Successfully set credentials */
# define CUPS_GSS_NONE -1 /* No credentials */
# define CUPS_GSS_FAIL -2 /* Failed credentials/authentication */
# ifdef HAVE_GSS_ACQUIRE_CRED_EX_F
# ifdef HAVE_GSS_GSSAPI_SPI_H
# include <GSS/gssapi_spi.h>
@@ -178,6 +181,8 @@ cupsDoAuthentication(
* Check the scheme name...
*/
DEBUG_printf(("2cupsDoAuthentication: Trying scheme \"%s\"...", scheme));
#ifdef HAVE_GSSAPI
if (!_cups_strcasecmp(scheme, "Negotiate"))
{
@@ -185,18 +190,36 @@ cupsDoAuthentication(
* Kerberos authentication...
*/
if (_cupsSetNegotiateAuthString(http, method, resource))
int gss_status; /* Auth status */
if ((gss_status = _cupsSetNegotiateAuthString(http, method, resource)) == CUPS_GSS_FAIL)
{
DEBUG_puts("1cupsDoAuthentication: Negotiate failed.");
http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
return (-1);
}
break;
else if (gss_status == CUPS_GSS_NONE)
{
DEBUG_puts("2cupsDoAuthentication: No credentials for Negotiate.");
continue;
}
else
{
DEBUG_puts("2cupsDoAuthentication: Using Negotiate.");
break;
}
}
else
#endif /* HAVE_GSSAPI */
if (_cups_strcasecmp(scheme, "Basic") && _cups_strcasecmp(scheme, "Digest"))
continue; /* Not supported (yet) */
{
/*
* Other schemes not yet supported...
*/
DEBUG_printf(("2cupsDoAuthentication: Scheme \"%s\" not yet supported.", scheme));
continue;
}
/*
* See if we should retry the current username:password...
@@ -226,6 +249,7 @@ cupsDoAuthentication(
if ((password = cupsGetPassword2(prompt, http, method, resource)) == NULL)
{
DEBUG_puts("1cupsDoAuthentication: User canceled password request.");
http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
return (-1);
}
@@ -255,6 +279,7 @@ cupsDoAuthentication(
char encode[256]; /* Base64 buffer */
DEBUG_puts("2cupsDoAuthentication: Using Basic.");
httpEncode64_2(encode, sizeof(encode), http->userpass, (int)strlen(http->userpass));
httpSetAuthString(http, "Basic", encode);
break;
@@ -273,19 +298,22 @@ cupsDoAuthentication(
cups_auth_param(schemedata, "realm", http->realm, sizeof(http->realm));
if (_httpSetDigestAuthString(http, nonce, method, resource))
{
DEBUG_puts("2cupsDoAuthentication: Using Basic.");
break;
}
}
}
if (http->authstring)
{
DEBUG_printf(("1cupsDoAuthentication: authstring=\"%s\"", http->authstring));
DEBUG_printf(("1cupsDoAuthentication: authstring=\"%s\".", http->authstring));
return (0);
}
else
{
DEBUG_printf(("1cupsDoAuthentication: Unknown auth type: \"%s\"", www_auth));
DEBUG_puts("1cupsDoAuthentication: No supported schemes.");
http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
return (-1);
@@ -298,7 +326,7 @@ cupsDoAuthentication(
* '_cupsSetNegotiateAuthString()' - Set the Kerberos authentication string.
*/
int /* O - 0 on success, -1 on error */
int /* O - 0 on success, negative on error */
_cupsSetNegotiateAuthString(
http_t *http, /* I - Connection to server */
const char *method, /* I - Request method ("GET", "POST", "PUT") */
@@ -323,10 +351,16 @@ _cupsSetNegotiateAuthString(
{
DEBUG_puts("1_cupsSetNegotiateAuthString: Weak-linked GSSAPI/Kerberos "
"framework is not present");
return (-1);
return (CUPS_GSS_NONE);
}
# endif /* __APPLE__ */
if (!strcmp(http->hostname, "localhost") || http->hostname[0] == '/' || isdigit(http->hostname[0] & 255) || !strchr(http->hostname, '.'))
{
DEBUG_printf(("1_cupsSetNegotiateAuthString: Kerberos not available for host \"%s\".", http->hostname));
return (CUPS_GSS_NONE);
}
if (http->gssname == GSS_C_NO_NAME)
{
http->gssname = cups_gss_getname(http, _cupsGSSServiceName());
@@ -371,7 +405,7 @@ _cupsSetNegotiateAuthString(
cupsUser(), http->gsshost);
if ((password = cupsGetPassword2(prompt, http, method, resource)) == NULL)
return (-1);
return (CUPS_GSS_FAIL);
/*
* Try to acquire credentials...
@@ -425,18 +459,20 @@ _cupsSetNegotiateAuthString(
}
# endif /* HAVE_GSS_ACQUIRED_CRED_EX_F */
if (GSS_ERROR(major_status))
if (major_status == GSS_S_NO_CRED)
{
cups_gss_printf(major_status, minor_status,
"_cupsSetNegotiateAuthString: Unable to initialize "
"security context");
return (-1);
cups_gss_printf(major_status, minor_status, "_cupsSetNegotiateAuthString: No credentials");
return (CUPS_GSS_NONE);
}
else if (GSS_ERROR(major_status))
{
cups_gss_printf(major_status, minor_status, "_cupsSetNegotiateAuthString: Unable to initialize security context");
return (CUPS_GSS_FAIL);
}
# ifdef DEBUG
else if (major_status == GSS_S_CONTINUE_NEEDED)
cups_gss_printf(major_status, minor_status,
"_cupsSetNegotiateAuthString: Continuation needed!");
cups_gss_printf(major_status, minor_status, "_cupsSetNegotiateAuthString: Continuation needed");
# endif /* DEBUG */
if (output_token.length > 0 && output_token.length <= 65536)
@@ -470,10 +506,10 @@ _cupsSetNegotiateAuthString(
"large - %d bytes!", (int)output_token.length));
gss_release_buffer(&minor_status, &output_token);
return (-1);
return (CUPS_GSS_FAIL);
}
return (0);
return (CUPS_GSS_OK);
}
#endif /* HAVE_GSSAPI */
+2 -2
Ver Arquivo
@@ -47,10 +47,10 @@ extern "C" {
* Constants...
*/
# define CUPS_VERSION 2.0210
# define CUPS_VERSION 2.0211
# define CUPS_VERSION_MAJOR 2
# define CUPS_VERSION_MINOR 2
# define CUPS_VERSION_PATCH 10
# define CUPS_VERSION_PATCH 11
# define CUPS_BC_FD 3
/* Back-channel file descriptor for
+12
Ver Arquivo
@@ -679,6 +679,12 @@ cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
return (-1);
}
if (fp->eof)
{
DEBUG_puts("5cupsFileGetChar: End-of-file!");
return (-1);
}
/*
* If the input buffer is empty, try to read more data...
*/
@@ -1651,6 +1657,12 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
if (bytes == 0)
return (0);
if (fp->eof)
{
DEBUG_puts("5cupsFileRead: End-of-file!");
return (-1);
}
/*
* Loop until all bytes are read...
*/
+2 -2
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* Hashing function for CUPS.
*
* Copyright © 2015-2018 by Apple Inc.
* Copyright © 2015-2019 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -235,7 +235,7 @@ cupsHashData(const char *algorithm, /* I - Algorithm name */
gnutls_hash_fast(alg, data, datalen, hash);
return (gnutls_hash_get_len(alg));
return ((ssize_t)gnutls_hash_get_len(alg));
}
#else
+40 -52
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* Internet Printing Protocol functions for CUPS.
*
* Copyright © 2007-2018 by Apple Inc.
* Copyright © 2007-2019 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -3752,8 +3752,7 @@ ippSetDate(ipp_t *ipp, /* I - IPP message */
* Range check input...
*/
if (!ipp || !attr || !*attr || (*attr)->value_tag != IPP_TAG_DATE ||
element < 0 || element > (*attr)->num_values || !datevalue)
if (!ipp || !attr || !*attr || ((*attr)->value_tag != IPP_TAG_DATE && (*attr)->value_tag != IPP_TAG_NOVALUE && (*attr)->value_tag != IPP_TAG_UNKNOWN) || element < 0 || element > (*attr)->num_values || !datevalue)
return (0);
/*
@@ -3836,9 +3835,7 @@ ippSetInteger(ipp_t *ipp, /* I - IPP message */
* Range check input...
*/
if (!ipp || !attr || !*attr ||
((*attr)->value_tag != IPP_TAG_INTEGER && (*attr)->value_tag != IPP_TAG_ENUM) ||
element < 0 || element > (*attr)->num_values)
if (!ipp || !attr || !*attr || ((*attr)->value_tag != IPP_TAG_INTEGER && (*attr)->value_tag != IPP_TAG_ENUM && (*attr)->value_tag != IPP_TAG_NOVALUE && (*attr)->value_tag != IPP_TAG_UNKNOWN) || element < 0 || element > (*attr)->num_values)
return (0);
/*
@@ -3846,7 +3843,12 @@ ippSetInteger(ipp_t *ipp, /* I - IPP message */
*/
if ((value = ipp_set_value(ipp, attr, element)) != NULL)
{
if ((*attr)->value_tag != IPP_TAG_ENUM)
(*attr)->value_tag = IPP_TAG_INTEGER;
value->integer = intvalue;
}
return (value != NULL);
}
@@ -3923,9 +3925,7 @@ ippSetOctetString(
* Range check input...
*/
if (!ipp || !attr || !*attr || (*attr)->value_tag != IPP_TAG_STRING ||
element < 0 || element > (*attr)->num_values ||
datalen < 0 || datalen > IPP_MAX_LENGTH)
if (!ipp || !attr || !*attr || ((*attr)->value_tag != IPP_TAG_STRING && (*attr)->value_tag != IPP_TAG_NOVALUE && (*attr)->value_tag != IPP_TAG_UNKNOWN) || element < 0 || element > (*attr)->num_values || datalen < 0 || datalen > IPP_MAX_LENGTH)
return (0);
/*
@@ -3949,6 +3949,8 @@ ippSetOctetString(
* Copy the data...
*/
(*attr)->value_tag = IPP_TAG_STRING;
if (value->unknown.data)
{
/*
@@ -4040,8 +4042,7 @@ ippSetRange(ipp_t *ipp, /* I - IPP message */
* Range check input...
*/
if (!ipp || !attr || !*attr || (*attr)->value_tag != IPP_TAG_RANGE ||
element < 0 || element > (*attr)->num_values || lowervalue > uppervalue)
if (!ipp || !attr || !*attr || ((*attr)->value_tag != IPP_TAG_RANGE && (*attr)->value_tag != IPP_TAG_NOVALUE && (*attr)->value_tag != IPP_TAG_UNKNOWN) || element < 0 || element > (*attr)->num_values || lowervalue > uppervalue)
return (0);
/*
@@ -4050,6 +4051,7 @@ ippSetRange(ipp_t *ipp, /* I - IPP message */
if ((value = ipp_set_value(ipp, attr, element)) != NULL)
{
(*attr)->value_tag = IPP_TAG_RANGE;
value->range.lower = lowervalue;
value->range.upper = uppervalue;
}
@@ -4122,9 +4124,7 @@ ippSetResolution(
* Range check input...
*/
if (!ipp || !attr || !*attr || (*attr)->value_tag != IPP_TAG_RESOLUTION ||
element < 0 || element > (*attr)->num_values || xresvalue <= 0 || yresvalue <= 0 ||
unitsvalue < IPP_RES_PER_INCH || unitsvalue > IPP_RES_PER_CM)
if (!ipp || !attr || !*attr || ((*attr)->value_tag != IPP_TAG_RESOLUTION && (*attr)->value_tag != IPP_TAG_NOVALUE && (*attr)->value_tag != IPP_TAG_UNKNOWN) || element < 0 || element > (*attr)->num_values || xresvalue <= 0 || yresvalue <= 0 || unitsvalue < IPP_RES_PER_INCH || unitsvalue > IPP_RES_PER_CM)
return (0);
/*
@@ -4133,6 +4133,7 @@ ippSetResolution(
if ((value = ipp_set_value(ipp, attr, element)) != NULL)
{
(*attr)->value_tag = IPP_TAG_RESOLUTION;
value->resolution.units = unitsvalue;
value->resolution.xres = xresvalue;
value->resolution.yres = yresvalue;
@@ -4234,10 +4235,7 @@ ippSetString(ipp_t *ipp, /* I - IPP message */
else
value_tag = IPP_TAG_ZERO;
if (!ipp || !attr || !*attr ||
(value_tag < IPP_TAG_TEXT && value_tag != IPP_TAG_TEXTLANG &&
value_tag != IPP_TAG_NAMELANG) || value_tag > IPP_TAG_MIMETYPE ||
element < 0 || element > (*attr)->num_values || !strvalue)
if (!ipp || !attr || !*attr || (value_tag < IPP_TAG_TEXT && value_tag != IPP_TAG_TEXTLANG && value_tag != IPP_TAG_NAMELANG && value_tag != IPP_TAG_NOVALUE && value_tag != IPP_TAG_UNKNOWN) || value_tag > IPP_TAG_MIMETYPE || element < 0 || element > (*attr)->num_values || !strvalue)
return (0);
/*
@@ -4246,6 +4244,9 @@ ippSetString(ipp_t *ipp, /* I - IPP message */
if ((value = ipp_set_value(ipp, attr, element)) != NULL)
{
if (value_tag == IPP_TAG_NOVALUE || value_tag == IPP_TAG_UNKNOWN)
(*attr)->value_tag = IPP_TAG_KEYWORD;
if (element > 0)
value->string.language = (*attr)->values[0].string.language;
@@ -4346,10 +4347,7 @@ ippSetStringfv(ipp_t *ipp, /* I - IPP message */
else
value_tag = IPP_TAG_ZERO;
if (!ipp || !attr || !*attr ||
(value_tag < IPP_TAG_TEXT && value_tag != IPP_TAG_TEXTLANG &&
value_tag != IPP_TAG_NAMELANG) || value_tag > IPP_TAG_MIMETYPE ||
!format)
if (!ipp || !attr || !*attr || (value_tag < IPP_TAG_TEXT && value_tag != IPP_TAG_TEXTLANG && value_tag != IPP_TAG_NAMELANG && value_tag != IPP_TAG_NOVALUE && value_tag != IPP_TAG_UNKNOWN) || value_tag > IPP_TAG_MIMETYPE || !format)
return (0);
/*
@@ -4401,6 +4399,8 @@ ippSetStringfv(ipp_t *ipp, /* I - IPP message */
max_bytes = IPP_MAX_CHARSET;
break;
case IPP_TAG_NOVALUE :
case IPP_TAG_UNKNOWN :
case IPP_TAG_KEYWORD :
max_bytes = IPP_MAX_KEYWORD;
break;
@@ -4975,30 +4975,24 @@ ippValidateAttribute(
{
if ((*ptr & 0xe0) == 0xc0)
{
ptr ++;
if ((*ptr & 0xc0) != 0x80)
if ((ptr[1] & 0xc0) != 0x80)
break;
ptr ++;
}
else if ((*ptr & 0xf0) == 0xe0)
{
ptr ++;
if ((*ptr & 0xc0) != 0x80)
break;
ptr ++;
if ((*ptr & 0xc0) != 0x80)
if ((ptr[1] & 0xc0) != 0x80 || (ptr[2] & 0xc0) != 0x80)
break;
ptr += 2;
}
else if ((*ptr & 0xf8) == 0xf0)
{
ptr ++;
if ((*ptr & 0xc0) != 0x80)
break;
ptr ++;
if ((*ptr & 0xc0) != 0x80)
break;
ptr ++;
if ((*ptr & 0xc0) != 0x80)
if ((ptr[1] & 0xc0) != 0x80 || (ptr[2] & 0xc0) != 0x80 || (ptr[3] & 0xc0) != 0x80)
break;
ptr += 3;
}
else if (*ptr & 0x80)
break;
@@ -5040,30 +5034,24 @@ ippValidateAttribute(
{
if ((*ptr & 0xe0) == 0xc0)
{
ptr ++;
if ((*ptr & 0xc0) != 0x80)
if ((ptr[1] & 0xc0) != 0x80)
break;
ptr ++;
}
else if ((*ptr & 0xf0) == 0xe0)
{
ptr ++;
if ((*ptr & 0xc0) != 0x80)
break;
ptr ++;
if ((*ptr & 0xc0) != 0x80)
if ((ptr[1] & 0xc0) != 0x80 || (ptr[2] & 0xc0) != 0x80)
break;
ptr += 2;
}
else if ((*ptr & 0xf8) == 0xf0)
{
ptr ++;
if ((*ptr & 0xc0) != 0x80)
break;
ptr ++;
if ((*ptr & 0xc0) != 0x80)
break;
ptr ++;
if ((*ptr & 0xc0) != 0x80)
if ((ptr[1] & 0xc0) != 0x80 || (ptr[2] & 0xc0) != 0x80 || (ptr[3] & 0xc0) != 0x80)
break;
ptr += 3;
}
else if (*ptr & 0x80)
break;
+79 -79
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* PPD cache implementation for CUPS.
*
* Copyright © 2010-2018 by Apple Inc.
* Copyright © 2010-2019 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -508,24 +508,20 @@ _ppdCacheCreateWithFile(
else if (!_cups_strcasecmp(line, "Filter"))
{
if (!pc->filters)
pc->filters = cupsArrayNew3(NULL, NULL, NULL, 0,
(cups_acopy_func_t)_cupsStrAlloc,
(cups_afree_func_t)_cupsStrFree);
pc->filters = cupsArrayNew3(NULL, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free);
cupsArrayAdd(pc->filters, value);
}
else if (!_cups_strcasecmp(line, "PreFilter"))
{
if (!pc->prefilters)
pc->prefilters = cupsArrayNew3(NULL, NULL, NULL, 0,
(cups_acopy_func_t)_cupsStrAlloc,
(cups_afree_func_t)_cupsStrFree);
pc->prefilters = cupsArrayNew3(NULL, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free);
cupsArrayAdd(pc->prefilters, value);
}
else if (!_cups_strcasecmp(line, "Product"))
{
pc->product = _cupsStrAlloc(value);
pc->product = strdup(value);
}
else if (!_cups_strcasecmp(line, "SingleFile"))
{
@@ -625,8 +621,8 @@ _ppdCacheCreateWithFile(
}
map = pc->bins + pc->num_bins;
map->pwg = _cupsStrAlloc(pwg_keyword);
map->ppd = _cupsStrAlloc(ppd_keyword);
map->pwg = strdup(pwg_keyword);
map->ppd = strdup(ppd_keyword);
pc->num_bins ++;
}
@@ -680,8 +676,8 @@ _ppdCacheCreateWithFile(
goto create_error;
}
size->map.pwg = _cupsStrAlloc(pwg_keyword);
size->map.ppd = _cupsStrAlloc(ppd_keyword);
size->map.pwg = strdup(pwg_keyword);
size->map.ppd = strdup(ppd_keyword);
pc->num_sizes ++;
}
@@ -709,15 +705,15 @@ _ppdCacheCreateWithFile(
pwgFormatSizeName(pwg_keyword, sizeof(pwg_keyword), "custom", "max",
pc->custom_max_width, pc->custom_max_length, NULL);
pc->custom_max_keyword = _cupsStrAlloc(pwg_keyword);
pc->custom_max_keyword = strdup(pwg_keyword);
pwgFormatSizeName(pwg_keyword, sizeof(pwg_keyword), "custom", "min",
pc->custom_min_width, pc->custom_min_length, NULL);
pc->custom_min_keyword = _cupsStrAlloc(pwg_keyword);
pc->custom_min_keyword = strdup(pwg_keyword);
}
else if (!_cups_strcasecmp(line, "SourceOption"))
{
pc->source_option = _cupsStrAlloc(value);
pc->source_option = strdup(value);
}
else if (!_cups_strcasecmp(line, "NumSources"))
{
@@ -764,8 +760,8 @@ _ppdCacheCreateWithFile(
}
map = pc->sources + pc->num_sources;
map->pwg = _cupsStrAlloc(pwg_keyword);
map->ppd = _cupsStrAlloc(ppd_keyword);
map->pwg = strdup(pwg_keyword);
map->ppd = strdup(ppd_keyword);
pc->num_sources ++;
}
@@ -813,8 +809,8 @@ _ppdCacheCreateWithFile(
}
map = pc->types + pc->num_types;
map->pwg = _cupsStrAlloc(pwg_keyword);
map->ppd = _cupsStrAlloc(ppd_keyword);
map->pwg = strdup(pwg_keyword);
map->ppd = strdup(ppd_keyword);
pc->num_types ++;
}
@@ -844,13 +840,13 @@ _ppdCacheCreateWithFile(
pc->presets[print_color_mode] + print_quality);
}
else if (!_cups_strcasecmp(line, "SidesOption"))
pc->sides_option = _cupsStrAlloc(value);
pc->sides_option = strdup(value);
else if (!_cups_strcasecmp(line, "Sides1Sided"))
pc->sides_1sided = _cupsStrAlloc(value);
pc->sides_1sided = strdup(value);
else if (!_cups_strcasecmp(line, "Sides2SidedLong"))
pc->sides_2sided_long = _cupsStrAlloc(value);
pc->sides_2sided_long = strdup(value);
else if (!_cups_strcasecmp(line, "Sides2SidedShort"))
pc->sides_2sided_short = _cupsStrAlloc(value);
pc->sides_2sided_short = strdup(value);
else if (!_cups_strcasecmp(line, "Finishings"))
{
if (!pc->finishings)
@@ -871,13 +867,13 @@ _ppdCacheCreateWithFile(
else if (!_cups_strcasecmp(line, "MaxCopies"))
pc->max_copies = atoi(value);
else if (!_cups_strcasecmp(line, "ChargeInfoURI"))
pc->charge_info_uri = _cupsStrAlloc(value);
pc->charge_info_uri = strdup(value);
else if (!_cups_strcasecmp(line, "JobAccountId"))
pc->account_id = !_cups_strcasecmp(value, "true");
else if (!_cups_strcasecmp(line, "JobAccountingUserId"))
pc->accounting_user_id = !_cups_strcasecmp(value, "true");
else if (!_cups_strcasecmp(line, "JobPassword"))
pc->password = _cupsStrAlloc(value);
pc->password = strdup(value);
else if (!_cups_strcasecmp(line, "Mandatory"))
{
if (pc->mandatory)
@@ -888,9 +884,7 @@ _ppdCacheCreateWithFile(
else if (!_cups_strcasecmp(line, "SupportFile"))
{
if (!pc->support_files)
pc->support_files = cupsArrayNew3(NULL, NULL, NULL, 0,
(cups_acopy_func_t)_cupsStrAlloc,
(cups_afree_func_t)_cupsStrFree);
pc->support_files = cupsArrayNew3(NULL, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free);
cupsArrayAdd(pc->support_files, value);
}
@@ -1130,8 +1124,8 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
*/
new_size = old_size;
_cupsStrFree(old_size->map.ppd);
_cupsStrFree(old_size->map.pwg);
free(old_size->map.ppd);
free(old_size->map.pwg);
}
}
@@ -1152,8 +1146,8 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
* Save this size...
*/
new_size->map.ppd = _cupsStrAlloc(ppd_size->name);
new_size->map.pwg = _cupsStrAlloc(pwg_name);
new_size->map.ppd = strdup(ppd_size->name);
new_size->map.pwg = strdup(pwg_name);
new_size->width = new_width;
new_size->length = new_length;
new_size->left = new_left;
@@ -1173,14 +1167,14 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
pwgFormatSizeName(pwg_keyword, sizeof(pwg_keyword), "custom", "max",
PWG_FROM_POINTS(ppd->custom_max[0]),
PWG_FROM_POINTS(ppd->custom_max[1]), NULL);
pc->custom_max_keyword = _cupsStrAlloc(pwg_keyword);
pc->custom_max_keyword = strdup(pwg_keyword);
pc->custom_max_width = PWG_FROM_POINTS(ppd->custom_max[0]);
pc->custom_max_length = PWG_FROM_POINTS(ppd->custom_max[1]);
pwgFormatSizeName(pwg_keyword, sizeof(pwg_keyword), "custom", "min",
PWG_FROM_POINTS(ppd->custom_min[0]),
PWG_FROM_POINTS(ppd->custom_min[1]), NULL);
pc->custom_min_keyword = _cupsStrAlloc(pwg_keyword);
pc->custom_min_keyword = strdup(pwg_keyword);
pc->custom_min_width = PWG_FROM_POINTS(ppd->custom_min[0]);
pc->custom_min_length = PWG_FROM_POINTS(ppd->custom_min[1]);
@@ -1199,7 +1193,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
if (input_slot)
{
pc->source_option = _cupsStrAlloc(input_slot->keyword);
pc->source_option = strdup(input_slot->keyword);
if ((pc->sources = calloc((size_t)input_slot->num_choices, sizeof(pwg_map_t))) == NULL)
{
@@ -1251,8 +1245,8 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
"_");
}
map->pwg = _cupsStrAlloc(pwg_name);
map->ppd = _cupsStrAlloc(choice->choice);
map->pwg = strdup(pwg_name);
map->ppd = strdup(choice->choice);
}
}
@@ -1315,8 +1309,8 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
"_");
}
map->pwg = _cupsStrAlloc(pwg_name);
map->ppd = _cupsStrAlloc(choice->choice);
map->pwg = strdup(pwg_name);
map->ppd = strdup(choice->choice);
}
}
@@ -1342,8 +1336,8 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
{
pwg_unppdize_name(choice->choice, pwg_keyword, sizeof(pwg_keyword), "_");
map->pwg = _cupsStrAlloc(pwg_keyword);
map->ppd = _cupsStrAlloc(choice->choice);
map->pwg = strdup(pwg_keyword);
map->ppd = strdup(choice->choice);
}
}
@@ -1558,7 +1552,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
if (duplex)
{
pc->sides_option = _cupsStrAlloc(duplex->keyword);
pc->sides_option = strdup(duplex->keyword);
for (i = duplex->num_choices, choice = duplex->choices;
i > 0;
@@ -1566,16 +1560,16 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
{
if ((!_cups_strcasecmp(choice->choice, "None") ||
!_cups_strcasecmp(choice->choice, "False")) && !pc->sides_1sided)
pc->sides_1sided = _cupsStrAlloc(choice->choice);
pc->sides_1sided = strdup(choice->choice);
else if ((!_cups_strcasecmp(choice->choice, "DuplexNoTumble") ||
!_cups_strcasecmp(choice->choice, "LongEdge") ||
!_cups_strcasecmp(choice->choice, "Top")) && !pc->sides_2sided_long)
pc->sides_2sided_long = _cupsStrAlloc(choice->choice);
pc->sides_2sided_long = strdup(choice->choice);
else if ((!_cups_strcasecmp(choice->choice, "DuplexTumble") ||
!_cups_strcasecmp(choice->choice, "ShortEdge") ||
!_cups_strcasecmp(choice->choice, "Bottom")) &&
!pc->sides_2sided_short)
pc->sides_2sided_short = _cupsStrAlloc(choice->choice);
pc->sides_2sided_short = strdup(choice->choice);
}
}
@@ -1583,9 +1577,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
* Copy filters and pre-filters...
*/
pc->filters = cupsArrayNew3(NULL, NULL, NULL, 0,
(cups_acopy_func_t)_cupsStrAlloc,
(cups_afree_func_t)_cupsStrFree);
pc->filters = cupsArrayNew3(NULL, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free);
cupsArrayAdd(pc->filters,
"application/vnd.cups-raw application/octet-stream 0 -");
@@ -1642,9 +1634,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
if ((ppd_attr = ppdFindAttr(ppd, "cupsPreFilter", NULL)) != NULL)
{
pc->prefilters = cupsArrayNew3(NULL, NULL, NULL, 0,
(cups_acopy_func_t)_cupsStrAlloc,
(cups_afree_func_t)_cupsStrFree);
pc->prefilters = cupsArrayNew3(NULL, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free);
do
{
@@ -1661,7 +1651,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
*/
if (ppd->product)
pc->product = _cupsStrAlloc(ppd->product);
pc->product = strdup(ppd->product);
/*
* Copy finishings mapping data...
@@ -1818,7 +1808,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
*/
if ((ppd_attr = ppdFindAttr(ppd, "cupsChargeInfoURI", NULL)) != NULL)
pc->charge_info_uri = _cupsStrAlloc(ppd_attr->value);
pc->charge_info_uri = strdup(ppd_attr->value);
if ((ppd_attr = ppdFindAttr(ppd, "cupsJobAccountId", NULL)) != NULL)
pc->account_id = !_cups_strcasecmp(ppd_attr->value, "true");
@@ -1827,7 +1817,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
pc->accounting_user_id = !_cups_strcasecmp(ppd_attr->value, "true");
if ((ppd_attr = ppdFindAttr(ppd, "cupsJobPassword", NULL)) != NULL)
pc->password = _cupsStrAlloc(ppd_attr->value);
pc->password = strdup(ppd_attr->value);
if ((ppd_attr = ppdFindAttr(ppd, "cupsMandatory", NULL)) != NULL)
pc->mandatory = _cupsArrayNewStrings(ppd_attr->value, ' ');
@@ -1836,9 +1826,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
* Support files...
*/
pc->support_files = cupsArrayNew3(NULL, NULL, NULL, 0,
(cups_acopy_func_t)_cupsStrAlloc,
(cups_afree_func_t)_cupsStrFree);
pc->support_files = cupsArrayNew3(NULL, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free);
for (ppd_attr = ppdFindAttr(ppd, "cupsICCProfile", NULL);
ppd_attr;
@@ -1894,8 +1882,8 @@ _ppdCacheDestroy(_ppd_cache_t *pc) /* I - PPD cache and mapping data */
{
for (i = pc->num_bins, map = pc->bins; i > 0; i --, map ++)
{
_cupsStrFree(map->pwg);
_cupsStrFree(map->ppd);
free(map->pwg);
free(map->ppd);
}
free(pc->bins);
@@ -1905,22 +1893,21 @@ _ppdCacheDestroy(_ppd_cache_t *pc) /* I - PPD cache and mapping data */
{
for (i = pc->num_sizes, size = pc->sizes; i > 0; i --, size ++)
{
_cupsStrFree(size->map.pwg);
_cupsStrFree(size->map.ppd);
free(size->map.pwg);
free(size->map.ppd);
}
free(pc->sizes);
}
if (pc->source_option)
_cupsStrFree(pc->source_option);
free(pc->source_option);
if (pc->sources)
{
for (i = pc->num_sources, map = pc->sources; i > 0; i --, map ++)
{
_cupsStrFree(map->pwg);
_cupsStrFree(map->ppd);
free(map->pwg);
free(map->ppd);
}
free(pc->sources);
@@ -1930,26 +1917,23 @@ _ppdCacheDestroy(_ppd_cache_t *pc) /* I - PPD cache and mapping data */
{
for (i = pc->num_types, map = pc->types; i > 0; i --, map ++)
{
_cupsStrFree(map->pwg);
_cupsStrFree(map->ppd);
free(map->pwg);
free(map->ppd);
}
free(pc->types);
}
if (pc->custom_max_keyword)
_cupsStrFree(pc->custom_max_keyword);
free(pc->custom_max_keyword);
free(pc->custom_min_keyword);
if (pc->custom_min_keyword)
_cupsStrFree(pc->custom_min_keyword);
_cupsStrFree(pc->product);
free(pc->product);
cupsArrayDelete(pc->filters);
cupsArrayDelete(pc->prefilters);
cupsArrayDelete(pc->finishings);
_cupsStrFree(pc->charge_info_uri);
_cupsStrFree(pc->password);
free(pc->charge_info_uri);
free(pc->password);
cupsArrayDelete(pc->mandatory);
@@ -2887,12 +2871,12 @@ _ppdCacheWriteFile(
if (pc->charge_info_uri)
cupsFilePutConf(fp, "ChargeInfoURI", pc->charge_info_uri);
cupsFilePrintf(fp, "AccountId %s\n", pc->account_id ? "true" : "false");
cupsFilePrintf(fp, "AccountingUserId %s\n",
cupsFilePrintf(fp, "JobAccountId %s\n", pc->account_id ? "true" : "false");
cupsFilePrintf(fp, "JobAccountingUserId %s\n",
pc->accounting_user_id ? "true" : "false");
if (pc->password)
cupsFilePutConf(fp, "Password", pc->password);
cupsFilePutConf(fp, "JobPassword", pc->password);
for (value = (char *)cupsArrayFirst(pc->mandatory);
value;
@@ -3117,6 +3101,22 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
cupsFilePuts(fp, "*cupsSNMPSupplies: False\n");
cupsFilePuts(fp, "*cupsLanguages: \"en\"\n");
if ((attr = ippFindAttribute(response, "printer-more-info", IPP_TAG_URI)) != NULL)
cupsFilePrintf(fp, "*APSupplies: \"%s\"\n", ippGetString(attr, 0, NULL));
if ((attr = ippFindAttribute(response, "printer-charge-info-uri", IPP_TAG_URI)) != NULL)
cupsFilePrintf(fp, "*cupsChargeInfoURI: \"%s\"\n", ippGetString(attr, 0, NULL));
/*
* Accounting...
*/
if (ippGetBoolean(ippFindAttribute(response, "job-account-id-supported", IPP_TAG_BOOLEAN), 0))
cupsFilePuts(fp, "*cupsJobAccountId: True\n");
if (ippGetBoolean(ippFindAttribute(response, "job-accounting-user-id-supported", IPP_TAG_BOOLEAN), 0))
cupsFilePuts(fp, "*cupsJobAccountingUserId: True\n");
/*
* Password/PIN printing...
*/
@@ -3149,7 +3149,7 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
pattern[maxlen] = '\0';
cupsFilePrintf(fp, "*cupsPassword: \"%s\"\n", pattern);
cupsFilePrintf(fp, "*cupsJobPassword: \"%s\"\n", pattern);
}
/*
+6 -6
Ver Arquivo
@@ -1,8 +1,8 @@
/*
* Option marking routines for CUPS.
*
* Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
* Copyright © 2007-2019 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -890,9 +890,9 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
if (cparam->current.custom_string)
_cupsStrFree(cparam->current.custom_string);
free(cparam->current.custom_string);
cparam->current.custom_string = _cupsStrAlloc(choice + 7);
cparam->current.custom_string = strdup(choice + 7);
break;
}
}
@@ -967,9 +967,9 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
if (cparam->current.custom_string)
_cupsStrFree(cparam->current.custom_string);
free(cparam->current.custom_string);
cparam->current.custom_string = _cupsStrRetain(val->value);
cparam->current.custom_string = strdup(val->value);
break;
}
}
+58 -133
Ver Arquivo
@@ -1,8 +1,8 @@
/*
* PPD file routines for CUPS.
*
* Copyright 2007-2018 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
* Copyright © 2007-2019 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -34,8 +34,6 @@
* Definitions...
*/
#define ppd_free(p) if (p) free(p) /* Safe free macro */
#define PPD_KEYWORD 1 /* Line contained a keyword */
#define PPD_OPTION 2 /* Line contained an option name */
#define PPD_TEXT 4 /* Line contained human-readable text */
@@ -117,7 +115,6 @@ void
ppdClose(ppd_file_t *ppd) /* I - PPD file record */
{
int i; /* Looping var */
ppd_emul_t *emul; /* Current emulation */
ppd_group_t *group; /* Current group */
char **font; /* Current font */
ppd_attr_t **attr; /* Current attribute */
@@ -136,28 +133,12 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */
* Free all strings at the top level...
*/
_cupsStrFree(ppd->lang_encoding);
_cupsStrFree(ppd->nickname);
if (ppd->patches)
free(ppd->patches);
_cupsStrFree(ppd->jcl_begin);
_cupsStrFree(ppd->jcl_end);
_cupsStrFree(ppd->jcl_ps);
/*
* Free any emulations...
*/
if (ppd->num_emulations > 0)
{
for (i = ppd->num_emulations, emul = ppd->emulations; i > 0; i --, emul ++)
{
_cupsStrFree(emul->start);
_cupsStrFree(emul->stop);
}
ppd_free(ppd->emulations);
}
free(ppd->lang_encoding);
free(ppd->nickname);
free(ppd->patches);
free(ppd->jcl_begin);
free(ppd->jcl_end);
free(ppd->jcl_ps);
/*
* Free any UI groups, subgroups, and options...
@@ -168,7 +149,7 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */
for (i = ppd->num_groups, group = ppd->groups; i > 0; i --, group ++)
ppd_free_group(group);
ppd_free(ppd->groups);
free(ppd->groups);
}
cupsArrayDelete(ppd->options);
@@ -179,14 +160,14 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */
*/
if (ppd->num_sizes > 0)
ppd_free(ppd->sizes);
free(ppd->sizes);
/*
* Free any constraints...
*/
if (ppd->num_consts > 0)
ppd_free(ppd->consts);
free(ppd->consts);
/*
* Free any filters...
@@ -201,9 +182,9 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */
if (ppd->num_fonts > 0)
{
for (i = ppd->num_fonts, font = ppd->fonts; i > 0; i --, font ++)
_cupsStrFree(*font);
free(*font);
ppd_free(ppd->fonts);
free(ppd->fonts);
}
/*
@@ -211,7 +192,7 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */
*/
if (ppd->num_profiles > 0)
ppd_free(ppd->profiles);
free(ppd->profiles);
/*
* Free any attributes...
@@ -221,11 +202,11 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */
{
for (i = ppd->num_attrs, attr = ppd->attrs; i > 0; i --, attr ++)
{
_cupsStrFree((*attr)->value);
ppd_free(*attr);
free((*attr)->value);
free(*attr);
}
ppd_free(ppd->attrs);
free(ppd->attrs);
}
cupsArrayDelete(ppd->sorted_attrs);
@@ -247,7 +228,7 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */
case PPD_CUSTOM_PASSCODE :
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
_cupsStrFree(cparam->current.custom_string);
free(cparam->current.custom_string);
break;
default :
@@ -295,7 +276,7 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */
* Free the whole record...
*/
ppd_free(ppd);
free(ppd);
}
@@ -443,7 +424,6 @@ _ppdOpen(
_ppd_localization_t localization) /* I - Localization to load */
{
int i, j, k; /* Looping vars */
int count; /* Temporary count */
_ppd_line_t line; /* Line buffer */
ppd_file_t *ppd; /* PPD file record */
ppd_group_t *group, /* Current group */
@@ -461,7 +441,6 @@ _ppdOpen(
/* Human-readable text from file */
*string, /* Code/text from file */
*sptr, /* Pointer into string */
*nameptr, /* Pointer into name */
*temp, /* Temporary string pointer */
**tempfonts; /* Temporary fonts pointer */
float order; /* Order dependency number */
@@ -635,15 +614,15 @@ _ppdOpen(
if (pg->ppd_status == PPD_OK)
pg->ppd_status = PPD_MISSING_PPDADOBE4;
_cupsStrFree(string);
ppd_free(line.buffer);
free(string);
free(line.buffer);
return (NULL);
}
DEBUG_printf(("2_ppdOpen: keyword=%s, string=%p", keyword, string));
_cupsStrFree(string);
free(string);
/*
* Allocate memory for the PPD file record...
@@ -653,8 +632,8 @@ _ppdOpen(
{
pg->ppd_status = PPD_ALLOC_ERROR;
_cupsStrFree(string);
ppd_free(line.buffer);
free(string);
free(line.buffer);
return (NULL);
}
@@ -851,7 +830,7 @@ _ppdOpen(
* Say all PPD files are UTF-8, since we convert to UTF-8...
*/
ppd->lang_encoding = _cupsStrAlloc("UTF-8");
ppd->lang_encoding = strdup("UTF-8");
encoding = _ppdGetEncoding(string);
}
else if (!strcmp(keyword, "LanguageVersion"))
@@ -872,10 +851,10 @@ _ppdOpen(
cupsCharsetToUTF8(utf8, string, sizeof(utf8), encoding);
ppd->nickname = _cupsStrAlloc((char *)utf8);
ppd->nickname = strdup((char *)utf8);
}
else
ppd->nickname = _cupsStrAlloc(string);
ppd->nickname = strdup(string);
}
else if (!strcmp(keyword, "Product"))
ppd->product = string;
@@ -885,17 +864,17 @@ _ppdOpen(
ppd->ttrasterizer = string;
else if (!strcmp(keyword, "JCLBegin"))
{
ppd->jcl_begin = _cupsStrAlloc(string);
ppd->jcl_begin = strdup(string);
ppd_decode(ppd->jcl_begin); /* Decode quoted string */
}
else if (!strcmp(keyword, "JCLEnd"))
{
ppd->jcl_end = _cupsStrAlloc(string);
ppd->jcl_end = strdup(string);
ppd_decode(ppd->jcl_end); /* Decode quoted string */
}
else if (!strcmp(keyword, "JCLToPSInterpreter"))
{
ppd->jcl_ps = _cupsStrAlloc(string);
ppd->jcl_ps = strdup(string);
ppd_decode(ppd->jcl_ps); /* Decode quoted string */
}
else if (!strcmp(keyword, "AccurateScreensSupport"))
@@ -963,10 +942,10 @@ _ppdOpen(
ppd->num_filters ++;
/*
* Retain a copy of the filter string...
* Make a copy of the filter string...
*/
*filter = _cupsStrRetain(string);
*filter = strdup(string);
}
else if (!strcmp(keyword, "Throughput"))
ppd->throughput = atoi(string);
@@ -989,7 +968,7 @@ _ppdOpen(
}
ppd->fonts = tempfonts;
ppd->fonts[ppd->num_fonts] = _cupsStrAlloc(name);
ppd->fonts[ppd->num_fonts] = strdup(name);
ppd->num_fonts ++;
}
else if (!strncmp(keyword, "ParamCustom", 11))
@@ -1154,7 +1133,7 @@ _ppdOpen(
strlcpy(choice->text, text[0] ? text : _("Custom"),
sizeof(choice->text));
choice->code = _cupsStrAlloc(string);
choice->code = strdup(string);
if (custom_option->section == PPD_ORDER_JCL)
ppd_decode(choice->code);
@@ -1203,60 +1182,6 @@ _ppdOpen(
else if (!strcmp(string, "Plus90"))
ppd->landscape = 90;
}
else if (!strcmp(keyword, "Emulators") && string)
{
for (count = 1, sptr = string; sptr != NULL;)
if ((sptr = strchr(sptr, ' ')) != NULL)
{
count ++;
while (*sptr == ' ')
sptr ++;
}
ppd->num_emulations = count;
if ((ppd->emulations = calloc((size_t)count, sizeof(ppd_emul_t))) == NULL)
{
pg->ppd_status = PPD_ALLOC_ERROR;
goto error;
}
for (i = 0, sptr = string; i < count; i ++)
{
for (nameptr = ppd->emulations[i].name;
*sptr != '\0' && *sptr != ' ';
sptr ++)
if (nameptr < (ppd->emulations[i].name + sizeof(ppd->emulations[i].name) - 1))
*nameptr++ = *sptr;
*nameptr = '\0';
while (*sptr == ' ')
sptr ++;
}
}
else if (!strncmp(keyword, "StartEmulator_", 14))
{
ppd_decode(string);
for (i = 0; i < ppd->num_emulations; i ++)
if (!strcmp(keyword + 14, ppd->emulations[i].name))
{
ppd->emulations[i].start = string;
string = NULL;
}
}
else if (!strncmp(keyword, "StopEmulator_", 13))
{
ppd_decode(string);
for (i = 0; i < ppd->num_emulations; i ++)
if (!strcmp(keyword + 13, ppd->emulations[i].name))
{
ppd->emulations[i].stop = string;
string = NULL;
}
}
else if (!strcmp(keyword, "JobPatchFile"))
{
/*
@@ -1410,7 +1335,7 @@ _ppdOpen(
option->section = PPD_ORDER_ANY;
_cupsStrFree(string);
free(string);
string = NULL;
/*
@@ -1438,7 +1363,7 @@ _ppdOpen(
strlcpy(choice->text,
custom_attr->text[0] ? custom_attr->text : _("Custom"),
sizeof(choice->text));
choice->code = _cupsStrRetain(custom_attr->value);
choice->code = strdup(custom_attr->value);
}
}
else if (!strcmp(keyword, "JCLOpenUI"))
@@ -1517,7 +1442,7 @@ _ppdOpen(
option->section = PPD_ORDER_JCL;
group = NULL;
_cupsStrFree(string);
free(string);
string = NULL;
/*
@@ -1541,7 +1466,7 @@ _ppdOpen(
strlcpy(choice->text,
custom_attr->text[0] ? custom_attr->text : _("Custom"),
sizeof(choice->text));
choice->code = _cupsStrRetain(custom_attr->value);
choice->code = strdup(custom_attr->value);
}
}
else if (!strcmp(keyword, "CloseUI"))
@@ -1555,7 +1480,7 @@ _ppdOpen(
option = NULL;
_cupsStrFree(string);
free(string);
string = NULL;
}
else if (!strcmp(keyword, "JCLCloseUI"))
@@ -1569,7 +1494,7 @@ _ppdOpen(
option = NULL;
_cupsStrFree(string);
free(string);
string = NULL;
}
else if (!strcmp(keyword, "OpenGroup"))
@@ -1616,14 +1541,14 @@ _ppdOpen(
if (group == NULL)
goto error;
_cupsStrFree(string);
free(string);
string = NULL;
}
else if (!strcmp(keyword, "CloseGroup"))
{
group = NULL;
_cupsStrFree(string);
free(string);
string = NULL;
}
else if (!strcmp(keyword, "OrderDependency"))
@@ -1681,7 +1606,7 @@ _ppdOpen(
option->order = order;
}
_cupsStrFree(string);
free(string);
string = NULL;
}
else if (!strncmp(keyword, "Default", 7))
@@ -1924,7 +1849,7 @@ _ppdOpen(
* Don't add this one as an attribute...
*/
_cupsStrFree(string);
free(string);
string = NULL;
}
else if (!strcmp(keyword, "PaperDimension"))
@@ -1946,7 +1871,7 @@ _ppdOpen(
size->width = (float)_cupsStrScand(string, &sptr, loc);
size->length = (float)_cupsStrScand(sptr, NULL, loc);
_cupsStrFree(string);
free(string);
string = NULL;
}
else if (!strcmp(keyword, "ImageableArea"))
@@ -1970,7 +1895,7 @@ _ppdOpen(
size->right = (float)_cupsStrScand(sptr, &sptr, loc);
size->top = (float)_cupsStrScand(sptr, NULL, loc);
_cupsStrFree(string);
free(string);
string = NULL;
}
else if (option != NULL &&
@@ -2026,7 +1951,7 @@ _ppdOpen(
(mask & (PPD_KEYWORD | PPD_STRING)) == (PPD_KEYWORD | PPD_STRING))
ppd_add_attr(ppd, keyword, name, text, string);
else
_cupsStrFree(string);
free(string);
}
/*
@@ -2049,7 +1974,7 @@ _ppdOpen(
goto error;
}
ppd_free(line.buffer);
free(line.buffer);
/*
* Reset language preferences...
@@ -2131,8 +2056,8 @@ _ppdOpen(
error:
_cupsStrFree(string);
ppd_free(line.buffer);
free(string);
free(line.buffer);
ppdClose(ppd);
@@ -2570,9 +2495,9 @@ ppd_free_filters(ppd_file_t *ppd) /* I - PPD file */
if (ppd->num_filters > 0)
{
for (i = ppd->num_filters, filter = ppd->filters; i > 0; i --, filter ++)
_cupsStrFree(*filter);
free(*filter);
ppd_free(ppd->filters);
free(ppd->filters);
ppd->num_filters = 0;
ppd->filters = NULL;
@@ -2599,7 +2524,7 @@ ppd_free_group(ppd_group_t *group) /* I - Group to free */
i --, option ++)
ppd_free_option(option);
ppd_free(group->options);
free(group->options);
}
if (group->num_subgroups > 0)
@@ -2609,7 +2534,7 @@ ppd_free_group(ppd_group_t *group) /* I - Group to free */
i --, subgroup ++)
ppd_free_group(subgroup);
ppd_free(group->subgroups);
free(group->subgroups);
}
}
@@ -2631,10 +2556,10 @@ ppd_free_option(ppd_option_t *option) /* I - Option to free */
i > 0;
i --, choice ++)
{
_cupsStrFree(choice->code);
free(choice->code);
}
ppd_free(option->choices);
free(option->choices);
}
}
@@ -3371,7 +3296,7 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
lineptr ++;
}
*string = _cupsStrAlloc(lineptr);
*string = strdup(lineptr);
mask |= PPD_STRING;
}
@@ -3493,7 +3418,7 @@ ppd_update_filters(ppd_file_t *ppd, /* I - PPD file */
filter += ppd->num_filters;
ppd->num_filters ++;
*filter = _cupsStrAlloc(buffer);
*filter = strdup(buffer);
}
while ((attr = ppdFindNextAttr(ppd, "cupsFilter2", NULL)) != NULL);
+4 -4
Ver Arquivo
@@ -5,8 +5,8 @@
* -D_PPD_DEPRECATED="" TO YOUR COMPILE OPTIONS. THIS HEADER AND THESE
* FUNCTIONS WILL BE REMOVED IN A FUTURE RELEASE OF CUPS.
*
* Copyright 2007-2015 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
* Copyright © 2007-2019 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -304,8 +304,8 @@ typedef struct ppd_file_s /**** PPD File ****/
int throughput; /* Pages per minute */
ppd_cs_t colorspace; /* Default colorspace */
char *patches; /* Patch commands to be sent to printer */
int num_emulations; /* Number of emulations supported */
ppd_emul_t *emulations; /* Emulations and the code to invoke them */
int num_emulations; /* Number of emulations supported (no longer supported) @private@ */
ppd_emul_t *emulations; /* Emulations and the code to invoke them (no longer supported) @private@ */
char *jcl_begin; /* Start JCL commands */
char *jcl_ps; /* Enter PostScript interpreter */
char *jcl_end; /* End JCL commands */
+5 -3
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* PWG media name API implementation for CUPS.
*
* Copyright 2009-2017 by Apple Inc.
* Copyright 2009-2019 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -26,6 +26,7 @@
#define _PWG_MEDIA_IN(p,l,a,x,y) {p, l, a, (int)(x * 2540), (int)(y * 2540)}
#define _PWG_MEDIA_MM(p,l,a,x,y) {p, l, a, (int)(x * 100), (int)(y * 100)}
#define _PWG_EPSILON 50 /* Matching tolerance */
/*
@@ -912,10 +913,11 @@ pwgMediaForSize(int width, /* I - Width in hundredths of millimeters */
{
/*
* Adobe uses a size matching algorithm with an epsilon of 5 points, which
* is just about 176/2540ths...
* is just about 176/2540ths... But a lot of international media sizes are
* very close so use 0.5mm (50/2540ths) as the maximum delta.
*/
return (_pwgMediaNearSize(width, length, 176));
return (_pwgMediaNearSize(width, length, _PWG_EPSILON));
}
+10 -11
Ver Arquivo
@@ -1,8 +1,8 @@
/*
* String functions for CUPS.
*
* Copyright 2007-2014 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
* Copyright © 2007-2019 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -316,15 +316,6 @@ _cupsStrFree(const char *s) /* I - String to free */
key = (_cups_sp_item_t *)(s - offsetof(_cups_sp_item_t, str));
#ifdef DEBUG_GUARDS
if (key->guard != _CUPS_STR_GUARD)
{
DEBUG_printf(("5_cupsStrFree: Freeing string %p(%s), guard=%08x, "
"ref_count=%d", key, key->str, key->guard, key->ref_count));
abort();
}
#endif /* DEBUG_GUARDS */
if ((item = (_cups_sp_item_t *)cupsArrayFind(stringpool, key)) != NULL &&
item == key)
{
@@ -332,6 +323,14 @@ _cupsStrFree(const char *s) /* I - String to free */
* Found it, dereference...
*/
#ifdef DEBUG_GUARDS
if (key->guard != _CUPS_STR_GUARD)
{
DEBUG_printf(("5_cupsStrFree: Freeing string %p(%s), guard=%08x, ref_count=%d", key, key->str, key->guard, key->ref_count));
abort();
}
#endif /* DEBUG_GUARDS */
item->ref_count --;
if (!item->ref_count)
+37 -12
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* TLS support code for CUPS using GNU TLS.
*
* Copyright © 2007-2018 by Apple Inc.
* Copyright © 2007-2019 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -173,10 +173,33 @@ cupsMakeServerCredentials(
gnutls_x509_crt_set_activation_time(crt, curtime);
gnutls_x509_crt_set_expiration_time(crt, curtime + 10 * 365 * 86400);
gnutls_x509_crt_set_ca_status(crt, 0);
gnutls_x509_crt_set_subject_alt_name(crt, GNUTLS_SAN_DNSNAME, common_name, (unsigned)strlen(common_name), GNUTLS_FSAN_SET);
if (!strchr(common_name, '.'))
{
/*
* Add common_name.local to the list, too...
*/
char localname[256]; /* hostname.local */
snprintf(localname, sizeof(localname), "%s.local", common_name);
gnutls_x509_crt_set_subject_alt_name(crt, GNUTLS_SAN_DNSNAME, localname, (unsigned)strlen(localname), GNUTLS_FSAN_APPEND);
}
gnutls_x509_crt_set_subject_alt_name(crt, GNUTLS_SAN_DNSNAME, "localhost", 9, GNUTLS_FSAN_APPEND);
if (num_alt_names > 0)
gnutls_x509_crt_set_subject_alternative_name(crt, GNUTLS_SAN_DNSNAME, alt_names[0]);
{
int i; /* Looping var */
for (i = 0; i < num_alt_names; i ++)
{
if (strcmp(alt_names[i], "localhost"))
{
gnutls_x509_crt_set_subject_alt_name(crt, GNUTLS_SAN_DNSNAME, alt_names[i], (unsigned)strlen(alt_names[i]), GNUTLS_FSAN_APPEND);
}
}
}
gnutls_x509_crt_set_key_purpose_oid(crt, GNUTLS_KP_TLS_WWW_SERVER, 0);
gnutls_x509_crt_set_key_usage(crt, GNUTLS_KEY_KEY_ENCIPHERMENT);
gnutls_x509_crt_set_key_usage(crt, GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT);
gnutls_x509_crt_set_version(crt, 3);
bytes = sizeof(buffer);
@@ -380,8 +403,8 @@ httpCredentialsAreValidForName(
if (result)
{
int i, /* Looping var */
count; /* Number of revoked certificates */
gnutls_x509_crl_iter_t iter = NULL;
/* Iterator */
unsigned char cserial[1024], /* Certificate serial number */
rserial[1024]; /* Revoked serial number */
size_t cserial_size, /* Size of cert serial number */
@@ -389,22 +412,24 @@ httpCredentialsAreValidForName(
_cupsMutexLock(&tls_mutex);
count = gnutls_x509_crl_get_crt_count(tls_crl);
if (count > 0)
if (gnutls_x509_crl_get_crt_count(tls_crl) > 0)
{
cserial_size = sizeof(cserial);
gnutls_x509_crt_get_serial(cert, cserial, &cserial_size);
for (i = 0; i < count; i ++)
{
rserial_size = sizeof(rserial);
if (!gnutls_x509_crl_get_crt_serial(tls_crl, (unsigned)i, rserial, &rserial_size, NULL) && cserial_size == rserial_size && !memcmp(cserial, rserial, rserial_size))
rserial_size = sizeof(rserial);
while (!gnutls_x509_crl_iter_crt_serial(tls_crl, &iter, rserial, &rserial_size, NULL))
{
if (cserial_size == rserial_size && !memcmp(cserial, rserial, rserial_size))
{
result = 0;
break;
}
rserial_size = sizeof(rserial);
}
gnutls_x509_crl_iter_deinit(iter);
}
_cupsMutexUnlock(&tls_mutex);
+4 -4
Ver Arquivo
@@ -1,7 +1,7 @@
//
// Array class for the CUPS PPD Compiler.
//
// Copyright 2007-2014 by Apple Inc.
// Copyright 2007-2019 by Apple Inc.
// Copyright 2002-2005 by Easy Software Products.
//
// These coded instructions, statements, and computer programs are the
@@ -39,7 +39,7 @@ ppdcArray::ppdcArray(ppdcArray *a)
memcpy(data, a->data, (size_t)count * sizeof(ppdcShared *));
for (int i = 0; i < count; i ++)
for (size_t i = 0; i < count; i ++)
data[i]->retain();
}
else
@@ -64,7 +64,7 @@ ppdcArray::~ppdcArray()
{
PPDC_DELETE;
for (int i = 0; i < count; i ++)
for (size_t i = 0; i < count; i ++)
data[i]->release();
if (alloc)
@@ -134,7 +134,7 @@ ppdcArray::next()
void
ppdcArray::remove(ppdcShared *d) // I - Data element
{
int i; // Looping var
size_t i; // Looping var
for (i = 0; i < count; i ++)
+2 -2
Ver Arquivo
@@ -1,7 +1,7 @@
//
// Definitions for the CUPS PPD Compiler.
//
// Copyright 2007-2009 by Apple Inc.
// Copyright 2007-2019 by Apple Inc.
// Copyright 2002-2007 by Easy Software Products.
//
// These coded instructions, statements, and computer programs are the
@@ -109,7 +109,7 @@ class ppdcArray //// Shared Array
{
public:
int count, // Number of elements
size_t count, // Number of elements
alloc, // Allocated elements
current; // Current element
ppdcShared **data; // Elements
+3 -5
Ver Arquivo
@@ -1,8 +1,8 @@
//
// PPD file merge utility for the CUPS PPD Compiler.
//
// Copyright 2007-2014 by Apple Inc.
// Copyright 2002-2007 by Easy Software Products.
// Copyright © 2007-2018 by Apple Inc.
// Copyright © 2002-2007 by Easy Software Products.
//
// These coded instructions, statements, and computer programs are the
// property of Apple Inc. and are protected by Federal copyright
@@ -42,6 +42,7 @@ main(int argc, // I - Number of command-line arguments
cups_array_t *ppds; // Array of PPD files
const char *inname, // First input filename
*outname; // Output filename (if any)
char bckname[1024]; // Backup filename
cups_file_t *infile, // Input file
*outfile; // Output file
cups_array_t *languages; // Languages in file
@@ -141,9 +142,6 @@ main(int argc, // I - Number of command-line arguments
if (outname && !strcmp(inname, outname))
{
// Rename input filename so that we don't overwrite it...
char bckname[1024]; // Backup filename
snprintf(bckname, sizeof(bckname), "%s.bck", inname);
if (rename(inname, bckname))
+2 -2
Ver Arquivo
@@ -1,7 +1,7 @@
//
// Test program for message catalog class.
//
// Copyright 2008 by Apple Inc.
// Copyright © 2008-2019 by Apple Inc.
//
// These coded instructions, statements, and computer programs are the
// property of Apple Inc. and are protected by Federal copyright
@@ -38,7 +38,7 @@ main(int argc, // I - Number of command-line arguments
// Scan the command-line...
catalog = new ppdcCatalog(NULL, argv[1]);
printf("%s: %d messages\n", argv[1], catalog->messages->count);
printf("%s: %u messages\n", argv[1], (unsigned)catalog->messages->count);
for (m = (ppdcMessage *)catalog->messages->first();
m;
+21 -29
Ver Arquivo
@@ -5,8 +5,8 @@
* created from driver information files, and dynamically generated PPD files
* using driver helper programs.
*
* Copyright 2007-2018 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
* Copyright  2007-2019 by Apple Inc.
* Copyright  1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -31,7 +31,7 @@
* Constants...
*/
#define PPD_SYNC 0x50504439 /* Sync word for ppds.dat (PPD9) */
#define PPD_SYNC 0x50504441 /* Sync word for ppds.dat (PPDA) */
#define PPD_MAX_LANG 32 /* Maximum languages */
#define PPD_MAX_PROD 32 /* Maximum products */
#define PPD_MAX_VERS 32 /* Maximum versions */
@@ -40,12 +40,9 @@
#define PPD_TYPE_PDF 1 /* PDF PPD */
#define PPD_TYPE_RASTER 2 /* CUPS raster PPD */
#define PPD_TYPE_FAX 3 /* Facsimile/MFD PPD */
#define PPD_TYPE_OBJECT_ANY 4 /* 3D (AMF/STL/g-code) PPD */
#define PPD_TYPE_OBJECT_DIRECT 5 /* 3D (AMF/STL/g-code) PPD over any connection */
#define PPD_TYPE_OBJECT_STORAGE 6 /* 3D (AMF/STL/g-code) PPD for storage to SD card, etc. */
#define PPD_TYPE_UNKNOWN 7 /* Other/hybrid PPD */
#define PPD_TYPE_DRV 8 /* Driver info file */
#define PPD_TYPE_ARCHIVE 9 /* Archive file */
#define PPD_TYPE_UNKNOWN 4 /* Other/hybrid PPD */
#define PPD_TYPE_DRV 5 /* Driver info file */
#define PPD_TYPE_ARCHIVE 6 /* Archive file */
#define TAR_BLOCK 512 /* Number of bytes in a block */
#define TAR_BLOCKS 10 /* Blocking factor */
@@ -372,8 +369,7 @@ cat_drv(const char *name, /* I - PPD name */
ppdcCatalog *catalog; // Message catalog in .drv file
fprintf(stderr, "DEBUG2: [cups-driverd] %d locales defined in \"%s\"...\n",
src->po_files->count, filename);
fprintf(stderr, "DEBUG2: [cups-driverd] %u locales defined in \"%s\"...\n", (unsigned)src->po_files->count, filename);
locales = new ppdcArray();
for (catalog = (ppdcCatalog *)src->po_files->first();
@@ -1527,8 +1523,20 @@ list_ppds(int request_id, /* I - Request ID */
}
if (send_type)
cupsdSendIPPString(IPP_TAG_KEYWORD, "ppd-type",
PPDTypes[ppd->record.type]);
{
if (ppd->record.type < PPD_TYPE_POSTSCRIPT || ppd->record.type > PPD_TYPE_ARCHIVE)
{
/*
* This cache file is corrupted, remove it!
*/
unlink(filename);
cupsdSendIPPString(IPP_TAG_KEYWORD, "ppd-type", PPDTypes[PPD_TYPE_UNKNOWN]);
}
else
cupsdSendIPPString(IPP_TAG_KEYWORD, "ppd-type", PPDTypes[ppd->record.type]);
}
if (send_model_number)
cupsdSendIPPInteger(IPP_TAG_INTEGER, "ppd-model-number",
@@ -2111,22 +2119,6 @@ load_ppd(const char *filename, /* I - Real filename */
type = PPD_TYPE_RASTER;
else if (strstr(line + 12, "application/vnd.cups-pdf"))
type = PPD_TYPE_PDF;
else if (strstr(line + 12, "application/amf") ||
strstr(line + 12, "application/g-code") ||
strstr(line + 12, "application/sla"))
type = PPD_TYPE_OBJECT_ANY;
}
else if (!strncmp(line, "*cups3DWorkflows:", 17))
{
int is_direct = strstr(line + 17, "direct") != NULL;
int is_storage = strstr(line + 17, "storage") != NULL;
if (is_direct && !is_storage)
type = PPD_TYPE_OBJECT_DIRECT;
else if (!is_direct && is_storage)
type = PPD_TYPE_OBJECT_STORAGE;
else
type = PPD_TYPE_OBJECT_ANY;
}
else if (!strncmp(line, "*cupsModelNumber:", 17))
sscanf(line, "*cupsModelNumber:%d", &model_number);
+11 -6
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* IPP routines for the CUPS scheduler.
*
* Copyright © 2007-2018 by Apple Inc.
* Copyright © 2007-2019 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* This file contains Kerberos support code, copyright 2006 by
@@ -2601,8 +2601,7 @@ add_printer(cupsd_client_t *con, /* I - Client connection */
if (!strcmp(attr->values[i].string.text, "none"))
continue;
printer->reasons[printer->num_reasons] =
_cupsStrRetain(attr->values[i].string.text);
printer->reasons[printer->num_reasons] = _cupsStrAlloc(attr->values[i].string.text);
printer->num_reasons ++;
if (!strcmp(attr->values[i].string.text, "paused") &&
@@ -4892,8 +4891,9 @@ copy_printer_attrs(
if ((p2_uri = ippFindAttribute(p2->attrs, "printer-uri-supported",
IPP_TAG_URI)) != NULL)
member_uris->values[i].string.text =
_cupsStrRetain(p2_uri->values[0].string.text);
{
member_uris->values[i].string.text = _cupsStrAlloc(p2_uri->values[0].string.text);
}
else
{
httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri,
@@ -5279,6 +5279,11 @@ create_local_bg_thread(
*response; /* Response from printer */
ipp_attribute_t *attr; /* Attribute in response */
ipp_status_t status; /* Status code */
static const char * const pattrs[] = /* Printer attributes we need */
{
"all",
"media-col-database"
};
/*
@@ -5313,7 +5318,7 @@ create_local_bg_thread(
request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
ippSetVersion(request, 2, 0);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printer->device_uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", NULL, "all");
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", (int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
response = cupsDoRequest(http, request, resource);
status = cupsLastError();
+26 -21
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* Job management routines for the CUPS scheduler.
*
* Copyright 2007-2018 by Apple Inc.
* Copyright 2007-2019 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -437,10 +437,20 @@ cupsdCleanJobs(void)
curtime = time(NULL);
JobHistoryUpdate = 0;
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdCleanJobs: curtime=%d", (int)curtime);
for (job = (cupsd_job_t *)cupsArrayFirst(Jobs);
job;
job = (cupsd_job_t *)cupsArrayNext(Jobs))
{
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdCleanJobs: Job %d, state=%d, printer=%p, history_time=%d, file_time=%d", job->id, (int)job->state_value, (void *)job->printer, (int)job->history_time, (int)job->file_time);
if ((job->history_time && job->history_time) < JobHistoryUpdate || !JobHistoryUpdate)
JobHistoryUpdate = job->history_time;
if ((job->file_time && job->file_time < JobHistoryUpdate) || !JobHistoryUpdate)
JobHistoryUpdate = job->file_time;
if (job->state_value >= IPP_JOB_CANCELED && !job->printer)
{
/*
@@ -456,21 +466,9 @@ cupsdCleanJobs(void)
else if (job->file_time && job->file_time <= curtime)
{
cupsdLogJob(job, CUPSD_LOG_DEBUG, "Removing document files.");
cupsdLogJob(job, CUPSD_LOG_DEBUG2, "curtime=%ld, job->file_time=%ld", (long)curtime, (long)job->file_time);
remove_job_files(job);
cupsdMarkDirty(CUPSD_DIRTY_JOBS);
if (job->history_time < JobHistoryUpdate || !JobHistoryUpdate)
JobHistoryUpdate = job->history_time;
}
else
{
if (job->history_time < JobHistoryUpdate || !JobHistoryUpdate)
JobHistoryUpdate = job->history_time;
if (job->file_time < JobHistoryUpdate || !JobHistoryUpdate)
JobHistoryUpdate = job->file_time;
}
}
}
@@ -1729,7 +1727,7 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */
job->completed_time = attr->values[0].integer;
if (JobHistory < INT_MAX)
job->history_time = attr->values[0].integer + JobHistory;
job->history_time = job->completed_time + JobHistory;
else
job->history_time = INT_MAX;
@@ -1740,7 +1738,7 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */
JobHistoryUpdate = job->history_time;
if (JobFiles < INT_MAX)
job->file_time = attr->values[0].integer + JobFiles;
job->file_time = job->completed_time + JobFiles;
else
job->file_time = INT_MAX;
@@ -2862,8 +2860,10 @@ cupsdUpdateJobs(void)
* Update history/file expiration times...
*/
job->completed_time = attr->values[0].integer;
if (JobHistory < INT_MAX)
job->history_time = attr->values[0].integer + JobHistory;
job->history_time = job->completed_time + JobHistory;
else
job->history_time = INT_MAX;
@@ -2877,7 +2877,7 @@ cupsdUpdateJobs(void)
JobHistoryUpdate = job->history_time;
if (JobFiles < INT_MAX)
job->file_time = attr->values[0].integer + JobFiles;
job->file_time = job->completed_time + JobFiles;
else
job->file_time = INT_MAX;
@@ -3442,6 +3442,12 @@ finalize_job(cupsd_job_t *job, /* I - Job */
* Stop the printer...
*/
if (job_state == IPP_JSTATE_CANCELED || job_state == IPP_JSTATE_ABORTED)
{
cupsdLogJob(job, CUPSD_LOG_INFO, "Ignored STOP from backend since the job is %s.", job_state == IPP_JSTATE_CANCELED ? "canceled" : "aborted");
break;
}
printer_state = IPP_PRINTER_STOPPED;
if (ErrorLog)
@@ -3456,8 +3462,7 @@ finalize_job(cupsd_job_t *job, /* I - Job */
{
job_state = IPP_JOB_PENDING;
ippSetString(job->attrs, &job->reasons, 0,
"resources-are-not-ready");
ippSetString(job->attrs, &job->reasons, 0, "resources-are-not-ready");
}
break;
@@ -4693,7 +4698,7 @@ set_time(cupsd_job_t *job, /* I - Job to update */
job->completed_time = curtime;
if (JobHistory < INT_MAX && attr)
job->history_time = attr->values[0].integer + JobHistory;
job->history_time = job->completed_time + JobHistory;
else
job->history_time = INT_MAX;
@@ -4701,7 +4706,7 @@ set_time(cupsd_job_t *job, /* I - Job to update */
JobHistoryUpdate = job->history_time;
if (JobFiles < INT_MAX && attr)
job->file_time = curtime + JobFiles;
job->file_time = job->completed_time + JobFiles;
else
job->file_time = INT_MAX;
+34 -47
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* Main loop for the CUPS scheduler.
*
* Copyright 2007-2018 by Apple Inc.
* Copyright 2007-2019 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -808,14 +808,25 @@ main(int argc, /* I - Number of command-line args */
*/
if (timeout == 86400 && OnDemand && IdleExitTimeout &&
!cupsArrayCount(ActiveJobs) &&
# ifdef HAVE_SYSTEMD
!WebInterface &&
# endif /* HAVE_SYSTEMD */
(!Browsing || !BrowseLocalProtocols || !cupsArrayCount(Printers)))
!cupsArrayCount(ActiveJobs))
{
timeout = IdleExitTimeout;
service_idle_exit = 1;
cupsd_printer_t *p = NULL; /* Current printer */
if (Browsing && BrowseLocalProtocols)
{
for (p = (cupsd_printer_t *)cupsArrayFirst(Printers); p; p = (cupsd_printer_t *)cupsArrayNext(Printers))
if (p->shared)
break;
}
if (!p)
{
timeout = IdleExitTimeout;
service_idle_exit = 1;
}
}
else
service_idle_exit = 0;
@@ -946,8 +957,7 @@ main(int argc, /* I - Number of command-line args */
if (current_time > expire_time)
{
if (cupsArrayCount(Subscriptions) > 0)
cupsdExpireSubscriptions(NULL, NULL);
cupsdExpireSubscriptions(NULL, NULL);
cupsdUnloadCompletedJobs();
@@ -982,6 +992,23 @@ main(int argc, /* I - Number of command-line args */
}
#endif /* !HAVE_AUTHORIZATION_H */
/*
* Clean job history...
*/
if (JobHistoryUpdate && current_time >= JobHistoryUpdate)
cupsdCleanJobs();
/*
* Update any pending multi-file documents...
*/
if ((current_time - senddoc_time) >= 10)
{
cupsdCheckJobs();
senddoc_time = current_time;
}
/*
* Check for new data on the client sockets...
*/
@@ -1014,23 +1041,6 @@ main(int argc, /* I - Number of command-line args */
}
}
/*
* Update any pending multi-file documents...
*/
if ((current_time - senddoc_time) >= 10)
{
cupsdCheckJobs();
senddoc_time = current_time;
}
/*
* Clean job history...
*/
if (JobHistoryUpdate && current_time >= JobHistoryUpdate)
cupsdCleanJobs();
/*
* Log statistics at most once a minute when in debug mode...
*/
@@ -1612,7 +1622,6 @@ select_timeout(int fds) /* I - Number of descriptors returned */
time_t now; /* Current time */
cupsd_client_t *con; /* Client information */
cupsd_job_t *job; /* Job information */
cupsd_printer_t *printer; /* Printer information */
const char *why; /* Debugging aid */
@@ -1701,12 +1710,6 @@ select_timeout(int fds) /* I - Number of descriptors returned */
* Check for any job activity...
*/
if (JobHistoryUpdate && timeout > JobHistoryUpdate)
{
timeout = JobHistoryUpdate;
why = "update job history";
}
for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs);
job;
job = (cupsd_job_t *)cupsArrayNext(ActiveJobs))
@@ -1737,22 +1740,6 @@ select_timeout(int fds) /* I - Number of descriptors returned */
}
}
/*
* Check for temporary printers that need to be deleted...
*/
for (printer = (cupsd_printer_t *)cupsArrayFirst(Printers); printer; printer = (cupsd_printer_t *)cupsArrayNext(Printers))
{
if (printer->temporary && !printer->job && (!local_timeout || local_timeout > (printer->state_time + 60)))
local_timeout = printer->state_time + 60;
}
if (timeout > local_timeout && local_timeout)
{
timeout = local_timeout;
why = "delete stale local printers";
}
/*
* Adjust from absolute to relative time. We add 1 second to the timeout since
* events occur after the timeout expires, and limit the timeout to 86400
+22 -123
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* Printer routines for the CUPS scheduler.
*
* Copyright 2007-2017 by Apple Inc.
* Copyright 2007-2019 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -48,8 +48,7 @@ static int compare_printers(void *first, void *second, void *data);
static void delete_printer_filters(cupsd_printer_t *p);
static void dirty_printer(cupsd_printer_t *p);
static void load_ppd(cupsd_printer_t *p);
static ipp_t *new_media_col(pwg_size_t *size, const char *source,
const char *type);
static ipp_t *new_media_col(pwg_size_t *size);
static void write_xml_string(cups_file_t *fp, const char *s);
@@ -3799,7 +3798,7 @@ dirty_printer(cupsd_printer_t *p) /* I - Printer */
static void
load_ppd(cupsd_printer_t *p) /* I - Printer */
{
int i, j, k; /* Looping vars */
int i, j; /* Looping vars */
char cache_name[1024]; /* Cache filename */
struct stat cache_info; /* Cache file info */
ppd_file_t *ppd; /* PPD file */
@@ -3811,9 +3810,7 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
*output_bin, /* OutputBin option */
*output_mode, /* OutputMode option */
*resolution; /* (Set|JCL|)Resolution option */
ppd_choice_t *choice, /* Current PPD choice */
*input_slot, /* Current input slot */
*media_type; /* Current media type */
ppd_choice_t *choice; /* Current PPD choice */
ppd_attr_t *ppd_attr; /* PPD attribute */
int xdpi, /* Horizontal resolution */
ydpi; /* Vertical resolution */
@@ -4073,20 +4070,8 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
{
ipp_t *col; /* Collection value */
input_slot = ppdFindMarkedChoice(ppd, "InputSlot");
media_type = ppdFindMarkedChoice(ppd, "MediaType");
col = new_media_col(pwgsize,
input_slot ?
_ppdCacheGetSource(p->pc,
input_slot->choice) :
NULL,
media_type ?
_ppdCacheGetType(p->pc,
media_type->choice) :
NULL);
ippAddCollection(p->ppd_attrs, IPP_TAG_PRINTER, "media-col-default",
col);
col = new_media_col(pwgsize);
ippAddCollection(p->ppd_attrs, IPP_TAG_PRINTER, "media-col-default", col);
ippDelete(col);
}
@@ -4280,89 +4265,19 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
* media-col-database
*/
num_media = p->pc->num_sizes;
if (p->pc->num_sources)
if ((attr = ippAddCollections(p->ppd_attrs, IPP_TAG_PRINTER, "media-col-database", p->pc->num_sizes, NULL)) != NULL)
{
if (p->pc->num_types > 0)
num_media += p->pc->num_sizes * p->pc->num_sources *
p->pc->num_types;
else
num_media += p->pc->num_sizes * p->pc->num_sources;
}
else if (p->pc->num_types)
num_media += p->pc->num_sizes * p->pc->num_types;
if ((attr = ippAddCollections(p->ppd_attrs, IPP_TAG_PRINTER,
"media-col-database", num_media,
NULL)) != NULL)
{
for (i = p->pc->num_sizes, pwgsize = p->pc->sizes, val = attr->values;
i > 0;
i --, pwgsize ++)
{
/*
* Start by adding the page size without source or type...
*/
ppdMarkOption(ppd, "PageSize", pwgsize->map.ppd);
val->collection = new_media_col(pwgsize, NULL, NULL);
val ++;
/*
* Then add the specific, supported combinations of size, source, and
* type...
*/
if (p->pc->num_sources > 0)
{
for (j = p->pc->num_sources, pwgsource = p->pc->sources;
j > 0;
j --, pwgsource ++)
{
ppdMarkOption(ppd, "InputSlot", pwgsource->ppd);
if (p->pc->num_types > 0)
{
for (k = p->pc->num_types, pwgtype = p->pc->types;
k > 0;
k --, pwgtype ++)
{
if (!ppdMarkOption(ppd, "MediaType", pwgtype->ppd))
{
val->collection = new_media_col(pwgsize, pwgsource->pwg,
pwgtype->pwg);
val ++;
}
}
}
else if (!ppdConflicts(ppd))
{
val->collection = new_media_col(pwgsize, pwgsource->pwg, NULL);
val ++;
}
}
}
else if (p->pc->num_types > 0)
{
for (j = p->pc->num_types, pwgtype = p->pc->types;
j > 0;
j --, pwgtype ++)
{
if (!ppdMarkOption(ppd, "MediaType", pwgtype->ppd))
{
val->collection = new_media_col(pwgsize, NULL, pwgtype->pwg);
val ++;
}
}
}
}
/*
* Update the number of media-col-database values...
* Adding each page size without source or type...
*/
attr->num_values = val - attr->values;
for (i = 0, pwgsize = p->pc->sizes; i < p->pc->num_sizes; i ++, pwgsize ++)
{
ipp_t *col = new_media_col(pwgsize);
ippSetCollection(p->ppd_attrs, &attr, i, col);
ippDelete(col);
}
}
}
@@ -5060,9 +4975,7 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
*/
static ipp_t * /* O - Collection value */
new_media_col(pwg_size_t *size, /* I - media-size/margin values */
const char *source, /* I - media-source value */
const char *type) /* I - media-type value */
new_media_col(pwg_size_t *size) /* I - media-size/margin values */
{
ipp_t *media_col, /* Collection value */
*media_size; /* media-size value */
@@ -5071,29 +4984,15 @@ new_media_col(pwg_size_t *size, /* I - media-size/margin values */
media_col = ippNew();
media_size = ippNew();
ippAddInteger(media_size, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"x-dimension", size->width);
ippAddInteger(media_size, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"y-dimension", size->length);
ippAddInteger(media_size, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "x-dimension", size->width);
ippAddInteger(media_size, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "y-dimension", size->length);
ippAddCollection(media_col, IPP_TAG_PRINTER, "media-size", media_size);
ippDelete(media_size);
ippAddInteger(media_col, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"media-bottom-margin", size->bottom);
ippAddInteger(media_col, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"media-left-margin", size->left);
ippAddInteger(media_col, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"media-right-margin", size->right);
ippAddInteger(media_col, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"media-top-margin", size->top);
if (source)
ippAddString(media_col, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "media-source",
NULL, source);
if (type)
ippAddString(media_col, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "media-type",
NULL, type);
ippAddInteger(media_col, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "media-bottom-margin", size->bottom);
ippAddInteger(media_col, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "media-left-margin", size->left);
ippAddInteger(media_col, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "media-right-margin", size->right);
ippAddInteger(media_col, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "media-top-margin", size->top);
return (media_col);
}
+10 -1
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* Server start/stop routines for the CUPS scheduler.
*
* Copyright 2007-2018 by Apple Inc.
* Copyright 2007-2019 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -176,6 +176,15 @@ cupsdStopServer(void)
cupsdDestroyProfile(DefaultProfile);
DefaultProfile = NULL;
/*
* Expire subscriptions and clean out old jobs...
*/
cupsdExpireSubscriptions(NULL, NULL);
if (JobHistoryUpdate)
cupsdCleanJobs();
/*
* Write out any dirty files...
*/
+4 -1
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* Subscription routines for the CUPS scheduler.
*
* Copyright 2007-2014 by Apple Inc.
* Copyright 2007-2019 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -652,6 +652,9 @@ cupsdExpireSubscriptions(
time_t curtime; /* Current time */
if (cupsArrayCount(Subscriptions) == 0)
return;
curtime = time(NULL);
update = 0;
+4 -4
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* "lpadmin" command for CUPS.
*
* Copyright © 2007-2018 by Apple Inc.
* Copyright © 2007-2019 by Apple Inc.
* Copyright © 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -1140,6 +1140,7 @@ enable_printer(http_t *http, /* I - Server connection */
request = ippNewRequest(IPP_OP_ENABLE_PRINTER);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, "localhost", ippPort(), "/printers/%s", printer);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
@@ -1194,9 +1195,7 @@ get_printer_ppd(
int port; /* Port number */
static const char * const pattrs[] = /* Attributes to use */
{
"job-template",
"printer-defaults",
"printer-description",
"all",
"media-col-database"
};
@@ -1451,6 +1450,7 @@ set_printer_options(
/* Status code */
_cupsLangPrintf(stderr, _("lpadmin: Unable to open PPD \"%s\": %s on line %d."), ppdfile, ppdErrorString(status), linenum);
return (1);
}
ppdMarkDefaults(ppd);
+71 -5
Ver Arquivo
@@ -3,7 +3,7 @@
# Perform the complete set of IPP compliance tests specified in the
# CUPS Software Test Plan.
#
# Copyright © 2007-2018 by Apple Inc.
# Copyright © 2007-2019 by Apple Inc.
# Copyright © 1997-2007 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -482,6 +482,14 @@ else
encryption=""
fi
if test $testtype = 0; then
jobhistory="30m"
jobfiles="5m"
else
jobhistory="30"
jobfiles="Off"
fi
cat >$BASE/cupsd.conf <<EOF
StrictConformance Yes
Browsing Off
@@ -492,8 +500,8 @@ MaxLogSize 0
AccessLogLevel actions
LogLevel $loglevel
LogTimeFormat usecs
PreserveJobHistory Yes
PreserveJobFiles 5m
PreserveJobHistory $jobhistory
PreserveJobFiles $jobfiles
<Policy default>
<Limit All>
Order Allow,Deny
@@ -820,12 +828,70 @@ else
echo PASS
fi
echo " </pre>" >>$strfile
#
# Perform job history test...
#
echo $ac_n "Starting history test: $ac_c"
echo "" >>$strfile
echo "`date '+[%d/%b/%Y:%H:%M:%S %z]'` \"5.11-history\":" >>$strfile
echo " lp -d Test1 testfile.jpg" >>$strfile
$runcups ../systemv/lp -d Test1 testfile.jpg 2>&1 >>$strfile
if test $? != 0; then
echo "FAIL (unable to queue test job)"
echo " FAILED" >>$strfile
fail=`expr $fail + 1`
else
echo "PASS"
echo " PASSED" >>$strfile
./waitjobs.sh >>$strfile
echo $ac_n "Verifying that history still exists: $ac_c"
echo " ls -l $BASE/spool" >>$strfile
count=`ls -1 $BASE/spool | wc -l`
if test $count = 1; then
echo "FAIL"
echo " FAILED (job control files not present)" >>$strfile
ls -l $BASE/spool >>$strfile
fail=`expr $fail + 1`
else
echo "PASS"
echo " PASSED" >>$strfile
echo $ac_n "Waiting for job history to expire: $ac_c"
echo "" >>$strfile
echo " sleep 35" >>$strfile
sleep 35
echo " lpstat" >>$strfile
$runcups ../systemv/lpstat 2>&1 >>$strfile
echo " ls -l $BASE/spool" >>$strfile
count=`ls -1 $BASE/spool | wc -l`
if test $count != 1; then
echo "FAIL"
echo " FAILED (job control files still present)" >>$strfile
ls -l $BASE/spool >>$strfile
fail=`expr $fail + 1`
else
echo "PASS"
echo " PASSED" >>$strfile
fi
fi
fi
#
# Stop the server...
#
echo " </pre>" >>$strfile
kill $cupsd
wait $cupsd
cupsdstatus=$?
@@ -898,7 +964,7 @@ fi
# Requests logged
count=`wc -l $BASE/log/access_log | awk '{print $1}'`
expected=`expr 35 + 18 + 30 + $pjobs \* 8 + $pprinters \* $pjobs \* 4`
expected=`expr 35 + 18 + 30 + $pjobs \* 8 + $pprinters \* $pjobs \* 4 + 2`
if test $count != $expected; then
echo "FAIL: $count requests logged, expected $expected."
echo " <p>FAIL: $count requests logged, expected $expected.</p>" >>$strfile
+2 -2
Ver Arquivo
@@ -94,8 +94,8 @@ typedef unsigned long useconds_t;
* Version of software...
*/
#define CUPS_SVERSION "CUPS v2.2.10"
#define CUPS_MINIMAL "CUPS/2.2.10"
#define CUPS_SVERSION "CUPS v2.2.11"
#define CUPS_MINIMAL "CUPS/2.2.11"
/*
+2 -2
Ver Arquivo
@@ -22,8 +22,8 @@
* Version of software...
*/
#define CUPS_SVERSION "CUPS v2.2.10"
#define CUPS_MINIMAL "CUPS/2.2.10"
#define CUPS_SVERSION "CUPS v2.2.11"
#define CUPS_MINIMAL "CUPS/2.2.11"
/*