Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 4d5e91c810 |
@@ -1,6 +1,106 @@
|
||||
CHANGES.txt - 2008-04-01
|
||||
CHANGES.txt - 2008-07-21
|
||||
------------------------
|
||||
|
||||
CHANGES IN CUPS V1.3.8
|
||||
|
||||
- Documentation updates (STR #2785, STR #2861, STR #2862)
|
||||
- The scheduler did not add the ending job sheet when the
|
||||
job was released.
|
||||
- The IPP backend did not relay marker-* attributes.
|
||||
- The CUPS GNOME/KDE menu item was not localized for
|
||||
Chinese (STR #2880)
|
||||
- The CUPS GNOME/KDE menu item was not localized for
|
||||
Japanese (STR #2876)
|
||||
- The cupstestppd utility reported mixed line endings for
|
||||
Mac OS and Windows PPD files (STR #2874)
|
||||
- The pdftops filter did not print landscape orientation PDF
|
||||
pages correctly on all printers (STR #2850)
|
||||
- The scheduler did not handle expiring of implicit classes
|
||||
or their members properly, leading to a configuration where
|
||||
one of the members would have a short name (STR #2766)
|
||||
- The scheduler and cupstestppd utilities did not support
|
||||
cupsFilter and cupsPreFilter programs with spaces in their
|
||||
names (STR #2866)
|
||||
- Removed unused variables and assignments found by the
|
||||
LLVM "clang" tool.
|
||||
- Added NULL checks recommended by the LLVM "clang" tool.
|
||||
- The scheduler would crash if you started a printer that
|
||||
pointed to a backend that did not exist (STR #2865)
|
||||
- The ppdLocalize functions incorrectly mapped all generic
|
||||
locales to country-specific locales.
|
||||
- The cups-driverd program did not support Simplified Chinese
|
||||
or Traditional Chinese language version strings (STR #2851)
|
||||
- Added an Indonesian translation (STR #2792)
|
||||
- Fixed a timing issue in the backends that could cause data
|
||||
corruption with the CUPS_SC_CMD_DRAIN_OUTPUT side-channel
|
||||
command (STR #2858)
|
||||
- The scheduler did not support "HostNameLookups" with all of
|
||||
the boolean names (STR #2861)
|
||||
- Fixed a compile problem with glibc 2.8 (STR #2860)
|
||||
- The PostScript filter did not support %%IncludeFeature lines
|
||||
in the page setup section of each page (STR #2831)
|
||||
- The scheduler did not generate printer-state events when the
|
||||
default printer was changed (STR #2764)
|
||||
- cupstestppd incorrectly reported a warning about the PPD format
|
||||
version in some locales (STR #2854)
|
||||
- cupsGetPPD() and friends incorrectly returned a PPD file for
|
||||
a class with no printers.
|
||||
- The member-uris values for local printers in a class returned
|
||||
by the scheduler did not reflect the connected hostname or
|
||||
port.
|
||||
- The CUPS PHP extension was not thread-safe (STR #2828)
|
||||
- The scheduler incorrectly added the document-format-default
|
||||
attribute to the list of "common" printer attributes, which
|
||||
over time would slow down the printing system (STR #2755,
|
||||
STR #2836)
|
||||
- The cups-deviced and cups-driverd helper programs did not set
|
||||
the CFProcessPath environment variable on Mac OS X (STR #2837)
|
||||
- "lpstat -p" could report the wrong job as printing (STR #2845)
|
||||
- The scheduler would crash when some cupsd.conf directives
|
||||
were missing values (STR #2849)
|
||||
- The web interface "move jobs" operation redirected users to
|
||||
the wrong URL (STR #2815)
|
||||
- The Polish web interface translation contained errors
|
||||
(STR #2815)
|
||||
- The scheduler did not report PostScript printer PPDs with
|
||||
filters as PostScript devices.
|
||||
- The scheduler did not set the job document-format attribute
|
||||
for jobs submitted using Create-Job and Send-Document.
|
||||
- cupsFileTell() did not work for log files opened in append
|
||||
mode (STR #2810)
|
||||
- The scheduler did not set QUERY_STRING all of the time
|
||||
for CGI scripts (STR #2781, STR #2816)
|
||||
- The scheduler now returns an error for bad job-sheets
|
||||
values (STR #2775)
|
||||
- Authenticated remote printing did not work over domain
|
||||
sockets (STR #2750)
|
||||
- The scheduler incorrectly logged errors for print filters
|
||||
when a job was canceled (STR #2806, #2808)
|
||||
- The scheduler no longer allows multiple RSS subscriptions
|
||||
with the same URI (STR #2789)
|
||||
- The scheduler now supports Kerberized printing with
|
||||
multiple server names (STR #2783)
|
||||
- "Satisfy any" did not work in IPP policies (STR #2782)
|
||||
- The CUPS imaging library would crash with very large
|
||||
images - more than 16Mx16M pixels (STR #2805)
|
||||
- The PNG image loading code would crash with large images
|
||||
(STR #2790)
|
||||
- The scheduler did not limit the total number of filters.
|
||||
- The scheduler now ensures that the RSS directory has
|
||||
the correct permissions.
|
||||
- The RSS notifier did not quote the feed URL in the RSS
|
||||
file it created (STR #2801)
|
||||
- The web interface allowed the creation and cancellation
|
||||
of RSS subscriptions without a username (STR #2774)
|
||||
- Increased the default MaxCopies value on Mac OS X to
|
||||
9999 to match the limit imposed by the print dialog.
|
||||
- The scheduler did not reject requests with an empty
|
||||
Content-Length field (STR #2787)
|
||||
- The scheduler did not log the current date and time and
|
||||
did not escape special characters in request URIs when
|
||||
logging bad requests to the access_log file (STR #2788)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.3.7
|
||||
|
||||
- CVE-2008-0047: cgiCompileSearch buffer overflow (STR #2729)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
CREDITS.txt - 2007-09-10
|
||||
CREDITS.txt - 2008-06-16
|
||||
------------------------
|
||||
|
||||
Few projects are completed by one person, and CUPS is no exception. We'd
|
||||
@@ -30,6 +30,7 @@ like to thank the following individuals for their contributions:
|
||||
Daniel Nylander - Swedish localization.
|
||||
Giulio Orsero - Bug fixes and testing.
|
||||
Michal Osowiecki - Polish localization.
|
||||
Citra Paska - Indonesian localization.
|
||||
Kurt Pfeifle - Bug fixes, beta testing, evangelism.
|
||||
Vincenzo Reale - Italian localization.
|
||||
Petter Reinholdtsen - HP-UX compiler stuff.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
INSTALL - CUPS v1.3.7 - 2008-04-01
|
||||
INSTALL - CUPS v1.3.8 - 2008-07-14
|
||||
----------------------------------
|
||||
|
||||
This file describes how to compile and install CUPS from source
|
||||
@@ -32,7 +32,7 @@ BEFORE YOU BEGIN
|
||||
many of the features provided by CUPS.
|
||||
|
||||
Kerberos support requires MIT Kerberos 1.6.3 or later or
|
||||
or Heimdal Kerberos, along with the corresponding GSSAPI
|
||||
Heimdal Kerberos, along with the corresponding GSSAPI
|
||||
pieces.
|
||||
|
||||
Also, please note that CUPS no longer includes the
|
||||
|
||||
@@ -84,6 +84,22 @@ depend:
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Run the clang.llvm.org static code analysis tool on the C sources.
|
||||
#
|
||||
|
||||
.PHONY: clang
|
||||
clang:
|
||||
if test ! -d clang; then \
|
||||
mkdir clang; \
|
||||
else \
|
||||
rm -rf clang/*; \
|
||||
fi
|
||||
$(MAKE) $(MFLAGS) CC="scan-build -o ../clang $(CC)" \
|
||||
CXX="scan-build -o ../clang $(CXX)" clean all
|
||||
test `ls -1 clang | wc -l` != 0 || exit 1
|
||||
|
||||
|
||||
#
|
||||
# Generate a ctags file...
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
README - CUPS v1.3.7 - 2008-04-01
|
||||
README - CUPS v1.3.8 - 2008-07-14
|
||||
---------------------------------
|
||||
|
||||
Looking for compile instructions? Read the file "INSTALL.txt"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
* compress_files() - Compress print files...
|
||||
* password_cb() - Disable the password prompt for
|
||||
* cupsDoFileRequest().
|
||||
* report_attr() - Report an IPP attribute value.
|
||||
* report_printer_state() - Report the printer state.
|
||||
* run_pictwps_filter() - Convert PICT files to PostScript when printing
|
||||
* remotely.
|
||||
@@ -72,6 +73,7 @@ static void check_printer_state(http_t *http, const char *uri,
|
||||
static void compress_files(int num_files, char **files);
|
||||
#endif /* HAVE_LIBZ */
|
||||
static const char *password_cb(const char *);
|
||||
static void report_attr(ipp_attribute_t *attr);
|
||||
static int report_printer_state(ipp_t *ipp, int job_id);
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -142,6 +144,11 @@ main(int argc, /* I - Number of command-line args */
|
||||
{ /* Printer attributes we want */
|
||||
"copies-supported",
|
||||
"document-format-supported",
|
||||
"marker-colors",
|
||||
"marker-levels",
|
||||
"marker-message",
|
||||
"marker-names",
|
||||
"marker-types",
|
||||
"printer-is-accepting-jobs",
|
||||
"printer-state",
|
||||
"printer-state-message",
|
||||
@@ -1288,6 +1295,11 @@ check_printer_state(
|
||||
*response; /* IPP response */
|
||||
static const char * const attrs[] = /* Attributes we want */
|
||||
{
|
||||
"marker-colors",
|
||||
"marker-levels",
|
||||
"marker-message",
|
||||
"marker-names",
|
||||
"marker-types",
|
||||
"printer-state-message",
|
||||
"printer-state-reasons"
|
||||
};
|
||||
@@ -1410,7 +1422,7 @@ password_cb(const char *prompt) /* I - Prompt (not used) */
|
||||
{
|
||||
(void)prompt;
|
||||
|
||||
if (password && password_tries < 3)
|
||||
if (password && *password && password_tries < 3)
|
||||
{
|
||||
password_tries ++;
|
||||
|
||||
@@ -1440,6 +1452,74 @@ password_cb(const char *prompt) /* I - Prompt (not used) */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'report_attr()' - Report an IPP attribute value.
|
||||
*/
|
||||
|
||||
static void
|
||||
report_attr(ipp_attribute_t *attr) /* I - Attribute */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
char value[1024], /* Value string */
|
||||
*valptr, /* Pointer into value string */
|
||||
*attrptr; /* Pointer into attribute value */
|
||||
|
||||
|
||||
/*
|
||||
* Convert the attribute values into quoted strings...
|
||||
*/
|
||||
|
||||
for (i = 0, valptr = value;
|
||||
i < attr->num_values && valptr < (value + sizeof(value) - 10);
|
||||
i ++)
|
||||
{
|
||||
if (i > 0)
|
||||
*valptr++ = ',';
|
||||
|
||||
switch (attr->value_tag)
|
||||
{
|
||||
case IPP_TAG_INTEGER :
|
||||
case IPP_TAG_ENUM :
|
||||
snprintf(valptr, sizeof(value) - (valptr - value), "%d",
|
||||
attr->values[i].integer);
|
||||
valptr += strlen(valptr);
|
||||
break;
|
||||
|
||||
case IPP_TAG_TEXT :
|
||||
case IPP_TAG_NAME :
|
||||
case IPP_TAG_KEYWORD :
|
||||
*valptr++ = '\"';
|
||||
for (attrptr = attr->values[i].string.text;
|
||||
*attrptr && valptr < (value + sizeof(value) - 10);
|
||||
attrptr ++)
|
||||
{
|
||||
if (*attrptr == '\\' || *attrptr == '\"')
|
||||
*valptr++ = '\\';
|
||||
|
||||
*valptr++ = *attrptr;
|
||||
}
|
||||
*valptr++ = '\"';
|
||||
break;
|
||||
|
||||
default :
|
||||
/*
|
||||
* Unsupported value type...
|
||||
*/
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
*valptr = '\0';
|
||||
|
||||
/*
|
||||
* Tell the scheduler about the new values...
|
||||
*/
|
||||
|
||||
fprintf(stderr, "ATTR: %s=%s\n", attr->name, value);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'report_printer_state()' - Report the printer state.
|
||||
*/
|
||||
@@ -1450,8 +1530,9 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
int count; /* Count of reasons shown... */
|
||||
ipp_attribute_t *psm, /* pritner-state-message */
|
||||
*reasons; /* printer-state-reasons */
|
||||
ipp_attribute_t *psm, /* printer-state-message */
|
||||
*reasons, /* printer-state-reasons */
|
||||
*marker; /* marker-* attributes */
|
||||
const char *reason; /* Current reason */
|
||||
const char *message; /* Message to show */
|
||||
char unknown[1024]; /* Unknown message string */
|
||||
@@ -1558,6 +1639,22 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
|
||||
|
||||
fprintf(stderr, "%s\n", state);
|
||||
|
||||
/*
|
||||
* Relay the current marker-* attribute values...
|
||||
*/
|
||||
|
||||
if ((marker = ippFindAttribute(ipp, "marker-colors", IPP_TAG_NAME)) != NULL)
|
||||
report_attr(marker);
|
||||
if ((marker = ippFindAttribute(ipp, "marker-levels",
|
||||
IPP_TAG_INTEGER)) != NULL)
|
||||
report_attr(marker);
|
||||
if ((marker = ippFindAttribute(ipp, "marker-message", IPP_TAG_TEXT)) != NULL)
|
||||
report_attr(marker);
|
||||
if ((marker = ippFindAttribute(ipp, "marker-names", IPP_TAG_NAME)) != NULL)
|
||||
report_attr(marker);
|
||||
if ((marker = ippFindAttribute(ipp, "marker-types", IPP_TAG_KEYWORD)) != NULL)
|
||||
report_attr(marker);
|
||||
|
||||
return (count);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Line Printer Daemon backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* 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
|
||||
@@ -445,8 +445,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
unlink(tmpfilename);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
filename = tmpfilename;
|
||||
}
|
||||
else if (argc == 6)
|
||||
{
|
||||
|
||||
@@ -280,7 +280,6 @@ int main (int argc, const char * argv[])
|
||||
*/
|
||||
static int listDevices(void)
|
||||
{
|
||||
int err = noErr;
|
||||
int i;
|
||||
int numberFound;
|
||||
|
||||
@@ -300,7 +299,7 @@ static int listDevices(void)
|
||||
return -1; /* Network is down */
|
||||
}
|
||||
|
||||
if ((err = zip_getmyzone(ZIP_DEF_INTERFACE, &at_zone)) != 0)
|
||||
if (zip_getmyzone(ZIP_DEF_INTERFACE, &at_zone))
|
||||
{
|
||||
perror("ERROR: Unable to get default AppleTalk zone");
|
||||
return -2;
|
||||
@@ -409,14 +408,13 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
|
||||
at_inet_t sendDataAddr;
|
||||
at_inet_t src;
|
||||
at_resp_t resp;
|
||||
int userdata, xo, reqlen;
|
||||
int userdata, xo = 0, reqlen;
|
||||
u_short tid;
|
||||
u_char bitmap;
|
||||
int maxfdp1,
|
||||
nbp_failures = 0;
|
||||
struct timeval timeout, *timeoutPtr;
|
||||
u_char flowQuantum = 1;
|
||||
u_short recvSequence = 0;
|
||||
time_t now,
|
||||
start_time,
|
||||
elasped_time,
|
||||
@@ -728,7 +726,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
|
||||
case AT_PAP_TYPE_SEND_DATA: /* Send-Data packet */
|
||||
sendDataAddr.socket = src.socket;
|
||||
gSendDataID = tid;
|
||||
recvSequence = OSReadBigInt16(&SEQUENCE_NUM(userdata), 0);
|
||||
OSReadBigInt16(&SEQUENCE_NUM(userdata), 0);
|
||||
|
||||
if ((fileBufferNbytes > 0 || fileEOFRead) && fileEOFSent == false)
|
||||
{
|
||||
@@ -906,8 +904,7 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
|
||||
{
|
||||
int result,
|
||||
open_result,
|
||||
userdata,
|
||||
atp_err;
|
||||
userdata;
|
||||
time_t tm,
|
||||
waitTime;
|
||||
char data[10],
|
||||
@@ -956,8 +953,8 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
|
||||
|
||||
fprintf(stderr, "DEBUG: -> %s\n", packet_name(AT_PAP_TYPE_OPEN_CONN));
|
||||
|
||||
if ((atp_err = atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0,
|
||||
0, &resp, &retry, 0)) < 0)
|
||||
if (atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0,
|
||||
0, &resp, &retry, 0) < 0)
|
||||
{
|
||||
statusUpdate("Destination unreachable", 23);
|
||||
result = EHOSTUNREACH;
|
||||
@@ -1024,7 +1021,6 @@ static int papClose()
|
||||
{
|
||||
int fd;
|
||||
u_short tmpID;
|
||||
int result;
|
||||
unsigned char rdata[ATP_DATA_SIZE];
|
||||
int userdata;
|
||||
u_char *puserdata = (u_char *)&userdata;
|
||||
@@ -1077,9 +1073,9 @@ static int papClose()
|
||||
resp.resp[0].iov_base = rdata;
|
||||
resp.resp[0].iov_len = sizeof(rdata);
|
||||
|
||||
result = atp_sendreq(fd, &gSessionAddr, 0, 0, userdata, 1, 0, 0, &resp, &retry, 0);
|
||||
atp_sendreq(fd, &gSessionAddr, 0, 0, userdata, 1, 0, 0, &resp, &retry, 0);
|
||||
|
||||
result = close(fd);
|
||||
close(fd);
|
||||
}
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ backendRunLoop(
|
||||
FD_SET(print_fd, &input);
|
||||
if (use_bc)
|
||||
FD_SET(device_fd, &input);
|
||||
if (side_cb)
|
||||
if (!print_bytes && side_cb)
|
||||
FD_SET(CUPS_SC_FD, &input);
|
||||
|
||||
FD_ZERO(&output);
|
||||
@@ -250,7 +250,15 @@ backendRunLoop(
|
||||
*/
|
||||
|
||||
if (side_cb && FD_ISSET(CUPS_SC_FD, &input))
|
||||
{
|
||||
/*
|
||||
* Do the side-channel request, then start back over in the select
|
||||
* loop since it may have read from print_fd...
|
||||
*/
|
||||
|
||||
(*side_cb)(print_fd, device_fd, use_bc);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if we have back-channel data ready...
|
||||
|
||||
@@ -556,7 +556,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
if (!print_bytes)
|
||||
FD_SET(print_fd, &input);
|
||||
FD_SET(device_fd, &input);
|
||||
FD_SET(CUPS_SC_FD, &input);
|
||||
if (!print_bytes)
|
||||
FD_SET(CUPS_SC_FD, &input);
|
||||
|
||||
FD_ZERO(&output);
|
||||
if (print_bytes)
|
||||
@@ -570,7 +571,15 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
*/
|
||||
|
||||
if (FD_ISSET(CUPS_SC_FD, &input))
|
||||
{
|
||||
/*
|
||||
* Do the side-channel request, then start back over in the select
|
||||
* loop since it may have read from print_fd...
|
||||
*/
|
||||
|
||||
side_cb(print_fd, device_fd, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if we have back-channel data ready...
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* "lpr" command for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -420,8 +420,6 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
else
|
||||
{
|
||||
num_files = 1;
|
||||
|
||||
#ifndef WIN32
|
||||
# if defined(HAVE_SIGSET)
|
||||
sigset(SIGHUP, sighandler);
|
||||
|
||||
@@ -308,6 +308,16 @@ do_add_rss_subscription(http_t *http) /* I - HTTP connection */
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure we have a username...
|
||||
*/
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate the subscription name...
|
||||
*/
|
||||
@@ -352,9 +362,6 @@ do_add_rss_subscription(http_t *http) /* I - HTTP connection */
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, printer_uri);
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
user = "guest";
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
|
||||
NULL, user);
|
||||
|
||||
@@ -897,7 +904,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
cgiCopyTemplateLang("choose-serial.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
else if (!file && (var = cgiGetVariable("PPD_NAME")) == NULL)
|
||||
else if (!file && !cgiGetVariable("PPD_NAME"))
|
||||
{
|
||||
if (modify)
|
||||
{
|
||||
@@ -1268,6 +1275,16 @@ do_cancel_subscription(http_t *http)/* I - HTTP connection */
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Require a username...
|
||||
*/
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Cancel the subscription...
|
||||
*/
|
||||
@@ -1279,9 +1296,6 @@ do_cancel_subscription(http_t *http)/* I - HTTP connection */
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER,
|
||||
"notify-subscription-id", id);
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
user = "guest";
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
|
||||
NULL, user);
|
||||
|
||||
@@ -2998,15 +3012,15 @@ do_set_options(http_t *http, /* I - HTTP connection */
|
||||
|
||||
cgiSetVariable("KEYWORD", "job_sheets_start");
|
||||
cgiSetVariable("KEYTEXT", cgiText(_("Starting Banner")));
|
||||
cgiSetVariable("DEFCHOICE", attr == NULL ?
|
||||
"" : attr->values[0].string.text);
|
||||
cgiSetVariable("DEFCHOICE", attr != NULL ?
|
||||
attr->values[0].string.text : "");
|
||||
|
||||
cgiCopyTemplateLang("option-pickone.tmpl");
|
||||
|
||||
cgiSetVariable("KEYWORD", "job_sheets_end");
|
||||
cgiSetVariable("KEYTEXT", cgiText(_("Ending Banner")));
|
||||
cgiSetVariable("DEFCHOICE", attr == NULL && attr->num_values > 1 ?
|
||||
"" : attr->values[1].string.text);
|
||||
cgiSetVariable("DEFCHOICE", attr != NULL && attr->num_values > 1 ?
|
||||
attr->values[1].string.text : "");
|
||||
|
||||
cgiCopyTemplateLang("option-pickone.tmpl");
|
||||
|
||||
@@ -3193,7 +3207,7 @@ do_set_options(http_t *http, /* I - HTTP connection */
|
||||
}
|
||||
|
||||
if ((var = cgiGetVariable("protocol")) != NULL)
|
||||
cupsFilePrintf(out, "*cupsProtocol: %s\n", cgiGetVariable("protocol"));
|
||||
cupsFilePrintf(out, "*cupsProtocol: %s\n", var);
|
||||
|
||||
cupsFileClose(in);
|
||||
cupsFileClose(out);
|
||||
@@ -3232,12 +3246,12 @@ do_set_options(http_t *http, /* I - HTTP connection */
|
||||
attr->values[1].string.text = _cupsStrAlloc(cgiGetVariable("job_sheets_end"));
|
||||
|
||||
if ((var = cgiGetVariable("printer_error_policy")) != NULL)
|
||||
attr = ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME,
|
||||
"printer-error-policy", NULL, var);
|
||||
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME,
|
||||
"printer-error-policy", NULL, var);
|
||||
|
||||
if ((var = cgiGetVariable("printer_op_policy")) != NULL)
|
||||
attr = ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME,
|
||||
"printer-op-policy", NULL, var);
|
||||
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME,
|
||||
"printer-op-policy", NULL, var);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
|
||||
@@ -474,10 +474,16 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
|
||||
|
||||
if (cupsLastError() <= IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiRewriteURL(job_printer_uri, resource, sizeof(resource), NULL);
|
||||
cgiFormEncode(uri, resource, sizeof(uri));
|
||||
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
|
||||
cgiSetVariable("refresh_page", refresh);
|
||||
const char *path = strstr(job_printer_uri, "/printers/");
|
||||
if (!path)
|
||||
path = strstr(job_printer_uri, "/classes/");
|
||||
|
||||
if (path)
|
||||
{
|
||||
cgiFormEncode(uri, path, sizeof(uri));
|
||||
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
|
||||
cgiSetVariable("refresh_page", refresh);
|
||||
}
|
||||
}
|
||||
|
||||
if (job_id)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-common.m4 7329 2008-02-20 00:32:58Z mike $"
|
||||
dnl "$Id: cups-common.m4 7735 2008-07-14 21:25:26Z mike $"
|
||||
dnl
|
||||
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -20,7 +20,7 @@ dnl Set the name of the config header file...
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl Version number information...
|
||||
CUPS_VERSION="1.3.7"
|
||||
CUPS_VERSION="1.3.8"
|
||||
CUPS_REVISION=""
|
||||
|
||||
AC_SUBST(CUPS_VERSION)
|
||||
@@ -258,10 +258,31 @@ case $uname in
|
||||
AC_CHECK_FUNCS(notify_post)
|
||||
|
||||
dnl Check for Authorization Services support
|
||||
AC_ARG_WITH(adminkey, [ --with-adminkey set the default SystemAuthKey value],
|
||||
default_adminkey="$withval",
|
||||
default_adminkey="default")
|
||||
AC_ARG_WITH(operkey, [ --with-operkey set the default operator @AUTHKEY value],
|
||||
default_operkey="$withval",
|
||||
default_operkey="default")
|
||||
|
||||
AC_CHECK_HEADER(Security/Authorization.h, [
|
||||
AC_DEFINE(HAVE_AUTHORIZATION_H)
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"])
|
||||
|
||||
if test "x$default_adminkey" != xdefault; then
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
|
||||
elif grep -q system.print.operator /etc/authorization; then
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
|
||||
else
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"
|
||||
fi
|
||||
|
||||
if test "x$default_operkey" != xdefault; then
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
|
||||
elif grep -q system.print.operator /etc/authorization; then
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
|
||||
else
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
|
||||
fi])
|
||||
AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
|
||||
;;
|
||||
esac
|
||||
@@ -273,5 +294,5 @@ AC_SUBST(FONTS)
|
||||
AC_SUBST(LEGACY_BACKENDS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-common.m4 7329 2008-02-20 00:32:58Z mike $".
|
||||
dnl End of "$Id: cups-common.m4 7735 2008-07-14 21:25:26Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-compiler.m4 7353 2008-02-28 00:54:04Z mike $"
|
||||
dnl "$Id: cups-compiler.m4 7648 2008-06-16 17:41:11Z mike $"
|
||||
dnl
|
||||
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -521,6 +521,12 @@ case $uname in
|
||||
OPTIM="$OPTIM -D_HPUX_SOURCE"
|
||||
;;
|
||||
|
||||
Linux*)
|
||||
# glibc 2.8 and higher breaks peer credentials unless you
|
||||
# define _GNU_SOURCE...
|
||||
OPTIM="$OPTIM -D_GNU_SOURCE"
|
||||
;;
|
||||
|
||||
OSF*)
|
||||
# Tru64 UNIX aka Digital UNIX aka OSF/1 need to be told
|
||||
# to be POSIX-compliant...
|
||||
@@ -529,5 +535,5 @@ case $uname in
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-compiler.m4 7353 2008-02-28 00:54:04Z mike $".
|
||||
dnl End of "$Id: cups-compiler.m4 7648 2008-06-16 17:41:11Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-defaults.m4 7296 2008-02-12 00:20:32Z mike $"
|
||||
dnl "$Id: cups-defaults.m4 7448 2008-04-14 18:10:27Z mike $"
|
||||
dnl
|
||||
dnl Default cupsd configuration settings for the Common UNIX Printing System
|
||||
dnl (CUPS).
|
||||
@@ -290,10 +290,10 @@ fi
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP")
|
||||
|
||||
dnl Default MaxCopies value...
|
||||
AC_ARG_WITH(max-copies, [ --with-max-copies set max copies value, default=100 ],
|
||||
AC_ARG_WITH(max-copies, [ --with-max-copies set default max copies value, default=auto ],
|
||||
CUPS_MAX_COPIES="$withval",
|
||||
if test "x$uname" = xDarwin; then
|
||||
CUPS_MAX_COPIES="999"
|
||||
CUPS_MAX_COPIES="9999"
|
||||
else
|
||||
CUPS_MAX_COPIES="100"
|
||||
fi)
|
||||
@@ -346,5 +346,5 @@ AC_SUBST(DEFAULT_IPP_PORT)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-defaults.m4 7296 2008-02-12 00:20:32Z mike $".
|
||||
dnl End of "$Id: cups-defaults.m4 7448 2008-04-14 18:10:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -386,7 +386,7 @@ cupsAdminCreateWindowsPPD(
|
||||
{
|
||||
write_option(dstfp, jclorder ++, "cupsJobSheetsStart", "Start Banner",
|
||||
"job-sheets", suppattr, defattr, 0, 2);
|
||||
write_option(dstfp, jclorder ++, "cupsJobSheetsEnd", "End Banner",
|
||||
write_option(dstfp, jclorder, "cupsJobSheetsEnd", "End Banner",
|
||||
"job-sheets", suppattr, defattr, 1, 2);
|
||||
}
|
||||
|
||||
@@ -961,7 +961,7 @@ _cupsAdminGetServerSettings(
|
||||
if (!value && strncmp(line, "</", 2))
|
||||
value = line + strlen(line);
|
||||
|
||||
if (!strcasecmp(line, "Port") || !strcasecmp(line, "Listen"))
|
||||
if ((!strcasecmp(line, "Port") || !strcasecmp(line, "Listen")) && value)
|
||||
{
|
||||
char *port; /* Pointer to port number, if any */
|
||||
|
||||
@@ -1017,7 +1017,7 @@ _cupsAdminGetServerSettings(
|
||||
{
|
||||
in_policy = 0;
|
||||
}
|
||||
else if (!strcasecmp(line, "<Limit") && in_policy)
|
||||
else if (!strcasecmp(line, "<Limit") && in_policy && value)
|
||||
{
|
||||
/*
|
||||
* See if the policy limit is for the Cancel-Job operation...
|
||||
@@ -1050,7 +1050,7 @@ _cupsAdminGetServerSettings(
|
||||
{
|
||||
cancel_policy = 0;
|
||||
}
|
||||
else if (!strcasecmp(line, "<Location"))
|
||||
else if (!strcasecmp(line, "<Location") && value)
|
||||
{
|
||||
in_admin_location = !strcasecmp(value, "/admin");
|
||||
in_location = 1;
|
||||
@@ -1060,7 +1060,7 @@ _cupsAdminGetServerSettings(
|
||||
in_admin_location = 0;
|
||||
in_location = 0;
|
||||
}
|
||||
else if (!strcasecmp(line, "Allow") &&
|
||||
else if (!strcasecmp(line, "Allow") && value &&
|
||||
strcasecmp(value, "localhost") && strcasecmp(value, "127.0.0.1")
|
||||
#ifdef AF_LOCAL
|
||||
&& *value != '/'
|
||||
@@ -1224,8 +1224,8 @@ _cupsAdminSetServerSettings(
|
||||
* Get the cupsd.conf file...
|
||||
*/
|
||||
|
||||
if ((status = get_cupsd_conf(http, cg, 0, cupsdconf, sizeof(cupsdconf),
|
||||
&remote)) == HTTP_OK)
|
||||
if (get_cupsd_conf(http, cg, 0, cupsdconf, sizeof(cupsdconf),
|
||||
&remote) == HTTP_OK)
|
||||
{
|
||||
if ((cupsd = cupsFileOpen(cupsdconf, "r")) == NULL)
|
||||
{
|
||||
|
||||
@@ -270,8 +270,7 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
|
||||
if (http->gssctx != GSS_C_NO_CONTEXT)
|
||||
{
|
||||
major_status = gss_delete_sec_context(&minor_status, &http->gssctx,
|
||||
GSS_C_NO_BUFFER);
|
||||
gss_delete_sec_context(&minor_status, &http->gssctx, GSS_C_NO_BUFFER);
|
||||
http->gssctx = GSS_C_NO_CONTEXT;
|
||||
}
|
||||
|
||||
@@ -323,14 +322,14 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
httpEncode64_2(http->authstring + 10, authsize - 10, output_token.value,
|
||||
output_token.length);
|
||||
|
||||
major_status = gss_release_buffer(&minor_status, &output_token);
|
||||
gss_release_buffer(&minor_status, &output_token);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_printf(("cupsDoAuthentication: Kerberos credentials too large - "
|
||||
"%d bytes!\n", output_token.length));
|
||||
|
||||
major_status = gss_release_buffer(&minor_status, &output_token);
|
||||
gss_release_buffer(&minor_status, &output_token);
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@@ -59,10 +59,10 @@ extern "C" {
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define CUPS_VERSION 1.0307
|
||||
# define CUPS_VERSION 1.0308
|
||||
# define CUPS_VERSION_MAJOR 1
|
||||
# define CUPS_VERSION_MINOR 3
|
||||
# define CUPS_VERSION_PATCH 7
|
||||
# define CUPS_VERSION_PATCH 8
|
||||
# define CUPS_DATE_ANY -1
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* User-defined destination (and option) support for the Common UNIX
|
||||
* Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -89,7 +89,7 @@ cupsAddDest(const char *name, /* I - Destination name */
|
||||
if (!name || !dests)
|
||||
return (0);
|
||||
|
||||
if ((dest = cupsGetDest(name, instance, num_dests, *dests)) != NULL)
|
||||
if (cupsGetDest(name, instance, num_dests, *dests))
|
||||
return (num_dests);
|
||||
|
||||
/*
|
||||
|
||||
@@ -110,7 +110,8 @@ struct _cups_file_s /**** CUPS file structure... ****/
|
||||
buf[4096], /* Buffer */
|
||||
*ptr, /* Pointer into buffer */
|
||||
*end; /* End of buffer data */
|
||||
off_t pos; /* File position for start of buffer */
|
||||
off_t pos, /* Position in file */
|
||||
bufpos; /* File position for start of buffer */
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
z_stream stream; /* (De)compression stream */
|
||||
@@ -402,13 +403,14 @@ cupsFileFlush(cups_file_t *fp) /* I - CUPS file */
|
||||
|
||||
if (!fp || fp->mode != 'w')
|
||||
{
|
||||
DEBUG_puts(" Attempt to flush a read-only file...");
|
||||
DEBUG_puts("cupsFileFlush: Attempt to flush a read-only file...");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
bytes = (ssize_t)(fp->ptr - fp->buf);
|
||||
|
||||
DEBUG_printf((" Flushing %ld bytes...\n", (long)bytes));
|
||||
DEBUG_printf(("cupsFileFlush: Flushing " CUPS_LLFMT " bytes...\n",
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
if (bytes > 0)
|
||||
{
|
||||
@@ -440,6 +442,8 @@ cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileGetChar(fp=%p)\n", fp));
|
||||
|
||||
if (!fp || (fp->mode != 'r' && fp->mode != 's'))
|
||||
{
|
||||
DEBUG_puts("cupsFileGetChar: Bad arguments!");
|
||||
@@ -463,6 +467,10 @@ cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
|
||||
|
||||
DEBUG_printf(("cupsFileGetChar: Returning %d...\n", *(fp->ptr) & 255));
|
||||
|
||||
fp->pos ++;
|
||||
|
||||
DEBUG_printf(("cupsFileGetChar: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (*(fp->ptr)++ & 255);
|
||||
}
|
||||
|
||||
@@ -485,6 +493,10 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileGetConf(fp=%p, buf=%p, buflen=" CUPS_LLFMT
|
||||
", value=%p, linenum=%p)\n", fp, buf, CUPS_LLCAST buflen,
|
||||
value, linenum));
|
||||
|
||||
if (!fp || (fp->mode != 'r' && fp->mode != 's') ||
|
||||
!buf || buflen < 2 || !value)
|
||||
{
|
||||
@@ -623,6 +635,9 @@ cupsFileGetLine(cups_file_t *fp, /* I - File to read from */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileGetLine(fp=%p, buf=%p, buflen=" CUPS_LLFMT ")\n",
|
||||
fp, buf, CUPS_LLCAST buflen));
|
||||
|
||||
if (!fp || (fp->mode != 'r' && fp->mode != 's') || !buf || buflen < 3)
|
||||
return (0);
|
||||
|
||||
@@ -637,6 +652,7 @@ cupsFileGetLine(cups_file_t *fp, /* I - File to read from */
|
||||
break;
|
||||
|
||||
*ptr++ = ch = *(fp->ptr)++;
|
||||
fp->pos ++;
|
||||
|
||||
if (ch == '\r')
|
||||
{
|
||||
@@ -649,7 +665,10 @@ cupsFileGetLine(cups_file_t *fp, /* I - File to read from */
|
||||
break;
|
||||
|
||||
if (*(fp->ptr) == '\n')
|
||||
{
|
||||
*ptr++ = *(fp->ptr)++;
|
||||
fp->pos ++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -665,6 +684,8 @@ cupsFileGetLine(cups_file_t *fp, /* I - File to read from */
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
DEBUG_printf(("cupsFileGetLine: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (ptr - buf);
|
||||
}
|
||||
|
||||
@@ -687,6 +708,9 @@ cupsFileGets(cups_file_t *fp, /* I - CUPS file */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileGets(fp=%p, buf=%p, buflen=" CUPS_LLFMT ")\n", fp, buf,
|
||||
CUPS_LLCAST buflen));
|
||||
|
||||
if (!fp || (fp->mode != 'r' && fp->mode != 's') || !buf || buflen < 2)
|
||||
return (NULL);
|
||||
|
||||
@@ -706,6 +730,7 @@ cupsFileGets(cups_file_t *fp, /* I - CUPS file */
|
||||
}
|
||||
|
||||
ch = *(fp->ptr)++;
|
||||
fp->pos ++;
|
||||
|
||||
if (ch == '\r')
|
||||
{
|
||||
@@ -718,7 +743,10 @@ cupsFileGets(cups_file_t *fp, /* I - CUPS file */
|
||||
break;
|
||||
|
||||
if (*(fp->ptr) == '\n')
|
||||
fp->ptr ++;
|
||||
{
|
||||
fp->ptr ++;
|
||||
fp->pos ++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -736,6 +764,8 @@ cupsFileGets(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
DEBUG_printf(("cupsFileGets: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (buf);
|
||||
}
|
||||
|
||||
@@ -801,7 +831,8 @@ cupsFileOpen(const char *filename, /* I - Name of file */
|
||||
*/
|
||||
|
||||
if (!filename || !mode ||
|
||||
(*mode != 'r' && *mode != 'w' && *mode != 'a' && *mode != 's'))
|
||||
(*mode != 'r' && *mode != 'w' && *mode != 'a' && *mode != 's') ||
|
||||
(*mode == 'a' && isdigit(mode[1] & 255)))
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
@@ -893,7 +924,8 @@ cupsFileOpenFd(int fd, /* I - File descriptor */
|
||||
*/
|
||||
|
||||
if (fd < 0 || !mode ||
|
||||
(*mode != 'r' && *mode != 'w' && *mode != 'a' && *mode != 's'))
|
||||
(*mode != 'r' && *mode != 'w' && *mode != 'a' && *mode != 's') ||
|
||||
(*mode == 'a' && isdigit(mode[1] & 255)))
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
@@ -911,8 +943,10 @@ cupsFileOpenFd(int fd, /* I - File descriptor */
|
||||
|
||||
switch (*mode)
|
||||
{
|
||||
case 'w' :
|
||||
case 'a' :
|
||||
fp->pos = lseek(fd, 0, SEEK_END);
|
||||
|
||||
case 'w' :
|
||||
fp->mode = 'w';
|
||||
fp->ptr = fp->buf;
|
||||
fp->end = fp->buf + sizeof(fp->buf);
|
||||
@@ -1039,7 +1073,16 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
|
||||
return (-1);
|
||||
|
||||
if (fp->mode == 's')
|
||||
return (cups_write(fp, buf, bytes));
|
||||
{
|
||||
if (cups_write(fp, buf, bytes) < 0)
|
||||
return (-1);
|
||||
|
||||
fp->pos += bytes;
|
||||
|
||||
DEBUG_printf(("cupsFilePrintf: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (bytes);
|
||||
}
|
||||
|
||||
if ((fp->ptr + bytes) > fp->end)
|
||||
if (cupsFileFlush(fp))
|
||||
@@ -1047,6 +1090,8 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += bytes;
|
||||
|
||||
DEBUG_printf(("cupsFilePrintf: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
if (bytes > sizeof(fp->buf))
|
||||
{
|
||||
#ifdef HAVE_LIBZ
|
||||
@@ -1109,6 +1154,8 @@ cupsFilePutChar(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos ++;
|
||||
|
||||
DEBUG_printf(("cupsFilePutChar: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -1144,6 +1191,8 @@ cupsFilePuts(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += bytes;
|
||||
|
||||
DEBUG_printf(("cupsFilePuts: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (bytes);
|
||||
}
|
||||
|
||||
@@ -1153,6 +1202,8 @@ cupsFilePuts(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += bytes;
|
||||
|
||||
DEBUG_printf(("cupsFilePuts: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
if (bytes > sizeof(fp->buf))
|
||||
{
|
||||
#ifdef HAVE_LIBZ
|
||||
@@ -1184,8 +1235,8 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
ssize_t count; /* Bytes read */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsFileRead(fp=%p, buf=%p, bytes=%ld)\n", fp, buf,
|
||||
(long)bytes));
|
||||
DEBUG_printf(("cupsFileRead(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n", fp, buf,
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@@ -1207,7 +1258,8 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
if (fp->ptr >= fp->end)
|
||||
if (cups_fill(fp) <= 0)
|
||||
{
|
||||
DEBUG_printf((" cups_fill() returned -1, total=%d\n", (int)total));
|
||||
DEBUG_printf(("cupsFileRead: cups_fill() returned -1, total=" CUPS_LLFMT "\n",
|
||||
CUPS_LLCAST total));
|
||||
|
||||
if (total > 0)
|
||||
return ((ssize_t)total);
|
||||
@@ -1221,6 +1273,9 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
memcpy(buf, fp->ptr, count);
|
||||
fp->ptr += count;
|
||||
fp->pos += count;
|
||||
|
||||
DEBUG_printf(("cupsFileRead: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
/*
|
||||
* Update the counts for the last read...
|
||||
@@ -1235,7 +1290,7 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
* Return the total number of bytes read...
|
||||
*/
|
||||
|
||||
DEBUG_printf((" total=%d\n", (int)total));
|
||||
DEBUG_printf(("cupsFileRead: total=%d\n", (int)total));
|
||||
|
||||
return ((ssize_t)total);
|
||||
}
|
||||
@@ -1252,6 +1307,9 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileRewind(fp=%p)\n", fp));
|
||||
DEBUG_printf(("cupsFileRewind: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
if (!fp || fp->mode != 'r')
|
||||
return (-1);
|
||||
|
||||
@@ -1259,18 +1317,22 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
|
||||
* Handle special cases...
|
||||
*/
|
||||
|
||||
if (fp->pos == 0)
|
||||
if (fp->bufpos == 0)
|
||||
{
|
||||
/*
|
||||
* No seeking necessary...
|
||||
*/
|
||||
|
||||
fp->pos = 0;
|
||||
|
||||
if (fp->ptr)
|
||||
{
|
||||
fp->ptr = fp->buf;
|
||||
fp->eof = 0;
|
||||
}
|
||||
|
||||
DEBUG_printf(("cupsFileRewind: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -1288,10 +1350,13 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
|
||||
|
||||
lseek(fp->fd, 0, SEEK_SET);
|
||||
|
||||
fp->pos = 0;
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
fp->eof = 0;
|
||||
fp->bufpos = 0;
|
||||
fp->pos = 0;
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
fp->eof = 0;
|
||||
|
||||
DEBUG_printf(("cupsFileRewind: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -1308,9 +1373,10 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
ssize_t bytes; /* Number bytes in buffer */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsFileSeek(fp=%p, pos=" CUPS_LLFMT ")\n", fp, pos));
|
||||
DEBUG_printf((" fp->pos=" CUPS_LLFMT "\n", fp->pos));
|
||||
DEBUG_printf((" fp->ptr=%p, fp->end=%p\n", fp->ptr, fp->end));
|
||||
DEBUG_printf(("cupsFileSeek(fp=%p, pos=" CUPS_LLFMT ")\n", fp,
|
||||
CUPS_LLCAST pos));
|
||||
DEBUG_printf(("cupsFileSeek: fp->pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
DEBUG_printf(("cupsFileSeek: fp->ptr=%p, fp->end=%p\n", fp->ptr, fp->end));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@@ -1326,19 +1392,22 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
if (pos == 0)
|
||||
return (cupsFileRewind(fp));
|
||||
|
||||
if (fp->pos == pos)
|
||||
if (fp->ptr)
|
||||
{
|
||||
/*
|
||||
* No seeking necessary...
|
||||
*/
|
||||
bytes = (ssize_t)(fp->end - fp->buf);
|
||||
|
||||
if (fp->ptr)
|
||||
if (pos >= fp->bufpos && pos < (fp->bufpos + bytes))
|
||||
{
|
||||
fp->ptr = fp->buf;
|
||||
fp->eof = 0;
|
||||
}
|
||||
/*
|
||||
* No seeking necessary...
|
||||
*/
|
||||
|
||||
return (pos);
|
||||
fp->pos = pos;
|
||||
fp->ptr = fp->buf + pos - fp->bufpos;
|
||||
fp->eof = 0;
|
||||
|
||||
return (pos);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
@@ -1354,26 +1423,20 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
#endif /* HAVE_LIBZ */
|
||||
|
||||
/*
|
||||
* Figure out the number of bytes in the current buffer, and then
|
||||
* see if we are outside of it...
|
||||
* Seek forwards or backwards...
|
||||
*/
|
||||
|
||||
if (fp->ptr)
|
||||
bytes = (ssize_t)(fp->end - fp->buf);
|
||||
else
|
||||
bytes = 0;
|
||||
|
||||
fp->eof = 0;
|
||||
|
||||
DEBUG_printf((" bytes=" CUPS_LLFMT "\n", CUPS_LLCAST bytes));
|
||||
DEBUG_printf(("cupsFileSeek: bytes=" CUPS_LLFMT "\n", CUPS_LLCAST bytes));
|
||||
|
||||
if (pos < fp->pos)
|
||||
if (pos < fp->bufpos)
|
||||
{
|
||||
/*
|
||||
* Need to seek backwards...
|
||||
*/
|
||||
|
||||
DEBUG_puts(" SEEK BACKWARDS");
|
||||
DEBUG_puts("cupsFileSeek: SEEK BACKWARDS");
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
if (fp->compressed)
|
||||
@@ -1381,72 +1444,70 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
inflateEnd(&fp->stream);
|
||||
|
||||
lseek(fp->fd, 0, SEEK_SET);
|
||||
fp->pos = 0;
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
fp->bufpos = 0;
|
||||
fp->pos = 0;
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
|
||||
while ((bytes = cups_fill(fp)) > 0)
|
||||
if (pos >= fp->pos && pos < (fp->pos + bytes))
|
||||
if (pos >= fp->bufpos && pos < (fp->bufpos + bytes))
|
||||
break;
|
||||
|
||||
if (bytes <= 0)
|
||||
return (-1);
|
||||
|
||||
fp->ptr = fp->buf + pos - fp->pos;
|
||||
fp->ptr = fp->buf + pos - fp->bufpos;
|
||||
fp->pos = pos;
|
||||
}
|
||||
else
|
||||
#endif /* HAVE_LIBZ */
|
||||
{
|
||||
fp->pos = lseek(fp->fd, pos, SEEK_SET);
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
fp->bufpos = lseek(fp->fd, pos, SEEK_SET);
|
||||
fp->pos = fp->bufpos;
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
|
||||
DEBUG_printf((" lseek() returned %ld...\n", (long)fp->pos));
|
||||
DEBUG_printf(("cupsFileSeek: lseek() returned " CUPS_LLFMT "...\n",
|
||||
CUPS_LLCAST fp->pos));
|
||||
}
|
||||
}
|
||||
else if (pos >= (fp->pos + bytes))
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Need to seek forwards...
|
||||
*/
|
||||
|
||||
DEBUG_puts(" SEEK FORWARDS");
|
||||
DEBUG_puts("cupsFileSeek: SEEK FORWARDS");
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
if (fp->compressed)
|
||||
{
|
||||
while ((bytes = cups_fill(fp)) > 0)
|
||||
{
|
||||
if (pos >= fp->pos && pos < (fp->pos + bytes))
|
||||
if (pos >= fp->bufpos && pos < (fp->bufpos + bytes))
|
||||
break;
|
||||
}
|
||||
|
||||
if (bytes <= 0)
|
||||
return (-1);
|
||||
|
||||
fp->ptr = fp->buf + pos - fp->pos;
|
||||
fp->ptr = fp->buf + pos - fp->bufpos;
|
||||
fp->pos = pos;
|
||||
}
|
||||
else
|
||||
#endif /* HAVE_LIBZ */
|
||||
{
|
||||
fp->pos = lseek(fp->fd, pos, SEEK_SET);
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
fp->bufpos = lseek(fp->fd, pos, SEEK_SET);
|
||||
fp->pos = fp->bufpos;
|
||||
fp->ptr = NULL;
|
||||
fp->end = NULL;
|
||||
|
||||
DEBUG_printf((" lseek() returned " CUPS_LLFMT "...\n", fp->pos));
|
||||
DEBUG_printf(("cupsFileSeek: lseek() returned " CUPS_LLFMT "...\n",
|
||||
CUPS_LLCAST fp->pos));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Just reposition the current pointer, since we have the right
|
||||
* range...
|
||||
*/
|
||||
|
||||
DEBUG_puts(" SEEK INSIDE BUFFER");
|
||||
|
||||
fp->ptr = fp->buf + pos - fp->pos;
|
||||
}
|
||||
DEBUG_printf(("cupsFileSeek: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (fp->pos);
|
||||
}
|
||||
@@ -1555,6 +1616,9 @@ cupsFileStdout(void)
|
||||
off_t /* O - File position */
|
||||
cupsFileTell(cups_file_t *fp) /* I - CUPS file */
|
||||
{
|
||||
DEBUG_printf(("cupsFileTell(fp=%p)\n", fp));
|
||||
DEBUG_printf(("cupsFileTell: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return (fp ? fp->pos : 0);
|
||||
}
|
||||
|
||||
@@ -1570,6 +1634,8 @@ cupsFileUnlock(cups_file_t *fp) /* I - File to lock */
|
||||
* Range check...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileUnlock(fp=%p)\n", fp));
|
||||
|
||||
if (!fp || fp->mode == 's')
|
||||
return (-1);
|
||||
|
||||
@@ -1598,6 +1664,9 @@ cupsFileWrite(cups_file_t *fp, /* I - CUPS file */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsFileWrite(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n",
|
||||
fp, buf, CUPS_LLCAST bytes));
|
||||
|
||||
if (!fp || !buf || bytes < 0 || (fp->mode != 'w' && fp->mode != 's'))
|
||||
return (-1);
|
||||
|
||||
@@ -1615,6 +1684,8 @@ cupsFileWrite(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += (off_t)bytes;
|
||||
|
||||
DEBUG_printf(("cupsFileWrite: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
return ((ssize_t)bytes);
|
||||
}
|
||||
|
||||
@@ -1624,6 +1695,8 @@ cupsFileWrite(cups_file_t *fp, /* I - CUPS file */
|
||||
|
||||
fp->pos += (off_t)bytes;
|
||||
|
||||
DEBUG_printf(("cupsFileWrite: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
|
||||
|
||||
if (bytes > sizeof(fp->buf))
|
||||
{
|
||||
#ifdef HAVE_LIBZ
|
||||
@@ -1652,8 +1725,8 @@ cups_compress(cups_file_t *fp, /* I - CUPS file */
|
||||
const char *buf, /* I - Buffer */
|
||||
size_t bytes) /* I - Number bytes */
|
||||
{
|
||||
DEBUG_printf(("cups_compress(fp=%p, buf=%p, bytes=%ld)\n", fp, buf,
|
||||
(long)bytes));
|
||||
DEBUG_printf(("cups_compress(fp=%p, buf=%p, bytes=" CUPS_LLFMT "\n", fp, buf,
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
/*
|
||||
* Update the CRC...
|
||||
@@ -1674,8 +1747,8 @@ cups_compress(cups_file_t *fp, /* I - CUPS file */
|
||||
* Flush the current buffer...
|
||||
*/
|
||||
|
||||
DEBUG_printf((" avail_in=%d, avail_out=%d\n", fp->stream.avail_in,
|
||||
fp->stream.avail_out));
|
||||
DEBUG_printf(("cups_compress: avail_in=%d, avail_out=%d\n",
|
||||
fp->stream.avail_in, fp->stream.avail_out));
|
||||
|
||||
if (fp->stream.avail_out < (int)(sizeof(fp->cbuf) / 8))
|
||||
{
|
||||
@@ -1710,19 +1783,15 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
|
||||
|
||||
|
||||
DEBUG_printf(("cups_fill(fp=%p)\n", fp));
|
||||
DEBUG_printf((" fp->ptr=%p, fp->end=%p, fp->buf=%p, "
|
||||
"fp->pos=" CUPS_LLFMT ", fp->eof=%d\n",
|
||||
fp->ptr, fp->end, fp->buf, fp->pos, fp->eof));
|
||||
|
||||
/*
|
||||
* Update the "pos" element as needed...
|
||||
*/
|
||||
DEBUG_printf(("cups_fill: fp->ptr=%p, fp->end=%p, fp->buf=%p, "
|
||||
"fp->bufpos=" CUPS_LLFMT ", fp->eof=%d\n",
|
||||
fp->ptr, fp->end, fp->buf, CUPS_LLCAST fp->bufpos, fp->eof));
|
||||
|
||||
if (fp->ptr && fp->end)
|
||||
fp->pos += (off_t)(fp->end - fp->buf);
|
||||
fp->bufpos += fp->end - fp->buf;
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
DEBUG_printf((" fp->compressed=%d\n", fp->compressed));
|
||||
DEBUG_printf(("cups_fill: fp->compressed=%d\n", fp->compressed));
|
||||
|
||||
while (!fp->ptr || fp->compressed)
|
||||
{
|
||||
@@ -1750,7 +1819,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
|
||||
* Can't read from file!
|
||||
*/
|
||||
|
||||
DEBUG_printf((" cups_read() returned " CUPS_LLFMT "!\n",
|
||||
DEBUG_printf(("cups_fill: cups_read() returned " CUPS_LLFMT "!\n",
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
return (-1);
|
||||
@@ -2030,6 +2099,9 @@ cups_read(cups_file_t *fp, /* I - CUPS file */
|
||||
ssize_t total; /* Total bytes read */
|
||||
|
||||
|
||||
DEBUG_printf(("cups_read(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n", fp, buf,
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
/*
|
||||
* Loop until we read at least 0 bytes...
|
||||
*/
|
||||
@@ -2048,6 +2120,8 @@ cups_read(cups_file_t *fp, /* I - CUPS file */
|
||||
total = read(fp->fd, buf, bytes);
|
||||
#endif /* WIN32 */
|
||||
|
||||
DEBUG_printf(("cups_read: total=" CUPS_LLFMT "\n", CUPS_LLCAST total));
|
||||
|
||||
if (total >= 0)
|
||||
break;
|
||||
|
||||
@@ -2082,8 +2156,8 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
|
||||
ssize_t count; /* Count this time */
|
||||
|
||||
|
||||
DEBUG_printf(("cups_write(fp=%p, buf=%p, bytes=%ld)\n", fp, buf,
|
||||
(long)bytes));
|
||||
DEBUG_printf(("cups_write(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n", fp, buf,
|
||||
CUPS_LLCAST bytes));
|
||||
|
||||
/*
|
||||
* Loop until all bytes are written...
|
||||
@@ -2104,6 +2178,8 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
|
||||
count = write(fp->fd, buf, bytes);
|
||||
#endif /* WIN32 */
|
||||
|
||||
DEBUG_printf(("cups_write: count=" CUPS_LLFMT "\n", CUPS_LLCAST count));
|
||||
|
||||
if (count < 0)
|
||||
{
|
||||
/*
|
||||
@@ -2116,8 +2192,6 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
DEBUG_printf((" count=%ld\n", (long)count));
|
||||
|
||||
/*
|
||||
* Update the counts for the last write call...
|
||||
*/
|
||||
|
||||
@@ -528,8 +528,6 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
|
||||
if (addr)
|
||||
addr->next = temp;
|
||||
else
|
||||
addr = temp;
|
||||
}
|
||||
}
|
||||
else if (!hostname)
|
||||
@@ -583,8 +581,6 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
|
||||
if (addr)
|
||||
addr->next = temp;
|
||||
else
|
||||
addr = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,6 +257,12 @@ extern void _cups_freeifaddrs(struct ifaddrs *addrs);
|
||||
# endif /* HAVE_GETIFADDRS */
|
||||
# endif /* !WIN32 */
|
||||
|
||||
/*
|
||||
* Common URI encoding function...
|
||||
*/
|
||||
|
||||
extern char *_httpEncodeURI(char *dst, const char *src, size_t dstsize);
|
||||
|
||||
#endif /* !_CUPS_HTTP_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
* httpStatus() - Return a short string describing a HTTP status code.
|
||||
* _cups_hstrerror() - hstrerror() emulation function for Solaris and
|
||||
* others...
|
||||
* _httpEncodeURI() - Percent-encode a HTTP request URI.
|
||||
* http_copy_decode() - Copy and decode a URI.
|
||||
* http_copy_encode() - Copy and encode a URI.
|
||||
*/
|
||||
@@ -1203,6 +1204,20 @@ _cups_hstrerror(int error) /* I - Error number */
|
||||
#endif /* !HAVE_HSTRERROR */
|
||||
|
||||
|
||||
/*
|
||||
* '_httpEncodeURI()' - Percent-encode a HTTP request URI.
|
||||
*/
|
||||
|
||||
char * /* O - Encoded URI */
|
||||
_httpEncodeURI(char *dst, /* I - Destination buffer */
|
||||
const char *src, /* I - Source URI */
|
||||
size_t dstsize) /* I - Size of destination buffer */
|
||||
{
|
||||
http_copy_encode(dst, src, dst + dstsize - 1, NULL, NULL, 1);
|
||||
return (dst);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'http_copy_decode()' - Copy and decode a URI.
|
||||
*/
|
||||
@@ -1311,6 +1326,8 @@ http_copy_encode(char *dst, /* O - Destination buffer */
|
||||
*dst++ = *src++;
|
||||
}
|
||||
|
||||
*dst = '\0';
|
||||
|
||||
if (*src)
|
||||
return (NULL);
|
||||
else
|
||||
|
||||
@@ -293,8 +293,7 @@ void
|
||||
httpClose(http_t *http) /* I - HTTP connection */
|
||||
{
|
||||
#ifdef HAVE_GSSAPI
|
||||
OM_uint32 minor_status, /* Minor status code */
|
||||
major_status; /* Major status code */
|
||||
OM_uint32 minor_status; /* Minor status code */
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
|
||||
@@ -321,11 +320,10 @@ httpClose(http_t *http) /* I - HTTP connection */
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
if (http->gssctx != GSS_C_NO_CONTEXT)
|
||||
major_status = gss_delete_sec_context(&minor_status, &http->gssctx,
|
||||
GSS_C_NO_BUFFER);
|
||||
gss_delete_sec_context(&minor_status, &http->gssctx, GSS_C_NO_BUFFER);
|
||||
|
||||
if (http->gssname != GSS_C_NO_NAME)
|
||||
major_status = gss_release_name(&minor_status, &http->gssname);
|
||||
gss_release_name(&minor_status, &http->gssname);
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
#ifdef HAVE_AUTHORIZATION_H
|
||||
@@ -2522,8 +2520,7 @@ http_send(http_t *http, /* I - HTTP connection */
|
||||
const char *uri) /* I - URI */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
char *ptr, /* Pointer in buffer */
|
||||
buf[1024]; /* Encoded URI buffer */
|
||||
char buf[1024]; /* Encoded URI buffer */
|
||||
static const char * const codes[] =
|
||||
{ /* Request code strings */
|
||||
NULL,
|
||||
@@ -2540,8 +2537,6 @@ http_send(http_t *http, /* I - HTTP connection */
|
||||
"TRACE",
|
||||
"CLOSE"
|
||||
};
|
||||
static const char hex[] = "0123456789ABCDEF";
|
||||
/* Hex digits */
|
||||
|
||||
|
||||
DEBUG_printf(("http_send(http=%p, request=HTTP_%s, uri=\"%s\")\n",
|
||||
@@ -2561,20 +2556,7 @@ http_send(http_t *http, /* I - HTTP connection */
|
||||
* Encode the URI as needed...
|
||||
*/
|
||||
|
||||
for (ptr = buf; *uri != '\0' && ptr < (buf + sizeof(buf) - 1); uri ++)
|
||||
if (*uri <= ' ' || *uri >= 127)
|
||||
{
|
||||
if (ptr < (buf + sizeof(buf) - 1))
|
||||
*ptr ++ = '%';
|
||||
if (ptr < (buf + sizeof(buf) - 1))
|
||||
*ptr ++ = hex[(*uri >> 4) & 15];
|
||||
if (ptr < (buf + sizeof(buf) - 1))
|
||||
*ptr ++ = hex[*uri & 15];
|
||||
}
|
||||
else
|
||||
*ptr ++ = *uri;
|
||||
|
||||
*ptr = '\0';
|
||||
_httpEncodeURI(buf, uri, sizeof(buf));
|
||||
|
||||
/*
|
||||
* See if we had an error the last time around; if so, reconnect...
|
||||
|
||||
@@ -1049,7 +1049,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
* Get the request header...
|
||||
*/
|
||||
|
||||
if ((n = (*cb)(src, buffer, 8)) < 8)
|
||||
if ((*cb)(src, buffer, 8) < 8)
|
||||
{
|
||||
DEBUG_printf(("ippReadIO: Unable to read header (%d bytes read)!\n", n));
|
||||
return (IPP_ERROR);
|
||||
@@ -1556,6 +1556,12 @@ ippReadIO(void *src, /* I - Data source */
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
if (!value)
|
||||
{
|
||||
DEBUG_puts("ippReadIO: NULL value!");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
value->unknown.length = n;
|
||||
if (n > 0)
|
||||
{
|
||||
|
||||
@@ -63,8 +63,8 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */
|
||||
*/
|
||||
|
||||
va_start(ap, message);
|
||||
bytes = vsnprintf(buffer, sizeof(buffer),
|
||||
_cupsLangString(cg->lang_default, message), ap);
|
||||
vsnprintf(buffer, sizeof(buffer),
|
||||
_cupsLangString(cg->lang_default, message), ap);
|
||||
va_end(ap);
|
||||
|
||||
/*
|
||||
|
||||
@@ -25,6 +25,7 @@ __cupsStrFormatd
|
||||
__cupsStrFree
|
||||
__cupsStrScand
|
||||
__cupsStrStatistics
|
||||
__httpEncodeURI
|
||||
__httpReadCDSA
|
||||
__httpWriteCDSA
|
||||
__ippAddAttr
|
||||
|
||||
@@ -436,13 +436,6 @@ ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */
|
||||
strlcpy(ll_CC, "sv_SE", ll_CC_size);
|
||||
else if (!strcmp(ll_CC, "zh")) /* Simplified Chinese */
|
||||
strlcpy(ll_CC, "zh_CN", ll_CC_size);
|
||||
else if (ll_CC_size >= 6)
|
||||
{
|
||||
ll_CC[2] = '_';
|
||||
ll_CC[3] = toupper(ll_CC[0] & 255);
|
||||
ll_CC[4] = toupper(ll_CC[1] & 255);
|
||||
ll_CC[5] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_printf(("ppd_ll_CC: lang->language=\"%s\", ll=\"%s\", ll_CC=\"%s\"...\n",
|
||||
|
||||
@@ -197,11 +197,14 @@ ppdFindChoice(ppd_option_t *o, /* I - Pointer to option */
|
||||
ppd_choice_t *c; /* Current choice */
|
||||
|
||||
|
||||
if (o == NULL || choice == NULL)
|
||||
if (!o || !choice)
|
||||
return (NULL);
|
||||
|
||||
if (choice[0] == '{' || !strncasecmp(choice, "Custom.", 7))
|
||||
choice = "Custom";
|
||||
|
||||
for (i = o->num_choices, c = o->choices; i > 0; i --, c ++)
|
||||
if (strcasecmp(c->choice, choice) == 0)
|
||||
if (!strcasecmp(c->choice, choice))
|
||||
return (c);
|
||||
|
||||
return (NULL);
|
||||
|
||||
@@ -63,9 +63,14 @@ cupsAddOption(const char *name, /* I - Name of option */
|
||||
cups_option_t *temp; /* Pointer to new option */
|
||||
|
||||
|
||||
if (name == NULL || !name[0] || value == NULL ||
|
||||
options == NULL || num_options < 0)
|
||||
DEBUG_printf(("cupsAddOption(name=\"%s\", value=\"%s\", num_options=%d, "
|
||||
"options=%p)\n", name, value, num_options, options));
|
||||
|
||||
if (!name || !name[0] || !value || !options || num_options < 0)
|
||||
{
|
||||
DEBUG_printf(("cupsAddOption: Returning %d\n", num_options));
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
/*
|
||||
* Look for an existing option with the same name...
|
||||
@@ -81,6 +86,8 @@ cupsAddOption(const char *name, /* I - Name of option */
|
||||
* No matching option name...
|
||||
*/
|
||||
|
||||
DEBUG_puts("cupsAddOption: New option...");
|
||||
|
||||
if (num_options == 0)
|
||||
temp = (cups_option_t *)malloc(sizeof(cups_option_t));
|
||||
else
|
||||
@@ -88,7 +95,10 @@ cupsAddOption(const char *name, /* I - Name of option */
|
||||
(num_options + 1));
|
||||
|
||||
if (temp == NULL)
|
||||
{
|
||||
DEBUG_puts("cupsAddOption: Unable to expand option array, returning 0");
|
||||
return (0);
|
||||
}
|
||||
|
||||
*options = temp;
|
||||
temp += num_options;
|
||||
@@ -122,7 +132,10 @@ cupsFreeOptions(
|
||||
int i; /* Looping var */
|
||||
|
||||
|
||||
if (num_options <= 0 || options == NULL)
|
||||
DEBUG_printf(("cupsFreeOptions(num_options=%d, options=%p)\n", num_options,
|
||||
options));
|
||||
|
||||
if (num_options <= 0 || !options)
|
||||
return;
|
||||
|
||||
for (i = 0; i < num_options; i ++)
|
||||
@@ -147,13 +160,23 @@ cupsGetOption(const char *name, /* I - Name of option */
|
||||
int i; /* Looping var */
|
||||
|
||||
|
||||
if (name == NULL || num_options <= 0 || options == NULL)
|
||||
DEBUG_printf(("cupsGetOption(name=\"%s\", num_options=%d, options=%p)\n",
|
||||
name, num_options, options));
|
||||
|
||||
if (!name || num_options <= 0 || !options)
|
||||
{
|
||||
DEBUG_puts("cupsGetOption: Returning NULL");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_options; i ++)
|
||||
if (strcasecmp(options[i].name, name) == 0)
|
||||
if (!strcasecmp(options[i].name, name))
|
||||
{
|
||||
DEBUG_printf(("cupsGetOption: Returning \"%s\"\n", options[i].value));
|
||||
return (options[i].value);
|
||||
}
|
||||
|
||||
DEBUG_puts("cupsGetOption: Returning NULL");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -474,22 +497,35 @@ cupsParseOptions(
|
||||
quote; /* Quote character */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsParseOptions(arg=\"%s\", num_options=%d, options=%p)\n",
|
||||
arg, num_options, options));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!arg)
|
||||
{
|
||||
DEBUG_printf(("cupsParseOptions: Returning %d\n", num_options));
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
if (!options || num_options < 0)
|
||||
{
|
||||
DEBUG_puts("cupsParseOptions: Returning 0");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make a copy of the argument string and then divide it up...
|
||||
*/
|
||||
|
||||
if ((copyarg = strdup(arg)) == NULL)
|
||||
{
|
||||
DEBUG_puts("cupsParseOptions: Unable to copy arg string");
|
||||
DEBUG_printf(("cupsParseOptions: Returning %d\n", num_options));
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
ptr = copyarg;
|
||||
|
||||
@@ -528,6 +564,8 @@ cupsParseOptions(
|
||||
while (isspace(*ptr & 255))
|
||||
*ptr++ = '\0';
|
||||
|
||||
DEBUG_printf(("cupsParseOptions: name=\"%s\"\n", name));
|
||||
|
||||
if (*ptr != '=')
|
||||
{
|
||||
/*
|
||||
@@ -548,80 +586,84 @@ cupsParseOptions(
|
||||
*/
|
||||
|
||||
*ptr++ = '\0';
|
||||
value = ptr;
|
||||
|
||||
if (*ptr == '\'' || *ptr == '\"')
|
||||
while (*ptr && !isspace(*ptr & 255))
|
||||
{
|
||||
/*
|
||||
* Quoted string constant...
|
||||
*/
|
||||
|
||||
quote = *ptr++;
|
||||
value = ptr;
|
||||
|
||||
while (*ptr != quote && *ptr)
|
||||
{
|
||||
if (*ptr == '\\' && ptr[1])
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
|
||||
if (*ptr == ',')
|
||||
ptr ++;
|
||||
}
|
||||
else if (*ptr == '\'' || *ptr == '\"')
|
||||
{
|
||||
/*
|
||||
* Quoted string constant...
|
||||
*/
|
||||
|
||||
if (*ptr != '\0')
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
else if (*ptr == '{')
|
||||
{
|
||||
/*
|
||||
* Collection value...
|
||||
*/
|
||||
quote = *ptr;
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
|
||||
int depth;
|
||||
|
||||
value = ptr;
|
||||
|
||||
for (depth = 1; *ptr; ptr ++)
|
||||
if (*ptr == '{')
|
||||
depth ++;
|
||||
else if (*ptr == '}')
|
||||
while (*ptr != quote && *ptr)
|
||||
{
|
||||
depth --;
|
||||
if (!depth)
|
||||
{
|
||||
ptr ++;
|
||||
if (*ptr == '\\' && ptr[1])
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
|
||||
if (*ptr != ',')
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (*ptr == '\\' && ptr[1])
|
||||
ptr ++;
|
||||
}
|
||||
|
||||
if (*ptr)
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
|
||||
if (*ptr != '\0')
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Normal space-delimited string...
|
||||
*/
|
||||
|
||||
value = ptr;
|
||||
|
||||
while (!isspace(*ptr & 255) && *ptr)
|
||||
}
|
||||
else if (*ptr == '{')
|
||||
{
|
||||
if (*ptr == '\\' && ptr[1])
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
/*
|
||||
* Collection value...
|
||||
*/
|
||||
|
||||
ptr ++;
|
||||
int depth;
|
||||
|
||||
for (depth = 0; *ptr; ptr ++)
|
||||
{
|
||||
if (*ptr == '{')
|
||||
depth ++;
|
||||
else if (*ptr == '}')
|
||||
{
|
||||
depth --;
|
||||
if (!depth)
|
||||
{
|
||||
ptr ++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (*ptr == '\\' && ptr[1])
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Normal space-delimited string...
|
||||
*/
|
||||
|
||||
while (!isspace(*ptr & 255) && *ptr)
|
||||
{
|
||||
if (*ptr == '\\' && ptr[1])
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
|
||||
ptr ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*ptr != '\0')
|
||||
*ptr++ = '\0';
|
||||
|
||||
DEBUG_printf(("cupsParseOptions: value=\"%s\"\n", value));
|
||||
|
||||
/*
|
||||
* Skip trailing whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
*ptr++ = '\0';
|
||||
ptr ++;
|
||||
|
||||
/*
|
||||
* Add the string value...
|
||||
@@ -637,6 +679,8 @@ cupsParseOptions(
|
||||
|
||||
free(copyarg);
|
||||
|
||||
DEBUG_printf(("cupsParseOptions: Returning %d\n", num_options));
|
||||
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
@@ -657,12 +701,18 @@ cupsRemoveOption(
|
||||
cups_option_t *option; /* Current option */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsRemoveOption(name=\"%s\", num_options=%d, options=%p)\n",
|
||||
name, num_options, options));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!name || num_options < 1 || !options)
|
||||
{
|
||||
DEBUG_printf(("cupsRemoveOption: Returning %d\n", num_options));
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop for the option...
|
||||
@@ -678,6 +728,8 @@ cupsRemoveOption(
|
||||
* Remove this option from the array...
|
||||
*/
|
||||
|
||||
DEBUG_puts("cupsRemoveOption: Found option, removing it...");
|
||||
|
||||
num_options --;
|
||||
i --;
|
||||
|
||||
@@ -693,6 +745,7 @@ cupsRemoveOption(
|
||||
* Return the new number of options...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsRemoveOption: Returning %d\n", num_options));
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
|
||||
@@ -623,11 +623,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
puts("");
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (strcmp(keyword, "CloseUI") && strcmp(keyword, "CloseGroup") &&
|
||||
strcmp(keyword, "CloseSubGroup") && strncmp(keyword, "Default", 7) &&
|
||||
strcmp(keyword, "JCLCloseUI") && strcmp(keyword, "JCLOpenUI") &&
|
||||
strcmp(keyword, "OpenUI") && strcmp(keyword, "OpenGroup") &&
|
||||
strcmp(keyword, "OpenSubGroup") && string == NULL)
|
||||
if (strncmp(keyword, "Default", 7) && !string)
|
||||
{
|
||||
/*
|
||||
* Need a string value!
|
||||
@@ -1098,7 +1094,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
else if (!strcmp(string, "Plus90"))
|
||||
ppd->landscape = 90;
|
||||
}
|
||||
else if (!strcmp(keyword, "Emulators"))
|
||||
else if (!strcmp(keyword, "Emulators") && string)
|
||||
{
|
||||
for (count = 1, sptr = string; sptr != NULL;)
|
||||
if ((sptr = strchr(sptr, ' ')) != NULL)
|
||||
@@ -2865,8 +2861,6 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
|
||||
if (ch == 0x0a)
|
||||
cupsFileGetChar(fp);
|
||||
}
|
||||
|
||||
ch = '\n';
|
||||
}
|
||||
else if (ch < ' ' && ch != '\t' && cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
for (i = 1, num_settings = 0; i < argc; i ++)
|
||||
for (i = 1, num_settings = 0, settings = NULL; i < argc; i ++)
|
||||
num_settings = cupsParseOptions(argv[i], num_settings, &settings);
|
||||
|
||||
if (cupsAdminSetServerSettings(http, num_settings, settings))
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* CUPS API test program for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -70,8 +70,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
printf("cupsGetDest(\"%s\"): ", dests[num_dests / 2].name);
|
||||
fflush(stdout);
|
||||
|
||||
if ((dest = cupsGetDest(dests[num_dests / 2].name, NULL, num_dests,
|
||||
dests)) == NULL)
|
||||
if (!cupsGetDest(dests[num_dests / 2].name, NULL, num_dests, dests))
|
||||
{
|
||||
status = 1;
|
||||
puts("FAIL");
|
||||
@@ -88,8 +87,8 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
if ((dest = cupsGetDest(NULL, NULL, num_dests, dests)) == NULL)
|
||||
{
|
||||
status = 1;
|
||||
puts("FAIL");
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
@@ -104,7 +103,6 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
if (cupsPrintFile(dest->name, "../data/testprint.ps", "Test Page",
|
||||
dest->num_options, dest->options) <= 0)
|
||||
{
|
||||
status = 1;
|
||||
puts("FAIL");
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* File test program for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -34,12 +34,14 @@
|
||||
#ifdef HAVE_LIBZ
|
||||
# include <zlib.h>
|
||||
#endif /* HAVE_LIBZ */
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int random_tests(void);
|
||||
static int read_write_tests(int compression);
|
||||
|
||||
|
||||
@@ -51,8 +53,10 @@ int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int status; /* Exit status */
|
||||
char filename[1024]; /* Filename buffer */
|
||||
int status; /* Exit status */
|
||||
char filename[1024]; /* Filename buffer */
|
||||
int fds[2]; /* Open file descriptors */
|
||||
cups_file_t *fdfile; /* File opened with cupsFileOpenFd() */
|
||||
|
||||
|
||||
if (argc == 1)
|
||||
@@ -73,11 +77,51 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
status += read_write_tests(1);
|
||||
#endif /* HAVE_LIBZ */
|
||||
|
||||
/*
|
||||
* Do uncompressed random I/O tests...
|
||||
*/
|
||||
|
||||
status += random_tests();
|
||||
|
||||
/*
|
||||
* Test fdopen and close without reading...
|
||||
*/
|
||||
|
||||
pipe(fds);
|
||||
close(fds[1]);
|
||||
|
||||
fputs("\ncupsFileOpenFd(fd, \"r\"): ", stdout);
|
||||
fflush(stdout);
|
||||
|
||||
if ((fdfile = cupsFileOpenFd(fds[0], "r")) == NULL)
|
||||
{
|
||||
puts("FAIL");
|
||||
status ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Able to open file, now close without reading. If we don't return
|
||||
* before the alarm fires, that is a failure and we will crash on the
|
||||
* alarm signal...
|
||||
*/
|
||||
|
||||
puts("PASS");
|
||||
fputs("cupsFileClose(no read): ", stdout);
|
||||
fflush(stdout);
|
||||
|
||||
alarm(5);
|
||||
cupsFileClose(fdfile);
|
||||
alarm(0);
|
||||
|
||||
puts("PASS");
|
||||
}
|
||||
|
||||
/*
|
||||
* Test path functions...
|
||||
*/
|
||||
|
||||
fputs("cupsFileFind: ", stdout);
|
||||
fputs("\ncupsFileFind: ", stdout);
|
||||
#ifdef WIN32
|
||||
if (cupsFileFind("notepad.exe", "C:/WINDOWS", 1, filename, sizeof(filename)) &&
|
||||
cupsFileFind("notepad.exe", "C:/WINDOWS;C:/WINDOWS/SYSTEM32", 1, filename, sizeof(filename)))
|
||||
@@ -134,6 +178,190 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'random_tests()' - Do random access tests.
|
||||
*/
|
||||
|
||||
static int /* O - Status */
|
||||
random_tests(void)
|
||||
{
|
||||
int status, /* Status of tests */
|
||||
pass, /* Current pass */
|
||||
count, /* Number of records read */
|
||||
record, /* Current record */
|
||||
num_records; /* Number of records */
|
||||
ssize_t pos, /* Position in file */
|
||||
expected; /* Expected position in file */
|
||||
cups_file_t *fp; /* File */
|
||||
char buffer[512]; /* Data buffer */
|
||||
|
||||
|
||||
/*
|
||||
* Run 4 passes, each time appending to a data file and then reopening the
|
||||
* file for reading to validate random records in the file.
|
||||
*/
|
||||
|
||||
for (status = 0, pass = 0; pass < 4; pass ++)
|
||||
{
|
||||
/*
|
||||
* cupsFileOpen(append)
|
||||
*/
|
||||
|
||||
printf("\ncupsFileOpen(append %d): ", pass);
|
||||
|
||||
if ((fp = cupsFileOpen("testfile.dat", "a")) == NULL)
|
||||
{
|
||||
printf("FAIL (%s)\n", strerror(errno));
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
/*
|
||||
* cupsFileTell()
|
||||
*/
|
||||
|
||||
expected = 256 * sizeof(buffer) * pass;
|
||||
|
||||
fputs("cupsFileTell(): ", stdout);
|
||||
if ((pos = cupsFileTell(fp)) != expected)
|
||||
{
|
||||
printf("FAIL (" CUPS_LLFMT " instead of " CUPS_LLFMT ")\n",
|
||||
CUPS_LLCAST pos, CUPS_LLCAST expected);
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
/*
|
||||
* cupsFileWrite()
|
||||
*/
|
||||
|
||||
fputs("cupsFileWrite(256 512-byte records): ", stdout);
|
||||
for (record = 0; record < 256; record ++)
|
||||
{
|
||||
memset(buffer, record, sizeof(buffer));
|
||||
if (cupsFileWrite(fp, buffer, sizeof(buffer)) < sizeof(buffer))
|
||||
break;
|
||||
}
|
||||
|
||||
if (record < 256)
|
||||
{
|
||||
printf("FAIL (%d: %s)\n", record, strerror(errno));
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
/*
|
||||
* cupsFileTell()
|
||||
*/
|
||||
|
||||
expected += 256 * sizeof(buffer);
|
||||
|
||||
fputs("cupsFileTell(): ", stdout);
|
||||
if ((pos = cupsFileTell(fp)) != expected)
|
||||
{
|
||||
printf("FAIL (" CUPS_LLFMT " instead of " CUPS_LLFMT ")\n",
|
||||
CUPS_LLCAST pos, CUPS_LLCAST expected);
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
cupsFileClose(fp);
|
||||
|
||||
/*
|
||||
* cupsFileOpen(read)
|
||||
*/
|
||||
|
||||
printf("\ncupsFileOpen(read %d): ", pass);
|
||||
|
||||
if ((fp = cupsFileOpen("testfile.dat", "r")) == NULL)
|
||||
{
|
||||
printf("FAIL (%s)\n", strerror(errno));
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
/*
|
||||
* cupsFileSeek, cupsFileRead
|
||||
*/
|
||||
|
||||
fputs("cupsFileSeek(), cupsFileRead(): ", stdout);
|
||||
|
||||
for (num_records = (pass + 1) * 256, count = (pass + 1) * 256,
|
||||
record = rand() % num_records;
|
||||
count > 0;
|
||||
count --, record = (record + (rand() & 31) - 16 + num_records) %
|
||||
num_records)
|
||||
{
|
||||
/*
|
||||
* The last record is always the first...
|
||||
*/
|
||||
|
||||
if (count == 1)
|
||||
record = 0;
|
||||
|
||||
/*
|
||||
* Try reading the data for the specified record, and validate the
|
||||
* contents...
|
||||
*/
|
||||
|
||||
expected = sizeof(buffer) * record;
|
||||
|
||||
if ((pos = cupsFileSeek(fp, expected)) != expected)
|
||||
{
|
||||
printf("FAIL (" CUPS_LLFMT " instead of " CUPS_LLFMT ")\n",
|
||||
CUPS_LLCAST pos, CUPS_LLCAST expected);
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cupsFileRead(fp, buffer, sizeof(buffer)) != sizeof(buffer))
|
||||
{
|
||||
printf("FAIL (%s)\n", strerror(errno));
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
else if ((buffer[0] & 255) != (record & 255) ||
|
||||
memcmp(buffer, buffer + 1, sizeof(buffer) - 1))
|
||||
{
|
||||
printf("FAIL (Bad Data - %d instead of %d)\n", buffer[0] & 255,
|
||||
record & 255);
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
puts("PASS");
|
||||
|
||||
cupsFileClose(fp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove the test file...
|
||||
*/
|
||||
|
||||
unlink("testfile.dat");
|
||||
|
||||
/*
|
||||
* Return the test status...
|
||||
*/
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'read_write_tests()' - Perform read/write tests.
|
||||
*/
|
||||
@@ -142,7 +370,7 @@ static int /* O - Status */
|
||||
read_write_tests(int compression) /* I - Use compression? */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
cups_file_t *fp; /* First file */
|
||||
cups_file_t *fp; /* File */
|
||||
int status; /* Exit status */
|
||||
char line[1024], /* Line from file */
|
||||
*value; /* Directive value from line */
|
||||
@@ -150,6 +378,7 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
unsigned char readbuf[8192], /* Read buffer */
|
||||
writebuf[8192]; /* Write buffer */
|
||||
int byte; /* Byte from file */
|
||||
off_t length; /* Length of file */
|
||||
static const char *partial_line = "partial line";
|
||||
/* Partial line */
|
||||
|
||||
@@ -221,7 +450,7 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
fputs("cupsFilePrintf(): ", stdout);
|
||||
|
||||
for (i = 0; i < 1000; i ++)
|
||||
if (cupsFilePrintf(fp, "TestLine %d\n", i) < 0)
|
||||
if (cupsFilePrintf(fp, "TestLine %03d\n", i) < 0)
|
||||
break;
|
||||
|
||||
if (i >= 1000)
|
||||
@@ -282,6 +511,20 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
status ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* cupsFileTell()
|
||||
*/
|
||||
|
||||
fputs("cupsFileTell(): ", stdout);
|
||||
|
||||
if ((length = cupsFileTell(fp)) == 81933283)
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
printf("FAIL (" CUPS_LLFMT " instead of 81933283)\n", CUPS_LLCAST length);
|
||||
status ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* cupsFileClose()
|
||||
*/
|
||||
@@ -306,7 +549,7 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
* cupsFileOpen(read)
|
||||
*/
|
||||
|
||||
fputs("cupsFileOpen(read): ", stdout);
|
||||
fputs("\ncupsFileOpen(read): ", stdout);
|
||||
|
||||
fp = cupsFileOpen(compression ? "testfile.dat.gz" : "testfile.dat", "r");
|
||||
if (fp)
|
||||
@@ -385,23 +628,9 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
|
||||
fputs("cupsFileGetChar(): ", stdout);
|
||||
|
||||
#ifdef DEBUG
|
||||
puts("\ni byte\n----- -----");
|
||||
|
||||
for (i = 0; i < 256; i ++)
|
||||
{
|
||||
byte = cupsFileGetChar(fp);
|
||||
|
||||
printf("%-5d %-5d\n", i, byte);
|
||||
|
||||
if (byte != i)
|
||||
break;
|
||||
}
|
||||
#else
|
||||
for (i = 0; i < 256; i ++)
|
||||
if ((byte = cupsFileGetChar(fp)) != i)
|
||||
break;
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (i >= 256)
|
||||
puts("PASS");
|
||||
@@ -467,6 +696,20 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
status ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* cupsFileTell()
|
||||
*/
|
||||
|
||||
fputs("cupsFileTell(): ", stdout);
|
||||
|
||||
if ((length = cupsFileTell(fp)) == 81933283)
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
printf("FAIL (" CUPS_LLFMT " instead of 81933283)\n", CUPS_LLCAST length);
|
||||
status ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* cupsFileClose()
|
||||
*/
|
||||
@@ -487,6 +730,12 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
status ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove the test file...
|
||||
*/
|
||||
|
||||
unlink(compression ? "testfile.dat.gz" : "testfile.dat");
|
||||
|
||||
/*
|
||||
* Return the test status...
|
||||
*/
|
||||
|
||||
@@ -299,7 +299,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
* httpAddrGetList()
|
||||
*/
|
||||
|
||||
fputs("httpAddrGetList(): ", stdout);
|
||||
printf("httpAddrGetList(%s): ", hostname);
|
||||
|
||||
addrlist = httpAddrGetList(hostname, AF_UNSPEC, NULL);
|
||||
if (addrlist)
|
||||
|
||||
@@ -772,7 +772,7 @@ cupsGetPPD2(http_t *http, /* I - HTTP connection */
|
||||
resource, sizeof(resource), 0))
|
||||
return (NULL);
|
||||
|
||||
DEBUG_printf(("Printer hostname=\"%s\", port=%d\n", hostname, port));
|
||||
DEBUG_printf(("cupsGetPPD3: Printer hostname=\"%s\", port=%d\n", hostname, port));
|
||||
|
||||
/*
|
||||
* Remap local hostname to localhost...
|
||||
@@ -1611,6 +1611,16 @@ cups_get_printer_uri(
|
||||
host, hostsize, port, resource, resourcesize);
|
||||
ippDelete(response);
|
||||
|
||||
if (!strncmp(resource, "/classes/", 9))
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("No printer-uri found for class!"));
|
||||
|
||||
*host = '\0';
|
||||
*resource = '\0';
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -1618,7 +1628,7 @@ cups_get_printer_uri(
|
||||
}
|
||||
|
||||
if (cupsLastError() != IPP_NOT_FOUND)
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, "No printer-uri found!");
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("No printer-uri found!"));
|
||||
|
||||
*host = '\0';
|
||||
*resource = '\0';
|
||||
|
||||
@@ -15,6 +15,8 @@ X-KDE-SubstituteUID=false
|
||||
X-KDE-Username=
|
||||
Name=Manage Printing
|
||||
Comment=CUPS Web Interface
|
||||
Name[de]=Druckerverwaltung
|
||||
Comment[de]=CUPS Webinterface
|
||||
Name[en_US]=Manage Printing
|
||||
Comment[en_US]=CUPS Web Interface
|
||||
Name[es]=Administrar impresión
|
||||
@@ -23,14 +25,17 @@ Name[et]=Trükkimise haldur
|
||||
Comment[et]=CUPS-i veebiliides
|
||||
Name[fr]=Gestionnaire d'impression
|
||||
Comment[fr]=Interface Web de CUPS
|
||||
Name[pl]=Zarządzanie drukowaniem
|
||||
Comment[pl]=Interfejs WWW CUPS
|
||||
Name[it]=Gestione stampa
|
||||
Comment[it]=Interfaccia web di CUPS
|
||||
Name[he]=נהל הדפסות
|
||||
Comment[he]=ממשק דפדפן של CUPS
|
||||
Name[id]=Manajemen Pencetakan
|
||||
Comment[id]=Antarmuka Web CUPS
|
||||
Name[it]=Gestione stampa
|
||||
Comment[it]=Interfaccia web di CUPS
|
||||
Name[ja]=印刷の管理
|
||||
Comment[ja]=CUPS Web インタフェース
|
||||
Name[pl]=Zarządzanie drukowaniem
|
||||
Comment[pl]=Interfejs WWW CUPS
|
||||
Name[zh]=打印机管理
|
||||
Comment[zh]=CUPS网页界面
|
||||
Name[zh_TW]=印表管理
|
||||
Comment[zh_TW]=CUPS 網頁介面
|
||||
Name[de]=Druckerverwaltung
|
||||
Comment[de]=CUPS Webinterface
|
||||
|
||||
|
||||
@@ -988,7 +988,7 @@ printers are shared (published) by default. The default is
|
||||
<H3>Description</H3>
|
||||
|
||||
<P>The <CODE>Deny</CODE> directive specifies a hostname, IP
|
||||
address, or network that is allowed access to the server.
|
||||
address, or network that is denied access to the server.
|
||||
<CODE>Deny</CODE> directives are cummulative, so multiple
|
||||
<CODE>Deny</CODE> directives can be used to allow access for
|
||||
multiple hosts or networks. The <CODE>/mm</CODE> notation
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
</head>
|
||||
<body>
|
||||
<!--
|
||||
"$Id: spec-ppd.html 7273 2008-01-30 19:21:55Z mike $"
|
||||
"$Id: spec-ppd.html 7444 2008-04-09 22:41:03Z mike $"
|
||||
|
||||
CUPS PPD extensions specification for the Common UNIX Printing System (CUPS).
|
||||
|
||||
Copyright 2007 by Apple Inc.
|
||||
Copyright 2007-2008 by Apple Inc.
|
||||
Copyright 1997-2007 by Easy Software Products.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
@@ -1185,13 +1185,27 @@ text:for%20all%20good%20men%20to%20come%20to%20the%20aid%20of%20their%20country.
|
||||
*cupsIPPReason com.vendor-error/A serious error occurred: "http://www.vendor.com/help"
|
||||
|
||||
<em>*% Map com.vendor-error to text and a local, Apple help book, and remote page</em>
|
||||
*APHelpBook: "file:///Library/Printers/vendor/Help/filename"
|
||||
*APHelpBook: "file:///Library/Printers/vendor/Help.bundle"
|
||||
*cupsIPPReason com.vendor-error/A serious error occurred: "/help/com.vendor/error.html
|
||||
help:anchor='com.vendor-error'%20bookID=Vendor%20Help
|
||||
http://www.vendor.com/help"
|
||||
*End
|
||||
</pre>
|
||||
|
||||
<h3><span class='info'>CUPS 1.4</span><a name='cupsMarkerName'>cupsMarkerName</a></h3>
|
||||
|
||||
<p class='summary'>*cupsMarkerName/Name Text: ""</p>
|
||||
|
||||
<p>This optional attribute maps <code>marker-names</code> strings that are
|
||||
generated by the driver to human readable text.</p>
|
||||
|
||||
<p>Examples:</p>
|
||||
|
||||
<pre class='command'>
|
||||
<em>*% Map cyanToner to "Cyan Toner"</em>
|
||||
*cupsMarkerName cyanToner/Cyan Toner: ""
|
||||
</pre>
|
||||
|
||||
<h3><span class='info'>CUPS 1.2</span><a name='cupsLanguages'>cupsLanguages</a></h3>
|
||||
|
||||
<p class='summary'>*cupsLanguages: "locale list"</p>
|
||||
@@ -1322,21 +1336,6 @@ PPD file extensions was used. Currently it must be the string
|
||||
|
||||
<h2 class='title'><a name='MACOSX'>Mac OS X Attributes</a></h2>
|
||||
|
||||
<h3><a name='APBookFile'>APBookFile</a></h3>
|
||||
|
||||
<p class='summary'>*APBookFile: "file URL"</p>
|
||||
|
||||
<p>This string attribute specifies the Apple help book file to use when
|
||||
looking up IPP reason codes for this printer driver. The
|
||||
<a href='#cupsIPPReason'><tt>cupsIPPReason</tt></a> attribute maps
|
||||
"help" URIs to this file.</p>
|
||||
|
||||
<p>Example:</p>
|
||||
|
||||
<pre class='command'>
|
||||
*APBookFile: "file:///Library/Printers/vendor/Help/filename"
|
||||
</pre>
|
||||
|
||||
<h3><span class='info'>Mac OS X 10.3</span><a name='APDialogExtension'>APDialogExtension</a></h3>
|
||||
|
||||
<p class='summary'>*APDialogExtension: "/Library/Printers/vendor/filename.plugin"</p>
|
||||
@@ -1445,6 +1444,21 @@ and the <tt>Tumble</tt> page attribute.</p>
|
||||
<p>Also see the related <a href='#cupsBackSide'><tt>cupsBackSide</tt></a>
|
||||
attribute.</p>
|
||||
|
||||
<h3><a name='APHelpBook'>APHelpBook</a></h3>
|
||||
|
||||
<p class='summary'>*APHelpBook: "bundle URL"</p>
|
||||
|
||||
<p>This string attribute specifies the Apple help book bundle to use when
|
||||
looking up IPP reason codes for this printer driver. The
|
||||
<a href='#cupsIPPReason'><tt>cupsIPPReason</tt></a> attribute maps
|
||||
"help" URIs to this file.</p>
|
||||
|
||||
<p>Example:</p>
|
||||
|
||||
<pre class='command'>
|
||||
*APHelpBook: "file:///Library/Printers/vendor/Help.bundle"
|
||||
</pre>
|
||||
|
||||
<h3><span class='info'>Mac OS X 10.3</span><a name='APPrinterIconPath'>APPrinterIconPath</a></h3>
|
||||
|
||||
<p class='summary'>*APPrinterIconPath: "/Library/Printers/vendor/filename"</p>
|
||||
@@ -1620,7 +1634,7 @@ the device.</p>
|
||||
|
||||
<li>Added custom option values support</li>
|
||||
|
||||
<li>Added <tt>APBookFile</tt> attribute</li>
|
||||
<li>Added <tt>APHelpBook</tt> attribute</li>
|
||||
|
||||
<li>Added <tt>APDuplexRequiresFlippedMargin</tt> attribute</li>
|
||||
|
||||
|
||||
|
Depois Largura: | Altura: | Tamanho: 1.6 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.3 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.4 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.2 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.0 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.8 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.0 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.4 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.8 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.3 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.2 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.3 KiB |
|
Depois Largura: | Altura: | Tamanho: 904 B |
|
Depois Largura: | Altura: | Tamanho: 1.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.4 KiB |
|
Depois Largura: | Altura: | Tamanho: 1018 B |
|
Depois Largura: | Altura: | Tamanho: 1.5 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.4 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.0 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.6 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.7 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.7 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.4 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.4 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.7 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.5 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.4 KiB |
|
Depois Largura: | Altura: | Tamanho: 686 B |
|
Depois Largura: | Altura: | Tamanho: 2.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.9 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.9 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.9 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.8 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.0 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.7 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.8 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.1 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.8 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.0 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.8 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.5 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.2 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.5 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.8 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.6 KiB |
|
Depois Largura: | Altura: | Tamanho: 1.5 KiB |
|
Depois Largura: | Altura: | Tamanho: 2.2 KiB |
@@ -0,0 +1,127 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<TITLE>Beranda - CUPS @CUPS_VERSION@@CUPS_REVISION@</TITLE>
|
||||
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/cups.css">
|
||||
<LINK REL="SHORTCUT ICON" HREF="/favicon.ico" TYPE="image/x-icon">
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<TABLE WIDTH="100%" STYLE="height: 100%;" BORDER="0" CELLSPACING="0" CELLPADDING="0" SUMMARY="Common UNIX Printing System @CUPS_VERSION@">
|
||||
<TR CLASS="header">
|
||||
<TD VALIGN="TOP" WIDTH="15" ROWSPAN="2"><IMG SRC="/images/top-left.gif" WIDTH="15" HEIGHT="80" ALT=""></TD>
|
||||
<TD VALIGN="TOP" WIDTH="55" ROWSPAN="2"><IMG SRC="/images/top-middle.gif" WIDTH="55" HEIGHT="80" ALT=""></TD>
|
||||
<TD WIDTH="100%" HEIGHT="60"><H1>Common UNIX Printing System @CUPS_VERSION@@CUPS_REVISION@</H1></TD>
|
||||
<TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="15" ROWSPAN="2"><IMG
|
||||
SRC="/images/top-right.gif" WIDTH="15" HEIGHT="15" ALT=""></TD>
|
||||
</TR>
|
||||
<TR CLASS="header"><TD WIDTH="100%" VALIGN="BOTTOM" NOWRAP>
|
||||
|
||||
<A CLASS="sel" HREF="/"><IMG SRC="/images/tab-left.gif" WIDTH="4"
|
||||
HEIGHT="4" ALIGN="TOP" BORDER="0"
|
||||
ALT=""> Beranda <IMG
|
||||
SRC="/images/tab-right.gif" WIDTH="4" HEIGHT="4" ALIGN="TOP"
|
||||
BORDER="0" ALT=""></A>
|
||||
|
||||
<A CLASS="unsel" HREF="/admin/"><IMG SRC="/images/tab-left.gif" WIDTH="4"
|
||||
HEIGHT="4" ALIGN="TOP" BORDER="0"
|
||||
ALT=""> Administrasi <IMG
|
||||
SRC="/images/tab-right.gif" WIDTH="4" HEIGHT="4" ALIGN="TOP"
|
||||
BORDER="0" ALT=""></A>
|
||||
|
||||
<A CLASS="unsel" HREF="/classes/"><IMG SRC="/images/tab-left.gif" WIDTH="4"
|
||||
HEIGHT="4" ALIGN="TOP" BORDER="0"
|
||||
ALT=""> Kelas <IMG
|
||||
SRC="/images/tab-right.gif" WIDTH="4" HEIGHT="4" ALIGN="TOP"
|
||||
BORDER="0" ALT=""></A>
|
||||
|
||||
<A CLASS="unsel" HREF="/help/"><IMG SRC="/images/tab-left.gif" WIDTH="4"
|
||||
HEIGHT="4" ALIGN="TOP" BORDER="0"
|
||||
ALT=""> Dokumentasi/Bantuan <IMG
|
||||
SRC="/images/tab-right.gif" WIDTH="4" HEIGHT="4" ALIGN="TOP"
|
||||
BORDER="0" ALT=""></A>
|
||||
|
||||
<A CLASS="unsel" HREF="/jobs/"><IMG SRC="/images/tab-left.gif" WIDTH="4"
|
||||
HEIGHT="4" ALIGN="TOP" BORDER="0"
|
||||
ALT=""> Tugas <IMG
|
||||
SRC="/images/tab-right.gif" WIDTH="4" HEIGHT="4" ALIGN="TOP"
|
||||
BORDER="0" ALT=""></A>
|
||||
|
||||
<A CLASS="unsel" HREF="/printers/"><IMG SRC="/images/tab-left.gif" WIDTH="4"
|
||||
HEIGHT="4" ALIGN="TOP" BORDER="0"
|
||||
ALT=""> Pencetak <IMG
|
||||
SRC="/images/tab-right.gif" WIDTH="4" HEIGHT="4" ALIGN="TOP"
|
||||
BORDER="0" ALT=""></A>
|
||||
|
||||
</TD></TR>
|
||||
<TR CLASS="page">
|
||||
<TD WIDTH="15"> </TD>
|
||||
<TD COLSPAN="2" WIDTH="100%" VALIGN="TOP" CLASS="page">
|
||||
|
||||
<H2 CLASS="title">Selamat Datang!</H2>
|
||||
|
||||
<P>Halaman web ini mempersilakan Anda untuk memantau pencetak Anda
|
||||
beserta tugas-tugasnya, selayak seperti melaksanakan tugas administrasi sistem.
|
||||
Klik pada tab-tab yang tersedia di atas atau tekan tombol di bawah ini untuk
|
||||
memulai administrasi.</P>
|
||||
|
||||
<P>
|
||||
<A HREF="/help/"><IMG SRC="/images/button-help.gif" CLASS="button" ALT="Bantuan"></A>
|
||||
<A HREF="/admin?OP=add-class"><IMG SRC="/images/button-add-class.gif" CLASS="button" ALT="Tambah Kelas"></A>
|
||||
<A HREF="/admin?OP=add-printer"><IMG SRC="/images/button-add-printer.gif" CLASS="button" ALT="Tambah Pencetak"></A>
|
||||
<A HREF="/classes"><IMG SRC="/images/button-manage-classes.gif" CLASS="button" ALT="Atur Kelas"></A>
|
||||
<A HREF="/jobs"><IMG SRC="/images/button-manage-jobs.gif" CLASS="button" ALT="Atur Tugas"></A>
|
||||
<A HREF="/printers"><IMG SRC="/images/button-manage-printers.gif" CLASS="button" ALT="Atur Pencetak"></A>
|
||||
<A HREF="/admin"><IMG SRC="/images/button-manage-server.gif" CLASS="button" ALT="Atur Server"></A>
|
||||
</P>
|
||||
|
||||
<P><I>Apabila nanti Anda ditanyai tentang nama pengguna dan sandi, masukkanlah
|
||||
nama pengguna beserta sandi Anda, atau berikanlah nama dan sandi milik
|
||||
"root". </I></P>
|
||||
|
||||
<H2 CLASS="title">Tentang CUPS</H2>
|
||||
|
||||
<P>
|
||||
<IMG SRC="/images/happy.gif" ALIGN="LEFT" WIDTH="196" HEIGHT="144"
|
||||
STYLE="padding-right: 10px;" ALT="Happy Computer and Printer">
|
||||
|
||||
CUPS menyediakan sistem cetak yang portabel bagi sistem operasi berbasis
|
||||
UNIX<SUP>®</SUP>. Pengembangan serta pengasuhan CUPS ditangani oleh
|
||||
<A HREF="http://www.apple.com">Apple Inc.</a> sebagai usaha untuk menaikkan solusi standar pencetakan. CUPS adalah sistem cetak standar yang dipakai pada MacOS<SUP>®</SUP> X dan kebanyakan distribusi
|
||||
Linux<SUP>®</SUP>.</P>
|
||||
|
||||
<P>CUPS menggunakan <A HREF="http://www.pwg.org/ipp/"
|
||||
TARGET="_blank"> <I>Internet Printing Protocol</I> ("IPP")</A> sebagai
|
||||
basis untuk memanajemen tugas, antrian tugas cetak, serta penambahan
|
||||
pencetak melalui jaringan yang juga berbasis pada <I>PostScript Printer Description</I> ("PPD")
|
||||
untuk mendukung pencetakan yang sesungguhnya.<BR CLEAR="ALL"></P>
|
||||
|
||||
<H2 CLASS="title">Untuk <I>Driver Pencetak</I> dan Asistensi</H2>
|
||||
|
||||
<P>Kunjungi situs resmi CUPS untuk <I>driver</I> pencetak maupun
|
||||
asistensi:</P>
|
||||
|
||||
<PRE>
|
||||
<A HREF="http://www.cups.org/" TARGET="_blank">www.cups.org</A>
|
||||
</PRE>
|
||||
|
||||
</TD>
|
||||
<TD WIDTH="15"> </TD>
|
||||
</TR>
|
||||
<TR CLASS="header">
|
||||
<TD VALIGN="BOTTOM" WIDTH="15"><IMG SRC="/images/bottom-left.gif"
|
||||
WIDTH="15" HEIGHT="15" ALT=""></TD>
|
||||
<TD COLSPAN="2" WIDTH="100%" STYLE="padding: 5;">
|
||||
|
||||
<P><SMALL>Common UNIX Printing System, CUPS, dan logo CUPS adalah
|
||||
merek dagang dari <A HREF="http://www.apple.com">Apple Inc.</A> Hak cipta CUPS
|
||||
pada 2007-2008 Apple Inc. Semua hak terdaftar.</SMALL></P>
|
||||
|
||||
</TD>
|
||||
|
||||
<TD ALIGN="RIGHT" VALIGN="BOTTOM" WIDTH="15"><IMG SRC="/images/bottom-right.gif"
|
||||
WIDTH="15" HEIGHT="15" ALT=""></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Colorspace conversions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1993-2006 by Easy Software Products.
|
||||
*
|
||||
* The color saturation/hue matrix stuff is provided thanks to Mr. Paul
|
||||
@@ -507,8 +507,7 @@ cupsImageRGBAdjust(cups_ib_t *pixels, /* IO - Input/output pixels */
|
||||
static cups_clut_t *lut = NULL; /* Lookup table for matrix */
|
||||
|
||||
|
||||
if (saturation != last_sat ||
|
||||
hue != last_hue)
|
||||
if (saturation != last_sat || hue != last_hue || !lut)
|
||||
{
|
||||
/*
|
||||
* Build the color adjustment matrix...
|
||||
|
||||
@@ -372,7 +372,6 @@ gif_get_code(FILE *fp, /* I - File to read from */
|
||||
lastbit = last_byte * 8;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
for (ret = 0, i = curbit + code_size - 1, j = code_size;
|
||||
j > 0;
|
||||
i --, j --)
|
||||
@@ -611,6 +610,8 @@ gif_read_lzw(FILE *fp, /* I - File to read from */
|
||||
|
||||
return (firstcode);
|
||||
}
|
||||
else if (!table)
|
||||
return (0);
|
||||
|
||||
if (sp > stack)
|
||||
return (*--sp);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* PNG image routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1993-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -170,16 +170,56 @@ _cupsImageReadPNG(
|
||||
* Interlaced images must be loaded all at once...
|
||||
*/
|
||||
|
||||
size_t bufsize; /* Size of buffer */
|
||||
|
||||
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
in = malloc(img->xsize * img->ysize);
|
||||
{
|
||||
bufsize = img->xsize * img->ysize;
|
||||
|
||||
if ((bufsize / img->ysize) != img->xsize)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: PNG image dimensions (%ux%u) too large!\n",
|
||||
(unsigned)width, (unsigned)height);
|
||||
fclose(fp);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
else
|
||||
in = malloc(img->xsize * img->ysize * 3);
|
||||
{
|
||||
bufsize = img->xsize * img->ysize * 3;
|
||||
|
||||
if ((bufsize / (img->ysize * 3)) != img->xsize)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: PNG image dimensions (%ux%u) too large!\n",
|
||||
(unsigned)width, (unsigned)height);
|
||||
fclose(fp);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
in = malloc(bufsize);
|
||||
}
|
||||
|
||||
bpp = cupsImageGetDepth(img);
|
||||
out = malloc(img->xsize * bpp);
|
||||
|
||||
if (!in || !out)
|
||||
{
|
||||
fputs("DEBUG: Unable to allocate memory for PNG image!\n", stderr);
|
||||
|
||||
if (in)
|
||||
free(in);
|
||||
|
||||
if (out)
|
||||
free(out);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the image, interlacing as needed...
|
||||
*/
|
||||
|
||||
@@ -725,7 +725,7 @@ get_tile(cups_image_t *img, /* I - Image */
|
||||
if ((img->tiles = calloc(sizeof(cups_itile_t *), ytiles)) == NULL)
|
||||
return (NULL);
|
||||
|
||||
if ((tile = calloc(sizeof(cups_itile_t), xtiles * ytiles)) == NULL)
|
||||
if ((tile = calloc(xtiles * sizeof(cups_itile_t), ytiles)) == NULL)
|
||||
return (NULL);
|
||||
|
||||
for (tiley = 0; tiley < ytiles; tiley ++)
|
||||
|
||||