Skip to content

Commit

Permalink
Merge changes from CUPS 1.4svn-r7547.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@748 a1ca3aef-8c08-0410-bb20-df032aa958be
  • Loading branch information
msweet committed May 7, 2008
1 parent d8bcaa3 commit a0f6818
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 43 deletions.
10 changes: 9 additions & 1 deletion CHANGES-1.3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ CHANGES-1.3.txt
CHANGES IN CUPS V1.3.8

- Documentation updates (STR #2785)
- 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)
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
Expand Down
7 changes: 6 additions & 1 deletion backend/mdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ main(int argc, /* I - Number of command-line args */
printf("network %s \"%s\" \"%s\"\n", device_uri,
device->make_and_model ? device->make_and_model : "Unknown",
device->name);
fflush(stdout);

device->sent = 1;
}
Expand Down Expand Up @@ -649,7 +650,8 @@ query_callback(
else
device->make_and_model = strdup(model);

if (device->type == CUPS_DEVICE_IPP &&
if ((device->type == CUPS_DEVICE_IPP ||
device->type == CUPS_DEVICE_PRINTER) &&
(value = TXTRecordGetValuePtr(rdlen, rdata, "printer-type",
&valueLen)) != NULL)
{
Expand All @@ -658,6 +660,9 @@ query_callback(
*/

device->cups_shared = 1;

if (device->type == CUPS_DEVICE_PRINTER)
device->sent = 1;
}
}
else
Expand Down
6 changes: 5 additions & 1 deletion backend/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
*
* Contents:
*
* backendCheckSideChannel() - Check the side-channel for pending requests.
* backendNetworkSideCB() - Handle common network side-channel commands.
* backendResolveURI() - Get the device URI, resolving as needed.
* resolve_callback() - Build a device URI for the given service name.
*/

/*
Expand Down Expand Up @@ -309,7 +313,7 @@ resolve_callback(
*/

rp[0] = '/';
memcpy(rp, value, valueLen);
memcpy(rp + 1, value, valueLen);
rp[valueLen + 1] = '\0';
}
else
Expand Down
14 changes: 10 additions & 4 deletions cgi-bin/ipp-var.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions data/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ install-data:
for file in $(DATAFILES); do \
$(INSTALL_DATA) $$file $(DATADIR)/data; \
done
$(INSTALL_DIR) -m 755 $(DATADIR)/model
$(INSTALL_DIR) -m 755 $(DATADIR)/ppdc
for file in $(PPDCFILES); do \
$(INSTALL_DATA) $$file $(DATADIR)/ppdc; \
Expand Down Expand Up @@ -184,6 +185,7 @@ uninstall:
done
-$(RMDIR) $(DATADIR)/profiles
-$(RMDIR) $(DATADIR)/ppdc
-$(RMDIR) $(DATADIR)/model
-$(RMDIR) $(DATADIR)/data
-$(RMDIR) $(DATADIR)/charsets
-$(RMDIR) $(DATADIR)/charmaps
Expand Down
20 changes: 10 additions & 10 deletions driver/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ testcmyk: testcmyk.o libcupsdriver.a ../cups/libcups.a
if test ! -d test; then \
mkdir test; \
fi
./testcmyk > test/testcmyk.log 2>&1
./testcmyk > test/testcmyk.log 2>&1 || echo "CMYK tests failed!"


#
Expand All @@ -292,14 +292,14 @@ testdither: testdither.o libcupsdriver.a ../cups/libcups.a
if test ! -d test; then \
mkdir test; \
fi
./testdither > test/0-255.pgm 2>test/0-255.log
./testdither 0 127 255 > test/0-127-255.pgm 2>test/0-127-255.log
./testdither 0 85 170 255 > test/0-85-170-255.pgm 2>test/0-85-170-255.log
./testdither 0 63 127 170 198 227 255 > test/0-63-127-170-198-227-255.pgm 2>test/0-63-127-170-198-227-255.log
./testdither 0 210 383 > test/0-210-383.pgm 2>test/0-210-383.log
./testdither 0 82 255 > test/0-82-255.pgm 2>test/0-82-255.log
./testdither 0 510 > test/0-510.pgm 2>test/0-510.log
./testdither 0 1020 > test/0-1020.pgm 2>test/0-1020.log
./testdither > test/0-255.pgm 2>test/0-255.log || echo "Dither 0-255 test failed!"
./testdither 0 127 255 > test/0-127-255.pgm 2>test/0-127-255.log || echo "Dither 0-127-255 test failed!"
./testdither 0 85 170 255 > test/0-85-170-255.pgm 2>test/0-85-170-255.log || echo "Dither 0-85-170-255 test failed!"
./testdither 0 63 127 170 198 227 255 > test/0-63-127-170-198-227-255.pgm 2>test/0-63-127-170-198-227-255.log || echo "Dither 0-63-127-170-198-227-255 test failed!"
./testdither 0 210 383 > test/0-210-383.pgm 2>test/0-210-383.log || echo "Dither 0-210-383 test failed!"
./testdither 0 82 255 > test/0-82-255.pgm 2>test/0-82-255.log || echo "Dither 0-82-255 test failed!"
./testdither 0 510 > test/0-510.pgm 2>test/0-510.log || echo "Dither 0-510 test failed!"
./testdither 0 1020 > test/0-1020.pgm 2>test/0-1020.log || echo "Dither 0-1020 test failed!"


#
Expand All @@ -313,7 +313,7 @@ testrgb: testrgb.o libcupsdriver.a ../cups/libcups.a
if test ! -d test; then \
mkdir test; \
fi
./testrgb > test/testrgb.log 2>&1
./testrgb > test/testrgb.log 2>&1 || echo "RGB tests failed!"


#
Expand Down
8 changes: 6 additions & 2 deletions scheduler/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -3697,7 +3697,10 @@ is_cgi(cupsd_client_t *con, /* I - Client connection */
*/

if ((options = strchr(con->uri, '?')) != NULL)
cupsdSetStringf(&(con->query_string), "QUERY_STRING=%s", options + 1);
{
options ++;
cupsdSetStringf(&(con->query_string), "QUERY_STRING=%s", options);
}

/*
* Check for known types...
Expand All @@ -3720,7 +3723,8 @@ is_cgi(cupsd_client_t *con, /* I - Client connection */

filename = strrchr(filename, '/') + 1; /* Filename always absolute */

cupsdSetStringf(&con->options, " %s", options);
if (options)
cupsdSetStringf(&con->options, " %s", options);

cupsdLogMessage(CUPSD_LOG_DEBUG2,
"is_cgi: Returning 1 with command=\"%s\" and options=\"%s\"",
Expand Down
5 changes: 1 addition & 4 deletions scheduler/cups-driverd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1271,15 +1271,12 @@ load_ppds(const char *d, /* I - Actual directory */
if (!strncasecmp(ptr, "true", 4))
type = PPD_TYPE_FAX;
}
else if (!strncmp(line, "*cupsFilter:", 12) &&
(type == PPD_TYPE_POSTSCRIPT || type == PPD_TYPE_UNKNOWN))
else if (!strncmp(line, "*cupsFilter:", 12) && type == PPD_TYPE_POSTSCRIPT)
{
if (strstr(line + 12, "application/vnd.cups-raster"))
type = PPD_TYPE_RASTER;
else if (strstr(line + 12, "application/vnd.cups-pdf"))
type = PPD_TYPE_PDF;
else
type = PPD_TYPE_UNKNOWN;
}
else if (!strncmp(line, "*cupsModelNumber:", 17))
sscanf(line, "*cupsModelNumber:%d", &model_number);
Expand Down
49 changes: 49 additions & 0 deletions scheduler/dirsvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,55 @@
*
* Contents:
*
* cupsdDeregisterPrinter() - Stop sending broadcast information for a local
* printer and remove any pending references to
* remote printers.
* cupsdLoadRemoteCache() - Load the remote printer cache.
* cupsdRegisterPrinter() - Start sending broadcast information for a
* printer or update the broadcast contents.
* cupsdRestartPolling() - Restart polling servers as needed.
* cupsdSaveRemoteCache() - Save the remote printer cache.
* cupsdSendBrowseList() - Send new browsing information as necessary.
* cupsdStartBrowsing() - Start sending and receiving broadcast
* information.
* cupsdStartPolling() - Start polling servers as needed.
* cupsdStopBrowsing() - Stop sending and receiving broadcast
* information.
* cupsdStopPolling() - Stop polling servers as needed.
* cupsdUpdateDNSSDBrowse() - Handle DNS-SD queries.
* cupsdUpdateDNSSDName() - Update the computer name we use for
* browsing...
* cupsdUpdateLDAPBrowse() - Scan for new printers via LDAP...
* cupsdUpdateSLPBrowse() - Get browsing information via SLP.
* dequote() - Remote quotes from a string.
* dnssdBuildTxtRecord() - Build a TXT record from printer info.
* dnssdComparePrinters() - Compare the registered names of two printers.
* dnssdDeregisterPrinter() - Stop sending broadcast information for a
* printer.
* dnssdPackTxtRecord() - Pack an array of key/value pairs into the TXT
* record format.
* dnssdRegisterCallback() - DNSServiceRegister callback.
* dnssdRegisterPrinter() - Start sending broadcast information for a
* printer or update the broadcast contents.
* get_hostconfig() - Get an /etc/hostconfig service setting.
* is_local_queue() - Determine whether the URI points at a local
* queue.
* process_browse_data() - Process new browse data.
* process_implicit_classes() - Create/update implicit classes as needed.
* send_cups_browse() - Send new browsing information using the CUPS
* protocol.
* send_ldap_browse() - Send LDAP printer registrations.
* send_slp_browse() - Register the specified printer with SLP.
* slp_attr_callback() - SLP attribute callback
* slp_dereg_printer() - SLPDereg() the specified printer
* slp_get_attr() - Get an attribute from an SLP registration.
* slp_reg_callback() - Empty SLPRegReport.
* slp_url_callback() - SLP service url callback
* update_cups_browse() - Update the browse lists using the CUPS
* protocol.
* update_lpd() - Update the LPD configuration as needed.
* update_polling() - Read status messages from the poll daemons.
* update_smb() - Update the SMB configuration as needed.
*/

/*
Expand Down
44 changes: 24 additions & 20 deletions scheduler/ipp.c
Original file line number Diff line number Diff line change
Expand Up @@ -8309,7 +8309,7 @@ print_job(cupsd_client_t *con, /* I - Client connection */
ipp_attribute_t *doc_name; /* document-name attribute */


cupsdLogMessage(CUPSD_LOG_DEBUG, "print_job: auto-typing file...");
cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job ???] Auto-typing file...");

doc_name = ippFindAttribute(con->request, "document-name", IPP_TAG_NAME);
filetype = mimeFileType(MimeDatabase, con->filename,
Expand All @@ -8318,6 +8318,9 @@ print_job(cupsd_client_t *con, /* I - Client connection */

if (!filetype)
filetype = mimeType(MimeDatabase, super, type);

cupsdLogMessage(CUPSD_LOG_INFO, "[Job ???] Request file type is %s/%s.",
filetype->super, filetype->type);
}
else
filetype = mimeType(MimeDatabase, super, type);
Expand Down Expand Up @@ -8373,9 +8376,6 @@ print_job(cupsd_client_t *con, /* I - Client connection */
if ((job = add_job(con, printer, filetype)) == NULL)
return;

cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Adding job file of type %s/%s.",
job->id, filetype->super, filetype->type);

/*
* Update quota data...
*/
Expand Down Expand Up @@ -8414,9 +8414,10 @@ print_job(cupsd_client_t *con, /* I - Client connection */
* Log and save the job...
*/

cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Queued on \"%s\" by \"%s\".",
job->id, job->dest, job->username);
cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] hold_until = %d", job->id,
cupsdLogMessage(CUPSD_LOG_INFO,
"[Job %d] File of type %s/%s queued by \"%s\".", job->id,
filetype->super, filetype->type, job->username);
cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] hold_until=%d", job->id,
(int)job->hold_until);

