From 9f5eb9be66a1755edd2c93bd7809883519c2e8eb Mon Sep 17 00:00:00 2001 From: msweet Date: Thu, 14 Aug 2008 06:33:44 +0000 Subject: [PATCH] Merge changes from CUPS 1.4svn-r7844. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@909 a1ca3aef-8c08-0410-bb20-df032aa958be --- config-scripts/cups-defaults.m4 | 12 ++--- cups/http-support.c | 79 ++++++++++++++++++++++++--------- cups/ppd.c | 11 ++--- man/cups-lpd.man.in | 2 +- scheduler/client.c | 1 + scheduler/ipp.c | 21 ++++++--- 6 files changed, 85 insertions(+), 41 deletions(-) diff --git a/config-scripts/cups-defaults.m4 b/config-scripts/cups-defaults.m4 index 624b3d6f2..bdc22ebb0 100644 --- a/config-scripts/cups-defaults.m4 +++ b/config-scripts/cups-defaults.m4 @@ -28,11 +28,7 @@ AC_SUBST(LANGUAGES) dnl Default ConfigFilePerm AC_ARG_WITH(config_file_perm, [ --with-config-file-perm set default ConfigFilePerm value, default=0640], CUPS_CONFIG_FILE_PERM="$withval", - if test "x$uname" = xDarwin; then - CUPS_CONFIG_FILE_PERM="644" - else - CUPS_CONFIG_FILE_PERM="640" - fi) + CUPS_CONFIG_FILE_PERM="640") AC_SUBST(CUPS_CONFIG_FILE_PERM) AC_DEFINE_UNQUOTED(CUPS_DEFAULT_CONFIG_FILE_PERM, 0$CUPS_CONFIG_FILE_PERM) @@ -51,9 +47,9 @@ AC_SUBST(CUPS_LOG_LEVEL) AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LOG_LEVEL, "$CUPS_LOG_LEVEL") dnl Default AccessLogLevel -AC_ARG_WITH(log_level, [ --with-access-log-level set default AccessLogLevel value, default=actions], - CUPS_LOG_LEVEL="$withval", - CUPS_LOG_LEVEL="actions") +AC_ARG_WITH(access_log_level, [ --with-access-log-level set default AccessLogLevel value, default=actions], + CUPS_ACCESS_LOG_LEVEL="$withval", + CUPS_ACCESS_LOG_LEVEL="actions") AC_SUBST(CUPS_ACCESS_LOG_LEVEL) AC_DEFINE_UNQUOTED(CUPS_DEFAULT_ACCESS_LOG_LEVEL, "$CUPS_ACCESS_LOG_LEVEL") diff --git a/cups/http-support.c b/cups/http-support.c index 56e27515c..30998136a 100644 --- a/cups/http-support.c +++ b/cups/http-support.c @@ -3,7 +3,7 @@ * * HTTP support routines for the Common UNIX Printing System (CUPS) scheduler. * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -1155,55 +1155,90 @@ httpSeparateURI( /* * 'httpStatus()' - Return a short string describing a HTTP status code. + * + * The returned string is localized to the current POSIX locale and is based + * on the status strings defined in RFC 2616. */ -const char * /* O - String or NULL */ +const char * /* O - Localized status string */ httpStatus(http_status_t status) /* I - HTTP status code */ { + const char *s; /* Status string */ + _cups_globals_t *cg = _cupsGlobals(); /* Global data */ + + + if (!cg->lang_default) + cg->lang_default = cupsLangDefault(); + switch (status) { case HTTP_CONTINUE : - return ("Continue"); + s = _("Continue"); + break; case HTTP_SWITCHING_PROTOCOLS : - return ("Switching Protocols"); + s = _("Switching Protocols"); + break; case HTTP_OK : - return ("OK"); + s = _("OK"); + break; case HTTP_CREATED : - return ("Created"); + s = _("Created"); + break; case HTTP_ACCEPTED : - return ("Accepted"); + s = _("Accepted"); + break; case HTTP_NO_CONTENT : - return ("No Content"); + s = _("No Content"); + break; case HTTP_MOVED_PERMANENTLY : - return ("Moved Permanently"); + s = _("Moved Permanently"); + break; case HTTP_SEE_OTHER : - return ("See Other"); + s = _("See Other"); + break; case HTTP_NOT_MODIFIED : - return ("Not Modified"); + s = _("Not Modified"); + break; case HTTP_BAD_REQUEST : - return ("Bad Request"); + s = _("Bad Request"); + break; case HTTP_UNAUTHORIZED : - return ("Unauthorized"); + s = _("Unauthorized"); + break; case HTTP_FORBIDDEN : - return ("Forbidden"); + s = _("Forbidden"); + break; case HTTP_NOT_FOUND : - return ("Not Found"); + s = _("Not Found"); + break; case HTTP_REQUEST_TOO_LARGE : - return ("Request Entity Too Large"); + s = _("Request Entity Too Large"); + break; case HTTP_URI_TOO_LONG : - return ("URI Too Long"); + s = _("URI Too Long"); + break; case HTTP_UPGRADE_REQUIRED : - return ("Upgrade Required"); + s = _("Upgrade Required"); + break; case HTTP_NOT_IMPLEMENTED : - return ("Not Implemented"); + s = _("Not Implemented"); + break; case HTTP_NOT_SUPPORTED : - return ("Not Supported"); + s = _("Not Supported"); + break; case HTTP_EXPECTATION_FAILED : - return ("Expectation Failed"); + s = _("Expectation Failed"); + break; + case HTTP_SERVICE_UNAVAILABLE : + s = _("Service Unavailable"); + break; default : - return ("Unknown"); + s = _("Unknown"); + break; } + + return (_cupsLangString(cg->lang_default, s)); } diff --git a/cups/ppd.c b/cups/ppd.c index e88dad15b..110f230ef 100644 --- a/cups/ppd.c +++ b/cups/ppd.c @@ -588,6 +588,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ cg->ppd_status = PPD_MISSING_PPDADOBE4; _cupsStrFree(string); + ppd_free(line.buffer); return (NULL); } @@ -604,6 +605,9 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ { cg->ppd_status = PPD_ALLOC_ERROR; + _cupsStrFree(string); + ppd_free(line.buffer); + return (NULL); } @@ -1881,8 +1885,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ _cupsStrFree(string); } - if (line.buffer) - free(line.buffer); + ppd_free(line.buffer); /* * Reset language preferences... @@ -1955,10 +1958,8 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ error: - if (line.buffer) - free(line.buffer); - _cupsStrFree(string); + ppd_free(line.buffer); ppdClose(ppd); diff --git a/man/cups-lpd.man.in b/man/cups-lpd.man.in index 3c5dcb059..54ad4b6ba 100644 --- a/man/cups-lpd.man.in +++ b/man/cups-lpd.man.in @@ -61,7 +61,7 @@ named \fI/etc/xinetd.d/cups\fR containing the following lines: .fi .SH OPTIONS .TP 5 -.h hostname[:port] +-h hostname[:port] .br Sets the CUPS server (and port) to use. .TP 5 diff --git a/scheduler/client.c b/scheduler/client.c index b9e525c9f..a4e249790 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -697,6 +697,7 @@ cupsdCloseClient(cupsd_client_t *con) /* I - Client to close */ free(con->http.input_set); httpClearCookie(HTTP(con)); + httpClearFields(HTTP(con)); cupsdClearString(&con->filename); cupsdClearString(&con->command); diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 23d15ad8b..ccd8d851c 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -249,7 +249,7 @@ cupsdProcessIPPRequest( ipp_attribute_t *attr; /* Current attribute */ ipp_attribute_t *charset; /* Character set attribute */ ipp_attribute_t *language; /* Language attribute */ - ipp_attribute_t *uri; /* Printer URI attribute */ + ipp_attribute_t *uri = NULL; /* Printer or job URI attribute */ ipp_attribute_t *username; /* requesting-user-name attr */ int sub_id; /* Subscription ID */ @@ -680,9 +680,10 @@ cupsdProcessIPPRequest( cupsdLogMessage(con->response->request.status.status_code >= IPP_BAD_REQUEST ? CUPSD_LOG_ERROR : CUPSD_LOG_DEBUG, - "Returning %s for %s from %s", + "Returning IPP %s for %s (%s) from %s", ippErrorString(con->response->request.status.status_code), ippOpString(con->request->request.op.operation_id), + uri ? uri->values[0].string.text : "no URI", con->http.hostname); if (cupsdSendHeader(con, HTTP_OK, "application/ipp", CUPSD_AUTH_NONE)) @@ -9796,9 +9797,19 @@ send_http_error( http_status_t status, /* I - HTTP status code */ cupsd_printer_t *printer) /* I - Printer, if any */ { - cupsdLogMessage(CUPSD_LOG_ERROR, "%s: %s", - ippOpString(con->request->request.op.operation_id), - httpStatus(status)); + ipp_attribute_t *uri; /* Request URI, if any */ + + + if ((uri = ippFindAttribute(con->request, "printer-uri", + IPP_TAG_URI)) == NULL) + uri = ippFindAttribute(con->request, "job-uri", IPP_TAG_URI); + + cupsdLogMessage(status == HTTP_FORBIDDEN ? CUPSD_LOG_ERROR : CUPSD_LOG_DEBUG, + "Returning HTTP %s for %s (%s) from %s", + httpStatus(status), + ippOpString(con->request->request.op.operation_id), + uri ? uri->values[0].string.text : "no URI", + con->http.hostname); if (status == HTTP_UNAUTHORIZED && printer && printer->num_auth_info_required > 0 && -- 2.39.2