Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 6317446a4b |
+58
-1
@@ -1,6 +1,63 @@
|
||||
CHANGES.txt - 2006-03-24
|
||||
CHANGES.txt - 2006-04-07
|
||||
------------------------
|
||||
|
||||
CHANGES IN CUPS V1.2
|
||||
|
||||
- The scheduler was not always using the string pool,
|
||||
causing random crashes.
|
||||
- The lpmove and the web interface's Move Job button did
|
||||
not work with stopped jobs (STR #1534)
|
||||
- The PostScript filter did not handle the page-set
|
||||
option properly with number-up printing (STR #1543)
|
||||
- The scheduler now only warns about unsupported ACLs
|
||||
once (STR #1532)
|
||||
- The "fitplot" option did not work with output from
|
||||
Mozilla (STR #1542)
|
||||
- The imagetops filter did not work with Level 2 or 3
|
||||
printers (STR #1533)
|
||||
- The scheduler now recognizes PostScript files with PJL
|
||||
commands that do not include an ENTER LANGUAGE command.
|
||||
- Added --with-printcap configure option.
|
||||
- 64-bit SSL fixes for MacOS X.
|
||||
- The scheduler didn't send some printer state change
|
||||
events.
|
||||
- The scheduler didn't send jobs to busy remote printers.
|
||||
- Fixed some problems with the launchd support.
|
||||
- Added new USB printer backend for MacOS X.
|
||||
- The PostScript filter now handles files that start with
|
||||
an incomplete PJL header (PR #6076)
|
||||
- The web interface language selection code did not try
|
||||
the generic language localization (STR #1531)
|
||||
- The language cache, string pool, and transcoding caches
|
||||
are now process global instead of per-thread to avoid
|
||||
problems with GNOME and to allow for data sharing
|
||||
between threads (STR #1530)
|
||||
- Fixed a CUPS 1.1.x compatibility bug (STR #1528)
|
||||
- The web interface redirection after certain printer
|
||||
administration tasks was broken (STR #1516)
|
||||
- Web interface authorization could get stuck (STR #1512)
|
||||
- Localization updates (STR #1513, STR #1518, STR #1520)
|
||||
- The pstops filter didn't work with some files (STR
|
||||
#1523)
|
||||
- "./configure --enable-static" didn't work (STR #1522)
|
||||
- The scheduler was not using the configured default
|
||||
Group (STR #1521)
|
||||
- The web interface still did not show the localized time
|
||||
and date for some locales and systems (STR #1509)
|
||||
- httpAddrGetList() would crash on systems without
|
||||
getaddrinfo().
|
||||
- Socket URIs without a trailing slash would cause the
|
||||
port number to not be accepted (STR #1519)
|
||||
- Local raw and System V printers were not advertised as
|
||||
such for printer browsing (STR #1502)
|
||||
- The RPM spec file incorrectly put duplicate copies of
|
||||
the Japanese and Spanish web interface templates in the
|
||||
main cups package (STR #1517)
|
||||
- cupsSetDests() did not explicitly set the permissions
|
||||
of the /etc/cups/lpoptions file (STR #1508)
|
||||
- The lpq command crashed with the -h option (STR #1515)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.2rc1
|
||||
|
||||
- Documentation updates (STR #1497, STR #1498)
|
||||
|
||||
+2
-2
@@ -118,11 +118,11 @@ INSTALLSTATIC = @INSTALLSTATIC@
|
||||
ARCHFLAGS = @ARCHFLAGS@
|
||||
ARFLAGS = @ARFLAGS@
|
||||
BACKLIBS = @BACKLIBS@
|
||||
CFLAGS = -I.. $(RC_CFLAGS) $(SSLFLAGS) @CPPFLAGS@ @CFLAGS@ \
|
||||
CFLAGS = -I.. $(SSLFLAGS) @CPPFLAGS@ @CFLAGS@ \
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
|
||||
COMMONLIBS = @LIBS@
|
||||
CUPSDLIBS = @CUPSDLIBS@
|
||||
CXXFLAGS = -I.. $(RC_CFLAGS) $(SSLFLAGS) @CPPFLAGS@ @CXXFLAGS@ \
|
||||
CXXFLAGS = -I.. $(SSLFLAGS) @CPPFLAGS@ @CXXFLAGS@ \
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
|
||||
CXXLIBS = @CXXLIBS@
|
||||
DSOFLAGS = @DSOFLAGS@
|
||||
|
||||
+1248
-1814
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -56,7 +56,9 @@ print_device(const char *uri, /* I - Device URI */
|
||||
const char *resource, /* I - Resource/modelname */
|
||||
const char *options, /* I - Device options/serial number */
|
||||
int fp, /* I - File descriptor to print */
|
||||
int copies) /* I - Copies to print */
|
||||
int copies, /* I - Copies to print */
|
||||
int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int fd; /* USB device */
|
||||
int rbytes; /* Number of bytes read */
|
||||
@@ -77,6 +79,8 @@ print_device(const char *uri, /* I - Device URI */
|
||||
unsigned int status; /* Port status (off-line, out-of-paper, etc.) */
|
||||
#endif /* __linux */
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
/*
|
||||
* Open the USB port device...
|
||||
|
||||
+7
-3
@@ -63,7 +63,7 @@
|
||||
void list_devices(void);
|
||||
int print_device(const char *uri, const char *hostname,
|
||||
const char *resource, const char *options,
|
||||
int fp, int copies);
|
||||
int fp, int copies, int argc, char *argv[]);
|
||||
|
||||
|
||||
/*
|
||||
@@ -109,7 +109,9 @@ print_device(const char *uri, /* I - Device URI */
|
||||
const char *resource, /* I - Resource/modelname */
|
||||
const char *options, /* I - Device options/serial number */
|
||||
int fp, /* I - File descriptor to print */
|
||||
int copies) /* I - Copies to print */
|
||||
int copies, /* I - Copies to print */
|
||||
int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
/*
|
||||
* Can't print, so just reference the arguments to eliminate compiler
|
||||
@@ -124,6 +126,8 @@ print_device(const char *uri, /* I - Device URI */
|
||||
(void)options;
|
||||
(void)fp;
|
||||
(void)copies;
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
@@ -251,7 +255,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* Finally, send the print file...
|
||||
*/
|
||||
|
||||
status = print_device(uri, hostname, resource, options, fp, copies);
|
||||
status = print_device(uri, hostname, resource, options, fp, copies, argc, argv);
|
||||
|
||||
/*
|
||||
* Close the input file and return...
|
||||
|
||||
+44
-18
@@ -49,6 +49,7 @@
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static http_t *connect_server(const char *, http_t *);
|
||||
static int show_jobs(const char *, http_t *, const char *,
|
||||
const char *, const int, const int);
|
||||
static void show_printer(const char *, http_t *, const char *);
|
||||
@@ -76,35 +77,23 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
int num_dests; /* Number of destinations */
|
||||
cups_dest_t *dests; /* Destinations */
|
||||
cups_lang_t *language; /* Language */
|
||||
#ifdef HAVE_SSL
|
||||
http_encryption_t encryption; /* Encryption? */
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
/*
|
||||
* Connect to the scheduler...
|
||||
*/
|
||||
|
||||
if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
|
||||
cupsEncryption())) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("%s: Unable to contact server!\n"), argv[0]);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for command-line options...
|
||||
*/
|
||||
|
||||
http = NULL;
|
||||
dest = NULL;
|
||||
user = NULL;
|
||||
id = 0;
|
||||
interval = 0;
|
||||
longstatus = 0;
|
||||
all = 0;
|
||||
num_dests = cupsGetDests(&dests);
|
||||
language = cupsLangDefault();
|
||||
num_dests = 0;
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
if (argv[i][0] == '+')
|
||||
@@ -115,10 +104,10 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
{
|
||||
case 'E' : /* Encrypt */
|
||||
#ifdef HAVE_SSL
|
||||
encryption = HTTP_ENCRYPT_REQUIRED;
|
||||
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
|
||||
|
||||
if (http)
|
||||
httpEncryption(http, encryption);
|
||||
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
|
||||
#else
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Sorry, no encryption support compiled in!\n"),
|
||||
@@ -166,6 +155,11 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
if ((instance = strchr(dest, '/')) != NULL)
|
||||
*instance++ = '\0';
|
||||
|
||||
http = connect_server(argv[0], http);
|
||||
|
||||
if (num_dests == 0)
|
||||
num_dests = cupsGetDests2(http, &dests);
|
||||
|
||||
if (cupsGetDest(dest, instance, num_dests, dests) == NULL)
|
||||
{
|
||||
if (instance)
|
||||
@@ -186,8 +180,11 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
break;
|
||||
|
||||
case 'h' : /* Connect to host */
|
||||
if (http != NULL)
|
||||
if (http)
|
||||
{
|
||||
httpClose(http);
|
||||
http = NULL;
|
||||
}
|
||||
|
||||
if (argv[i][2] != '\0')
|
||||
cupsSetServer(argv[i] + 2);
|
||||
@@ -225,8 +222,13 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
else
|
||||
user = argv[i];
|
||||
|
||||
http = connect_server(argv[0], http);
|
||||
|
||||
if (dest == NULL && !all)
|
||||
{
|
||||
if (num_dests == 0)
|
||||
num_dests = cupsGetDests2(http, &dests);
|
||||
|
||||
for (i = 0; i < num_dests; i ++)
|
||||
if (dests[i].is_default)
|
||||
dest = dests[i].name;
|
||||
@@ -294,6 +296,30 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'connect_server()' - Connect to the server as necessary...
|
||||
*/
|
||||
|
||||
static http_t * /* O - New HTTP connection */
|
||||
connect_server(const char *command, /* I - Command name */
|
||||
http_t *http) /* I - Current HTTP connection */
|
||||
{
|
||||
if (!http)
|
||||
{
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(),
|
||||
cupsEncryption());
|
||||
|
||||
if (http == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("%s: Unable to connect to server\n"), command);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
return (http);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_jobs()' - Show jobs.
|
||||
*/
|
||||
|
||||
+10
-2
@@ -132,12 +132,20 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
if (!strcmp(op, "redirect"))
|
||||
{
|
||||
const char *url; /* Redirection URL... */
|
||||
char prefix[1024]; /* URL prefix */
|
||||
|
||||
|
||||
if (getenv("HTTPS"))
|
||||
snprintf(prefix, sizeof(prefix), "https://%s:%s",
|
||||
getenv("SERVER_NAME"), getenv("SERVER_PORT"));
|
||||
else
|
||||
snprintf(prefix, sizeof(prefix), "http://%s:%s",
|
||||
getenv("SERVER_NAME"), getenv("SERVER_PORT"));
|
||||
|
||||
if ((url = cgiGetVariable("URL")) != NULL)
|
||||
printf("Location: %s\n\n", url);
|
||||
printf("Location: %s%s\n\n", prefix, url);
|
||||
else
|
||||
puts("Location: /admin\n");
|
||||
printf("Location: %s/admin\n\n", prefix);
|
||||
}
|
||||
else if (!strcmp(op, "start-printer"))
|
||||
do_printer_op(http, IPP_RESUME_PRINTER, cgiText(_("Start Printer")));
|
||||
|
||||
@@ -110,7 +110,7 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
|
||||
if ((lang = getenv("LANG")) != NULL)
|
||||
{
|
||||
for (i = 0; lang[i] && i < 15; i ++)
|
||||
if (isalnum(lang[i] & 255))
|
||||
if (isalnum(lang[i] & 255) || lang[i] == '_')
|
||||
locale[i] = tolower(lang[i]);
|
||||
else if (lang[i] == '-')
|
||||
locale[i] = '_';
|
||||
|
||||
+5
-3
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: mime.types 4590 2005-08-24 19:25:49Z mike $"
|
||||
# "$Id: mime.types 5375 2006-04-06 20:10:55Z mike $"
|
||||
#
|
||||
# MIME types file for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
@@ -77,7 +77,9 @@ application/postscript ai eps ps string(0,%!) string(0,<04>%!) \
|
||||
(contains(0,1024,"LANGUAGE=POSTSCRIPT") \
|
||||
contains(0,1024,"LANGUAGE = Postscript") \
|
||||
contains(0,1024,"LANGUAGE = PostScript") \
|
||||
contains(0,1024,"LANGUAGE = POSTSCRIPT"))
|
||||
contains(0,1024,"LANGUAGE = POSTSCRIPT") \
|
||||
(contains(0,1024,<0a>%!) + \
|
||||
!contains(0,1024,"ENTER LANGUAGE")))
|
||||
application/vnd.hp-HPGL hpgl string(0,<1B>&)\
|
||||
string(0,<1B>E<1B>%0B) \
|
||||
string(0,<1B>%-1B) string(0,<201B>)\
|
||||
@@ -165,5 +167,5 @@ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
|
||||
#application/octet-stream
|
||||
|
||||
#
|
||||
# End of "$Id: mime.types 4590 2005-08-24 19:25:49Z mike $".
|
||||
# End of "$Id: mime.types 5375 2006-04-06 20:10:55Z mike $".
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-common.m4 5288 2006-03-14 02:38:07Z mike $"
|
||||
dnl "$Id: cups-common.m4 5354 2006-03-29 20:55:15Z mike $"
|
||||
dnl
|
||||
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -79,9 +79,10 @@ fi
|
||||
|
||||
dnl Static library option...
|
||||
INSTALLSTATIC=""
|
||||
AC_ARG_ENABLE(install_static, [ --enable-static install static libraries, default=no])
|
||||
AC_ARG_ENABLE(static, [ --enable-static install static libraries, default=no])
|
||||
|
||||
if test x$enable_install_static = xyes; then
|
||||
if test x$enable_static = xyes; then
|
||||
echo Installing static libraries...
|
||||
INSTALLSTATIC="installstatic"
|
||||
fi
|
||||
|
||||
@@ -264,5 +265,5 @@ AC_SUBST(DEFAULT_IPP_PORT)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-common.m4 5288 2006-03-14 02:38:07Z mike $".
|
||||
dnl End of "$Id: cups-common.m4 5354 2006-03-29 20:55:15Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -111,13 +111,21 @@ AC_SUBST(CUPS_IMPLICIT_CLASSES)
|
||||
|
||||
dnl Default UseNetworkDefault
|
||||
AC_ARG_ENABLE(network_default, [ --enable-use-network-default
|
||||
enable UseNetworkDefault by default, default=yes])
|
||||
if test "x$enable_network_default" = xno; then
|
||||
enable UseNetworkDefault by default, default=auto])
|
||||
if test "x$enable_network_default" != xno; then
|
||||
AC_MSG_CHECKING(whether to use network default printers)
|
||||
if test "x$enable_network_default" = xyes -o $uname != Darwin; then
|
||||
CUPS_USE_NETWORK_DEFAULT="Yes"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
CUPS_USE_NETWORK_DEFAULT="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
else
|
||||
CUPS_USE_NETWORK_DEFAULT="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 0)
|
||||
else
|
||||
CUPS_USE_NETWORK_DEFAULT="Yes"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 1)
|
||||
fi
|
||||
AC_SUBST(CUPS_USE_NETWORK_DEFAULT)
|
||||
|
||||
@@ -148,12 +156,7 @@ AC_ARG_WITH(cups-group, [ --with-cups-group set default group for CUPS],
|
||||
CUPS_GROUP="$withval",
|
||||
AC_MSG_CHECKING(for default print group)
|
||||
if test -f /etc/group; then
|
||||
if test x$uname = xDarwin; then
|
||||
GROUP_LIST="nobody"
|
||||
else
|
||||
GROUP_LIST="lp nobody"
|
||||
fi
|
||||
|
||||
GROUP_LIST="lp nobody"
|
||||
CUPS_GROUP=""
|
||||
for group in $GROUP_LIST; do
|
||||
if test "`grep \^${group}: /etc/group`" != ""; then
|
||||
@@ -215,6 +218,22 @@ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USER, "$CUPS_USER")
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GROUP, "$CUPS_GROUP")
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SYSTEM_GROUPS, "$CUPS_SYSTEM_GROUPS")
|
||||
|
||||
dnl Default printcap file...
|
||||
AC_ARG_WITH(printcap, [ --with-printcap set default printcap file],
|
||||
default_printcap="$withval",
|
||||
default_printcap="/etc/printcap")
|
||||
|
||||
if test x$enable_printcap != xno -a x$default_printcap != xno; then
|
||||
if test "x$default_printcap" = "x/etc/printcap" -a "$uname" = "Darwin" -a $uversion -ge 90; then
|
||||
CUPS_DEFAULT_PRINTCAP=""
|
||||
else
|
||||
CUPS_DEFAULT_PRINTCAP="$default_printcap"
|
||||
fi
|
||||
else
|
||||
CUPS_DEFAULT_PRINTCAP=""
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP")
|
||||
|
||||
dnl
|
||||
dnl End of "$Id$".
|
||||
|
||||
@@ -70,6 +70,13 @@
|
||||
#define CUPS_DEFAULT_IPP_PORT 631
|
||||
|
||||
|
||||
/*
|
||||
* Default printcap file...
|
||||
*/
|
||||
|
||||
#define CUPS_DEFAULT_PRINTCAP "/etc/printcap"
|
||||
|
||||
|
||||
/*
|
||||
* Maximum number of file descriptors to support.
|
||||
*/
|
||||
|
||||
+1
-1
@@ -26,7 +26,6 @@ AC_INIT(cups/cups.h)
|
||||
|
||||
sinclude(config-scripts/cups-opsys.m4)
|
||||
sinclude(config-scripts/cups-common.m4)
|
||||
sinclude(config-scripts/cups-defaults.m4)
|
||||
sinclude(config-scripts/cups-directories.m4)
|
||||
sinclude(config-scripts/cups-manpages.m4)
|
||||
|
||||
@@ -43,6 +42,7 @@ sinclude(config-scripts/cups-pam.m4)
|
||||
sinclude(config-scripts/cups-threads.m4)
|
||||
sinclude(config-scripts/cups-largefile.m4)
|
||||
sinclude(config-scripts/cups-launchd.m4)
|
||||
sinclude(config-scripts/cups-defaults.m4)
|
||||
sinclude(config-scripts/cups-pdf.m4)
|
||||
sinclude(config-scripts/cups-scripting.m4)
|
||||
|
||||
|
||||
+2
-4
@@ -172,10 +172,8 @@ install: all installhdrs $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64)
|
||||
|
||||
installstatic:
|
||||
$(INSTALL_DIR) -m 755 $(LIBDIR)
|
||||
if test $(LIBCUPS) != "libcups.a"; then \
|
||||
$(INSTALL_LIB) libcups.a $(LIBDIR); \
|
||||
$(RANLIB) $(LIBDIR)/libcups.a; \
|
||||
fi
|
||||
$(INSTALL_LIB) libcups.a $(LIBDIR)
|
||||
$(RANLIB) $(LIBDIR)/libcups.a
|
||||
|
||||
installhdrs:
|
||||
$(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
|
||||
|
||||
+5
-1
@@ -92,9 +92,13 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
* See if we can do local authentication...
|
||||
*/
|
||||
|
||||
if (!cups_local_auth(http))
|
||||
if (http->digest_tries < 3 && !cups_local_auth(http))
|
||||
{
|
||||
DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n", http->authstring));
|
||||
|
||||
if (http->status == HTTP_UNAUTHORIZED)
|
||||
http->digest_tries ++;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -531,6 +531,16 @@ cupsSetDests2(http_t *http, /* I - HTTP connection */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
/*
|
||||
* Set the permissions to 0644 when saving to the /etc/cups/lpoptions
|
||||
* file...
|
||||
*/
|
||||
|
||||
if (!getuid())
|
||||
fchmod(fileno(fp), 0644);
|
||||
#endif /* !WIN32 */
|
||||
|
||||
/*
|
||||
* Write each printer; each line looks like:
|
||||
*
|
||||
|
||||
+6
-3
@@ -364,7 +364,7 @@ cupsEncodeOptions2(
|
||||
* Copy the name over...
|
||||
*/
|
||||
|
||||
if ((attr->name = strdup(option->name)) == NULL)
|
||||
if ((attr->name = _cupsStrAlloc(option->name)) == NULL)
|
||||
{
|
||||
/*
|
||||
* Ran out of memory!
|
||||
@@ -515,14 +515,14 @@ cupsEncodeOptions2(
|
||||
*/
|
||||
|
||||
attr->values[j].unknown.length = strlen(val);
|
||||
attr->values[j].unknown.data = strdup(val);
|
||||
attr->values[j].unknown.data = _cupsStrAlloc(val);
|
||||
|
||||
DEBUG_printf(("cupsEncodeOptions2: Added octet-string value \"%s\"...\n",
|
||||
attr->values[j].unknown.data));
|
||||
break;
|
||||
|
||||
default :
|
||||
if ((attr->values[j].string.text = strdup(val)) == NULL)
|
||||
if ((attr->values[j].string.text = _cupsStrAlloc(val)) == NULL)
|
||||
{
|
||||
/*
|
||||
* Ran out of memory!
|
||||
@@ -537,6 +537,9 @@ cupsEncodeOptions2(
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (copy)
|
||||
free(copy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-3
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "http-private.h"
|
||||
#include "globals.h"
|
||||
#include "debug.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -101,6 +102,8 @@ _cupsGlobals(void)
|
||||
* Initialize the global data exactly once...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("_cupsGlobals(): globals_key_once=%d\n", globals_key_once));
|
||||
|
||||
pthread_once(&globals_key_once, globals_init);
|
||||
|
||||
/*
|
||||
@@ -109,6 +112,8 @@ _cupsGlobals(void)
|
||||
|
||||
if ((globals = (_cups_globals_t *)pthread_getspecific(globals_key)) == NULL)
|
||||
{
|
||||
DEBUG_puts("_cupsGlobals: allocating memory for thread...");
|
||||
|
||||
/*
|
||||
* No, allocate memory as set the pointer for the key...
|
||||
*/
|
||||
@@ -116,6 +121,8 @@ _cupsGlobals(void)
|
||||
globals = calloc(1, sizeof(_cups_globals_t));
|
||||
pthread_setspecific(globals_key, globals);
|
||||
|
||||
DEBUG_printf((" globals=%p\n", globals));
|
||||
|
||||
/*
|
||||
* Initialize variables that have non-zero values
|
||||
*/
|
||||
@@ -142,6 +149,9 @@ static void
|
||||
globals_init()
|
||||
{
|
||||
pthread_key_create(&globals_key, globals_destructor);
|
||||
|
||||
DEBUG_printf(("globals_init(): globals_key=%x(%u)\n", globals_key,
|
||||
globals_key));
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +166,8 @@ globals_destructor(void *value) /* I - Data to free */
|
||||
_cups_globals_t *cg; /* Global data */
|
||||
|
||||
|
||||
DEBUG_printf(("globals_destructor(value=%p)\n", value));
|
||||
|
||||
cg = (_cups_globals_t *)value;
|
||||
|
||||
httpClose(cg->http);
|
||||
@@ -163,9 +175,8 @@ globals_destructor(void *value) /* I - Data to free */
|
||||
for (i = 0; i < 3; i ++)
|
||||
cupsFileClose(cg->stdio_files[i]);
|
||||
|
||||
_cupsStrFlush(cg);
|
||||
_cupsLangFlush(cg);
|
||||
_cupsCharmapFlush(cg);
|
||||
if (cg->last_status_message)
|
||||
free(cg->last_status_message);
|
||||
|
||||
cupsFreeOptions(cg->cupsd_num_settings, cg->cupsd_settings);
|
||||
|
||||
|
||||
@@ -95,7 +95,6 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
/* Unknown error statuses */
|
||||
|
||||
/* language.c */
|
||||
cups_lang_t *lang_cache; /* Language string cache */
|
||||
cups_lang_t *lang_default; /* Default language */
|
||||
# ifdef __APPLE__
|
||||
# ifdef HAVE_CF_LOCALE_ID
|
||||
@@ -113,10 +112,6 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
/* tempfile.c */
|
||||
char tempfile[1024]; /* cupsTempFd/File buffer */
|
||||
|
||||
/* transcode.c */
|
||||
_cups_cmap_t *cmap_cache; /* SBCS Charmap Cache */
|
||||
_cups_vmap_t *vmap_cache; /* VBCS Charmap Cache */
|
||||
|
||||
/* usersys.c */
|
||||
http_encryption_t encryption; /* Encryption setting */
|
||||
char user[65], /* User name */
|
||||
@@ -134,9 +129,6 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
/* Default printer */
|
||||
char ppd_filename[HTTP_MAX_URI];
|
||||
/* PPD filename */
|
||||
|
||||
/* string.c */
|
||||
cups_array_t *stringpool; /* String pool */
|
||||
} _cups_globals_t;
|
||||
|
||||
|
||||
@@ -144,12 +136,9 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
extern void _cupsCharmapFlush(_cups_globals_t *cg);
|
||||
extern const char *_cupsGetPassword(const char *prompt);
|
||||
extern _cups_globals_t *_cupsGlobals(void);
|
||||
extern void _cupsLangFlush(_cups_globals_t *cg);
|
||||
extern void _cupsSetError(ipp_status_t status, const char *message);
|
||||
extern void _cupsStrFlush(_cups_globals_t *cg);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -411,7 +411,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
# ifdef AF_INET6
|
||||
if (host->h_addrtype == AF_INET6)
|
||||
{
|
||||
first->addr.ipv6.sin6_family = AF_INET6;
|
||||
temp->addr.ipv6.sin6_family = AF_INET6;
|
||||
memcpy(&(temp->addr.ipv6), host->h_addr_list[i],
|
||||
sizeof(temp->addr.ipv6));
|
||||
temp->addr.ipv6.sin6_port = htons(portnum);
|
||||
@@ -419,7 +419,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
else
|
||||
# endif /* AF_INET6 */
|
||||
{
|
||||
first->addr.ipv4.sin_family = AF_INET;
|
||||
temp->addr.ipv4.sin_family = AF_INET;
|
||||
memcpy(&(temp->addr.ipv4), host->h_addr_list[i],
|
||||
sizeof(temp->addr.ipv4));
|
||||
temp->addr.ipv4.sin_port = htons(portnum);
|
||||
|
||||
@@ -100,6 +100,15 @@ typedef struct
|
||||
|
||||
typedef SSLConnectionRef http_tls_t;
|
||||
|
||||
typedef union _cdsa_conn_ref_u /**** CDSA Connection reference union
|
||||
**** used to resolve 64-bit casting
|
||||
**** warnings.
|
||||
****/
|
||||
{
|
||||
SSLConnectionRef connection; /* SSL connection pointer */
|
||||
int sock; /* Socket */
|
||||
} cdsa_conn_ref_t;
|
||||
|
||||
extern OSStatus _httpReadCDSA(SSLConnectionRef connection, void *data,
|
||||
size_t *dataLength);
|
||||
extern OSStatus _httpWriteCDSA(SSLConnectionRef connection, const void *data,
|
||||
|
||||
@@ -1057,7 +1057,7 @@ httpSeparateURI(
|
||||
|
||||
*port = strtol(uri + 1, (char **)&uri, 10);
|
||||
|
||||
if (*uri != '/')
|
||||
if (*uri != '/' && *uri)
|
||||
{
|
||||
*port = 0;
|
||||
return (HTTP_URI_BAD_PORT);
|
||||
@@ -1141,6 +1141,10 @@ httpStatus(http_status_t status) /* I - HTTP status code */
|
||||
return ("Accepted");
|
||||
case HTTP_NO_CONTENT :
|
||||
return ("No Content");
|
||||
case HTTP_MOVED_PERMANENTLY :
|
||||
return ("Moved Permanently");
|
||||
case HTTP_SEE_OTHER :
|
||||
return ("See Other");
|
||||
case HTTP_NOT_MODIFIED :
|
||||
return ("Not Modified");
|
||||
case HTTP_BAD_REQUEST :
|
||||
|
||||
+26
-7
@@ -1388,11 +1388,15 @@ _httpReadCDSA(
|
||||
void *data, /* I - Data buffer */
|
||||
size_t *dataLength) /* IO - Number of bytes */
|
||||
{
|
||||
OSStatus result; /* Return value */
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
OSStatus result; /* Return value */
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
cdsa_conn_ref_t u; /* Connection reference union */
|
||||
|
||||
|
||||
u.connection = connection;
|
||||
|
||||
do
|
||||
bytes = recv((int)connection, data, *dataLength, 0);
|
||||
bytes = recv(u.sock, data, *dataLength, 0);
|
||||
while (bytes == -1 && errno == EINTR);
|
||||
|
||||
if (bytes == *dataLength)
|
||||
@@ -1962,11 +1966,15 @@ _httpWriteCDSA(
|
||||
const void *data, /* I - Data buffer */
|
||||
size_t *dataLength) /* IO - Number of bytes */
|
||||
{
|
||||
OSStatus result; /* Return value */
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
OSStatus result; /* Return value */
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
cdsa_conn_ref_t u; /* Connection reference union */
|
||||
|
||||
|
||||
u.connection = connection;
|
||||
|
||||
do
|
||||
bytes = write((int)connection, data, *dataLength);
|
||||
bytes = write(u.sock, data, *dataLength);
|
||||
while (bytes == -1 && errno == EINTR);
|
||||
|
||||
if (bytes == *dataLength)
|
||||
@@ -2295,13 +2303,24 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
|
||||
conn->credentials = credentials;
|
||||
|
||||
# elif defined(HAVE_CDSASSL)
|
||||
cdsa_conn_ref_t u; /* Connection reference union */
|
||||
|
||||
|
||||
error = SSLNewContext(false, &conn);
|
||||
|
||||
if (!error)
|
||||
error = SSLSetIOFuncs(conn, _httpReadCDSA, _httpWriteCDSA);
|
||||
|
||||
if (!error)
|
||||
error = SSLSetConnection(conn, (SSLConnectionRef)http->fd);
|
||||
{
|
||||
/*
|
||||
* Use a union to resolve warnings about int/pointer size mismatches...
|
||||
*/
|
||||
|
||||
u.connection = NULL;
|
||||
u.sock = http->fd;
|
||||
error = SSLSetConnection(conn, u.connection);
|
||||
}
|
||||
|
||||
if (!error)
|
||||
error = SSLSetAllowsExpiredCerts(conn, true);
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include <stdio.h>
|
||||
# include "transcode.h"
|
||||
|
||||
# ifdef __cplusplus
|
||||
@@ -90,6 +91,7 @@ typedef struct _cups_vmap_s /**** VBCS Charmap Struct ****/
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
extern void _cupsCharmapFlush(void);
|
||||
extern void _cupsCharmapFree(const cups_encoding_t encoding);
|
||||
extern void *_cupsCharmapGet(const cups_encoding_t encoding);
|
||||
extern const char *_cupsEncodingName(cups_encoding_t encoding);
|
||||
|
||||
+75
-28
@@ -31,7 +31,6 @@
|
||||
* cupsLangEncoding() - Return the character encoding (us-ascii, etc.)
|
||||
* for the given language.
|
||||
* cupsLangFlush() - Flush all language data out of the cache.
|
||||
* _cupsLangFlush() - Flush all language data out of the cache.
|
||||
* cupsLangFree() - Free language data.
|
||||
* cupsLangGet() - Get a language.
|
||||
* _cupsLangString() - Get a message string.
|
||||
@@ -65,6 +64,18 @@
|
||||
#endif /* HAVE_COREFOUNDATION_H */
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
static pthread_mutex_t lang_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
/* Mutex to control access to cache */
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
static cups_lang_t *lang_cache = NULL;
|
||||
/* Language string cache */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
@@ -203,17 +214,6 @@ cupsLangEncoding(cups_lang_t *lang) /* I - Language data */
|
||||
|
||||
void
|
||||
cupsLangFlush(void)
|
||||
{
|
||||
_cupsLangFlush(_cupsGlobals());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsLangFlush()' - Flush all language data out of the cache.
|
||||
*/
|
||||
|
||||
void
|
||||
_cupsLangFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
{
|
||||
cups_lang_t *lang, /* Current language */
|
||||
*next; /* Next language */
|
||||
@@ -223,7 +223,11 @@ _cupsLangFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
* Free all languages in the cache...
|
||||
*/
|
||||
|
||||
for (lang = cg->lang_cache; lang != NULL; lang = next)
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
for (lang = lang_cache; lang != NULL; lang = next)
|
||||
{
|
||||
/*
|
||||
* Free all messages...
|
||||
@@ -239,7 +243,11 @@ _cupsLangFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
free(lang);
|
||||
}
|
||||
|
||||
cg->lang_cache = NULL;
|
||||
lang_cache = NULL;
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
}
|
||||
|
||||
|
||||
@@ -252,8 +260,16 @@ _cupsLangFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
void
|
||||
cupsLangFree(cups_lang_t *lang) /* I - Language to free */
|
||||
{
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
if (lang != NULL && lang->used > 0)
|
||||
lang->used --;
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
}
|
||||
|
||||
|
||||
@@ -558,14 +574,27 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
{
|
||||
snprintf(real, sizeof(real), "%s_%s", langname, country);
|
||||
|
||||
if ((lang = cups_cache_lookup(real, encoding)) != NULL)
|
||||
return (lang);
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/%s/cups_%s.po", cg->localedir,
|
||||
real, real);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(real, langname);
|
||||
filename[0] = '\0'; /* anti-compiler-warning-code */
|
||||
}
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
if ((lang = cups_cache_lookup(langname, encoding)) != NULL)
|
||||
{
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (lang);
|
||||
}
|
||||
|
||||
if (!country[0] || access(filename, 0))
|
||||
{
|
||||
@@ -573,9 +602,6 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
* Country localization not available, look for generic localization...
|
||||
*/
|
||||
|
||||
if ((lang = cups_cache_lookup(langname, encoding)) != NULL)
|
||||
return (lang);
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/%s/cups_%s.po", cg->localedir,
|
||||
langname, langname);
|
||||
|
||||
@@ -587,11 +613,8 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
|
||||
DEBUG_printf(("access(\"%s\", 0): %s\n", filename, strerror(errno)));
|
||||
|
||||
strcpy(real, "C");
|
||||
snprintf(filename, sizeof(filename), "%s/C/cups_C.po", cg->localedir);
|
||||
}
|
||||
else
|
||||
strcpy(real, langname);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -599,7 +622,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
* record...
|
||||
*/
|
||||
|
||||
for (lang = cg->lang_cache; lang != NULL; lang = lang->next)
|
||||
for (lang = lang_cache; lang != NULL; lang = lang->next)
|
||||
if (lang->used == 0)
|
||||
break;
|
||||
|
||||
@@ -610,10 +633,16 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
*/
|
||||
|
||||
if ((lang = calloc(sizeof(cups_lang_t), 1)) == NULL)
|
||||
return (NULL);
|
||||
{
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
lang->next = cg->lang_cache;
|
||||
cg->lang_cache = lang;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
lang->next = lang_cache;
|
||||
lang_cache = lang;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -646,6 +675,10 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
* Return...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (lang);
|
||||
}
|
||||
|
||||
@@ -668,7 +701,21 @@ _cupsLangString(cups_lang_t *lang, /* I - Language */
|
||||
if (!lang || !message)
|
||||
return (message);
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
{
|
||||
const char *s; /* Localized message */
|
||||
|
||||
pthread_mutex_lock(&lang_mutex);
|
||||
|
||||
s = _cupsMessageLookup(lang->strings, message);
|
||||
|
||||
pthread_mutex_unlock(&lang_mutex);
|
||||
|
||||
return (s);
|
||||
}
|
||||
#else
|
||||
return (_cupsMessageLookup(lang->strings, message));
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
}
|
||||
|
||||
|
||||
@@ -1166,7 +1213,7 @@ cups_cache_lookup(const char *name,/* I - Name of locale */
|
||||
* Loop through the cache and return a match if found...
|
||||
*/
|
||||
|
||||
for (lang = _cupsGlobals()->lang_cache; lang != NULL; lang = lang->next)
|
||||
for (lang = lang_cache; lang != NULL; lang = lang->next)
|
||||
{
|
||||
DEBUG_printf(("cups_cache_lookup: lang=%p, language=\"%s\", encoding=%d(%s)\n",
|
||||
lang, lang->language, lang->encoding,
|
||||
|
||||
+39
-34
@@ -64,6 +64,7 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
|
||||
ipp_t *response; /* IPP response data */
|
||||
size_t length; /* Content-Length value */
|
||||
http_status_t status; /* Status of HTTP request */
|
||||
int got_status; /* Did we get the status? */
|
||||
ipp_state_t state; /* State of IPP processing */
|
||||
FILE *file; /* File to send */
|
||||
struct stat fileinfo; /* File information */
|
||||
@@ -184,54 +185,58 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait up to 1 second for a 100-continue response...
|
||||
* Send the IPP data...
|
||||
*/
|
||||
|
||||
if (httpWait(http, 1000))
|
||||
status = httpUpdate(http);
|
||||
else
|
||||
status = HTTP_CONTINUE;
|
||||
DEBUG_puts("cupsDoFileRequest: ipp write...");
|
||||
|
||||
if (status == HTTP_CONTINUE)
|
||||
request->state = IPP_IDLE;
|
||||
status = HTTP_CONTINUE;
|
||||
got_status = 0;
|
||||
|
||||
while ((state = ippWrite(http, request)) != IPP_DATA)
|
||||
if (state == IPP_ERROR)
|
||||
break;
|
||||
else if (httpCheck(http))
|
||||
{
|
||||
got_status = 1;
|
||||
|
||||
if ((status = httpUpdate(http)) != HTTP_CONTINUE)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!got_status)
|
||||
{
|
||||
/*
|
||||
* Send the IPP data...
|
||||
* Wait up to 1 second to get the 100-continue response...
|
||||
*/
|
||||
|
||||
DEBUG_puts("cupsDoFileRequest: ipp write...");
|
||||
if (httpWait(http, 1000))
|
||||
status = httpUpdate(http);
|
||||
}
|
||||
else if (httpCheck(http))
|
||||
status = httpUpdate(http);
|
||||
|
||||
request->state = IPP_IDLE;
|
||||
if (status == HTTP_CONTINUE && state == IPP_DATA && filename)
|
||||
{
|
||||
DEBUG_puts("cupsDoFileRequest: file write...");
|
||||
|
||||
while ((state = ippWrite(http, request)) != IPP_DATA)
|
||||
if (state == IPP_ERROR)
|
||||
break;
|
||||
else if (httpCheck(http))
|
||||
/*
|
||||
* Send the file...
|
||||
*/
|
||||
|
||||
rewind(file);
|
||||
|
||||
while ((bytes = (int)fread(buffer, 1, sizeof(buffer), file)) > 0)
|
||||
{
|
||||
if (httpCheck(http))
|
||||
{
|
||||
if ((status = httpUpdate(http)) != HTTP_CONTINUE)
|
||||
break;
|
||||
}
|
||||
|
||||
if (state == IPP_DATA && filename)
|
||||
{
|
||||
DEBUG_puts("cupsDoFileRequest: file write...");
|
||||
|
||||
/*
|
||||
* Send the file...
|
||||
*/
|
||||
|
||||
rewind(file);
|
||||
|
||||
while ((bytes = (int)fread(buffer, 1, sizeof(buffer), file)) > 0)
|
||||
{
|
||||
if (httpCheck(http))
|
||||
{
|
||||
if ((status = httpUpdate(http)) != HTTP_CONTINUE)
|
||||
break;
|
||||
}
|
||||
|
||||
if (httpWrite2(http, buffer, bytes) < bytes)
|
||||
break;
|
||||
}
|
||||
if (httpWrite2(http, buffer, bytes) < bytes)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+91
-23
@@ -46,9 +46,24 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include "array.h"
|
||||
#include "debug.h"
|
||||
#include "string.h"
|
||||
#include "globals.h"
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
# include <pthread.h>
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
static pthread_mutex_t sp_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
/* Mutex to control access to pool */
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
static cups_array_t *stringpool = NULL;
|
||||
/* Global string pool */
|
||||
|
||||
|
||||
/*
|
||||
@@ -65,7 +80,6 @@ static int compare_sp_items(_cups_sp_item_t *a, _cups_sp_item_t *b);
|
||||
char * /* O - String pointer */
|
||||
_cupsStrAlloc(const char *s) /* I - String */
|
||||
{
|
||||
_cups_globals_t *cg; /* Global data */
|
||||
_cups_sp_item_t *item, /* String pool item */
|
||||
key; /* Search key */
|
||||
|
||||
@@ -81,13 +95,21 @@ _cupsStrAlloc(const char *s) /* I - String */
|
||||
* Get the string pool...
|
||||
*/
|
||||
|
||||
cg = _cupsGlobals();
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
if (!cg->stringpool)
|
||||
cg->stringpool = cupsArrayNew((cups_array_func_t)compare_sp_items, NULL);
|
||||
if (!stringpool)
|
||||
stringpool = cupsArrayNew((cups_array_func_t)compare_sp_items, NULL);
|
||||
|
||||
if (!stringpool)
|
||||
{
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
if (!cg->stringpool)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if the string is already in the pool...
|
||||
@@ -95,7 +117,7 @@ _cupsStrAlloc(const char *s) /* I - String */
|
||||
|
||||
key.str = (char *)s;
|
||||
|
||||
if ((item = (_cups_sp_item_t *)cupsArrayFind(cg->stringpool, &key)) != NULL)
|
||||
if ((item = (_cups_sp_item_t *)cupsArrayFind(stringpool, &key)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Found it, return the cached string...
|
||||
@@ -103,6 +125,10 @@ _cupsStrAlloc(const char *s) /* I - String */
|
||||
|
||||
item->ref_count ++;
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (item->str);
|
||||
}
|
||||
|
||||
@@ -112,7 +138,13 @@ _cupsStrAlloc(const char *s) /* I - String */
|
||||
|
||||
item = (_cups_sp_item_t *)calloc(1, sizeof(_cups_sp_item_t));
|
||||
if (!item)
|
||||
{
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
item->ref_count = 1;
|
||||
item->str = strdup(s);
|
||||
@@ -120,6 +152,11 @@ _cupsStrAlloc(const char *s) /* I - String */
|
||||
if (!item->str)
|
||||
{
|
||||
free(item);
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -127,7 +164,11 @@ _cupsStrAlloc(const char *s) /* I - String */
|
||||
* Add the string to the pool and return it...
|
||||
*/
|
||||
|
||||
cupsArrayAdd(cg->stringpool, item);
|
||||
cupsArrayAdd(stringpool, item);
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (item->str);
|
||||
}
|
||||
@@ -138,20 +179,32 @@ _cupsStrAlloc(const char *s) /* I - String */
|
||||
*/
|
||||
|
||||
void
|
||||
_cupsStrFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
_cupsStrFlush(void)
|
||||
{
|
||||
_cups_sp_item_t *item; /* Current item */
|
||||
|
||||
|
||||
for (item = (_cups_sp_item_t *)cupsArrayFirst(cg->stringpool);
|
||||
DEBUG_printf(("_cupsStrFlush(cg=%p)\n", cg));
|
||||
DEBUG_printf((" %d strings in array\n", cupsArrayCount(stringpool)));
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
for (item = (_cups_sp_item_t *)cupsArrayFirst(stringpool);
|
||||
item;
|
||||
item = (_cups_sp_item_t *)cupsArrayNext(cg->stringpool))
|
||||
item = (_cups_sp_item_t *)cupsArrayNext(stringpool))
|
||||
{
|
||||
free(item->str);
|
||||
free(item);
|
||||
}
|
||||
|
||||
cupsArrayDelete(cg->stringpool);
|
||||
cupsArrayDelete(stringpool);
|
||||
stringpool = NULL;
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
}
|
||||
|
||||
|
||||
@@ -242,7 +295,6 @@ _cupsStrFormatd(char *buf, /* I - String */
|
||||
void
|
||||
_cupsStrFree(const char *s) /* I - String to free */
|
||||
{
|
||||
_cups_globals_t *cg; /* Global data */
|
||||
_cups_sp_item_t *item, /* String pool item */
|
||||
key; /* Search key */
|
||||
|
||||
@@ -255,21 +307,28 @@ _cupsStrFree(const char *s) /* I - String to free */
|
||||
return;
|
||||
|
||||
/*
|
||||
* Get the string pool...
|
||||
* Check the string pool...
|
||||
*
|
||||
* We don't need to lock the mutex yet, as we only want to know if
|
||||
* the stringpool is initialized. The rest of the code will still
|
||||
* work if it is initialized before we lock...
|
||||
*/
|
||||
|
||||
cg = _cupsGlobals();
|
||||
|
||||
if (!cg->stringpool)
|
||||
if (!stringpool)
|
||||
return;
|
||||
|
||||
/*
|
||||
* See if the string is already in the pool...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
key.str = (char *)s;
|
||||
|
||||
if ((item = (_cups_sp_item_t *)cupsArrayFind(cg->stringpool, &key)) != NULL)
|
||||
if ((item = (_cups_sp_item_t *)cupsArrayFind(stringpool, &key)) != NULL &&
|
||||
item->str == s)
|
||||
{
|
||||
/*
|
||||
* Found it, dereference...
|
||||
@@ -283,12 +342,16 @@ _cupsStrFree(const char *s) /* I - String to free */
|
||||
* Remove and free...
|
||||
*/
|
||||
|
||||
cupsArrayRemove(cg->stringpool, item);
|
||||
cupsArrayRemove(stringpool, item);
|
||||
|
||||
free(item->str);
|
||||
free(item);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
}
|
||||
|
||||
|
||||
@@ -402,19 +465,20 @@ _cupsStrStatistics(size_t *alloc_bytes, /* O - Allocated bytes */
|
||||
tbytes, /* Total string bytes */
|
||||
len; /* Length of string */
|
||||
_cups_sp_item_t *item; /* Current item */
|
||||
_cups_globals_t *cg; /* Global data */
|
||||
|
||||
|
||||
/*
|
||||
* Loop through strings in pool, counting everything up...
|
||||
*/
|
||||
|
||||
cg = _cupsGlobals();
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
for (count = 0, abytes = 0, tbytes = 0,
|
||||
item = (_cups_sp_item_t *)cupsArrayFirst(cg->stringpool);
|
||||
item = (_cups_sp_item_t *)cupsArrayFirst(stringpool);
|
||||
item;
|
||||
item = (_cups_sp_item_t *)cupsArrayNext(cg->stringpool))
|
||||
item = (_cups_sp_item_t *)cupsArrayNext(stringpool))
|
||||
{
|
||||
/*
|
||||
* Count allocated memory, using a 64-bit aligned buffer as a basis.
|
||||
@@ -426,6 +490,10 @@ _cupsStrStatistics(size_t *alloc_bytes, /* O - Allocated bytes */
|
||||
tbytes += item->ref_count * len;
|
||||
}
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
/*
|
||||
* Return values...
|
||||
*/
|
||||
|
||||
@@ -131,6 +131,7 @@ extern int _cups_vsnprintf(char *, size_t, const char *, va_list);
|
||||
*/
|
||||
|
||||
extern char *_cupsStrAlloc(const char *s);
|
||||
extern void _cupsStrFlush(void);
|
||||
extern void _cupsStrFree(const char *s);
|
||||
extern size_t _cupsStrStatistics(size_t *alloc_bytes, size_t *total_bytes);
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
*OpenUI IntOption/Integer: PickOne
|
||||
*OrderDependency: 10 AnySetup *IntOption
|
||||
*DefaultIntOption: None
|
||||
*IntOption None: ""
|
||||
*IntOption 1: "IntOption=1"
|
||||
*IntOption 2: "IntOption=2"
|
||||
*IntOption 3: "IntOption=3"
|
||||
@@ -137,6 +138,7 @@
|
||||
*OpenUI StringOption/String: PickOne
|
||||
*OrderDependency: 10 AnySetup *StringOption
|
||||
*DefaultStringOption: None
|
||||
*StringOption None: ""
|
||||
*StringOption foo: "StringOption=foo"
|
||||
*StringOption bar: "StringOption=bar"
|
||||
*CloseUI: *StringOption
|
||||
|
||||
@@ -94,6 +94,8 @@ static uri_test_t uri_tests[] = /* URI test data */
|
||||
"mailto", "", "", "user@domain.com", 0, 0 },
|
||||
{ HTTP_URI_OK, "socket://server/",
|
||||
"socket", "", "server", "/", 9100, 0 },
|
||||
{ HTTP_URI_OK, "socket://192.168.1.1:9101/",
|
||||
"socket", "", "192.168.1.1", "/", 9101, 9101 },
|
||||
{ HTTP_URI_OK, "ipp://username:password@[v1.fe80::200:1234:5678:9abc+eth0]:999/ipp",
|
||||
"ipp", "username:password", "fe80::200:1234:5678:9abc%eth0", "/ipp", 999, 999 },
|
||||
{ HTTP_URI_OK, "http://server/admin?DEVICE_URI=usb://HP/Photosmart%25202600%2520series?serial=MY53OK70V10400",
|
||||
@@ -112,6 +114,8 @@ static uri_test_t uri_tests[] = /* URI test data */
|
||||
/* Missing resource */
|
||||
{ HTTP_URI_MISSING_RESOURCE, "socket://[::192.168.2.1]",
|
||||
"socket", "", "::192.168.2.1", "/", 9100, 0 },
|
||||
{ HTTP_URI_MISSING_RESOURCE, "socket://192.168.1.1:9101",
|
||||
"socket", "", "192.168.1.1", "/", 9101 },
|
||||
|
||||
/* Bad URI */
|
||||
{ HTTP_URI_BAD_URI, "",
|
||||
|
||||
+145
-49
@@ -37,6 +37,7 @@
|
||||
* conv_vbcs_to_utf8() - Convert legacy DBCS/VBCS to UTF-8.
|
||||
* free_sbcs_charmap() - Free memory used by a single byte character set.
|
||||
* free_vbcs_charmap() - Free memory used by a variable byte character set.
|
||||
* get_charmap() - Lookup or get a character set map (private).
|
||||
* get_charmap_count() - Count lines in a charmap file.
|
||||
* get_sbcs_charmap() - Get SBCS Charmap.
|
||||
* get_vbcs_charmap() - Get DBCS/VBCS Charmap.
|
||||
@@ -48,11 +49,26 @@
|
||||
|
||||
#include "globals.h"
|
||||
#include "debug.h"
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
static pthread_mutex_t map_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
/* Mutex to control access to maps */
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
static _cups_cmap_t *cmap_cache = NULL;
|
||||
/* SBCS Charmap Cache */
|
||||
static _cups_vmap_t *vmap_cache = NULL;
|
||||
/* VBCS Charmap Cache */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
@@ -76,6 +92,7 @@ static int conv_vbcs_to_utf8(cups_utf8_t *dest,
|
||||
const cups_encoding_t encoding);
|
||||
static void free_sbcs_charmap(_cups_cmap_t *sbcs);
|
||||
static void free_vbcs_charmap(_cups_vmap_t *vbcs);
|
||||
static void *get_charmap(const cups_encoding_t encoding);
|
||||
static int get_charmap_count(cups_file_t *fp);
|
||||
static _cups_cmap_t *get_sbcs_charmap(const cups_encoding_t encoding,
|
||||
const char *filename);
|
||||
@@ -88,7 +105,7 @@ static _cups_vmap_t *get_vbcs_charmap(const cups_encoding_t encoding,
|
||||
*/
|
||||
|
||||
void
|
||||
_cupsCharmapFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
_cupsCharmapFlush(void)
|
||||
{
|
||||
_cups_cmap_t *cmap, /* Legacy SBCS / Unicode Charset Map */
|
||||
*cnext; /* Next Legacy SBCS Charset Map */
|
||||
@@ -96,24 +113,28 @@ _cupsCharmapFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
*vnext; /* Next Legacy VBCS Charset Map */
|
||||
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
/*
|
||||
* Loop through SBCS charset map cache, free all memory...
|
||||
*/
|
||||
|
||||
for (cmap = cg->cmap_cache; cmap; cmap = cnext)
|
||||
for (cmap = cmap_cache; cmap; cmap = cnext)
|
||||
{
|
||||
cnext = cmap->next;
|
||||
|
||||
free_sbcs_charmap(cmap);
|
||||
}
|
||||
|
||||
cg->cmap_cache = NULL;
|
||||
cmap_cache = NULL;
|
||||
|
||||
/*
|
||||
* Loop through DBCS/VBCS charset map cache, free all memory...
|
||||
*/
|
||||
|
||||
for (vmap = cg->vmap_cache; vmap; vmap = vnext)
|
||||
for (vmap = vmap_cache; vmap; vmap = vnext)
|
||||
{
|
||||
vnext = vmap->next;
|
||||
|
||||
@@ -122,7 +143,11 @@ _cupsCharmapFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
free(vmap);
|
||||
}
|
||||
|
||||
cg->vmap_cache = NULL;
|
||||
vmap_cache = NULL;
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
}
|
||||
|
||||
|
||||
@@ -138,21 +163,23 @@ _cupsCharmapFree(
|
||||
{
|
||||
_cups_cmap_t *cmap; /* Legacy SBCS / Unicode Charset Map */
|
||||
_cups_vmap_t *vmap; /* Legacy VBCS / Unicode Charset Map */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
|
||||
|
||||
|
||||
/*
|
||||
* See if we already have this SBCS charset map loaded...
|
||||
*/
|
||||
|
||||
for (cmap = cg->cmap_cache; cmap; cmap = cmap->next)
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
for (cmap = cmap_cache; cmap; cmap = cmap->next)
|
||||
{
|
||||
if (cmap->encoding == encoding)
|
||||
{
|
||||
if (cmap->used > 0)
|
||||
cmap->used --;
|
||||
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,15 +187,19 @@ _cupsCharmapFree(
|
||||
* See if we already have this DBCS/VBCS charset map loaded...
|
||||
*/
|
||||
|
||||
for (vmap = cg->vmap_cache; vmap; vmap = vmap->next)
|
||||
for (vmap = vmap_cache; vmap; vmap = vmap->next)
|
||||
{
|
||||
if (vmap->encoding == encoding)
|
||||
{
|
||||
if (vmap->used > 0)
|
||||
vmap->used --;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
}
|
||||
|
||||
|
||||
@@ -185,8 +216,7 @@ void * /* O - Charset map pointer */
|
||||
_cupsCharmapGet(
|
||||
const cups_encoding_t encoding) /* I - Encoding */
|
||||
{
|
||||
char filename[1024]; /* Filename for charset map file */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
void *charmap; /* Charset map pointer */
|
||||
|
||||
|
||||
DEBUG_printf(("_cupsCharmapGet(encoding=%d)\n", encoding));
|
||||
@@ -202,24 +232,20 @@ _cupsCharmapGet(
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the data directory and charset map name...
|
||||
* Lookup or get the charset map pointer and return...
|
||||
*/
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/charmaps/%s.txt",
|
||||
cg->cups_datadir, _cupsEncodingName(encoding));
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
DEBUG_printf((" filename=\"%s\"\n", filename));
|
||||
charmap = get_charmap(encoding);
|
||||
|
||||
/*
|
||||
* Read charset map input file into cache...
|
||||
*/
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
if (encoding < CUPS_ENCODING_SBCS_END)
|
||||
return (get_sbcs_charmap(encoding, filename));
|
||||
else if (encoding < CUPS_ENCODING_VBCS_END)
|
||||
return (get_vbcs_charmap(encoding, filename));
|
||||
else
|
||||
return (NULL);
|
||||
return (charmap);
|
||||
}
|
||||
|
||||
|
||||
@@ -239,6 +265,9 @@ cupsCharsetToUTF8(
|
||||
const int maxout, /* I - Max output */
|
||||
const cups_encoding_t encoding) /* I - Encoding */
|
||||
{
|
||||
int bytes; /* Number of bytes converted */
|
||||
|
||||
|
||||
/*
|
||||
* Check for valid arguments...
|
||||
*/
|
||||
@@ -270,15 +299,25 @@ cupsCharsetToUTF8(
|
||||
* Convert input legacy charset to UTF-8...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
if (encoding < CUPS_ENCODING_SBCS_END)
|
||||
return (conv_sbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding));
|
||||
bytes = conv_sbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding);
|
||||
else if (encoding < CUPS_ENCODING_VBCS_END)
|
||||
return (conv_vbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding));
|
||||
bytes = conv_vbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding);
|
||||
else
|
||||
{
|
||||
puts(" Bad encoding, returning -1");
|
||||
return (-1);
|
||||
DEBUG_puts(" Bad encoding, returning -1");
|
||||
bytes = -1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (bytes);
|
||||
}
|
||||
|
||||
|
||||
@@ -298,6 +337,9 @@ cupsUTF8ToCharset(
|
||||
const int maxout, /* I - Max output */
|
||||
const cups_encoding_t encoding) /* I - Encoding */
|
||||
{
|
||||
int bytes; /* Number of bytes converted */
|
||||
|
||||
|
||||
/*
|
||||
* Check for valid arguments...
|
||||
*/
|
||||
@@ -325,12 +367,22 @@ cupsUTF8ToCharset(
|
||||
* Convert input UTF-8 to legacy charset...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
if (encoding < CUPS_ENCODING_SBCS_END)
|
||||
return (conv_utf8_to_sbcs((cups_sbcs_t *)dest, src, maxout, encoding));
|
||||
bytes = conv_utf8_to_sbcs((cups_sbcs_t *)dest, src, maxout, encoding);
|
||||
else if (encoding < CUPS_ENCODING_VBCS_END)
|
||||
return (conv_utf8_to_vbcs((cups_sbcs_t *)dest, src, maxout, encoding));
|
||||
bytes = conv_utf8_to_vbcs((cups_sbcs_t *)dest, src, maxout, encoding);
|
||||
else
|
||||
return (-1);
|
||||
bytes = -1;
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (bytes);
|
||||
}
|
||||
|
||||
|
||||
@@ -675,7 +727,7 @@ conv_sbcs_to_utf8(
|
||||
* Find legacy charset map in cache...
|
||||
*/
|
||||
|
||||
if ((cmap = (_cups_cmap_t *)_cupsCharmapGet(encoding)) == NULL)
|
||||
if ((cmap = (_cups_cmap_t *)get_charmap(encoding)) == NULL)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
@@ -714,7 +766,7 @@ conv_sbcs_to_utf8(
|
||||
* Convert internal UCS-4 to output UTF-8 (and delete BOM)...
|
||||
*/
|
||||
|
||||
_cupsCharmapFree(encoding);
|
||||
cmap->used --;
|
||||
|
||||
return (cupsUTF32ToUTF8(dest, work, maxout));
|
||||
}
|
||||
@@ -743,7 +795,7 @@ conv_utf8_to_sbcs(
|
||||
* Find legacy charset map in cache...
|
||||
*/
|
||||
|
||||
if ((cmap = (_cups_cmap_t *) _cupsCharmapGet(encoding)) == NULL)
|
||||
if ((cmap = (_cups_cmap_t *)get_charmap(encoding)) == NULL)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
@@ -790,7 +842,7 @@ conv_utf8_to_sbcs(
|
||||
|
||||
*dest = '\0';
|
||||
|
||||
_cupsCharmapFree(encoding);
|
||||
cmap->used --;
|
||||
|
||||
return ((int)(dest - start));
|
||||
}
|
||||
@@ -820,7 +872,7 @@ conv_utf8_to_vbcs(
|
||||
* Find legacy charset map in cache...
|
||||
*/
|
||||
|
||||
if ((vmap = (_cups_vmap_t *)_cupsCharmapGet(encoding)) == NULL)
|
||||
if ((vmap = (_cups_vmap_t *)get_charmap(encoding)) == NULL)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
@@ -902,7 +954,7 @@ conv_utf8_to_vbcs(
|
||||
|
||||
*dest = '\0';
|
||||
|
||||
_cupsCharmapFree(encoding);
|
||||
vmap->used --;
|
||||
|
||||
return ((int)(dest - start));
|
||||
}
|
||||
@@ -932,7 +984,7 @@ conv_vbcs_to_utf8(
|
||||
* Find legacy charset map in cache...
|
||||
*/
|
||||
|
||||
if ((vmap = (_cups_vmap_t *)_cupsCharmapGet(encoding)) == NULL)
|
||||
if ((vmap = (_cups_vmap_t *)get_charmap(encoding)) == NULL)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
@@ -1027,7 +1079,7 @@ conv_vbcs_to_utf8(
|
||||
|
||||
*workptr = 0;
|
||||
|
||||
_cupsCharmapFree(encoding);
|
||||
vmap->used --;
|
||||
|
||||
/*
|
||||
* Convert internal UCS-4 to output UTF-8 (and delete BOM)...
|
||||
@@ -1080,6 +1132,46 @@ free_vbcs_charmap(_cups_vmap_t *vmap) /* I - Character set */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'get_charmap()' - Lookup or get a character set map (private).
|
||||
*
|
||||
* This code handles single-byte (SBCS), double-byte (DBCS), and
|
||||
* variable-byte (VBCS) character sets _without_ charset escapes...
|
||||
* This code does not handle multiple-byte character sets (MBCS)
|
||||
* (such as ISO-2022-JP) with charset switching via escapes...
|
||||
*/
|
||||
|
||||
|
||||
void * /* O - Charset map pointer */
|
||||
get_charmap(
|
||||
const cups_encoding_t encoding) /* I - Encoding */
|
||||
{
|
||||
char filename[1024]; /* Filename for charset map file */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
|
||||
|
||||
/*
|
||||
* Get the data directory and charset map name...
|
||||
*/
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/charmaps/%s.txt",
|
||||
cg->cups_datadir, _cupsEncodingName(encoding));
|
||||
|
||||
DEBUG_printf((" filename=\"%s\"\n", filename));
|
||||
|
||||
/*
|
||||
* Read charset map input file into cache...
|
||||
*/
|
||||
|
||||
if (encoding < CUPS_ENCODING_SBCS_END)
|
||||
return (get_sbcs_charmap(encoding, filename));
|
||||
else if (encoding < CUPS_ENCODING_VBCS_END)
|
||||
return (get_vbcs_charmap(encoding, filename));
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'get_charmap_count()' - Count lines in a charmap file.
|
||||
*/
|
||||
@@ -1129,19 +1221,19 @@ get_sbcs_charmap(
|
||||
cups_ucs2_t *crow; /* Pointer to UCS-2 row in 'char2uni' */
|
||||
cups_sbcs_t *srow; /* Pointer to SBCS row in 'uni2char' */
|
||||
char line[256]; /* Line from charset map file */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
|
||||
|
||||
|
||||
/*
|
||||
* See if we already have this SBCS charset map loaded...
|
||||
*/
|
||||
|
||||
for (cmap = cg->cmap_cache; cmap; cmap = cmap->next)
|
||||
for (cmap = cmap_cache; cmap; cmap = cmap->next)
|
||||
{
|
||||
if (cmap->encoding == encoding)
|
||||
{
|
||||
cmap->used ++;
|
||||
DEBUG_printf((" returning existing cmap=%p\n", cmap));
|
||||
|
||||
return ((void *)cmap);
|
||||
}
|
||||
}
|
||||
@@ -1161,6 +1253,7 @@ get_sbcs_charmap(
|
||||
{
|
||||
cupsFileClose(fp);
|
||||
DEBUG_puts(" Unable to allocate memory!");
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -1228,8 +1321,8 @@ get_sbcs_charmap(
|
||||
* Add it to the cache and return...
|
||||
*/
|
||||
|
||||
cmap->next = cg->cmap_cache;
|
||||
cg->cmap_cache = cmap;
|
||||
cmap->next = cmap_cache;
|
||||
cmap_cache = cmap;
|
||||
|
||||
DEBUG_printf((" returning new cmap=%p\n", cmap));
|
||||
|
||||
@@ -1273,7 +1366,6 @@ get_vbcs_charmap(
|
||||
char line[256]; /* Line from charset map file */
|
||||
int i; /* Loop variable */
|
||||
int wide; /* 32-bit legacy char */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
|
||||
|
||||
|
||||
DEBUG_printf(("get_vbcs_charmap(encoding=%d, filename=\"%s\")\n",
|
||||
@@ -1283,12 +1375,13 @@ get_vbcs_charmap(
|
||||
* See if we already have this DBCS/VBCS charset map loaded...
|
||||
*/
|
||||
|
||||
for (vmap = cg->vmap_cache; vmap; vmap = vmap->next)
|
||||
for (vmap = vmap_cache; vmap; vmap = vmap->next)
|
||||
{
|
||||
if (vmap->encoding == encoding)
|
||||
{
|
||||
vmap->used ++;
|
||||
DEBUG_printf((" returning existing vmap=%p\n", vmap));
|
||||
|
||||
return ((void *)vmap);
|
||||
}
|
||||
}
|
||||
@@ -1300,6 +1393,7 @@ get_vbcs_charmap(
|
||||
if ((fp = cupsFileOpen(filename, "r")) == NULL)
|
||||
{
|
||||
DEBUG_printf((" Unable to open file: %s\n", strerror(errno)));
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -1310,6 +1404,7 @@ get_vbcs_charmap(
|
||||
if ((mapcount = get_charmap_count(fp)) <= 0)
|
||||
{
|
||||
DEBUG_puts(" Unable to get charmap count!");
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -1323,6 +1418,7 @@ get_vbcs_charmap(
|
||||
{
|
||||
cupsFileClose(fp);
|
||||
DEBUG_puts(" Unable to allocate memory!");
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -1465,8 +1561,8 @@ get_vbcs_charmap(
|
||||
* Add it to the cache and return...
|
||||
*/
|
||||
|
||||
vmap->next = cg->vmap_cache;
|
||||
cg->vmap_cache = vmap;
|
||||
vmap->next = vmap_cache;
|
||||
vmap_cache = vmap;
|
||||
|
||||
DEBUG_printf((" returning new vmap=%p\n", vmap));
|
||||
|
||||
|
||||
@@ -17,3 +17,5 @@ Type=Application
|
||||
X-DCOP-ServiceType=
|
||||
X-KDE-SubstituteUID=false
|
||||
X-KDE-Username=
|
||||
Name[es]=Administrar impresión
|
||||
Comment[es]=Interfaz Web de CUPS
|
||||
|
||||
@@ -133,7 +133,7 @@ WIDTH="15" HEIGHT="15" ALT=""></TD>
|
||||
|
||||
<P><SMALL>Common UNIX Printing System, CUPS, y el logo de CUPS son
|
||||
marcas registradas de <A HREF="http://www.easysw.com">Easy Software
|
||||
Products</A>. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products,
|
||||
Products</A>. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products.
|
||||
Todos los derechos reservados.</SMALL></P>
|
||||
|
||||
</TD>
|
||||
|
||||
+2
-4
@@ -107,10 +107,8 @@ install: all installhdrs $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64)
|
||||
|
||||
installstatic:
|
||||
$(INSTALL_DIR) -m 755 $(LIBDIR)
|
||||
-if test $(LIBCUPSIMAGE) != "libcupsimage.a"; then \
|
||||
$(INSTALL_LIB) libcupsimage.a $(LIBDIR); \
|
||||
$(RANLIB) $(LIBDIR)/libcupsimage.a; \
|
||||
fi
|
||||
$(INSTALL_LIB) libcupsimage.a $(LIBDIR);
|
||||
$(RANLIB) $(LIBDIR)/libcupsimage.a;
|
||||
|
||||
installhdrs:
|
||||
$(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
|
||||
|
||||
@@ -873,7 +873,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
|
||||
printf("<<"
|
||||
"/cupsImageType 1"
|
||||
"/ImageType 1"
|
||||
"/Width %d"
|
||||
"/Height %d"
|
||||
"/BitsPerComponent 8",
|
||||
@@ -892,12 +892,12 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
break;
|
||||
}
|
||||
|
||||
fputs("/DataSource currentfile /ASCII85Decode filter", stdout);
|
||||
fputs("\n/DataSource currentfile/ASCII85Decode filter", stdout);
|
||||
|
||||
if (((xc1 - xc0 + 1) / xprint) < 100.0)
|
||||
fputs("/Interpolate true", stdout);
|
||||
|
||||
puts("/cupsImageMatrix[1 0 0 -1 0 1]>>image");
|
||||
puts("/ImageMatrix[1 0 0 -1 0 1]>>image");
|
||||
|
||||
for (y = yc0, out_offset = 0; y <= yc1; y ++)
|
||||
{
|
||||
|
||||
+121
-81
@@ -56,6 +56,7 @@
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <cups/file.h>
|
||||
#include <cups/array.h>
|
||||
@@ -307,10 +308,13 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
fputs("DEBUG: Skipping PJL header...\n", stderr);
|
||||
|
||||
while (strstr(line, "ENTER LANGUAGE") == NULL)
|
||||
while (strstr(line, "ENTER LANGUAGE") == NULL && strncmp(line, "%!", 2))
|
||||
if ((len = cupsFileGetLine(fp, line, sizeof(line))) == 0)
|
||||
break;
|
||||
|
||||
if (!strncmp(line, "%!", 2))
|
||||
break;
|
||||
|
||||
if ((len = cupsFileGetLine(fp, line, sizeof(line))) == 0)
|
||||
break;
|
||||
}
|
||||
@@ -434,12 +438,10 @@ check_range(pstops_doc_t *doc, /* I - Document information */
|
||||
* See if we only print even or odd pages...
|
||||
*/
|
||||
|
||||
if (!strcasecmp(doc->page_set, "even") &&
|
||||
((page - 1) % (doc->number_up << 1)) < doc->number_up)
|
||||
if (!strcasecmp(doc->page_set, "even") && (page & 1))
|
||||
return (0);
|
||||
|
||||
if (!strcasecmp(doc->page_set, "odd") &&
|
||||
((page - 1) % (doc->number_up << 1)) >= doc->number_up)
|
||||
if (!strcasecmp(doc->page_set, "odd") && !(page & 1))
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -590,6 +592,12 @@ copy_comments(cups_file_t *fp, /* I - File to read from */
|
||||
{
|
||||
if (saw_bounding_box)
|
||||
fputs("ERROR: Duplicate %%BoundingBox: comment seen!\n", stderr);
|
||||
else if (strstr(line + 14, "(atend)"))
|
||||
{
|
||||
/*
|
||||
* Do nothing for now but use the default imageable area...
|
||||
*/
|
||||
}
|
||||
else if (sscanf(line + 14, "%d%d%d%d", doc->bounding_box + 0,
|
||||
doc->bounding_box + 1, doc->bounding_box + 2,
|
||||
doc->bounding_box + 3) != 4)
|
||||
@@ -738,14 +746,26 @@ copy_dsc(cups_file_t *fp, /* I - File to read from */
|
||||
*/
|
||||
|
||||
fprintf(stderr, "DEBUG: Before copy_prolog - %s", line);
|
||||
copy_prolog(fp, doc, ppd, line, linelen, linesize);
|
||||
linelen = copy_prolog(fp, doc, ppd, line, linelen, linesize);
|
||||
|
||||
/*
|
||||
* Then the document setup section...
|
||||
*/
|
||||
|
||||
fprintf(stderr, "DEBUG: Before copy_setup - %s", line);
|
||||
copy_setup(fp, doc, ppd, line, linelen, linesize);
|
||||
linelen = copy_setup(fp, doc, ppd, line, linelen, linesize);
|
||||
|
||||
/*
|
||||
* Copy until we see %%Page:...
|
||||
*/
|
||||
|
||||
while (strncmp(line, "%%Page:", 7) && strncmp(line, "%%Trailer", 9))
|
||||
{
|
||||
fwrite(line, 1, linelen, stdout);
|
||||
|
||||
if ((linelen = cupsFileGetLine(fp, line, linesize)) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Then process pages until we have no more...
|
||||
@@ -774,13 +794,13 @@ copy_dsc(cups_file_t *fp, /* I - File to read from */
|
||||
* Finish up the last page(s)...
|
||||
*/
|
||||
|
||||
if (number && is_not_last_page(number))
|
||||
if (number && is_not_last_page(number) && cupsArrayLast(doc->pages))
|
||||
{
|
||||
pageinfo = (pstops_page_t *)cupsArrayLast(doc->pages);
|
||||
|
||||
start_nup(doc, doc->number_up - 1, 0, doc->bounding_box);
|
||||
start_nup(doc, doc->number_up, 0, doc->bounding_box);
|
||||
doc_puts(doc, "showpage\n");
|
||||
end_nup(doc, doc->number_up - 1);
|
||||
end_nup(doc, doc->number_up);
|
||||
|
||||
pageinfo->length = cupsFileTell(doc->temp) - pageinfo->offset;
|
||||
}
|
||||
@@ -802,9 +822,9 @@ copy_dsc(cups_file_t *fp, /* I - File to read from */
|
||||
printf("%%%%Page: (filler) %d\n", doc->page);
|
||||
}
|
||||
|
||||
start_nup(doc, doc->number_up - 1, 0, doc->bounding_box);
|
||||
start_nup(doc, doc->number_up, 0, doc->bounding_box);
|
||||
doc_puts(doc, "showpage\n");
|
||||
end_nup(doc, doc->number_up - 1);
|
||||
end_nup(doc, doc->number_up);
|
||||
|
||||
pageinfo->length = cupsFileTell(doc->temp) - pageinfo->offset;
|
||||
}
|
||||
@@ -1265,22 +1285,101 @@ copy_page(cups_file_t *fp, /* I - File to read from */
|
||||
* Copy any page setup commands...
|
||||
*/
|
||||
|
||||
if (first_page)
|
||||
{
|
||||
doc_puts(doc, "%%BeginPageSetup\n");
|
||||
|
||||
if (pageinfo->num_options > 0)
|
||||
{
|
||||
int i; /* Looping var */
|
||||
ppd_option_t *option; /* PPD option */
|
||||
int min_order; /* Minimum OrderDependency value */
|
||||
char *doc_setup, /* DocumentSetup commands to send */
|
||||
*any_setup; /* AnySetup commands to send */
|
||||
|
||||
|
||||
/*
|
||||
* Yes, figure out the minimum OrderDependency value...
|
||||
*/
|
||||
|
||||
if ((option = ppdFindOption(ppd, "PageRegion")) != NULL)
|
||||
min_order = option->order;
|
||||
else
|
||||
min_order = 999.0f;
|
||||
|
||||
for (i = 0; i < pageinfo->num_options; i ++)
|
||||
if ((option = ppdFindOption(ppd, pageinfo->options[i].name)) != NULL &&
|
||||
option->order < min_order)
|
||||
min_order = option->order;
|
||||
|
||||
/*
|
||||
* Mark and extract them...
|
||||
*/
|
||||
|
||||
cupsMarkOptions(ppd, pageinfo->num_options, pageinfo->options);
|
||||
|
||||
doc_setup = ppdEmitString(ppd, PPD_ORDER_DOCUMENT, min_order);
|
||||
any_setup = ppdEmitString(ppd, PPD_ORDER_ANY, min_order);
|
||||
|
||||
/*
|
||||
* Then send them out...
|
||||
*/
|
||||
|
||||
if (doc_setup)
|
||||
doc_puts(doc, doc_setup);
|
||||
|
||||
if (any_setup)
|
||||
doc_puts(doc, any_setup);
|
||||
|
||||
/*
|
||||
* Free the command strings...
|
||||
*/
|
||||
|
||||
if (doc_setup)
|
||||
free(doc_setup);
|
||||
|
||||
if (any_setup)
|
||||
free(any_setup);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Prep for the start of the page description...
|
||||
*/
|
||||
|
||||
start_nup(doc, number, 1, bounding_box);
|
||||
|
||||
/*
|
||||
* Copy page setup commands as needed...
|
||||
*/
|
||||
|
||||
if (!strncmp(line, "%%BeginPageSetup", 16))
|
||||
{
|
||||
/*
|
||||
* Copy page setup commands...
|
||||
*/
|
||||
int feature = 0; /* In a Begin/EndFeature block? */
|
||||
|
||||
doc_write(doc, line, linelen);
|
||||
|
||||
while ((linelen = cupsFileGetLine(fp, line, linesize)) > 0)
|
||||
{
|
||||
if (!strncmp(line, "%%EndPageSetup", 14))
|
||||
break;
|
||||
else if (!strncmp(line, "%%BeginFeature:", 15))
|
||||
{
|
||||
feature = 1;
|
||||
|
||||
if (doc->number_up > 1 || doc->fitplot)
|
||||
continue;
|
||||
}
|
||||
else if (!strncmp(line, "%%EndFeature:", 13))
|
||||
{
|
||||
feature = 0;
|
||||
|
||||
if (doc->number_up > 1 || doc->fitplot)
|
||||
continue;
|
||||
}
|
||||
else if (!strncmp(line, "%%Include", 9))
|
||||
continue;
|
||||
|
||||
if (doc->number_up == 1 && !doc->fitplot)
|
||||
if (!feature || (doc->number_up == 1 && !doc->fitplot))
|
||||
doc_write(doc, line, linelen);
|
||||
}
|
||||
|
||||
@@ -1290,73 +1389,14 @@ copy_page(cups_file_t *fp, /* I - File to read from */
|
||||
|
||||
if (linelen > 0)
|
||||
linelen = cupsFileGetLine(fp, line, linesize);
|
||||
|
||||
if (pageinfo->num_options == 0)
|
||||
doc_puts(doc, "%%EndPageSetup\n");
|
||||
}
|
||||
else if (first_page && pageinfo->num_options > 0)
|
||||
doc_puts(doc, "%%BeginPageSetup\n");
|
||||
|
||||
if (first_page && pageinfo->num_options > 0)
|
||||
{
|
||||
int i; /* Looping var */
|
||||
ppd_option_t *option; /* PPD option */
|
||||
int min_order; /* Minimum OrderDependency value */
|
||||
char *doc_setup, /* DocumentSetup commands to send */
|
||||
*any_setup; /* AnySetup commands to send */
|
||||
|
||||
|
||||
/*
|
||||
* Yes, figure out the minimum OrderDependency value...
|
||||
*/
|
||||
|
||||
if ((option = ppdFindOption(ppd, "PageRegion")) != NULL)
|
||||
min_order = option->order;
|
||||
else
|
||||
min_order = 999.0f;
|
||||
|
||||
for (i = 0; i < pageinfo->num_options; i ++)
|
||||
if ((option = ppdFindOption(ppd, pageinfo->options[i].name)) != NULL &&
|
||||
option->order < min_order)
|
||||
min_order = option->order;
|
||||
|
||||
/*
|
||||
* Mark and extract them...
|
||||
*/
|
||||
|
||||
cupsMarkOptions(ppd, pageinfo->num_options, pageinfo->options);
|
||||
|
||||
doc_setup = ppdEmitString(ppd, PPD_ORDER_DOCUMENT, min_order);
|
||||
any_setup = ppdEmitString(ppd, PPD_ORDER_ANY, min_order);
|
||||
|
||||
/*
|
||||
* Then send them out...
|
||||
*/
|
||||
|
||||
if (doc_setup)
|
||||
doc_puts(doc, doc_setup);
|
||||
|
||||
if (any_setup)
|
||||
doc_puts(doc, any_setup);
|
||||
|
||||
/*
|
||||
* Free the command strings...
|
||||
*/
|
||||
|
||||
if (doc_setup)
|
||||
free(doc_setup);
|
||||
|
||||
if (any_setup)
|
||||
free(any_setup);
|
||||
|
||||
doc_puts(doc, "%%EndPageSetup\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Prep for the start of the page description...
|
||||
* Finish the PageSetup section as needed...
|
||||
*/
|
||||
|
||||
start_nup(doc, number, 1, bounding_box);
|
||||
if (first_page)
|
||||
doc_puts(doc, "%%EndPageSetup\n");
|
||||
|
||||
/*
|
||||
* Read the rest of the page description...
|
||||
@@ -1368,7 +1408,7 @@ copy_page(cups_file_t *fp, /* I - File to read from */
|
||||
{
|
||||
if (level == 0 &&
|
||||
(!strncmp(line, "%%Page:", 7) ||
|
||||
!strncmp(line, "%%Trailer:", 10) ||
|
||||
!strncmp(line, "%%Trailer", 9) ||
|
||||
!strncmp(line, "%%EOF", 5)))
|
||||
break;
|
||||
else if (!strncmp(line, "%%BeginDocument", 15) ||
|
||||
@@ -2400,7 +2440,7 @@ skip_page(cups_file_t *fp, /* I - File to read from */
|
||||
while ((linelen = cupsFileGetLine(fp, line, linesize)) > 0)
|
||||
{
|
||||
if (level == 0 &&
|
||||
(!strncmp(line, "%%Page:", 7) || !strncmp(line, "%%Trailer:", 10)))
|
||||
(!strncmp(line, "%%Page:", 7) || !strncmp(line, "%%Trailer", 9)))
|
||||
break;
|
||||
else if (!strncmp(line, "%%BeginDocument", 15) ||
|
||||
!strncmp(line, "%ADO_BeginApplication", 21))
|
||||
|
||||
+44
-16
@@ -23,12 +23,12 @@ msgstr ""
|
||||
"Project-Id-Version: CUPS 1.2\n"
|
||||
"Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
|
||||
"POT-Creation-Date: 2006-03-23 21:52-0500\n"
|
||||
"PO-Revision-Date: 2006-03-13 17:36+0100\n"
|
||||
"PO-Revision-Date: 2006-03-25 21:48+0100\n"
|
||||
"Last-Translator: Juan Pablo González Riopedre <riopedre@tiscali.es>\n"
|
||||
"Language-Team: Spanish\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Content-Transfer-Encoding: 8bit"
|
||||
|
||||
msgid "Options Installed"
|
||||
msgstr "Opciones instaladas"
|
||||
@@ -77,10 +77,10 @@ msgid ""
|
||||
"this page."
|
||||
msgstr ""
|
||||
"Introduzca su nombre de usuario y contraseña o el nombre de usuario y "
|
||||
"contraseña de root para poder acceder a esta página"
|
||||
"contraseña de root para poder acceder a esta página."
|
||||
|
||||
msgid "You must use a https: URL to access this page."
|
||||
msgstr "Debe escribir una URL https para acceder a esta página."
|
||||
msgstr "Debe escribir un URL https para acceder a esta página."
|
||||
|
||||
#, c-format
|
||||
msgid "Bad request version number %d.%d!"
|
||||
@@ -2863,94 +2863,112 @@ msgid ""
|
||||
"You must access this page using the URL <A HREF=\"https://%s:%d%s\">https://%"
|
||||
"s:%d%s</A>."
|
||||
msgstr ""
|
||||
"Debe acceder a esta página usando el URL <A HREF=\"https://%s:%d%s\">https://%"
|
||||
"s:%d%s</A>."
|
||||
|
||||
#, fuzzy, c-format
|
||||
#, c-format
|
||||
msgid "Unsupported format '%s'!"
|
||||
msgstr "No se admite el uso del formato '%s/%s'."
|
||||
msgstr "No se admite el uso del formato '%s'."
|
||||
|
||||
#, fuzzy
|
||||
msgid "FAIL\n"
|
||||
msgstr " FALLO\n"
|
||||
msgstr "FALLO\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Line %d is longer than 255 characters (%d)!\n"
|
||||
" REF: Page 25, Line Length\n"
|
||||
msgstr ""
|
||||
" La línea %d es más larga de 255 caracteres (%d).\n"
|
||||
" REF: Página 25, Longitud de Línea\n"
|
||||
|
||||
msgid ""
|
||||
" Missing %!PS-Adobe-3.0 on first line!\n"
|
||||
" REF: Page 17, 3.1 Conforming Documents\n"
|
||||
msgstr ""
|
||||
" Falta %!PS-Adobe-3.0 en la primera línea.\n"
|
||||
" REF: Página 17, 3.1 Conformidad de documentos\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Bad %%%%Pages: on line %d!\n"
|
||||
" REF: Page 43, %%%%Pages:\n"
|
||||
msgstr ""
|
||||
" %%%%Pages: incorrecto en línea %d.\n"
|
||||
" REF: Página 43, %%%%Pages:\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Bad %%%%BoundingBox: on line %d!\n"
|
||||
" REF: Page 39, %%%%BoundingBox:\n"
|
||||
msgstr ""
|
||||
" %%%%BoundingBox: incorrecto en línea %d.\n"
|
||||
" REF: Página 39, %%%%BoundingBox:\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Bad %%%%Page: on line %d!\n"
|
||||
" REF: Page 53, %%%%Page:\n"
|
||||
msgstr ""
|
||||
" %%%%Page: incorrecto en línea %d.\n"
|
||||
" REF: Página 53, %%%%Page:\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Missing or bad %%BoundingBox: comment!\n"
|
||||
" REF: Page 39, %%BoundingBox:\n"
|
||||
msgstr ""
|
||||
" Falta comentario %%BoundingBox: o incorrecto.\n"
|
||||
" REF: Página 39, %%BoundingBox:\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Missing or bad %%Pages: comment!\n"
|
||||
" REF: Page 43, %%Pages:\n"
|
||||
msgstr ""
|
||||
" Falta comentario %%Pages: o incorrecto.\n"
|
||||
" REF: Página 43, %%Pages:\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Missing %%EndComments comment!\n"
|
||||
" REF: Page 41, %%EndComments\n"
|
||||
msgstr ""
|
||||
" Falta comentario %%EndComments.\n"
|
||||
" REF: Página 41, %%EndComments\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Missing or bad %%Page: comments!\n"
|
||||
" REF: Page 53, %%Page:\n"
|
||||
msgstr ""
|
||||
" Falta comentario %%Page: o incorrecto.\n"
|
||||
" REF: Página 53, %%Page:\n"
|
||||
|
||||
#, c-format
|
||||
msgid " Too many %%EndDocument comments!\n"
|
||||
msgstr ""
|
||||
msgstr " Demasiados comentarios %%EndDocument.\n"
|
||||
|
||||
#, c-format
|
||||
msgid " Too many %%BeginDocument comments!\n"
|
||||
msgstr ""
|
||||
msgstr " Demasiados comentarios %%BeginDocument.\n"
|
||||
|
||||
#, c-format
|
||||
msgid " Saw %d lines that exceeded 255 characters!\n"
|
||||
msgstr ""
|
||||
msgstr " Se han visto %d líneas que exceden de 255 caracteres.\n"
|
||||
|
||||
#, fuzzy
|
||||
msgid "PASS\n"
|
||||
msgstr " PASA\n"
|
||||
msgstr "PASA\n"
|
||||
|
||||
msgid " Warning: file contains binary data!\n"
|
||||
msgstr ""
|
||||
msgstr " Advertencia: el archivo contiene datos binarios.\n"
|
||||
|
||||
#, c-format
|
||||
msgid " Warning: obsolete DSC version %.1f in file!\n"
|
||||
msgstr ""
|
||||
msgstr " Advertencia: versión DSC %.1f obsoleta en el archivo.\n"
|
||||
|
||||
#, c-format
|
||||
msgid " Warning: no %%EndComments comment in file!\n"
|
||||
msgstr ""
|
||||
msgstr " Advertencia: no hay comentario %%EndComments en el archivo.\n"
|
||||
|
||||
msgid ""
|
||||
"Usage: cupstestdsc [options] filename.ps [... filename.ps]\n"
|
||||
@@ -2963,3 +2981,13 @@ msgid ""
|
||||
" Note: this program only validates the DSC comments, not the PostScript "
|
||||
"itself.\n"
|
||||
msgstr ""
|
||||
"Uso: cupstestdsc [opciones] nombre_archivo.ps [... nombre_archivo.ps]\n"
|
||||
" cupstestdsc [opciones] -\n"
|
||||
"\n"
|
||||
"Opciones:\n"
|
||||
"\n"
|
||||
" -h Muestra cómo se usa el programa\n"
|
||||
"\n"
|
||||
" Nota: este programa sólo valida los comentarios DSC, no el PostScript "
|
||||
"en sí mismo.\n"
|
||||
|
||||
|
||||
+38
-14
@@ -26,7 +26,7 @@ msgstr ""
|
||||
"Project-Id-Version: CUPS 1.2\n"
|
||||
"Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
|
||||
"POT-Creation-Date: 2006-03-23 21:52-0500\n"
|
||||
"PO-Revision-Date: 2006-03-14 09:29+0900\n"
|
||||
"PO-Revision-Date: 2006-03-29 23:44+0900\n"
|
||||
"Last-Translator: Kenshi Muto <kmuto@debian.org>\n"
|
||||
"Language-Team: Japanese <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -2798,95 +2798,111 @@ msgstr "ジョブ #%d はすでに完了しています - キャンセルでき
|
||||
msgid ""
|
||||
"You must access this page using the URL <A HREF=\"https://%s:%d%s\">https://%"
|
||||
"s:%d%s</A>."
|
||||
msgstr ""
|
||||
msgstr "このページには URL <A HREF=\"https://%s:%d%s\">https://%s:%d%s</A> を使ってアクセスする必要があります。"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#, c-format
|
||||
msgid "Unsupported format '%s'!"
|
||||
msgstr "'%s/%s' はサポートされていない形式です!"
|
||||
msgstr "'%s' はサポートされていない形式です!"
|
||||
|
||||
#, fuzzy
|
||||
msgid "FAIL\n"
|
||||
msgstr " 失敗\n"
|
||||
msgstr "失敗\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Line %d is longer than 255 characters (%d)!\n"
|
||||
" REF: Page 25, Line Length\n"
|
||||
msgstr ""
|
||||
" %d 行が 255文字より長くなっています (%d)!\n"
|
||||
" REF: 25 ページ、Line Length\n"
|
||||
|
||||
msgid ""
|
||||
" Missing %!PS-Adobe-3.0 on first line!\n"
|
||||
" REF: Page 17, 3.1 Conforming Documents\n"
|
||||
msgstr ""
|
||||
" 先頭行に %!PS-Adobe-3.0 がありません!\n"
|
||||
" REF: 17 ページ、3.1 Conforming Documents\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Bad %%%%Pages: on line %d!\n"
|
||||
" REF: Page 43, %%%%Pages:\n"
|
||||
msgstr ""
|
||||
" 不正な %%%%Pages: (%d 行)!\n"
|
||||
" REF: 43 ページ、%%%%Pages:\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Bad %%%%BoundingBox: on line %d!\n"
|
||||
" REF: Page 39, %%%%BoundingBox:\n"
|
||||
msgstr ""
|
||||
" 不正な %%%%BoundingBox: (%d 行)!\n"
|
||||
" REF: 39 ページ、%%%%BoundingBox:\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Bad %%%%Page: on line %d!\n"
|
||||
" REF: Page 53, %%%%Page:\n"
|
||||
msgstr ""
|
||||
" 不正な %%%%Page: (%d 行)!\n"
|
||||
" REF: 53 ページ、%%%%Page:\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Missing or bad %%BoundingBox: comment!\n"
|
||||
" REF: Page 39, %%BoundingBox:\n"
|
||||
msgstr ""
|
||||
" %%BoundingBox: コメントが見つからないか不正です!\n"
|
||||
" REF: 39 ページ、%%BoundingBox:\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Missing or bad %%Pages: comment!\n"
|
||||
" REF: Page 43, %%Pages:\n"
|
||||
msgstr ""
|
||||
" %%Pages: コメントが見つからないか不正です!\n"
|
||||
" REF: 43 ページ、%%Pages:\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Missing %%EndComments comment!\n"
|
||||
" REF: Page 41, %%EndComments\n"
|
||||
msgstr ""
|
||||
" %%EndComments コメントが見つかりません!\n"
|
||||
" REF: 41 ページ、%%EndComments\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Missing or bad %%Page: comments!\n"
|
||||
" REF: Page 53, %%Page:\n"
|
||||
msgstr ""
|
||||
" %Page: コメントが見つからないか不正です!\n"
|
||||
" REF: 53 ページ、%%Page:\n"
|
||||
|
||||
#, c-format
|
||||
msgid " Too many %%EndDocument comments!\n"
|
||||
msgstr ""
|
||||
msgstr " %%EndDocument コメントが多すぎます!\n"
|
||||
|
||||
#, c-format
|
||||
msgid " Too many %%BeginDocument comments!\n"
|
||||
msgstr ""
|
||||
msgstr " %%BeginDocument コメントが多すぎます!\n"
|
||||
|
||||
#, c-format
|
||||
msgid " Saw %d lines that exceeded 255 characters!\n"
|
||||
msgstr ""
|
||||
msgstr " 255文字を超える %d 行が見つかりました!\n"
|
||||
|
||||
#, fuzzy
|
||||
msgid "PASS\n"
|
||||
msgstr " 合格\n"
|
||||
msgstr "合格\n"
|
||||
|
||||
msgid " Warning: file contains binary data!\n"
|
||||
msgstr ""
|
||||
msgstr " 警告: ファイルにバイナリデータが含まれています!\n"
|
||||
|
||||
#, c-format
|
||||
msgid " Warning: obsolete DSC version %.1f in file!\n"
|
||||
msgstr ""
|
||||
msgstr " 警告: ファイルは時代遅れの DSC バージョン %.1f です!\n"
|
||||
|
||||
#, c-format
|
||||
msgid " Warning: no %%EndComments comment in file!\n"
|
||||
msgstr ""
|
||||
msgstr " 警告: ファイルに %%EndComments コメントがありません!\n"
|
||||
|
||||
msgid ""
|
||||
"Usage: cupstestdsc [options] filename.ps [... filename.ps]\n"
|
||||
@@ -2899,3 +2915,11 @@ msgid ""
|
||||
" Note: this program only validates the DSC comments, not the PostScript "
|
||||
"itself.\n"
|
||||
msgstr ""
|
||||
"使い方: cupstestdsc [オプション] ファイル名.ps [... ファイル名.ps]\n"
|
||||
" cupstestdsc [オプション] -\n"
|
||||
"\n"
|
||||
"オプション:\n"
|
||||
"\n"
|
||||
" -h プログラムの使い方を表示する\n"
|
||||
"\n"
|
||||
" 注意: このプログラムは DSC コメントを検証するだけで、PostScript 自身を検証するものではありません。\n"
|
||||
|
||||
@@ -162,6 +162,8 @@ $CUPS_GROUP=@CUPS_GROUP@
|
||||
$CUPS_PRIMARY_SYSTEM_GROUP=@CUPS_PRIMARY_SYSTEM_GROUP@
|
||||
$CUPS_PERM=0@CUPS_CONFIG_FILE_PERM@
|
||||
|
||||
$INSTALLSTATIC=@INSTALLSTATIC@
|
||||
|
||||
$MAN1EXT=@MAN1EXT@
|
||||
$MAN5EXT=@MAN5EXT@
|
||||
$MAN8EXT=@MAN8EXT@
|
||||
@@ -210,11 +212,11 @@ d 0755 root sys $SERVERBIN/driver -
|
||||
d 0755 root sys $SERVERBIN/filter -
|
||||
f 0755 root sys $SERVERBIN/filter/gziptoany filter/gziptoany
|
||||
f 0755 root sys $SERVERBIN/filter/hpgltops filter/hpgltops
|
||||
%if $IMGFILTERS
|
||||
%if IMGFILTERS
|
||||
f 0755 root sys $SERVERBIN/filter/imagetops filter/imagetops
|
||||
f 0755 root sys $SERVERBIN/filter/imagetoraster filter/imagetoraster
|
||||
%endif
|
||||
%if $PDFTOPS
|
||||
%if PDFTOPS
|
||||
f 0755 root sys $SERVERBIN/filter/pdftops pdftops/pdftops
|
||||
%endif
|
||||
f 0755 root sys $SERVERBIN/filter/pstops filter/pstops
|
||||
@@ -422,8 +424,10 @@ f 0644 root sys $INCLUDEDIR/cups/md5.h cups/md5.h
|
||||
f 0644 root sys $INCLUDEDIR/cups/ppd.h cups/ppd.h
|
||||
f 0644 root sys $INCLUDEDIR/cups/raster.h filter/raster.h
|
||||
|
||||
%if INSTALLSTATIC
|
||||
f 0644 root sys $LIBDIR/libcups.a cups/libcups.a
|
||||
f 0644 root sys $LIBDIR/libcupsimage.a filter/libcupsimage.a
|
||||
%endif
|
||||
|
||||
d 0755 root sys $DOCDIR/help -
|
||||
f 0644 root sys $DOCDIR/help doc/help/api*.html
|
||||
|
||||
@@ -37,6 +37,10 @@
|
||||
%{?_with_php: %define _php --with-php}
|
||||
%{!?_with_php: %define _php --without-php}
|
||||
|
||||
%{!?_with_static: %{!?_without_static: %define _without_static --without-static}}
|
||||
%{?_with_static: %define _static --enable-static}
|
||||
%{!?_with_static: %define _static --disable-static}
|
||||
|
||||
Summary: Common UNIX Printing System
|
||||
Name: cups
|
||||
Version: @CUPS_VERSION@
|
||||
@@ -127,10 +131,10 @@ UNIX
|
||||
|
||||
%build
|
||||
%ifarch x86_64
|
||||
./configure --enable-32bit %{_dbus} %{_php}
|
||||
./configure --enable-32bit %{_dbus} %{_php} %{_static}
|
||||
%else
|
||||
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_OPT_FLAGS" \
|
||||
./configure %{_dbus} %{_php}
|
||||
./configure %{_dbus} %{_php} %{_static}
|
||||
%endif
|
||||
# If we got this far, all prerequisite libraries must be here.
|
||||
make
|
||||
@@ -244,7 +248,20 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
/usr/sbin/*
|
||||
%dir /usr/share/cups
|
||||
/usr/share/cups/*
|
||||
%dir /usr/share/cups/banners
|
||||
/usr/share/cups/banners/*
|
||||
%dir /usr/share/cups/charmaps
|
||||
/usr/share/cups/charmaps/*
|
||||
%dir /usr/share/cups/charsets
|
||||
/usr/share/cups/charsets/*
|
||||
%dir /usr/share/cups/data
|
||||
/usr/share/cups/data/*
|
||||
%dir /usr/share/cups/fonts
|
||||
/usr/share/cups/fonts/*
|
||||
%dir /usr/share/cups/model
|
||||
/usr/share/cups/model/*
|
||||
%dir /usr/share/cups/templates
|
||||
/usr/share/cups/templates/*.tmpl
|
||||
%dir /usr/share/doc/cups
|
||||
/usr/share/doc/cups/*.*
|
||||
%dir /usr/share/doc/cups/help
|
||||
@@ -312,9 +329,12 @@ rm -rf $RPM_BUILD_ROOT
|
||||
/usr/bin/cups-config
|
||||
%dir /usr/include/cups
|
||||
/usr/include/cups/*
|
||||
#/usr/lib/*.a
|
||||
/usr/lib*/*.so
|
||||
|
||||
%if %{?_with_static:1}%{!?_with_static:0}
|
||||
/usr/lib*/*.a
|
||||
%endif
|
||||
|
||||
%dir /usr/share/doc/cups/help
|
||||
/usr/share/doc/cups/help/api*.html
|
||||
/usr/share/doc/cups/help/spec*.html
|
||||
|
||||
+14
-4
@@ -107,6 +107,8 @@ cupsdAddCert(int pid, /* I - Process ID */
|
||||
# ifdef HAVE_MBR_UID_TO_UUID
|
||||
uuid_t group; /* Group ID */
|
||||
# endif /* HAVE_MBR_UID_TO_UUID */
|
||||
static int acls_not_supported = 0;
|
||||
/* Only warn once */
|
||||
#endif /* HAVE_ACL_INIT */
|
||||
|
||||
|
||||
@@ -201,7 +203,8 @@ cupsdAddCert(int pid, /* I - Process ID */
|
||||
|
||||
if (acl_valid(acl))
|
||||
{
|
||||
char *text, *textptr;
|
||||
char *text, *textptr; /* Temporary string */
|
||||
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR, "ACL did not validate: %s",
|
||||
strerror(errno));
|
||||
@@ -217,9 +220,16 @@ cupsdAddCert(int pid, /* I - Process ID */
|
||||
# endif /* HAVE_MBR_UID_TO_UUID */
|
||||
|
||||
if (acl_set_fd(fd, acl))
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"Unable to set ACLs on root certificate \"%s\" - %s",
|
||||
filename, strerror(errno));
|
||||
{
|
||||
if (errno != EOPNOTSUPP || !acls_not_supported)
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"Unable to set ACLs on root certificate \"%s\" - %s",
|
||||
filename, strerror(errno));
|
||||
|
||||
if (errno == EOPNOTSUPP)
|
||||
acls_not_supported = 1;
|
||||
}
|
||||
|
||||
acl_free(acl);
|
||||
}
|
||||
#endif /* HAVE_ACL_INIT */
|
||||
|
||||
+48
-15
@@ -957,7 +957,7 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
|
||||
else
|
||||
snprintf(locale, sizeof(locale), "%s.%s",
|
||||
con->http.fields[HTTP_FIELD_ACCEPT_LANGUAGE], DefaultCharset);
|
||||
|
||||
|
||||
con->language = cupsLangGet(locale);
|
||||
}
|
||||
else
|
||||
@@ -2246,7 +2246,11 @@ cupsdWriteClient(cupsd_client_t *con) /* I - Client connection */
|
||||
*/
|
||||
|
||||
if (!strncasecmp(buf, "Location:", 9))
|
||||
{
|
||||
cupsdSendHeader(con, HTTP_SEE_OTHER, NULL);
|
||||
if (httpPrintf(HTTP(con), "Content-Length: 0\r\n") < 0)
|
||||
return (0);
|
||||
}
|
||||
else if (!strncasecmp(buf, "Status:", 7))
|
||||
cupsdSendError(con, atoi(buf + 7));
|
||||
else
|
||||
@@ -2470,6 +2474,8 @@ check_if_modified(
|
||||
while (*ptr != '\0' && *ptr != ';')
|
||||
ptr ++;
|
||||
}
|
||||
else
|
||||
ptr ++;
|
||||
}
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
@@ -2612,11 +2618,13 @@ encrypt_client(cupsd_client_t *con) /* I - Client to encrypt */
|
||||
return (1);
|
||||
|
||||
# elif defined(HAVE_CDSASSL)
|
||||
OSStatus error; /* Error info */
|
||||
SSLContextRef conn; /* New connection */
|
||||
CFArrayRef certificatesArray; /* Array containing certificates */
|
||||
int allowExpired; /* Allow expired certificates? */
|
||||
int allowAnyRoot; /* Allow any root certificate? */
|
||||
OSStatus error; /* Error info */
|
||||
SSLContextRef conn; /* New connection */
|
||||
CFArrayRef certificatesArray;
|
||||
/* Array containing certificates */
|
||||
int allowExpired; /* Allow expired certificates? */
|
||||
int allowAnyRoot; /* Allow any root certificate? */
|
||||
cdsa_conn_ref_t u; /* Connection reference union */
|
||||
|
||||
|
||||
conn = NULL;
|
||||
@@ -2641,12 +2649,23 @@ encrypt_client(cupsd_client_t *con) /* I - Client to encrypt */
|
||||
error = SSLSetProtocolVersion(conn, kSSLProtocol3);
|
||||
|
||||
if (!error)
|
||||
error = SSLSetConnection(conn, (SSLConnectionRef)con->http.fd);
|
||||
{
|
||||
/*
|
||||
* Use a union to resolve warnings about int/pointer size mismatches...
|
||||
*/
|
||||
|
||||
u.connection = NULL;
|
||||
u.sock = con->http.fd;
|
||||
error = SSLSetConnection(conn, u.connection);
|
||||
}
|
||||
|
||||
if (!error)
|
||||
error = SSLSetPeerDomainName(conn, ServerName, strlen(ServerName) + 1);
|
||||
|
||||
/* have to do these options before setting server certs */
|
||||
/*
|
||||
* Have to set these options before setting server certs...
|
||||
*/
|
||||
|
||||
if (!error && allowExpired)
|
||||
error = SSLSetAllowsExpiredCerts(conn, true);
|
||||
|
||||
@@ -2826,9 +2845,9 @@ get_file(cupsd_client_t *con, /* I - Client connection */
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
else if (con->language != NULL)
|
||||
else if (con->language)
|
||||
snprintf(filename, len, "%s/%s%s", DocumentRoot, con->language->language,
|
||||
con->uri);
|
||||
con->uri);
|
||||
else
|
||||
snprintf(filename, len, "%s%s", DocumentRoot, con->uri);
|
||||
|
||||
@@ -2840,16 +2859,30 @@ get_file(cupsd_client_t *con, /* I - Client connection */
|
||||
* then fallback to the default one...
|
||||
*/
|
||||
|
||||
if ((status = stat(filename, filestats)) != 0 && con->language != NULL)
|
||||
if ((status = stat(filename, filestats)) != 0 && con->language &&
|
||||
strncmp(con->uri, "/ppd/", 5) &&
|
||||
strncmp(con->uri, "/admin/conf/", 12) &&
|
||||
strncmp(con->uri, "/admin/log/", 11))
|
||||
{
|
||||
/*
|
||||
* Drop the language prefix and try the current directory...
|
||||
* Drop the country code...
|
||||
*/
|
||||
|
||||
if (strncmp(con->uri, "/ppd/", 5) &&
|
||||
strncmp(con->uri, "/admin/conf/", 12) &&
|
||||
strncmp(con->uri, "/admin/log/", 11))
|
||||
char ll[3]; /* Short language name */
|
||||
|
||||
|
||||
strlcpy(ll, con->language->language, sizeof(ll));
|
||||
snprintf(filename, len, "%s/%s%s", DocumentRoot, ll, con->uri);
|
||||
|
||||
if ((ptr = strchr(filename, '?')) != NULL)
|
||||
*ptr = '\0';
|
||||
|
||||
if ((status = stat(filename, filestats)) != 0)
|
||||
{
|
||||
/*
|
||||
* Drop the language prefix and try the root directory...
|
||||
*/
|
||||
|
||||
snprintf(filename, len, "%s%s", DocumentRoot, con->uri);
|
||||
|
||||
if ((ptr = strchr(filename, '?')) != NULL)
|
||||
|
||||
+20
-7
@@ -243,6 +243,7 @@ cupsdReadConfiguration(void)
|
||||
if (NumBrowsers > 0)
|
||||
{
|
||||
free(Browsers);
|
||||
Browsers = NULL;
|
||||
|
||||
NumBrowsers = 0;
|
||||
}
|
||||
@@ -281,7 +282,7 @@ cupsdReadConfiguration(void)
|
||||
cupsdSetString(&AccessLog, CUPS_LOGDIR "/access_log");
|
||||
cupsdSetString(&ErrorLog, CUPS_LOGDIR "/error_log");
|
||||
cupsdSetString(&PageLog, CUPS_LOGDIR "/page_log");
|
||||
cupsdSetString(&Printcap, "/etc/printcap");
|
||||
cupsdSetString(&Printcap, CUPS_DEFAULT_PRINTCAP);
|
||||
cupsdSetString(&PrintcapGUI, "/usr/bin/glpoptions");
|
||||
cupsdSetString(&FontPath, CUPS_FONTPATH);
|
||||
cupsdSetString(&RemoteRoot, "remroot");
|
||||
@@ -338,22 +339,34 @@ cupsdReadConfiguration(void)
|
||||
endpwent();
|
||||
|
||||
/*
|
||||
* Find the default group (nobody)...
|
||||
* Find the default group...
|
||||
*/
|
||||
|
||||
group = getgrnam("nobody");
|
||||
group = getgrnam(CUPS_DEFAULT_GROUP);
|
||||
endgrent();
|
||||
|
||||
if (group != NULL)
|
||||
if (group)
|
||||
Group = group->gr_gid;
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Use the (historical) NFS nobody group ID (-2 as a 16-bit twos-
|
||||
* complement number...)
|
||||
* Fallback to group "nobody"...
|
||||
*/
|
||||
|
||||
Group = 65534;
|
||||
group = getgrnam("nobody");
|
||||
endgrent();
|
||||
|
||||
if (group)
|
||||
Group = group->gr_gid;
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Use the (historical) NFS nobody group ID (-2 as a 16-bit twos-
|
||||
* complement number...)
|
||||
*/
|
||||
|
||||
Group = 65534;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+14
-2
@@ -2471,8 +2471,20 @@ send_cups_browse(cupsd_printer_t *p) /* I - Printer to send */
|
||||
|
||||
dequote(location, p->location, sizeof(location));
|
||||
dequote(info, p->info, sizeof(info));
|
||||
dequote(make_model, p->make_model ? p->make_model : "Unknown",
|
||||
sizeof(make_model));
|
||||
|
||||
if (p->make_model)
|
||||
dequote(make_model, p->make_model, sizeof(make_model));
|
||||
else if (p->type & CUPS_PRINTER_CLASS)
|
||||
{
|
||||
if (p->num_printers > 0 && p->printers[0]->make_model)
|
||||
strlcpy(make_model, p->printers[0]->make_model, sizeof(make_model));
|
||||
else
|
||||
strlcpy(make_model, "Local Printer Class", sizeof(make_model));
|
||||
}
|
||||
else if (p->raw)
|
||||
strlcpy(make_model, "Local Raw Printer", sizeof(make_model));
|
||||
else
|
||||
strlcpy(make_model, "Local System V Printer", sizeof(make_model));
|
||||
|
||||
/*
|
||||
* Send a packet to each browse address...
|
||||
|
||||
+3
-4
@@ -68,11 +68,10 @@ cupsdInitEnv(void)
|
||||
|
||||
#if defined(__APPLE__)
|
||||
/*
|
||||
* Add special voodoo magic for MacOS X 10.4 and later - this allows MacOS
|
||||
* X programs to access their bundle resources properly...
|
||||
* Add special voodoo magic for MacOS X - this allows MacOS X
|
||||
* programs to access their bundle resources properly...
|
||||
*
|
||||
* This string is replaced in cupsdStartProcess() when we are running on
|
||||
* versions of MacOS X prior to 10.4...
|
||||
* This string is replaced in cupsdStartProcess()...
|
||||
*/
|
||||
|
||||
cupsdSetString(common_env, "<CFProcessPath>");
|
||||
|
||||
+22
-3
@@ -1489,10 +1489,13 @@ add_job(cupsd_client_t *con, /* I - Client connection */
|
||||
*/
|
||||
|
||||
cupsdSetJobHoldUntil(job, attr->values[0].string.text);
|
||||
|
||||
job->state->values[0].integer = IPP_JOB_HELD;
|
||||
job->state_value = IPP_JOB_HELD;
|
||||
}
|
||||
else if (job->attrs->request.op.operation_id == IPP_CREATE_JOB)
|
||||
{
|
||||
job->hold_until = time(NULL) + 60;
|
||||
job->hold_until = time(NULL) + 60;
|
||||
job->state->values[0].integer = IPP_JOB_HELD;
|
||||
job->state_value = IPP_JOB_HELD;
|
||||
}
|
||||
@@ -6525,7 +6528,7 @@ move_job(cupsd_client_t *con, /* I - Client connection */
|
||||
* Move the job to a different printer or class...
|
||||
*/
|
||||
|
||||
cupsdMoveJob(job, dest);
|
||||
cupsdMoveJob(job, dprinter);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6557,7 +6560,7 @@ move_job(cupsd_client_t *con, /* I - Client connection */
|
||||
* Move the job to a different printer or class...
|
||||
*/
|
||||
|
||||
cupsdMoveJob(job, dest);
|
||||
cupsdMoveJob(job, dprinter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8811,11 +8814,19 @@ start_printer(cupsd_client_t *con, /* I - Client connection */
|
||||
cupsdStartPrinter(printer, 1);
|
||||
|
||||
if (dtype & CUPS_PRINTER_CLASS)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_INFO, "Class \"%s\" started by \"%s\".", name,
|
||||
get_username(con));
|
||||
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED, printer, NULL,
|
||||
"Class \"%s\" started by \"%s\".", name, get_username(con));
|
||||
}
|
||||
else
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_INFO, "Printer \"%s\" started by \"%s\".", name,
|
||||
get_username(con));
|
||||
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED, printer, NULL,
|
||||
"Printer \"%s\" started by \"%s\".", name, get_username(con));
|
||||
}
|
||||
|
||||
cupsdCheckJobs();
|
||||
|
||||
@@ -8899,11 +8910,19 @@ stop_printer(cupsd_client_t *con, /* I - Client connection */
|
||||
cupsdStopPrinter(printer, 1);
|
||||
|
||||
if (dtype & CUPS_PRINTER_CLASS)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_INFO, "Class \"%s\" stopped by \"%s\".", name,
|
||||
get_username(con));
|
||||
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED, printer, NULL,
|
||||
"Class \"%s\" stopped by \"%s\".", name, get_username(con));
|
||||
}
|
||||
else
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_INFO, "Printer \"%s\" stopped by \"%s\".", name,
|
||||
get_username(con));
|
||||
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED, printer, NULL,
|
||||
"Printer \"%s\" stopped by \"%s\".", name, get_username(con));
|
||||
}
|
||||
|
||||
/*
|
||||
* Everything was ok, so return OK status...
|
||||
|
||||
+27
-13
@@ -386,7 +386,8 @@ cupsdCheckJobs(void)
|
||||
"job-actual-printer-uri", NULL, printer->uri);
|
||||
}
|
||||
|
||||
if (printer->state == IPP_PRINTER_IDLE || /* Printer is idle */
|
||||
if ((!(printer->type & CUPS_PRINTER_REMOTE) && /* Printer is local */
|
||||
printer->state == IPP_PRINTER_IDLE) || /* and idle */
|
||||
((printer->type & CUPS_PRINTER_REMOTE) && /* Printer is remote */
|
||||
!printer->job)) /* and not printing */
|
||||
start_job(job, printer);
|
||||
@@ -1066,34 +1067,43 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */
|
||||
*/
|
||||
|
||||
void
|
||||
cupsdMoveJob(cupsd_job_t *job, /* I - Job */
|
||||
const char *dest) /* I - Destination */
|
||||
cupsdMoveJob(cupsd_job_t *job, /* I - Job */
|
||||
cupsd_printer_t *p) /* I - Destination printer or class */
|
||||
{
|
||||
ipp_attribute_t *attr; /* job-printer-uri attribute */
|
||||
cupsd_printer_t *p; /* Destination printer or class */
|
||||
const char *olddest; /* Old destination */
|
||||
cupsd_printer_t *oldp; /* Old pointer */
|
||||
|
||||
|
||||
/*
|
||||
* Find the printer...
|
||||
*/
|
||||
|
||||
if ((p = cupsdFindDest(dest)) == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Don't move completed jobs...
|
||||
*/
|
||||
|
||||
if (job->state_value >= IPP_JOB_PROCESSING)
|
||||
if (job->state_value > IPP_JOB_STOPPED)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Get the old destination...
|
||||
*/
|
||||
|
||||
olddest = job->dest;
|
||||
|
||||
if (job->printer)
|
||||
oldp = job->printer;
|
||||
else
|
||||
oldp = cupsdFindDest(olddest);
|
||||
|
||||
/*
|
||||
* Change the destination information...
|
||||
*/
|
||||
|
||||
cupsdLoadJob(job);
|
||||
|
||||
cupsdSetString(&job->dest, dest);
|
||||
cupsdAddEvent(CUPSD_EVENT_JOB_STOPPED, oldp, job,
|
||||
"Job #%d moved from %s to %s.", job->id, olddest,
|
||||
p->name);
|
||||
|
||||
cupsdSetString(&job->dest, p->name);
|
||||
job->dtype = p->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE |
|
||||
CUPS_PRINTER_IMPLICIT);
|
||||
|
||||
@@ -1101,6 +1111,10 @@ cupsdMoveJob(cupsd_job_t *job, /* I - Job */
|
||||
IPP_TAG_URI)) != NULL)
|
||||
cupsdSetString(&(attr->values[0].string.text), p->uri);
|
||||
|
||||
cupsdAddEvent(CUPSD_EVENT_JOB_STOPPED, p, job,
|
||||
"Job #%d moved from %s to %s.", job->id, olddest,
|
||||
p->name);
|
||||
|
||||
cupsdSaveJob(job);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ extern int cupsdGetUserJobCount(const char *username);
|
||||
extern void cupsdHoldJob(cupsd_job_t *job);
|
||||
extern void cupsdLoadAllJobs(void);
|
||||
extern void cupsdLoadJob(cupsd_job_t *job);
|
||||
extern void cupsdMoveJob(cupsd_job_t *job, const char *dest);
|
||||
extern void cupsdMoveJob(cupsd_job_t *job, cupsd_printer_t *p);
|
||||
extern void cupsdReleaseJob(cupsd_job_t *job);
|
||||
extern void cupsdRestartJob(cupsd_job_t *job);
|
||||
extern void cupsdSaveAllJobs(void);
|
||||
|
||||
+22
-48
@@ -1012,7 +1012,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
* accumulated. Don't send these more than once a second...
|
||||
*/
|
||||
|
||||
if (LastEvent && (time(NULL) - LastEventTime) > 1)
|
||||
if (LastEvent)
|
||||
{
|
||||
#ifdef HAVE_NOTIFY_POST
|
||||
if (LastEvent & CUPSD_EVENT_PRINTER_CHANGED)
|
||||
@@ -1040,10 +1040,9 @@ main(int argc, /* I - Number of command-line args */
|
||||
#endif /* HAVE_NOTIFY_POST */
|
||||
|
||||
/*
|
||||
* Reset the accumulated events and notification time...
|
||||
* Reset the accumulated events...
|
||||
*/
|
||||
|
||||
LastEventTime = time(NULL);
|
||||
LastEvent = CUPSD_EVENT_NONE;
|
||||
}
|
||||
}
|
||||
@@ -1190,7 +1189,7 @@ cupsdClearString(char **s) /* O - String value */
|
||||
{
|
||||
if (s && *s)
|
||||
{
|
||||
free(*s);
|
||||
_cupsStrFree(*s);
|
||||
*s = NULL;
|
||||
}
|
||||
}
|
||||
@@ -1256,10 +1255,10 @@ cupsdSetString(char **s, /* O - New string */
|
||||
return;
|
||||
|
||||
if (*s)
|
||||
free(*s);
|
||||
_cupsStrFree(*s);
|
||||
|
||||
if (v)
|
||||
*s = strdup(v);
|
||||
*s = _cupsStrAlloc(v);
|
||||
else
|
||||
*s = NULL;
|
||||
}
|
||||
@@ -1290,13 +1289,13 @@ cupsdSetStringf(char **s, /* O - New string */
|
||||
vsnprintf(v, sizeof(v), f, ap);
|
||||
va_end(ap);
|
||||
|
||||
*s = strdup(v);
|
||||
*s = _cupsStrAlloc(v);
|
||||
}
|
||||
else
|
||||
*s = NULL;
|
||||
|
||||
if (olds)
|
||||
free(olds);
|
||||
_cupsStrFree(olds);
|
||||
}
|
||||
|
||||
|
||||
@@ -1315,12 +1314,10 @@ launchd_checkin(void)
|
||||
ld_resp, /* Launch data response */
|
||||
ld_array, /* Launch data array */
|
||||
ld_sockets, /* Launch data sockets dictionary */
|
||||
ld_runatload, /* Run-at-load setting */
|
||||
tmp; /* Launch data */
|
||||
cupsd_listener_t *lis; /* Listeners array */
|
||||
http_addr_t addr; /* Address variable */
|
||||
socklen_t addrlen; /* Length of address */
|
||||
bool runatload; /* Run-at-load setting value */
|
||||
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG, "launchd_checkin: pid=%d", (int)getpid());
|
||||
@@ -1346,26 +1343,6 @@ launchd_checkin(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the "run-at-load" setting...
|
||||
*/
|
||||
|
||||
if ((ld_runatload =
|
||||
launch_data_dict_lookup(ld_resp, LAUNCH_JOBKEY_RUNATLOAD)) != NULL &&
|
||||
launch_data_get_type(ld_runatload) == LAUNCH_DATA_BOOL)
|
||||
runatload = launch_data_get_bool(ld_runatload);
|
||||
else
|
||||
{
|
||||
errno = launch_data_get_errno(ld_resp);
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"launchd_checkin: Unable to find Run-at-load setting: %s",
|
||||
strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG, "launchd_checkin: Run-at-load=%s",
|
||||
runatload ? "true" : "false");
|
||||
|
||||
/*
|
||||
* Get the sockets dictionary...
|
||||
*/
|
||||
@@ -1459,18 +1436,22 @@ launchd_checkin(void)
|
||||
{
|
||||
if (launch_data_get_type(ld_array) == LAUNCH_DATA_ARRAY)
|
||||
{
|
||||
tmp = launch_data_array_get_index(ld_array, 0);
|
||||
|
||||
if (launch_data_get_type(tmp) == LAUNCH_DATA_FD)
|
||||
if ((tmp = launch_data_array_get_index(ld_array, 0)))
|
||||
{
|
||||
if (BrowseSocket != -1)
|
||||
close(BrowseSocket);
|
||||
|
||||
BrowseSocket = launch_data_get_fd(tmp);
|
||||
}
|
||||
else
|
||||
cupsdLogMessage(CUPSD_LOG_WARN,
|
||||
"launchd_checkin: BrowseSocket not a fd!");
|
||||
if (launch_data_get_type(tmp) == LAUNCH_DATA_FD)
|
||||
{
|
||||
if (BrowseSocket != -1)
|
||||
close(BrowseSocket);
|
||||
|
||||
BrowseSocket = launch_data_get_fd(tmp);
|
||||
}
|
||||
else
|
||||
cupsdLogMessage(CUPSD_LOG_WARN,
|
||||
"launchd_checkin: BrowseSocket not a fd!");
|
||||
}
|
||||
else
|
||||
cupsdLogMessage(CUPSD_LOG_WARN,
|
||||
"launchd_checkin: BrowseSockets is an empty array!");
|
||||
}
|
||||
else
|
||||
cupsdLogMessage(CUPSD_LOG_WARN,
|
||||
@@ -2107,13 +2088,6 @@ select_timeout(int fds) /* I - Number of descriptors returned */
|
||||
if (fds || cupsArrayCount(Clients) > 50)
|
||||
return (1);
|
||||
|
||||
/*
|
||||
* If we had a recent event notification, timeout in 1 second...
|
||||
*/
|
||||
|
||||
if (LastEvent)
|
||||
return (1);
|
||||
|
||||
/*
|
||||
* Otherwise, check all of the possible events that we need to wake for...
|
||||
*/
|
||||
|
||||
@@ -2271,6 +2271,11 @@ cupsdSetPrinterState(
|
||||
|
||||
if (old_state != s)
|
||||
{
|
||||
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE_CHANGED, p, NULL,
|
||||
"%s \"%s\" state changed.",
|
||||
(p->type & CUPS_PRINTER_CLASS) ? "Class" : "Printer",
|
||||
p->name);
|
||||
|
||||
/*
|
||||
* Let the browse code know this needs to be updated...
|
||||
*/
|
||||
|
||||
+27
-25
@@ -35,9 +35,9 @@
|
||||
|
||||
#include "cupsd.h"
|
||||
#include <grp.h>
|
||||
#if defined(__APPLE__) && __GNUC__ < 4
|
||||
#if defined(__APPLE__)
|
||||
# include <libgen.h>
|
||||
#endif /* __APPLE__ && __GNUC__ < 4 */
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
|
||||
/*
|
||||
@@ -128,45 +128,47 @@ cupsdStartProcess(
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* POSIX signal handler */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
#if defined(__APPLE__) && __GNUC__ < 4
|
||||
int envc; /* Number of environment variables */
|
||||
#if defined(__APPLE__)
|
||||
char processPath[1024], /* CFProcessPath environment variable */
|
||||
linkpath[1024]; /* Link path for symlinks... */
|
||||
int linkbytes; /* Bytes for link path */
|
||||
#endif /* __APPLE__ && __GNUC__ < 4 */
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"cupsdStartProcess(\"%s\", %p, %p, %d, %d, %d)",
|
||||
command, argv, envp, infd, outfd, errfd);
|
||||
|
||||
#if defined(__APPLE__) && __GNUC__ < 4
|
||||
/*
|
||||
* Add special voodoo magic for MacOS X 10.3 and earlier - this allows
|
||||
* MacOS X programs to access their bundle resources properly...
|
||||
*/
|
||||
|
||||
if ((linkbytes = readlink(command, linkpath, sizeof(linkpath) - 1)) > 0)
|
||||
#if defined(__APPLE__)
|
||||
if (envp)
|
||||
{
|
||||
/*
|
||||
* Yes, this is a symlink to the actual program, nul-terminate and
|
||||
* use it...
|
||||
* Add special voodoo magic for MacOS X - this allows MacOS X
|
||||
* programs to access their bundle resources properly...
|
||||
*/
|
||||
|
||||
linkpath[linkbytes] = '\0';
|
||||
if ((linkbytes = readlink(command, linkpath, sizeof(linkpath) - 1)) > 0)
|
||||
{
|
||||
/*
|
||||
* Yes, this is a symlink to the actual program, nul-terminate and
|
||||
* use it...
|
||||
*/
|
||||
|
||||
if (linkpath[0] == '/')
|
||||
snprintf(processPath, sizeof(processPath), "CFProcessPath=%s",
|
||||
linkpath);
|
||||
linkpath[linkbytes] = '\0';
|
||||
|
||||
if (linkpath[0] == '/')
|
||||
snprintf(processPath, sizeof(processPath), "CFProcessPath=%s",
|
||||
linkpath);
|
||||
else
|
||||
snprintf(processPath, sizeof(processPath), "CFProcessPath=%s/%s",
|
||||
dirname(command), linkpath);
|
||||
}
|
||||
else
|
||||
snprintf(processPath, sizeof(processPath), "CFProcessPath=%s/%s",
|
||||
dirname(command), linkpath);
|
||||
}
|
||||
else
|
||||
snprintf(processPath, sizeof(processPath), "CFProcessPath=%s", command);
|
||||
snprintf(processPath, sizeof(processPath), "CFProcessPath=%s", command);
|
||||
|
||||
envp[0] = processPath; /* Replace <CFProcessPath> string */
|
||||
#endif /* __APPLE__ && __GNUC__ > 3 */
|
||||
envp[0] = processPath; /* Replace <CFProcessPath> string */
|
||||
}
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
/*
|
||||
* Block signals before forking...
|
||||
|
||||
@@ -119,7 +119,6 @@ cupsdStartServer(void)
|
||||
|
||||
LastEvent = CUPSD_EVENT_PRINTER_CHANGED | CUPSD_EVENT_JOB_STATE_CHANGED |
|
||||
CUPSD_EVENT_SERVER_STARTED;
|
||||
LastEventTime = 0;
|
||||
|
||||
started = 1;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,9 @@ cupsdStatBufUpdate(cupsd_statbuf_t *sb, /* I - Status buffer */
|
||||
* Copy over the buffer data we've used up...
|
||||
*/
|
||||
|
||||
_cups_strcpy(sb->buffer, lineptr);
|
||||
if (lineptr < sb->buffer + sb->bufused)
|
||||
_cups_strcpy(sb->buffer, lineptr);
|
||||
|
||||
sb->bufused -= lineptr - sb->buffer;
|
||||
|
||||
if (sb->bufused < 0)
|
||||
|
||||
@@ -136,8 +136,6 @@ VAR int MaxEvents VALUE(100), /* Maximum number of events */
|
||||
VAR cupsd_event_t **Events VALUE(NULL); /* Active events */
|
||||
|
||||
VAR unsigned LastEvent VALUE(0); /* Last events processed */
|
||||
VAR time_t LastEventTime VALUE(0); /* Time that the last events were sent */
|
||||
|
||||
VAR int NotifierPipes[2] VALUE2(-1, -1);
|
||||
/* Pipes for notifier error/debug output */
|
||||
VAR cupsd_statbuf_t *NotifierStatusBuffer VALUE(NULL);
|
||||
|
||||
@@ -8,7 +8,7 @@ WIDTH="15" HEIGHT="15" ALT=""></TD>
|
||||
|
||||
<P><SMALL>Common UNIX Printing System, CUPS, y el logo de CUPS son
|
||||
marcas registradas de <A HREF="http://www.easysw.com">Easy Software
|
||||
Products</A>. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products,
|
||||
Products</A>. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products.
|
||||
Todos los derechos reservados.</SMALL></P>
|
||||
|
||||
</TD>
|
||||
|
||||
Arquivo executável
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# List public API symbols...
|
||||
#
|
||||
|
||||
for function in `nm -g *.so | grep "T " | awk '{print $3}' | grep -v '^_' | sort`; do
|
||||
found=`grep $function\( *.h | grep -v DEPRECATED`
|
||||
|
||||
if test "x$found" != x; then
|
||||
echo $function
|
||||
fi
|
||||
done
|
||||
Referência em uma Nova Issue
Bloquear um usuário