/*
Expand Down Expand Up @@ -9305,7 +9306,8 @@ send_document(cupsd_client_t *con, /* I - Client connection */
ipp_attribute_t *uri) /* I - Printer URI */
{
ipp_attribute_t *attr; /* Current attribute */
ipp_attribute_t *format; /* Document-format attribute */
ipp_attribute_t *format; /* Request's document-format attribute */
ipp_attribute_t *jformat; /* Job's document-format attribute */
const char *default_format;/* document-format-default value */
int jobid; /* Job ID number */
cupsd_job_t *job; /* Current job */
Expand Down Expand Up @@ -9501,7 +9503,7 @@ send_document(cupsd_client_t *con, /* I - Client connection */
ipp_attribute_t *doc_name; /* document-name attribute */


cupsdLogMessage(CUPSD_LOG_DEBUG, "send_document: auto-typing file...");
cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] Auto-typing file...", job->id);

doc_name = ippFindAttribute(con->request, "document-name", IPP_TAG_NAME);
filetype = mimeFileType(MimeDatabase, con->filename,
Expand All @@ -9510,12 +9512,18 @@ send_document(cupsd_client_t *con, /* I - Client connection */

if (!filetype)
filetype = mimeType(MimeDatabase, super, type);

cupsdLogMessage(CUPSD_LOG_DEBUG,
"[Job %d] Request file type is %s/%s.", job->id,
filetype->super, filetype->type);
}
else
filetype = mimeType(MimeDatabase, super, type);

jformat = ippFindAttribute(job->attrs, "document-format", IPP_TAG_MIMETYPE);

if (filetype &&
(!format ||
(!jformat ||
(!strcmp(super, "application") && !strcmp(type, "octet-stream"))))
{
/*
Expand All @@ -9526,14 +9534,14 @@ send_document(cupsd_client_t *con, /* I - Client connection */
snprintf(mimetype, sizeof(mimetype), "%s/%s", filetype->super,
filetype->type);

if (format)
if (jformat)
{
_cupsStrFree(format->values[0].string.text);
_cupsStrFree(jformat->values[0].string.text);

format->values[0].string.text = _cupsStrAlloc(mimetype);
jformat->values[0].string.text = _cupsStrAlloc(mimetype);
}
else
ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_MIMETYPE,
ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_MIMETYPE,
"document-format", NULL, mimetype);
}
else if (!filetype)
Expand Down Expand Up @@ -9564,10 +9572,6 @@ send_document(cupsd_client_t *con, /* I - Client connection */
return;
}

cupsdLogMessage(CUPSD_LOG_DEBUG,
"send_document: request file type is %s/%s.",
filetype->super, filetype->type);

/*
* Add the file to the job...
*/
Expand Down Expand Up @@ -9595,8 +9599,8 @@ send_document(cupsd_client_t *con, /* I - Client connection */
cupsdClearString(&con->filename);

cupsdLogMessage(CUPSD_LOG_INFO,
"File of type %s/%s queued in job #%d by \"%s\".",
filetype->super, filetype->type, job->id, job->username);
"[Job %d] File of type %s/%s queued by \"%s\".", job->id,
filetype->super, filetype->type, job->username);

/*
* Start the job if this is the last document...
Expand Down

0 comments on commit a0f6818

Please sign in to comment.