From 355e94dc85c9adaf0ad76a1dc8f5ff960181059c Mon Sep 17 00:00:00 2001
From: msweet
Date: Thu, 26 Jul 2007 22:45:43 +0000
Subject: [PATCH] Merge changes from CUPS trunk, r6739.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@361 a1ca3aef-8c08-0410-bb20-df032aa958be
---
CHANGES.txt | 37 +-
cgi-bin/admin.c | 148 +-
cgi-bin/template.c | 42 +-
conf/cupsd.conf.in | 15 +-
config-scripts/cups-common.m4 | 12 +-
config-scripts/cups-compiler.m4 | 19 +-
config-scripts/cups-defaults.m4 | 24 +-
config.h.in | 5 +-
configure.in | 11 +-
cups/adminutil.c | 152 +-
cups/auth.c | 109 +-
cups/getputfile.c | 13 +-
cups/globals.h | 5 +-
cups/http.c | 82 +-
cups/http.h | 8 +-
cups/libcups.exp | 2 +
cups/mark.c | 11 +-
cups/options.c | 46 +-
cups/ppd.c | 8 +-
cups/request.c | 90 +-
doc/Makefile | 5 +-
doc/help/api-httpipp.html | 54 +
doc/help/kerberos.html | 137 +
doc/help/policies.html | 80 +-
doc/help/spec-ppd.html | 7 +-
doc/images/button-accept-jobs.gif | Bin 527 -> 442 bytes
doc/images/button-add-class.gif | Bin 484 -> 387 bytes
doc/images/button-add-printer.gif | Bin 487 -> 401 bytes
doc/images/button-add-rss-subscription.gif | Bin 717 -> 624 bytes
doc/images/button-add-this-printer.gif | Bin 577 -> 477 bytes
doc/images/button-cancel-all-jobs.gif | Bin 568 -> 450 bytes
doc/images/button-cancel-job.gif | Bin 474 -> 377 bytes
doc/images/button-cancel-subscription.gif | Bin 663 -> 568 bytes
doc/images/button-change-settings.gif | Bin 615 -> 521 bytes
doc/images/button-clean-print-heads.gif | Bin 615 -> 503 bytes
doc/images/button-clear.gif | Bin 359 -> 279 bytes
doc/images/button-continue.gif | Bin 423 -> 345 bytes
doc/images/button-delete-class.gif | Bin 520 -> 406 bytes
doc/images/button-delete-printer.gif | Bin 508 -> 412 bytes
doc/images/button-edit-configuration-file.gif | Bin 699 -> 562 bytes
doc/images/button-export-samba.gif | Bin 771 -> 648 bytes
doc/images/button-find-new-printers.gif | Bin 0 -> 509 bytes
doc/images/button-help.gif | Bin 327 -> 256 bytes
doc/images/button-hold-job.gif | Bin 436 -> 325 bytes
doc/images/button-list-available-printers.gif | Bin 708 -> 0 bytes
doc/images/button-manage-classes.gif | Bin 619 -> 522 bytes
doc/images/button-manage-jobs.gif | Bin 556 -> 450 bytes
doc/images/button-manage-printers.gif | Bin 610 -> 508 bytes
doc/images/button-manage-server.gif | Bin 599 -> 493 bytes
doc/images/button-modify-class.gif | Bin 559 -> 461 bytes
doc/images/button-modify-printer.gif | Bin 559 -> 454 bytes
doc/images/button-move-job.gif | Bin 463 -> 370 bytes
doc/images/button-move-jobs.gif | Bin 574 -> 462 bytes
doc/images/button-print-self-test-page.gif | Bin 674 -> 552 bytes
doc/images/button-print-test-page.gif | Bin 564 -> 457 bytes
doc/images/button-publish-printer.gif | Bin 550 -> 446 bytes
doc/images/button-reject-jobs.gif | Bin 509 -> 395 bytes
doc/images/button-release-job.gif | Bin 536 -> 428 bytes
doc/images/button-restart-job.gif | Bin 493 -> 408 bytes
doc/images/button-save-changes.gif | Bin 580 -> 482 bytes
doc/images/button-search.gif | Bin 410 -> 332 bytes
doc/images/button-set-allowed-users.gif | Bin 673 -> 549 bytes
doc/images/button-set-as-default.gif | Bin 585 -> 479 bytes
doc/images/button-set-printer-options.gif | Bin 649 -> 541 bytes
doc/images/button-show-active.gif | Bin 662 -> 547 bytes
doc/images/button-show-all.gif | Bin 570 -> 472 bytes
doc/images/button-show-completed.gif | Bin 764 -> 626 bytes
doc/images/button-show-next.gif | Bin 514 -> 419 bytes
doc/images/button-show-previous.gif | Bin 582 -> 484 bytes
doc/images/button-sort-ascending.gif | Bin 699 -> 577 bytes
doc/images/button-sort-descending.gif | Bin 723 -> 606 bytes
doc/images/button-start-class.gif | Bin 498 -> 397 bytes
doc/images/button-start-printer.gif | Bin 500 -> 407 bytes
doc/images/button-stop-class.gif | Bin 500 -> 390 bytes
doc/images/button-stop-printer.gif | Bin 501 -> 383 bytes
doc/images/button-unpublish-printer.gif | Bin 594 -> 499 bytes
doc/images/button-use-default-config.gif | Bin 864 -> 731 bytes
doc/images/button-view-access-log.gif | Bin 638 -> 534 bytes
doc/images/button-view-error-log.gif | Bin 554 -> 473 bytes
doc/images/button-view-page-log.gif | Bin 590 -> 496 bytes
doc/images/button-view-printable-version.gif | Bin 743 -> 616 bytes
filter/Makefile | 6 +-
filter/rastertolabel.c | 6 +-
...s-lpd.plist => org.cups.cups-lpd.plist.in} | 2 +-
locale/Makefile | 6 +-
locale/cups.pot | 130 +-
locale/cups_da.po | 61 +-
locale/cups_de.po | 65 +-
locale/cups_es.po | 65 +-
locale/cups_et.po | 65 +-
locale/cups_fi.po | 61 +-
locale/cups_fr.po | 65 +-
locale/cups_he.po | 65 +-
locale/cups_it.po | 65 +-
locale/cups_ja.po | 3587 +++--------------
locale/cups_ko.po | 1519 ++++---
locale/cups_no.po | 61 +-
locale/cups_pl.po | 65 +-
locale/cups_pt.po | 61 +-
locale/cups_ru.po | 61 +-
locale/cups_sv.po | 65 +-
locale/cups_zh.po | 1525 ++++---
locale/cups_zh_TW.po | 1063 ++---
man/cupsaddsmb.man.in | 28 +-
packaging/cups.list.in | 36 +-
packaging/cups.spec.in | 85 +-
ppd/Makefile | 10 +-
ppd/sample.drv | 30 +-
ppd/zebra.ppd | 244 +-
scheduler/auth.c | 76 +-
scheduler/client.c | 18 +-
scheduler/cups-lpd.c | 50 +-
scheduler/ipp.c | 28 +-
scheduler/job.c | 21 +-
scheduler/testlpd.c | 31 +-
systemv/cupsctl.c | 2 +-
templates/admin.tmpl | 8 +-
templates/de/edit-config.tmpl | 22 +
templates/de/edit-config.tmpl.in | 92 -
templates/edit-config.tmpl | 22 +
templates/edit-config.tmpl.in | 92 -
templates/es/edit-config.tmpl | 22 +
templates/es/edit-config.tmpl.in | 92 -
templates/et/edit-config.tmpl | 22 +
templates/et/edit-config.tmpl.in | 92 -
templates/fr/edit-config.tmpl | 22 +
templates/fr/edit-config.tmpl.in | 92 -
templates/he/edit-config.tmpl | 22 +
templates/he/edit-config.tmpl.in | 91 -
templates/it/edit-config.tmpl | 22 +
templates/it/edit-config.tmpl.in | 92 -
templates/ja/edit-config.tmpl | 22 +
templates/ja/edit-config.tmpl.in | 92 -
templates/pl/edit-config.tmpl | 22 +
templates/pl/edit-config.tmpl.in | 92 -
templates/sv/edit-config.tmpl | 22 +
templates/sv/edit-config.tmpl.in | 92 -
templates/zh_TW/edit-config.tmpl | 22 +
templates/zh_TW/edit-config.tmpl.in | 91 -
tools/buttons.txt | 2 +-
tools/makebuttons | 16 +-
141 files changed, 5400 insertions(+), 6328 deletions(-)
create mode 100644 doc/help/kerberos.html
create mode 100644 doc/images/button-find-new-printers.gif
delete mode 100644 doc/images/button-list-available-printers.gif
rename init/{org.cups.cups-lpd.plist => org.cups.cups-lpd.plist.in} (96%)
create mode 100644 templates/de/edit-config.tmpl
delete mode 100644 templates/de/edit-config.tmpl.in
create mode 100644 templates/edit-config.tmpl
delete mode 100644 templates/edit-config.tmpl.in
create mode 100644 templates/es/edit-config.tmpl
delete mode 100644 templates/es/edit-config.tmpl.in
create mode 100644 templates/et/edit-config.tmpl
delete mode 100644 templates/et/edit-config.tmpl.in
create mode 100644 templates/fr/edit-config.tmpl
delete mode 100644 templates/fr/edit-config.tmpl.in
create mode 100644 templates/he/edit-config.tmpl
delete mode 100644 templates/he/edit-config.tmpl.in
create mode 100644 templates/it/edit-config.tmpl
delete mode 100644 templates/it/edit-config.tmpl.in
create mode 100644 templates/ja/edit-config.tmpl
delete mode 100644 templates/ja/edit-config.tmpl.in
create mode 100644 templates/pl/edit-config.tmpl
delete mode 100644 templates/pl/edit-config.tmpl.in
create mode 100644 templates/sv/edit-config.tmpl
delete mode 100644 templates/sv/edit-config.tmpl.in
create mode 100644 templates/zh_TW/edit-config.tmpl
delete mode 100644 templates/zh_TW/edit-config.tmpl.in
diff --git a/CHANGES.txt b/CHANGES.txt
index 02ea9533e..800277f99 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,8 +1,41 @@
-CHANGES.txt - 2007-07-19
+CHANGES.txt - 2007-07-26
------------------------
-CHANGES IN CUPS V1.3??
+CHANGES IN CUPS V1.3rc1
+ - When lprm and cancel are run with no job ID, they now will
+ cancel the first stopped job if no pending or processing
+ jobs are left in the queue.
+ - The scheduler now logs successful print jobs, filter
+ failures, and the job file types at the default log
+ level (STR #2458)
+ - The scheduler now logs the usernames it is using for
+ authorization at LogLevel debug instead of debug2 (STR #2448)
+ - Added Intellitech Intellibar and Zebra CPCL PPDs to the list
+ of installed PPDs.
+ - Added 6" and 8" wide label sizes for the Zebra ZPL Label
+ Printer driver (STR #2442)
+ - The cupsaddsmb program and web interface now support
+ exporting of 64-bit Windows drivers, when available
+ (STR #2439)
+ - Moving a job that was printing did not stop the job on the
+ original printer (STR #2262)
+ - The cups-lpd mini-daemon did not work on Mac OS X server.
+ - Added httpGetAuthString() and httpSetAuthString() APIs to get
+ and set the current (cached) authorization string to use for
+ HTTP requests.
+ - Updated the default cupsd.conf policy to list the
+ "administrative" operations separately from the "printer
+ control" operations so that it is easier to define a
+ group of users that are "printer operators".
+ - The web interface now pulls the default cupsd.conf file
+ from cupsd.conf.default in the CUPS config directory.
+ - Added a help file for using Kerberos with CUPS.
+ - The scheduler now strips the "@KDC" portion of Kerberos
+ usernames since those usernames typically do not appear in
+ the group membership lists used by CUPS.
+ - cupsMarkOptions() could (incorrectly) leave multiple option
+ choices marked.
- Backends could (incorrectly) run as root during discovery
(STR #2454)
- Avahi is now supported for DNS-SD (Bonjour) printer sharing
diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c
index d73295a1d..37e565684 100644
--- a/cgi-bin/admin.c
+++ b/cgi-bin/admin.c
@@ -1,5 +1,5 @@
/*
- * "$Id: admin.c 6649 2007-07-11 21:46:42Z mike $"
+ * "$Id: admin.c 6733 2007-07-26 18:09:46Z mike $"
*
* Administration CGI for the Common UNIX Printing System (CUPS).
*
@@ -165,7 +165,8 @@ main(int argc, /* I - Number of command-line arguments */
do_printer_op(http, CUPS_SET_DEFAULT, cgiText(_("Set As Default")));
else if (!strcmp(op, "set-sharing"))
do_set_sharing(http);
- else if (!strcmp(op, "list-available-printers"))
+ else if (!strcmp(op, "find-new-printers") ||
+ !strcmp(op, "list-available-printers"))
do_list_printers(http);
else if (!strcmp(op, "add-class"))
do_am_class(http, 0);
@@ -366,7 +367,12 @@ do_add_rss_subscription(http_t *http) /* I - HTTP connection */
ippDelete(cupsDoRequest(http, request, "/"));
- if (cupsLastError() > IPP_OK_CONFLICT)
+ if (cupsLastError() == IPP_NOT_AUTHORIZED)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
+ else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(_("Add RSS Subscription"));
cgiShowIPPError(_("Unable to add RSS subscription:"));
@@ -627,7 +633,12 @@ do_am_class(http_t *http, /* I - HTTP connection */
ippDelete(cupsDoRequest(http, request, "/admin/"));
- if (cupsLastError() > IPP_OK_CONFLICT)
+ if (cupsLastError() == IPP_NOT_AUTHORIZED)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
+ else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(title);
cgiShowIPPError(modify ? _("Unable to modify class:") :
@@ -1179,7 +1190,12 @@ do_am_printer(http_t *http, /* I - HTTP connection */
else
ippDelete(cupsDoRequest(http, request, "/admin/"));
- if (cupsLastError() > IPP_OK_CONFLICT)
+ if (cupsLastError() == IPP_NOT_AUTHORIZED)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
+ else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(title);
cgiShowIPPError(modify ? _("Unable to modify printer:") :
@@ -1271,7 +1287,12 @@ do_cancel_subscription(http_t *http)/* I - HTTP connection */
ippDelete(cupsDoRequest(http, request, "/"));
- if (cupsLastError() > IPP_OK_CONFLICT)
+ if (cupsLastError() == IPP_NOT_AUTHORIZED)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
+ else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(_("Cancel RSS Subscription"));
cgiShowIPPError(_("Unable to cancel RSS subscription:"));
@@ -1399,6 +1420,12 @@ do_config_server(http_t *http) /* I - HTTP connection */
if (!cupsAdminSetServerSettings(http, num_settings, settings))
{
+ if (cupsLastError() == IPP_NOT_AUTHORIZED)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
+
cgiStartHTML(cgiText(_("Change Settings")));
cgiSetVariable("MESSAGE",
cgiText(_("Unable to change server settings:")));
@@ -1501,7 +1528,13 @@ do_config_server(http_t *http) /* I - HTTP connection */
status = cupsPutFile(http, "/admin/conf/cupsd.conf", tempfile);
- if (status != HTTP_CREATED)
+ if (status == HTTP_UNAUTHORIZED)
+ {
+ puts("Status: 401\n");
+ unlink(tempfile);
+ exit(0);
+ }
+ else if (status != HTTP_CREATED)
{
cgiSetVariable("MESSAGE",
cgiText(_("Unable to upload cupsd.conf file:")));
@@ -1526,7 +1559,10 @@ do_config_server(http_t *http) /* I - HTTP connection */
{
struct stat info; /* cupsd.conf information */
cups_file_t *cupsd; /* cupsd.conf file */
- char *buffer; /* Buffer for entire file */
+ char *buffer, /* Buffer for entire file */
+ *bufptr, /* Pointer into buffer */
+ *bufend; /* End of buffer */
+ int ch; /* Character from file */
char filename[1024]; /* Filename */
const char *server_root; /* Location of config files */
@@ -1606,14 +1642,55 @@ do_config_server(http_t *http) /* I - HTTP connection */
cgiSetVariable("CUPSDCONF", buffer);
free(buffer);
+ /*
+ * Then get the default cupsd.conf file and put that into a string as
+ * well...
+ */
+
+ strlcat(filename, ".default", sizeof(filename));
+
+ if (!stat(filename, &info) && info.st_size < (1024 * 1024) &&
+ (cupsd = cupsFileOpen(filename, "r")) != NULL)
+ {
+ buffer = calloc(1, 2 * info.st_size + 1);
+ bufend = buffer + 2 * info.st_size - 1;
+
+ for (bufptr = buffer;
+ bufptr < bufend && (ch = cupsFileGetChar(cupsd)) != EOF;)
+ {
+ if (ch == '\\' || ch == '\"')
+ {
+ *bufptr++ = '\\';
+ *bufptr++ = ch;
+ }
+ else if (ch == '\n')
+ {
+ *bufptr++ = '\\';
+ *bufptr++ = 'n';
+ }
+ else if (ch == '\t')
+ {
+ *bufptr++ = '\\';
+ *bufptr++ = 't';
+ }
+ else if (ch >= ' ')
+ *bufptr++ = ch;
+ }
+
+ *bufptr = '\0';
+
+ cupsFileClose(cupsd);
+
+ cgiSetVariable("CUPSDCONF_DEFAULT", buffer);
+ free(buffer);
+ }
+
/*
* Show the current config file...
*/
cgiStartHTML(cgiText(_("Edit Configuration File")));
- printf("\n", filename);
-
cgiCopyTemplateLang("edit-config.tmpl");
cgiEndHTML();
@@ -1681,7 +1758,12 @@ do_delete_class(http_t *http) /* I - HTTP connection */
* Show the results...
*/
- if (cupsLastError() <= IPP_OK_CONFLICT)
+ if (cupsLastError() == IPP_NOT_AUTHORIZED)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
+ else if (cupsLastError() <= IPP_OK_CONFLICT)
{
/*
* Redirect successful updates back to the classes page...
@@ -1761,7 +1843,12 @@ do_delete_printer(http_t *http) /* I - HTTP connection */
* Show the results...
*/
- if (cupsLastError() <= IPP_OK_CONFLICT)
+ if (cupsLastError() == IPP_NOT_AUTHORIZED)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
+ else if (cupsLastError() <= IPP_OK_CONFLICT)
{
/*
* Redirect successful updates back to the printers page...
@@ -2325,7 +2412,12 @@ do_printer_op(http_t *http, /* I - HTTP connection */
ippDelete(cupsDoRequest(http, request, "/admin/"));
- if (cupsLastError() > IPP_OK_CONFLICT)
+ if (cupsLastError() == IPP_NOT_AUTHORIZED)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
+ else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(title);
cgiShowIPPError(_("Unable to change printer:"));
@@ -2446,7 +2538,12 @@ do_set_allowed_users(http_t *http) /* I - HTTP connection */
cgiStartHTML(cgiText(_("Set Allowed Users")));
- if (cupsLastError() > IPP_OK_CONFLICT)
+ if (cupsLastError() == IPP_NOT_AUTHORIZED)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
+ else if (cupsLastError() > IPP_OK_CONFLICT)
cgiShowIPPError(_("Unable to get printer attributes:"));
else
cgiCopyTemplateLang("users.tmpl");
@@ -2583,7 +2680,12 @@ do_set_allowed_users(http_t *http) /* I - HTTP connection */
ippDelete(cupsDoRequest(http, request, "/admin/"));
- if (cupsLastError() > IPP_OK_CONFLICT)
+ if (cupsLastError() == IPP_NOT_AUTHORIZED)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
+ else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(cgiText(_("Set Allowed Users")));
cgiShowIPPError(_("Unable to change printer:"));
@@ -3127,7 +3229,12 @@ do_set_options(http_t *http, /* I - HTTP connection */
else
ippDelete(cupsDoRequest(http, request, "/admin/"));
- if (cupsLastError() > IPP_OK_CONFLICT)
+ if (cupsLastError() == IPP_NOT_AUTHORIZED)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
+ else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(title);
cgiShowIPPError(_("Unable to set options:"));
@@ -3221,7 +3328,12 @@ do_set_sharing(http_t *http) /* I - HTTP connection */
ippDelete(response);
}
- if (cupsLastError() > IPP_OK_CONFLICT)
+ if (cupsLastError() == IPP_NOT_AUTHORIZED)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
+ else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(cgiText(_("Set Publishing")));
cgiShowIPPError(_("Unable to change printer-is-shared attribute:"));
@@ -3300,5 +3412,5 @@ match_string(const char *a, /* I - First string */
/*
- * End of "$Id: admin.c 6649 2007-07-11 21:46:42Z mike $".
+ * End of "$Id: admin.c 6733 2007-07-26 18:09:46Z mike $".
*/
diff --git a/cgi-bin/template.c b/cgi-bin/template.c
index 9677e44fe..908db4b48 100644
--- a/cgi-bin/template.c
+++ b/cgi-bin/template.c
@@ -1,5 +1,5 @@
/*
- * "$Id: template.c 6649 2007-07-11 21:46:42Z mike $"
+ * "$Id: template.c 6717 2007-07-24 23:47:12Z mike $"
*
* CGI template function.
*
@@ -50,7 +50,7 @@ cgiCopyTemplateFile(FILE *out, /* I - Output file */
FILE *in; /* Input file */
- fprintf(stderr, "DEBUG: cgiCopyTemplateFile(out=%p, tmpl=\"%s\")\n", out,
+ fprintf(stderr, "DEBUG2: cgiCopyTemplateFile(out=%p, tmpl=\"%s\")\n", out,
tmpl ? tmpl : "(null)");
/*
@@ -93,7 +93,7 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
FILE *in; /* Input file */
- fprintf(stderr, "DEBUG: cgiCopyTemplateLang(tmpl=\"%s\")\n",
+ fprintf(stderr, "DEBUG2: cgiCopyTemplateLang(tmpl=\"%s\")\n",
tmpl ? tmpl : "(null)");
/*
@@ -115,7 +115,7 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
else
locale[0] = '\0';
- fprintf(stderr, "DEBUG: locale=\"%s\"...\n", locale);
+ fprintf(stderr, "DEBUG2: locale=\"%s\"...\n", locale);
/*
* See if we have a template file for this language...
@@ -133,7 +133,7 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
snprintf(filename, sizeof(filename), "%s/%s", directory, tmpl);
}
- fprintf(stderr, "DEBUG: Template file is \"%s\"...\n", filename);
+ fprintf(stderr, "DEBUG2: Template file is \"%s\"...\n", filename);
/*
* Open the template file...
@@ -231,7 +231,7 @@ cgi_copy(FILE *out, /* I - Output file */
int uriencode; /* Encode as URI */
- fprintf(stderr, "DEBUG: %*sStarting at file position %ld...\n", indent, "",
+ fprintf(stderr, "DEBUG2: %*sStarting at file position %ld...\n", indent, "",
ftell(in));
/*
@@ -263,7 +263,7 @@ cgi_copy(FILE *out, /* I - Output file */
if (s == name && isspace(ch & 255))
{
- fprintf(stderr, "DEBUG: %*sLone { at %ld...\n", indent, "", ftell(in));
+ fprintf(stderr, "DEBUG2: %*sLone { at %ld...\n", indent, "", ftell(in));
if (out)
{
@@ -275,7 +275,7 @@ cgi_copy(FILE *out, /* I - Output file */
}
if (ch == '}')
- fprintf(stderr, "DEBUG: %*s\"{%s}\" at %ld...\n", indent, "", name,
+ fprintf(stderr, "DEBUG2: %*s\"{%s}\" at %ld...\n", indent, "", name,
ftell(in));
/*
@@ -339,7 +339,7 @@ cgi_copy(FILE *out, /* I - Output file */
pos = ftell(in);
- fprintf(stderr, "DEBUG: %*sLooping on \"%s\" at %ld, count=%d...\n",
+ fprintf(stderr, "DEBUG2: %*sLooping on \"%s\" at %ld, count=%d...\n",
indent, "", name + 1, pos, count);
if (count > 0)
@@ -355,7 +355,7 @@ cgi_copy(FILE *out, /* I - Output file */
else
cgi_copy(NULL, in, 0, '}', indent + 2);
- fprintf(stderr, "DEBUG: %*sFinished looping on \"%s\"...\n", indent,
+ fprintf(stderr, "DEBUG2: %*sFinished looping on \"%s\"...\n", indent,
"", name + 1);
continue;
@@ -400,6 +400,8 @@ cgi_copy(FILE *out, /* I - Output file */
{
if (uriencode)
cgi_puturi(outptr, out);
+ else if (!strcasecmp(name, "?cupsdconf_default"))
+ fputs(outptr, stdout);
else
cgi_puts(outptr, out);
}
@@ -491,7 +493,7 @@ cgi_copy(FILE *out, /* I - Output file */
if (ch != '?')
{
fprintf(stderr,
- "DEBUG: %*sBad terminator '%c' at file position %ld...\n",
+ "DEBUG2: %*sBad terminator '%c' at file position %ld...\n",
indent, "", ch, ftell(in));
return;
}
@@ -521,7 +523,7 @@ cgi_copy(FILE *out, /* I - Output file */
}
fprintf(stderr,
- "DEBUG: %*sStarting \"{%s%c%s\" at %ld, result=%d...\n",
+ "DEBUG2: %*sStarting \"{%s%c%s\" at %ld, result=%d...\n",
indent, "", name, op, compare, ftell(in), result);
if (result)
@@ -530,10 +532,10 @@ cgi_copy(FILE *out, /* I - Output file */
* Comparison true; output first part and ignore second...
*/
- fprintf(stderr, "DEBUG: %*sOutput first part...\n", indent, "");
+ fprintf(stderr, "DEBUG2: %*sOutput first part...\n", indent, "");
cgi_copy(out, in, element, ':', indent + 2);
- fprintf(stderr, "DEBUG: %*sSkip second part...\n", indent, "");
+ fprintf(stderr, "DEBUG2: %*sSkip second part...\n", indent, "");
cgi_copy(NULL, in, element, '}', indent + 2);
}
else
@@ -542,14 +544,14 @@ cgi_copy(FILE *out, /* I - Output file */
* Comparison false; ignore first part and output second...
*/
- fprintf(stderr, "DEBUG: %*sSkip first part...\n", indent, "");
+ fprintf(stderr, "DEBUG2: %*sSkip first part...\n", indent, "");
cgi_copy(NULL, in, element, ':', indent + 2);
- fprintf(stderr, "DEBUG: %*sOutput second part...\n", indent, "");
+ fprintf(stderr, "DEBUG2: %*sOutput second part...\n", indent, "");
cgi_copy(out, in, element, '}', indent + 2);
}
- fprintf(stderr, "DEBUG: %*sFinished \"{%s%c%s\", out=%p...\n", indent, "",
+ fprintf(stderr, "DEBUG2: %*sFinished \"{%s%c%s\", out=%p...\n", indent, "",
name, op, compare, out);
}
else if (ch == '\\') /* Quoted char */
@@ -563,11 +565,11 @@ cgi_copy(FILE *out, /* I - Output file */
putc(ch, out);
if (ch == EOF)
- fprintf(stderr, "DEBUG: %*sReturning at file position %ld on EOF...\n",
+ fprintf(stderr, "DEBUG2: %*sReturning at file position %ld on EOF...\n",
indent, "", ftell(in));
else
fprintf(stderr,
- "DEBUG: %*sReturning at file position %ld on character '%c'...\n",
+ "DEBUG2: %*sReturning at file position %ld on character '%c'...\n",
indent, "", ftell(in), ch);
if (ch == EOF && term)
@@ -661,5 +663,5 @@ cgi_puturi(const char *s, /* I - String to output */
/*
- * End of "$Id: template.c 6649 2007-07-11 21:46:42Z mike $".
+ * End of "$Id: template.c 6717 2007-07-24 23:47:12Z mike $".
*/
diff --git a/conf/cupsd.conf.in b/conf/cupsd.conf.in
index c2cda0675..1660ed44e 100644
--- a/conf/cupsd.conf.in
+++ b/conf/cupsd.conf.in
@@ -1,5 +1,5 @@
#
-# "$Id: cupsd.conf.in 6690 2007-07-18 23:58:37Z mike $"
+# "$Id: cupsd.conf.in 6720 2007-07-25 00:40:03Z mike $"
#
# Sample configuration file for the Common UNIX Printing System (CUPS)
# scheduler. See "man cupsd.conf" for a complete description of this
@@ -56,15 +56,22 @@ DefaultAuthType Basic
# All administration operations require an administrator to authenticate...
-
+
AuthType Default
Require user @SYSTEM
Order deny,allow
+ # All printer operations require a printer operator to authenticate...
+
+ AuthType Default
+ Require user @CUPS_DEFAULT_PRINTADMIN_AUTH@
+ Order deny,allow
+
+
# Only the owner or an administrator can cancel or authenticate a job...
- Require user @OWNER @SYSTEM
+ Require user @OWNER @CUPS_DEFAULT_PRINTADMIN_AUTH@
Order deny,allow
@@ -74,5 +81,5 @@ DefaultAuthType Basic
#
-# End of "$Id: cupsd.conf.in 6690 2007-07-18 23:58:37Z mike $".
+# End of "$Id: cupsd.conf.in 6720 2007-07-25 00:40:03Z mike $".
#
diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4
index 7e344e41e..ad42ccef6 100644
--- a/config-scripts/cups-common.m4
+++ b/config-scripts/cups-common.m4
@@ -1,5 +1,5 @@
dnl
-dnl "$Id: cups-common.m4 6689 2007-07-18 23:52:15Z mike $"
+dnl "$Id: cups-common.m4 6720 2007-07-25 00:40:03Z 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 Versio number information...
-CUPS_VERSION="1.3b1"
+CUPS_VERSION="1.3rc1"
CUPS_REVISION=""
#if test -z "$CUPS_REVISION" -a -d .svn; then
# CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`"
@@ -186,6 +186,7 @@ dnl Extra platform-specific libraries...
BACKLIBS=""
CUPSDLIBS=""
DBUSDIR=""
+CUPS_DEFAULT_PRINTADMIN_AUTH="@SYSTEM"
CUPS_SYSTEM_AUTHKEY=""
AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto])
@@ -232,7 +233,8 @@ case $uname in
dnl Check for Authorization Services support
AC_CHECK_HEADER(Security/Authorization.h, [
AC_DEFINE(HAVE_AUTHORIZATION_H)
- CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"])
+ CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
+ CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"])
AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
;;
@@ -260,6 +262,8 @@ case $uname in
;;
esac
+AC_SUBST(CUPS_DEFAULT_PRINTADMIN_AUTH)
+AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTADMIN_AUTH, "$CUPS_DEFAULT_PRINTADMIN_AUTH")
AC_SUBST(CUPS_SYSTEM_AUTHKEY)
dnl See if we have POSIX ACL support...
@@ -282,5 +286,5 @@ AC_SUBST(DEFAULT_IPP_PORT)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
dnl
-dnl End of "$Id: cups-common.m4 6689 2007-07-18 23:52:15Z mike $".
+dnl End of "$Id: cups-common.m4 6720 2007-07-25 00:40:03Z mike $".
dnl
diff --git a/config-scripts/cups-compiler.m4 b/config-scripts/cups-compiler.m4
index 93302113f..c89a2a613 100644
--- a/config-scripts/cups-compiler.m4
+++ b/config-scripts/cups-compiler.m4
@@ -1,5 +1,5 @@
dnl
-dnl "$Id: cups-compiler.m4 6687 2007-07-18 19:49:45Z mike $"
+dnl "$Id: cups-compiler.m4 6698 2007-07-20 14:15:44Z mike $"
dnl
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -72,14 +72,19 @@ AC_SUBST(PIEFLAGS)
RELROFLAGS=""
AC_SUBST(RELROFLAGS)
+LIBCUPSORDER="libcups.order"
AC_ARG_WITH(libcupsorder, [ --with-libcupsorder libcups secorder file, default=libcups.order],
- LIBCUPSORDER="$withval",
- LIBCUPSORDER="libcups.order")
+ if test -f "$withval"; then
+ LIBCUPSORDER="$withval"
+ fi)
AC_SUBST(LIBCUPSORDER)
-AC_ARG_WITH(libcupsimageorder, [ --with-libcupimagesorder libcupsimage secorder file, default=libcups.order],
- LIBCUPSIMAGEORDER="$withval",
- LIBCUPSIMAGEORDER="libcupsimage.order")
+LIBCUPSIMAGEORDER="libcupsimage.order"
+AC_ARG_WITH(libcupsimageorder, [ --with-libcupsimagesorder
+ libcupsimage secorder file, default=libcupsimage.order],
+ if test -f "$withval"; then
+ LIBCUPSIMAGEORDER="$withval"
+ fi)
AC_SUBST(LIBCUPSIMAGEORDER)
if test -n "$GCC"; then
@@ -459,5 +464,5 @@ case $uname in
esac
dnl
-dnl End of "$Id: cups-compiler.m4 6687 2007-07-18 19:49:45Z mike $".
+dnl End of "$Id: cups-compiler.m4 6698 2007-07-20 14:15:44Z mike $".
dnl
diff --git a/config-scripts/cups-defaults.m4 b/config-scripts/cups-defaults.m4
index 6b6d46436..b0dcf268a 100644
--- a/config-scripts/cups-defaults.m4
+++ b/config-scripts/cups-defaults.m4
@@ -1,5 +1,5 @@
dnl
-dnl "$Id: cups-defaults.m4 6656 2007-07-12 23:56:23Z mike $"
+dnl "$Id: cups-defaults.m4 6720 2007-07-25 00:40:03Z mike $"
dnl
dnl Default cupsd configuration settings for the Common UNIX Printing System
dnl (CUPS).
@@ -159,7 +159,13 @@ dnl Determine the correct username and group for this OS...
AC_ARG_WITH(cups_user, [ --with-cups-user set default user for CUPS],
CUPS_USER="$withval",
AC_MSG_CHECKING(for default print user)
- if test -f /etc/passwd; then
+ if test x$uname = xDarwin; then
+ if x`id -u _lp 2>/dev/null` = x; then
+ CUPS_USER="lp";
+ else
+ CUPS_USER="_lp";
+ fi
+ elif test -f /etc/passwd; then
CUPS_USER=""
for user in lp lpd guest daemon nobody; do
if test "`grep \^${user}: /etc/passwd`" != ""; then
@@ -181,8 +187,14 @@ AC_ARG_WITH(cups_user, [ --with-cups-user set default user for CUPS],
AC_ARG_WITH(cups_group, [ --with-cups-group set default group for CUPS],
CUPS_GROUP="$withval",
AC_MSG_CHECKING(for default print group)
- if test -f /etc/group; then
- GROUP_LIST="lp nobody"
+ if test x$uname = xDarwin; then
+ if x`id -g _lp 2>/dev/null` = x; then
+ CUPS_GROUP="lp";
+ else
+ CUPS_GROUP="_lp";
+ fi
+ elif test -f /etc/group; then
+ GROUP_LIST="_lp lp nobody"
CUPS_GROUP=""
for group in $GROUP_LIST; do
if test "`grep \^${group}: /etc/group`" != ""; then
@@ -204,7 +216,7 @@ AC_ARG_WITH(cups_group, [ --with-cups-group set default group for CUPS],
AC_ARG_WITH(system_groups, [ --with-system-groups set default system groups for CUPS],
CUPS_SYSTEM_GROUPS="$withval",
if test x$uname = xDarwin; then
- CUPS_SYSTEM_GROUPS="lpadmin admin"
+ CUPS_SYSTEM_GROUPS="admin"
else
AC_MSG_CHECKING(for default system groups)
if test -f /etc/group; then
@@ -324,5 +336,5 @@ AC_SUBST(CUPS_SNMP_ADDRESS)
AC_SUBST(CUPS_SNMP_COMMUNITY)
dnl
-dnl End of "$Id: cups-defaults.m4 6656 2007-07-12 23:56:23Z mike $".
+dnl End of "$Id: cups-defaults.m4 6720 2007-07-25 00:40:03Z mike $".
dnl
diff --git a/config.h.in b/config.h.in
index 8f7347a74..cdc5853be 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,5 +1,5 @@
/*
- * "$Id: config.h.in 6689 2007-07-18 23:52:15Z mike $"
+ * "$Id: config.h.in 6720 2007-07-25 00:40:03Z mike $"
*
* Configuration file for the Common UNIX Printing System (CUPS).
*
@@ -31,6 +31,7 @@
#define CUPS_DEFAULT_USER "lp"
#define CUPS_DEFAULT_GROUP "sys"
#define CUPS_DEFAULT_SYSTEM_GROUPS "sys root system"
+#define CUPS_DEFAULT_PRINTADMIN_AUTH "@SYSTEM"
/*
@@ -539,5 +540,5 @@
#endif /* !_CUPS_CONFIG_H_ */
/*
- * End of "$Id: config.h.in 6689 2007-07-18 23:52:15Z mike $".
+ * End of "$Id: config.h.in 6720 2007-07-25 00:40:03Z mike $".
*/
diff --git a/configure.in b/configure.in
index c52453f83..ec142509d 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
dnl
-dnl "$Id: configure.in 6649 2007-07-11 21:46:42Z mike $"
+dnl "$Id: configure.in 6717 2007-07-24 23:47:12Z mike $"
dnl
dnl Configuration script for the Common UNIX Printing System (CUPS).
dnl
@@ -53,10 +53,6 @@ if test "x$LANGUAGES" != x; then
LANGFILES="$LANGFILES doc/$lang/index.html"
fi
- if test -f templates/$lang/edit-config.tmpl.in; then
- LANGFILES="$LANGFILES templates/$lang/edit-config.tmpl"
- fi
-
if test -f templates/$lang/header.tmpl.in; then
LANGFILES="$LANGFILES templates/$lang/header.tmpl"
fi
@@ -69,14 +65,15 @@ AC_SUBST(UNINSTALL_LANGUAGES)
AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config
conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
doc/index.html doc/help/ref-cupsd-conf.html doc/help/standard.html
+ init/org.cups.cups-lpd.plist
man/client.conf.man man/cups-deviced.man man/cups-driverd.man
man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man
man/cupsd.conf.man man/lpoptions.man
- templates/edit-config.tmpl templates/header.tmpl
+ templates/header.tmpl
$LANGFILES)
chmod +x cups-config
dnl
-dnl End of "$Id: configure.in 6649 2007-07-11 21:46:42Z mike $".
+dnl End of "$Id: configure.in 6717 2007-07-24 23:47:12Z mike $".
dnl
diff --git a/cups/adminutil.c b/cups/adminutil.c
index 20a97af30..dce551e3d 100644
--- a/cups/adminutil.c
+++ b/cups/adminutil.c
@@ -1,5 +1,5 @@
/*
- * "$Id: adminutil.c 6649 2007-07-11 21:46:42Z mike $"
+ * "$Id: adminutil.c 6729 2007-07-26 00:30:52Z mike $"
*
* Administration utility API definitions for the Common UNIX Printing
* System (CUPS).
@@ -583,6 +583,10 @@ cupsAdminExportSamba(
}
}
+ /*
+ * See if we have the Win9x PS driver...
+ */
+
snprintf(file, sizeof(file), "%s/drivers/ADOBEPS4.DRV", cg->cups_datadir);
if (!access(file, 0))
{
@@ -653,6 +657,136 @@ cupsAdminExportSamba(
}
}
+ /*
+ * See if we have the 64-bit Windows PS driver...
+ *
+ * Files:
+ *
+ * x64/ps5ui.dll
+ * x64/pscript.hlp
+ * x64/pscript.ntf
+ * x64/pscript5.dll
+ */
+
+ snprintf(file, sizeof(file), "%s/drivers/x64/pscript5.dll", cg->cups_datadir);
+ if (!access(file, 0))
+ {
+ have_drivers |= 4;
+
+ /*
+ * 64-bit Windows driver is installed; do the smbclient commands needed
+ * to copy the Win64 drivers over...
+ */
+
+ snprintf(address, sizeof(address), "//%s/print$", samba_server);
+
+ snprintf(subcmd, sizeof(subcmd),
+ "mkdir x64;"
+ "put %s x64/%s.ppd;"
+ "put %s/drivers/x64/ps5ui.dll x64/ps5ui.dll;"
+ "put %s/drivers/x64/pscript.hlp x64/pscript.hlp;"
+ "put %s/drivers/x64/pscript.ntf x64/pscript.ntf;"
+ "put %s/drivers/x64/pscript5.dll x64/pscript5.dll",
+ ppd, dest, cg->cups_datadir, cg->cups_datadir,
+ cg->cups_datadir, cg->cups_datadir);
+
+ if ((status = do_samba_command("smbclient", address, subcmd,
+ authfile, logfile)) != 0)
+ {
+ snprintf(message, sizeof(message),
+ _cupsLangString(language,
+ _("Unable to copy 64-bit Windows printer "
+ "driver files (%d)!")), status);
+
+ _cupsSetError(IPP_INTERNAL_ERROR, message);
+
+ if (logfile)
+ _cupsLangPrintf(logfile, "%s\n", message);
+
+ unlink(authfile);
+
+ return (0);
+ }
+
+ /*
+ * See if we also have the CUPS driver files; if so, use them!
+ */
+
+ snprintf(file, sizeof(file), "%s/drivers/x64/cupsps6.dll", cg->cups_datadir);
+ if (!access(file, 0))
+ {
+ /*
+ * Copy the CUPS driver files over...
+ */
+
+ snprintf(subcmd, sizeof(subcmd),
+ "put %s/drivers/x64/cups6.ini x64/cups6.ini;"
+ "put %s/drivers/x64/cupsps6.dll x64/cupsps6.dll;"
+ "put %s/drivers/x64/cupsui6.dll x64/cupsui6.dll",
+ cg->cups_datadir, cg->cups_datadir, cg->cups_datadir);
+
+ if ((status = do_samba_command("smbclient", address, subcmd,
+ authfile, logfile)) != 0)
+ {
+ snprintf(message, sizeof(message),
+ _cupsLangString(language,
+ _("Unable to copy 64-bit CUPS printer driver "
+ "files (%d)!")), status);
+
+ _cupsSetError(IPP_INTERNAL_ERROR, message);
+
+ if (logfile)
+ _cupsLangPrintf(logfile, "%s\n", message);
+
+ unlink(authfile);
+
+ return (0);
+ }
+
+ /*
+ * Do the rpcclient command needed for the CUPS drivers...
+ */
+
+ snprintf(subcmd, sizeof(subcmd),
+ "adddriver \"Windows x64\" \"%s:"
+ "pscript5.dll:%s.ppd:ps5ui.dll:pscript.hlp:NULL:RAW:"
+ "pscript5.dll,%s.ppd,ps5ui.dll,pscript.hlp,pscript.ntf,"
+ "cups6.ini,cupsps6.dll,cupsui6.dll\"",
+ dest, dest, dest);
+ }
+ else
+ {
+ /*
+ * Don't have the CUPS drivers, so just use the standard Windows
+ * drivers...
+ */
+
+ snprintf(subcmd, sizeof(subcmd),
+ "adddriver \"Windows x64\" \"%s:"
+ "pscript5.dll:%s.ppd:ps5ui.dll:pscript.hlp:NULL:RAW:"
+ "pscript5.dll,%s.ppd,ps5ui.dll,pscript.hlp,pscript.ntf\"",
+ dest, dest, dest);
+ }
+
+ if ((status = do_samba_command("rpcclient", samba_server, subcmd,
+ authfile, logfile)) != 0)
+ {
+ snprintf(message, sizeof(message),
+ _cupsLangString(language,
+ _("Unable to install Windows 2000 printer "
+ "driver files (%d)!")), status);
+
+ _cupsSetError(IPP_INTERNAL_ERROR, message);
+
+ if (logfile)
+ _cupsLangPrintf(logfile, "%s\n", message);
+
+ unlink(authfile);
+
+ return (0);
+ }
+ }
+
if (logfile && !(have_drivers & 1))
{
if (!have_drivers)
@@ -1403,8 +1537,8 @@ _cupsAdminSetServerSettings(
"cancel a job...\n"
" \n"
" Order deny,allow\n"
- " Allow @SYSTEM\n"
- " Allow @OWNER\n"
+ " Require user @OWNER "
+ CUPS_DEFAULT_PRINTADMIN_AUTH "\n"
" \n");
}
@@ -1556,7 +1690,8 @@ _cupsAdminSetServerSettings(
"a job...\n"
" \n"
" Order deny,allow\n"
- " Require user @OWNER @SYSTEM\n"
+ " Require user @OWNER "
+ CUPS_DEFAULT_PRINTADMIN_AUTH "\n"
" \n");
in_cancel_job = 0;
@@ -1754,7 +1889,7 @@ _cupsAdminSetServerSettings(
{
cupsFilePuts(temp, "\n"
" # Job-related operations must be done by the owner "
- "or an adminstrator...\n"
+ "or an administrator...\n"
" \n"
" # All administration operations require an "
- "adminstrator to authenticate...\n"
+ "administrator to authenticate...\n"
" \n"
- " Require user @OWNER @SYSTEM\n"
" Order deny,allow\n"
+ " Require user @OWNER "
+ CUPS_DEFAULT_PRINTADMIN_AUTH "\n"
" \n");
cupsFilePuts(temp, " \n"
@@ -2210,5 +2346,5 @@ write_option(cups_file_t *dstfp, /* I - PPD file */
/*
- * End of "$Id: adminutil.c 6649 2007-07-11 21:46:42Z mike $".
+ * End of "$Id: adminutil.c 6729 2007-07-26 00:30:52Z mike $".
*/
diff --git a/cups/auth.c b/cups/auth.c
index 0c7692cc0..1f9072c5b 100644
--- a/cups/auth.c
+++ b/cups/auth.c
@@ -1,5 +1,5 @@
/*
- * "$Id: auth.c 6673 2007-07-14 00:16:39Z mike $"
+ * "$Id: auth.c 6722 2007-07-25 17:19:09Z mike $"
*
* Authentication functions for the Common UNIX Printing System (CUPS).
*
@@ -65,6 +65,8 @@ extern const char *cssmErrorString(int error);
# ifdef DEBUG
static void DEBUG_gss_printf(OM_uint32 major_status, OM_uint32 minor_status,
const char *message);
+# else
+# define DEBUG_gss_printf(major, minor, message)
# endif /* DEBUG */
static gss_name_t cups_get_gss_creds(http_t *http, const char *service_name);
#endif /* HAVE_GSSAPI */
@@ -106,12 +108,7 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
* Clear the current authentication string...
*/
- http->_authstring[0] = '\0';
-
- if (http->authstring && http->authstring != http->_authstring)
- free(http->authstring);
-
- http->authstring = http->_authstring;
+ httpSetAuthString(http, NULL, NULL);
/*
* See if we can do local authentication...
@@ -176,13 +173,6 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
if (!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9))
{
- if (http->status == HTTP_UNAUTHORIZED && http->digest_tries >= 3)
- {
- DEBUG_printf(("cupsDoAuthentication: too many Negotiate tries (%d)\n",
- http->digest_tries));
-
- return (-1);
- }
#ifdef HAVE_GSSAPI
/*
* Kerberos authentication...
@@ -196,8 +186,10 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
/* Input token */
char *gss_service_name;
/* GSS service name */
+# ifdef USE_SPNEGO
const char *authorization;
/* Pointer into Authorization string */
+# endif /* USE_SPNEGO */
# ifdef __APPLE__
@@ -214,6 +206,14 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
}
# endif /* __APPLE__ */
+ if (http->status == HTTP_UNAUTHORIZED && http->digest_tries >= 3)
+ {
+ DEBUG_printf(("cupsDoAuthentication: too many Negotiate tries (%d)\n",
+ http->digest_tries));
+
+ return (-1);
+ }
+
if (http->gssname == GSS_C_NO_NAME)
{
if ((gss_service_name = getenv("CUPS_GSSSERVICENAME")) == NULL)
@@ -224,6 +224,7 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
http->gssname = cups_get_gss_creds(http, gss_service_name);
}
+# ifdef USE_SPNEGO /* We don't implement SPNEGO just yet... */
/*
* Find the start of the Kerberos input token...
*/
@@ -237,10 +238,36 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
if (*authorization)
{
/*
- * For SPNEGO, this is where we'll feed the server's authorization data
- * back into gss via input_token...
+ * Decode the authorization string to get the input token...
*/
+
+ int len = strlen(authorization);
+
+ input_token.value = malloc(len);
+ input_token.value = httpDecode64_2(input_token.value, &len,
+ authorization);
+ input_token.length = len;
+
+# ifdef DEBUG
+ {
+ char *ptr = (char *)input_token.value;
+ int left = len;
+
+ fputs("input_token=", stdout);
+ while (left > 0)
+ {
+ if (*ptr < ' ')
+ printf("\\%03o", *ptr & 255);
+ else
+ putchar(*ptr);
+ ptr ++;
+ left --;
+ }
+ putchar('\n');
+ }
+# endif /* DEBUG */
}
+# endif /* USE_SPNEGO */
if (http->gssctx != GSS_C_NO_CONTEXT)
{
@@ -252,7 +279,8 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
major_status = gss_init_sec_context(&minor_status, GSS_C_NO_CREDENTIAL,
&http->gssctx,
http->gssname, http->gssmech,
- GSS_C_DELEG_FLAG | GSS_C_MUTUAL_FLAG,
+ GSS_C_DELEG_FLAG | GSS_C_MUTUAL_FLAG |
+ GSS_C_INTEG_FLAG,
GSS_C_INDEFINITE,
GSS_C_NO_CHANNEL_BINDINGS,
&input_token, &http->gssmech,
@@ -270,27 +298,17 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
return (-1);
}
-# ifdef DEBUG
if (major_status == GSS_S_CONTINUE_NEEDED)
DEBUG_gss_printf(major_status, minor_status, "Continuation needed!");
-# endif /* DEBUG */
if (output_token.length)
{
httpEncode64_2(encode, sizeof(encode), output_token.value,
output_token.length);
-
- http->authstring = malloc(strlen(encode) + 11);
- sprintf(http->authstring, "Negotiate %s", encode); /* Safe because allocated */
+ httpSetAuthString(http, "Negotiate", encode);
major_status = gss_release_buffer(&minor_status, &output_token);
}
-
- /*
- * Copy back what we can to _authstring for backwards compatibility...
- */
-
- strlcpy(http->_authstring, http->authstring, sizeof(http->_authstring));
#endif /* HAVE_GSSAPI */
}
else if (strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Digest", 6))
@@ -301,7 +319,7 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
httpEncode64_2(encode, sizeof(encode), http->userpass,
(int)strlen(http->userpass));
- snprintf(http->_authstring, sizeof(http->_authstring), "Basic %s", encode);
+ httpSetAuthString(http, "Basic", encode);
}
else
{
@@ -309,15 +327,18 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
* Digest authentication...
*/
+ char digest[1024]; /* Digest auth data */
+
+
httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "realm", realm);
httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "nonce", nonce);
httpMD5(cupsUser(), realm, strchr(http->userpass, ':') + 1, encode);
httpMD5Final(nonce, method, resource, encode);
- snprintf(http->_authstring, sizeof(http->_authstring),
- "Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", "
- "uri=\"%s\", response=\"%s\"", cupsUser(), realm, nonce,
- resource, encode);
+ snprintf(digest, sizeof(digest),
+ "username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", "
+ "response=\"%s\"", cupsUser(), realm, nonce, resource, encode);
+ httpSetAuthString(http, "Digest", digest);
}
DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n", http->authstring));
@@ -523,11 +544,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
httpEncode64_2(buffer, sizeof(buffer), (void *)&auth_extrn,
sizeof(auth_extrn));
- http->authstring = malloc(strlen(buffer) + 9);
- sprintf(http->authstring, "AuthRef %s", buffer);
-
- /* Copy back to _authstring for backwards compatibility */
- strlcpy(http->_authstring, http->authstring, sizeof(http->_authstring));
+ httpSetAuthString(http, "AuthRef", buffer);
DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
http->authstring));
@@ -563,7 +580,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
* check if we need Kerberos authentication...
*/
- if (!strcmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate"))
+ if (!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9))
{
/*
* Yes, don't try the root certificate...
@@ -590,11 +607,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
* Set the authorization string and return...
*/
- http->authstring = malloc(strlen(certificate) + 7);
- sprintf(http->authstring, "Local %s", certificate);
-
- /* Copy back to _authstring for backwards compatibility */
- strlcpy(http->_authstring, http->authstring, sizeof(http->_authstring));
+ httpSetAuthString(http, "Local", certificate);
DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
http->authstring));
@@ -623,11 +636,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
if ((pwd = getpwnam(username)) != NULL && pwd->pw_uid == getuid())
{
- http->authstring = malloc(strlen(username) + 10);
- sprintf(http->authstring, "PeerCred %s", username);
-
- /* Copy back to _authstring for backwards compatibility */
- strlcpy(http->_authstring, http->authstring, sizeof(http->_authstring));
+ httpSetAuthString(http, "PeerCred", username);
DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
http->authstring));
@@ -643,5 +652,5 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
/*
- * End of "$Id: auth.c 6673 2007-07-14 00:16:39Z mike $".
+ * End of "$Id: auth.c 6722 2007-07-25 17:19:09Z mike $".
*/
diff --git a/cups/getputfile.c b/cups/getputfile.c
index 8990751ee..b39a8339b 100644
--- a/cups/getputfile.c
+++ b/cups/getputfile.c
@@ -1,5 +1,5 @@
/*
- * "$Id: getputfile.c 6649 2007-07-11 21:46:42Z mike $"
+ * "$Id: getputfile.c 6720 2007-07-25 00:40:03Z mike $"
*
* Get/put file functions for the Common UNIX Printing System (CUPS).
*
@@ -26,10 +26,9 @@
* Include necessary headers...
*/
-#include "http-private.h"
+#include "globals.h"
#include "cups.h"
#include "language.h"
-#include "string.h"
#include "debug.h"
#include
#include
@@ -167,7 +166,10 @@ cupsGetFd(http_t *http, /* I - HTTP connection to server */
write(fd, buffer, bytes);
}
else
+ {
+ _cupsSetHTTPError(status);
httpFlush(http);
+ }
/*
* Return the request status...
@@ -416,7 +418,10 @@ cupsPutFd(http_t *http, /* I - HTTP connection to server */
*/
if (status != HTTP_CREATED)
+ {
+ _cupsSetHTTPError(status);
httpFlush(http);
+ }
return (status);
}
@@ -479,5 +484,5 @@ cupsPutFile(http_t *http, /* I - HTTP connection to server */
/*
- * End of "$Id: getputfile.c 6649 2007-07-11 21:46:42Z mike $".
+ * End of "$Id: getputfile.c 6720 2007-07-25 00:40:03Z mike $".
*/
diff --git a/cups/globals.h b/cups/globals.h
index 1be579cbc..ac3dd83df 100644
--- a/cups/globals.h
+++ b/cups/globals.h
@@ -1,5 +1,5 @@
/*
- * "$Id: globals.h 6649 2007-07-11 21:46:42Z mike $"
+ * "$Id: globals.h 6712 2007-07-24 00:13:05Z mike $"
*
* Global variable definitions for the Common UNIX Printing System (CUPS).
*
@@ -127,6 +127,7 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
extern const char *_cupsGetPassword(const char *prompt);
extern _cups_globals_t *_cupsGlobals(void);
extern void _cupsSetError(ipp_status_t status, const char *message);
+extern void _cupsSetHTTPError(http_status_t status);
/*
@@ -139,5 +140,5 @@ extern void _cupsSetError(ipp_status_t status, const char *message);
#endif /* !_CUPS_GLOBALS_H_ */
/*
- * End of "$Id: globals.h 6649 2007-07-11 21:46:42Z mike $".
+ * End of "$Id: globals.h 6712 2007-07-24 00:13:05Z mike $".
*/
diff --git a/cups/http.c b/cups/http.c
index b2de909e5..9efa1a365 100644
--- a/cups/http.c
+++ b/cups/http.c
@@ -1,5 +1,5 @@
/*
- * "$Id: http.c 6649 2007-07-11 21:46:42Z mike $"
+ * "$Id: http.c 6724 2007-07-25 20:39:33Z mike $"
*
* HTTP routines for the Common UNIX Printing System (CUPS).
*
@@ -34,6 +34,7 @@
* httpFlush() - Flush data from a HTTP connection.
* httpFlushWrite() - Flush data in write buffer.
* httpGet() - Send a GET request to the server.
+ * httpGetAuthString() - Get the current authorization string.
* httpGetBlocking() - Get the blocking/non-block state of a connection.
* httpGetCookie() - Get any cookie data from the response.
* httpGetFd() - Get the file descriptor associated with a
@@ -58,6 +59,7 @@
* _httpReadCDSA() - Read function for the CDSA library.
* _httpReadGNUTLS() - Read function for the GNU TLS library.
* httpReconnect() - Reconnect to a HTTP server...
+ * httpSetAuthString() - Set the current authorization string.
* httpSetCookie() - Set the cookie value(s)...
* httpSetExpect() - Set the Expect: header in a request.
* httpSetField() - Set the value of an HTTP header.
@@ -605,6 +607,27 @@ httpGet(http_t *http, /* I - HTTP connection */
}
+/*
+ * 'httpGetAuthString()' - Get the current authorization string.
+ *
+ * The authorization string is set by cupsDoAuthentication() and
+ * httpSetAuthString(). Use httpGetAuthString() to retrieve the
+ * string to use with httpSetField() for the HTTP_FIELD_AUTHORIZATION
+ * value.
+ *
+ * @since CUPS 1.3@
+ */
+
+char * /* O - Authorization string */
+httpGetAuthString(http_t *http) /* I - HTTP connection */
+{
+ if (http)
+ return (http->authstring);
+ else
+ return (NULL);
+}
+
+
/*
* 'httpGetBlocking()' - Get the blocking/non-block state of a connection.
*
@@ -1677,6 +1700,61 @@ httpReconnect(http_t *http) /* I - HTTP connection */
}
+/*
+ * 'httpSetAuthString()' - Set the current authorization string.
+ *
+ * This function just stores a copy of the current authorization string in
+ * the HTTP connection object. You must still call httpSetField() to set
+ * HTTP_FIELD_AUTHORIZATION prior to issuing a HTTP request using httpGet(),
+ * httpHead(), httpOptions(), httpPost, or httpPut().
+ *
+ * @since CUPS 1.3@
+ */
+
+void
+httpSetAuthString(http_t *http, /* I - HTTP connection */
+ const char *scheme, /* I - Auth scheme (NULL to clear it) */
+ const char *data) /* I - Auth data (NULL for none) */
+{
+ /*
+ * Range check input...
+ */
+
+ if (!http)
+ return;
+
+ if (http->authstring && http->authstring != http->_authstring)
+ free(http->authstring);
+
+ http->authstring = http->_authstring;
+
+ if (scheme)
+ {
+ /*
+ * Set the current authorization string...
+ */
+
+ int len = (int)strlen(scheme) + (data ? (int)strlen(data) + 1 : 0) + 1;
+
+ if (len > (int)sizeof(http->_authstring))
+ http->authstring = malloc(len);
+
+ if (data)
+ snprintf(http->authstring, len, "%s %s", scheme, data);
+ else
+ strlcpy(http->authstring, scheme, len);
+ }
+ else
+ {
+ /*
+ * Clear the current authorization string...
+ */
+
+ http->_authstring[0] = '\0';
+ }
+}
+
+
/*
* 'httpSetCookie()' - Set the cookie value(s)...
*
@@ -3155,5 +3233,5 @@ http_write_ssl(http_t *http, /* I - HTTP connection */
/*
- * End of "$Id: http.c 6649 2007-07-11 21:46:42Z mike $".
+ * End of "$Id: http.c 6724 2007-07-25 20:39:33Z mike $".
*/
diff --git a/cups/http.h b/cups/http.h
index 72c243ec6..2e765c40e 100644
--- a/cups/http.h
+++ b/cups/http.h
@@ -1,5 +1,5 @@
/*
- * "$Id: http.h 6649 2007-07-11 21:46:42Z mike $"
+ * "$Id: http.h 6722 2007-07-25 17:19:09Z mike $"
*
* Hyper-Text Transport Protocol definitions for the Common UNIX Printing
* System (CUPS).
@@ -442,6 +442,10 @@ extern void httpSetLength(http_t *http, size_t length);
extern ssize_t httpWrite2(http_t *http, const char *buffer,
size_t length);
+/**** New in CUPS 1.3 ****/
+extern char *httpGetAuthString(http_t *http);
+extern void httpSetAuthString(http_t *http, const char *scheme,
+ const char *data);
/*
* C++ magic...
@@ -453,5 +457,5 @@ extern ssize_t httpWrite2(http_t *http, const char *buffer,
#endif /* !_CUPS_HTTP_H_ */
/*
- * End of "$Id: http.h 6649 2007-07-11 21:46:42Z mike $".
+ * End of "$Id: http.h 6722 2007-07-25 17:19:09Z mike $".
*/
diff --git a/cups/libcups.exp b/cups/libcups.exp
index 14f9b916b..6d3e6e0c8 100644
--- a/cups/libcups.exp
+++ b/cups/libcups.exp
@@ -183,6 +183,7 @@ _httpError
_httpFlush
_httpFlushWrite
_httpGet
+_httpGetAuthString
_httpGetBlocking
_httpGetCookie
_httpGetDateString
@@ -213,6 +214,7 @@ _httpReconnect
_httpSeparate
_httpSeparate2
_httpSeparateURI
+_httpSetAuthString
_httpSetCookie
_httpSetExpect
_httpSetField
diff --git a/cups/mark.c b/cups/mark.c
index 92d2faee2..83298a226 100644
--- a/cups/mark.c
+++ b/cups/mark.c
@@ -1,5 +1,5 @@
/*
- * "$Id: mark.c 6649 2007-07-11 21:46:42Z mike $"
+ * "$Id: mark.c 6703 2007-07-20 21:28:10Z mike $"
*
* Option marking routines for the Common UNIX Printing System (CUPS).
*
@@ -73,6 +73,8 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
for (o1 = ppdFirstOption(ppd); o1; o1 = ppdNextOption(ppd))
o1->conflicted = 0;
+ cupsArraySave(ppd->marked);
+
/*
* Loop through all of the UI constraints and flag any options
* that conflict...
@@ -173,6 +175,8 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
}
}
+ cupsArrayRestore(ppd->marked);
+
/*
* Return the number of conflicts found...
*/
@@ -617,8 +621,7 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
else if (!strcasecmp(option, "InputSlot"))
{
/*
- * Unmark ManualFeed True and possibly mark ManualFeed False
- * option...
+ * Unmark ManualFeed option...
*/
if ((o = ppdFindOption(ppd, "ManualFeed")) != NULL)
@@ -721,5 +724,5 @@ ppd_defaults(ppd_file_t *ppd, /* I - PPD file */
/*
- * End of "$Id: mark.c 6649 2007-07-11 21:46:42Z mike $".
+ * End of "$Id: mark.c 6703 2007-07-20 21:28:10Z mike $".
*/
diff --git a/cups/options.c b/cups/options.c
index cd38c185b..493756dde 100644
--- a/cups/options.c
+++ b/cups/options.c
@@ -1,5 +1,5 @@
/*
- * "$Id: options.c 6649 2007-07-11 21:46:42Z mike $"
+ * "$Id: options.c 6703 2007-07-20 21:28:10Z mike $"
*
* Option routines for the Common UNIX Printing System (CUPS).
*
@@ -22,6 +22,7 @@
* cupsMarkOptions() - Mark command-line options in a PPD file.
* cupsParseOptions() - Parse options from a command-line argument.
* cupsRemoveOptions() - Remove an option from an option array.
+ * debug_marked() - Output the marked array to stdout...
* ppd_mark_choices() - Mark one or more option choices from a string.
*/
@@ -40,6 +41,11 @@
* Local functions...
*/
+#ifdef DEBUG
+static void debug_marked(ppd_file_t *ppd, const char *title);
+#else
+# define debug_marked(ppd,title)
+#endif /* DEBUG */
static int ppd_mark_choices(ppd_file_t *ppd, const char *options);
@@ -205,6 +211,8 @@ cupsMarkOptions(
if (ppd == NULL || num_options <= 0 || options == NULL)
return (0);
+ debug_marked(ppd, "Before...");
+
/*
* Mark options...
*/
@@ -256,7 +264,7 @@ cupsMarkOptions(
conflict = 1;
if (cupsGetOption("EFMediaType", num_options, options) == NULL)
- if (ppdMarkOption(ppd, "EFMediaType", s))
+ if (ppdMarkOption(ppd, "EFMediaType", s)) /* EFI */
conflict = 1;
if (cupsGetOption("EFMediaQualityMode", num_options, options) == NULL)
@@ -429,12 +437,16 @@ cupsMarkOptions(
conflict = 1;
}
}
- else if (!strcasecmp(optptr->name, "mirror") &&
- ppdMarkOption(ppd, "MirrorPrint", optptr->value))
- conflict = 1;
+ else if (!strcasecmp(optptr->name, "mirror"))
+ {
+ if (ppdMarkOption(ppd, "MirrorPrint", optptr->value))
+ conflict = 1;
+ }
else if (ppdMarkOption(ppd, optptr->name, optptr->value))
conflict = 1;
+ debug_marked(ppd, "After...");
+
return (conflict);
}
@@ -695,6 +707,28 @@ cupsRemoveOption(
}
+#ifdef DEBUG
+/*
+ * 'debug_marked()' - Output the marked array to stdout...
+ */
+
+static void
+debug_marked(ppd_file_t *ppd, /* I - PPD file data */
+ const char *title) /* I - Title for list */
+{
+ ppd_choice_t *c; /* Current choice */
+
+
+ printf("cupsMarkOptions: %s\n", title);
+
+ for (c = (ppd_choice_t *)cupsArrayFirst(ppd->marked);
+ c;
+ c = (ppd_choice_t *)cupsArrayNext(ppd->marked))
+ printf("cupsMarkOptions: %s=%s\n", c->option->keyword, c->choice);
+}
+#endif /* DEBUG */
+
+
/*
* 'ppd_mark_choices()' - Mark one or more option choices from a string.
*/
@@ -778,5 +812,5 @@ ppd_mark_choices(ppd_file_t *ppd, /* I - PPD file */
/*
- * End of "$Id: options.c 6649 2007-07-11 21:46:42Z mike $".
+ * End of "$Id: options.c 6703 2007-07-20 21:28:10Z mike $".
*/
diff --git a/cups/ppd.c b/cups/ppd.c
index 53fac4ad0..bf4185db0 100644
--- a/cups/ppd.c
+++ b/cups/ppd.c
@@ -1,5 +1,5 @@
/*
- * "$Id: ppd.c 6660 2007-07-13 05:09:30Z mike $"
+ * "$Id: ppd.c 6719 2007-07-25 00:08:49Z mike $"
*
* PPD file routines for the Common UNIX Printing System (CUPS).
*
@@ -573,7 +573,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
return (NULL);
}
- ppd->language_level = 1;
+ ppd->language_level = 2;
ppd->color_device = 0;
ppd->colorspace = PPD_CS_GRAY;
ppd->landscape = -90;
@@ -2248,7 +2248,7 @@ static int /* O - Result of comparison */
ppd_compare_choices(ppd_choice_t *a, /* I - First choice */
ppd_choice_t *b) /* I - Second choice */
{
- return (a->option - b->option);
+ return (strcmp(a->option->keyword, b->option->keyword));
}
@@ -3186,5 +3186,5 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
/*
- * End of "$Id: ppd.c 6660 2007-07-13 05:09:30Z mike $".
+ * End of "$Id: ppd.c 6719 2007-07-25 00:08:49Z mike $".
*/
diff --git a/cups/request.c b/cups/request.c
index 560367901..cee243687 100644
--- a/cups/request.c
+++ b/cups/request.c
@@ -1,5 +1,5 @@
/*
- * "$Id: request.c 6649 2007-07-11 21:46:42Z mike $"
+ * "$Id: request.c 6712 2007-07-24 00:13:05Z mike $"
*
* IPP utilities for the Common UNIX Printing System (CUPS).
*
@@ -19,6 +19,7 @@
* cupsDoFileRequest() - Do an IPP request with a file.
* cupsDoRequest() - Do an IPP request.
* _cupsSetError() - Set the last IPP status code and status-message.
+ * _cupsSetHTTPError() - Set the last error using the HTTP status.
*/
/*
@@ -455,44 +456,7 @@ cupsDoIORequest(http_t *http, /* I - HTTP connection to server */
ippErrorString(response->request.status.status_code));
}
else if (status != HTTP_OK)
- {
- switch (status)
- {
- case HTTP_NOT_FOUND :
- _cupsSetError(IPP_NOT_FOUND, httpStatus(status));
- break;
-
- case HTTP_UNAUTHORIZED :
- _cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status));
- break;
-
- case HTTP_FORBIDDEN :
- _cupsSetError(IPP_FORBIDDEN, httpStatus(status));
- break;
-
- case HTTP_BAD_REQUEST :
- _cupsSetError(IPP_BAD_REQUEST, httpStatus(status));
- break;
-
- case HTTP_REQUEST_TOO_LARGE :
- _cupsSetError(IPP_REQUEST_VALUE, httpStatus(status));
- break;
-
- case HTTP_NOT_IMPLEMENTED :
- _cupsSetError(IPP_OPERATION_NOT_SUPPORTED, httpStatus(status));
- break;
-
- case HTTP_NOT_SUPPORTED :
- _cupsSetError(IPP_VERSION_NOT_SUPPORTED, httpStatus(status));
- break;
-
- default :
- DEBUG_printf(("HTTP error %d mapped to IPP_SERVICE_UNAVAILABLE!\n",
- status));
- _cupsSetError(IPP_SERVICE_UNAVAILABLE, httpStatus(status));
- break;
- }
- }
+ _cupsSetHTTPError(status);
return (response);
}
@@ -542,5 +506,51 @@ _cupsSetError(ipp_status_t status, /* I - IPP status code */
/*
- * End of "$Id: request.c 6649 2007-07-11 21:46:42Z mike $".
+ * '_cupsSetHTTPError()' - Set the last error using the HTTP status.
+ */
+
+void
+_cupsSetHTTPError(http_status_t status) /* I - HTTP status code */
+{
+ switch (status)
+ {
+ case HTTP_NOT_FOUND :
+ _cupsSetError(IPP_NOT_FOUND, httpStatus(status));
+ break;
+
+ case HTTP_UNAUTHORIZED :
+ _cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status));
+ break;
+
+ case HTTP_FORBIDDEN :
+ _cupsSetError(IPP_FORBIDDEN, httpStatus(status));
+ break;
+
+ case HTTP_BAD_REQUEST :
+ _cupsSetError(IPP_BAD_REQUEST, httpStatus(status));
+ break;
+
+ case HTTP_REQUEST_TOO_LARGE :
+ _cupsSetError(IPP_REQUEST_VALUE, httpStatus(status));
+ break;
+
+ case HTTP_NOT_IMPLEMENTED :
+ _cupsSetError(IPP_OPERATION_NOT_SUPPORTED, httpStatus(status));
+ break;
+
+ case HTTP_NOT_SUPPORTED :
+ _cupsSetError(IPP_VERSION_NOT_SUPPORTED, httpStatus(status));
+ break;
+
+ default :
+ DEBUG_printf(("HTTP error %d mapped to IPP_SERVICE_UNAVAILABLE!\n",
+ status));
+ _cupsSetError(IPP_SERVICE_UNAVAILABLE, httpStatus(status));
+ break;
+ }
+}
+
+
+/*
+ * End of "$Id: request.c 6712 2007-07-24 00:13:05Z mike $".
*/
diff --git a/doc/Makefile b/doc/Makefile
index 69d17e249..2414de04f 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,5 +1,5 @@
#
-# "$Id: Makefile 6649 2007-07-11 21:46:42Z mike $"
+# "$Id: Makefile 6733 2007-07-26 18:09:46Z mike $"
#
# Documentation makefile for the Common UNIX Printing System (CUPS).
#
@@ -42,9 +42,9 @@ WEBBUTTONS = \
images/button-delete-printer.gif \
images/button-edit-configuration-file.gif \
images/button-export-samba.gif \
+ images/button-find-new-printers.gif \
images/button-help.gif \
images/button-hold-job.gif \
- images/button-list-available-printers.gif \
images/button-manage-classes.gif \
images/button-manage-jobs.gif \
images/button-manage-printers.gif \
@@ -115,6 +115,7 @@ HELPFILES = \
help/api-raster.html \
help/cgi.html \
help/glossary.html \
+ help/kerberos.html \
help/license.html \
help/man-accept.html \
help/man-backend.html \
diff --git a/doc/help/api-httpipp.html b/doc/help/api-httpipp.html
index af6a40dd4..036d97082 100644
--- a/doc/help/api-httpipp.html
+++ b/doc/help/api-httpipp.html
@@ -936,6 +936,7 @@ require CUPS 1.1 or higher.
httpFlush()
httpFlushWrite() CUPS 1.2
httpGet()
+ httpGetAuthString() CUPS 1.3
httpGetBlocking() CUPS 1.2
httpGetCookie() CUPS 1.1.19
httpGetDateString() DEPRECATED
@@ -965,6 +966,7 @@ require CUPS 1.1 or higher.
httpSeparate() DEPRECATED
httpSeparate2() CUPS 1.1.21
httpSeparateURI() CUPS 1.2
+ httpSetAuthString() CUPS 1.3
httpSetCookie() CUPS 1.1.19
httpSetExpect() CUPS 1.2
httpSetField()
@@ -1741,6 +1743,30 @@ httpGet(
Returns
Status of call (0 = success)
+
+Description
+Get the current authorization string.
+
The authorization string is set by cupsDoAuthentication() and
+httpSetAuthString(). Use httpGetAuthString() to retrieve the
+string to use with httpSetField() for the HTTP_FIELD_AUTHORIZATION
+value.
+
+
+
Syntax
+
+char *
+httpGetAuthString(
+ http_t * http);
+
+Arguments
+
+Name | Description |
+
+http | HTTP connection |
+
+Returns
+Authorization string
+
Description
Get the blocking/non-block state of a connection.
@@ -2420,6 +2446,34 @@ httpSeparateURI(
Returns
Result of separation
+
+Description
+Set the current authorization string.
+
This function just stores a copy of the current authorization string in
+the HTTP connection object. You must still call httpSetField() to set
+HTTP_FIELD_AUTHORIZATION prior to issuing a HTTP request using httpGet(),
+httpHead(), httpOptions(), httpPost, or httpPut().
+
+
+
Syntax
+
+void
+httpSetAuthString(
+ http_t * http,
+ const char * scheme,
+ const char * data);
+
+Arguments
+
+Name | Description |
+
+http | HTTP connection |
+scheme | Auth scheme (NULL to clear it) |
+data | Auth data (NULL for none) |
+
+Returns
+Nothing.
+
Description
Set the cookie value(s)...
diff --git a/doc/help/kerberos.html b/doc/help/kerberos.html
new file mode 100644
index 000000000..a7b0e5ed0
--- /dev/null
+++ b/doc/help/kerberos.html
@@ -0,0 +1,137 @@
+
+
+
+ Using Kerberos Authentication
+
+
+
+CUPS 1.3 adds Kerberos support which allows you to use a Key Distribution
+Center (KDC) for authentication on your local CUPS server and when printing
+to a remote authenticated queue. This document describes how to configure
+CUPS to use Kerberos authentication and provides helpful links to the MIT
+help pages for configuring Kerberos on your systems and network.
+
+
+
+
+Before you can use Kerberos with CUPS, you will need to configure
+Kerberos on your system and setup a system as a KDC. Because this
+configuration is highly system and site-specific, please consult
+the following on-line resources provided by the creators of Kerberos
+at the Massachussetts Institute of Technology (MIT):
+
+
+
+The Linux Documentation Project also has a HOWTO on Kerberos:
+
+
+
+
+
+
+Once you have configured Kerberos on your system(s), you can then
+enable Kerberos authentication by selecting the Negotiate
+authentication type. The simplest way to do this is using the
+cupsctl(8) command:
+
+
+cupsctl DefaultAuthType=Negotiate
+
+
+You can also enable Kerberos from the web interface by checking the
+Use Kerberos Authentication box and clicking Change
+Settings:
+
+
+http://localhost:631/admin
+
+
+After you have enabled Kerberos authentication, add AuthType Default
+lines to the policies you want to protect with authentication, for example:
+
+
+Listing 1: Remote Printer Operation Policy
+
+ 1 <Policy remote>
+ 2 # Job-related operations must be done by the owner or an
+ administrator...
+ 3 <Limit Send-Document Send-URI Hold-Job Release-Job
+ Restart-Job Purge-Jobs Set-Job-Attributes
+ Create-Job-Subscription Renew-Subscription
+ Cancel-Subscription Get-Notifications Reprocess-Job
+ Cancel-Current-Job Suspend-Current-Job Resume-Job
+ CUPS-Move-Job>
+ 4 AuthType Default
+ 5 Require user @OWNER @SYSTEM
+ 6 Order deny,allow
+ 7 </Limit>
+ 8
+ 9 # Require authentication when creating jobs
+10 <Limit Create-Job Print-Job Print-URI>
+11 AuthType Default
+12 Require valid-user
+13 Order deny,allow
+14 </Limit>
+15
+16 # All administration operations require an administrator
+ to authenticate...
+17 <Limit CUPS-Add-Printer CUPS-Delete-Printer
+ CUPS-Add-Class CUPS-Delete-Class CUPS-Set-Default>
+18 AuthType Default
+19 Require user @SYSTEM
+20 Order deny,allow
+21 </Limit>
+22
+23 # All printer operations require a printer operator
+ to authenticate...
+24 <Limit Pause-Printer Resume-Printer
+ Set-Printer-Attributes Enable-Printer Disable-Printer
+ Pause-Printer-After-Current-Job Hold-New-Jobs
+ Release-Held-New-Jobs Deactivate-Printer Activate-Printer
+ Restart-Printer Shutdown-Printer Startup-Printer
+ Promote-Job Schedule-Job-After CUPS-Accept-Jobs
+ CUPS-Reject-Jobs>
+25 AuthType Default
+26 Require user varies by OS
+27 Order deny,allow
+28 </Limit>
+29
+30 # Only the owner or an administrator can cancel or
+ authenticate a job...
+31 <Limit Cancel-Job CUPS-Authenticate-Job>
+32 Require user @OWNER @SYSTEM
+33 Order deny,allow
+34 </Limit>
+35
+36 <Limit All>
+37 Order deny,allow
+38 </Limit>
+39 </Policy>
+
+
+
+
+
+CUPS implements Kerberos over HTTP using GSS API and the service name
+"ipp". Delegation of credentials (needed for remote printers with
+authentication) is only supported when using a single KDC on your network.
+
+After getting a user's Kerberos credentials, CUPS strips the "@KDC"
+portion of the username so that it can check the group membership locally,
+effectively treating the Kerberos account as a local user account.
+
+
+
diff --git a/doc/help/policies.html b/doc/help/policies.html
index 804fc3e9e..a90617968 100644
--- a/doc/help/policies.html
+++ b/doc/help/policies.html
@@ -54,7 +54,7 @@ trying to use the new policy.
1 <Policy default>
2 # Job-related operations must be done by the owner or an
- adminstrator...
+ administrator...
3 <Limit Send-Document Send-URI Hold-Job Release-Job
Restart-Job Purge-Jobs Set-Job-Attributes
Create-Job-Subscription Renew-Subscription
@@ -65,32 +65,40 @@ trying to use the new policy.
5 Order deny,allow
6 </Limit>
7
- 8 # All administration operations require an adminstrator
+ 8 # All administration operations require an administrator
to authenticate...
- 9 <Limit Pause-Printer Resume-Printer
- Set-Printer-Attributes Enable-Printer Disable-Printer
- Pause-Printer-After-Current-Job Hold-New-Jobs
- Release-Held-New-Jobs Deactivate-Printer Activate-Printer
- Restart-Printer Shutdown-Printer Startup-Printer
- Promote-Job Schedule-Job-After CUPS-Add-Printer
- CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class
- CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>
-10 AuthType Basic
+ 9 <Limit CUPS-Add-Printer CUPS-Delete-Printer CUPS-Add-Class
+ CUPS-Delete-Class CUPS-Set-Default>
+10 AuthType Default
11 Require user @SYSTEM
12 Order deny,allow
13 </Limit>
14
-15 # Only the owner or an administrator can cancel or
+15 # All printer operations require a printer operator
+ to authenticate...
+16 <Limit Pause-Printer Resume-Printer
+ Set-Printer-Attributes Enable-Printer Disable-Printer
+ Pause-Printer-After-Current-Job Hold-New-Jobs
+ Release-Held-New-Jobs Deactivate-Printer Activate-Printer
+ Restart-Printer Shutdown-Printer Startup-Printer
+ Promote-Job Schedule-Job-After CUPS-Accept-Jobs
+ CUPS-Reject-Jobs>
+17 AuthType Default
+18 Require user varies by OS
+19 Order deny,allow
+20 </Limit>
+21
+22 # Only the owner or an administrator can cancel or
authenticate a job...
-16 <Limit Cancel-Job CUPS-Authenticate-Job>
-17 Require user @OWNER @SYSTEM
-18 Order deny,allow
-19 </Limit>
-20
-21 <Limit All>
-22 Order deny,allow
-23 </Limit>
-24 </Policy>
+23 <Limit Cancel-Job CUPS-Authenticate-Job>
+24 Require user @OWNER @SYSTEM
+25 Order deny,allow
+26 </Limit>
+27
+28 <Limit All>
+29 Order deny,allow
+30 </Limit>
+31 </Policy>
The Default CUPS Operation Policy
@@ -139,18 +147,26 @@ however, do use the AuthType directive, and so
administrative operations need to be authenticated:
- 9 <Limit Pause-Printer Resume-Printer
+ 9 <Limit CUPS-Add-Printer CUPS-Delete-Printer CUPS-Add-Class
+ CUPS-Delete-Class CUPS-Set-Default>
+10 AuthType Default
+11 Require user @SYSTEM
+12 Order deny,allow
+13 </Limit>
+14
+15 # All printer operations require a printer operator
+ to authenticate...
+16 <Limit Pause-Printer Resume-Printer
Set-Printer-Attributes Enable-Printer Disable-Printer
Pause-Printer-After-Current-Job Hold-New-Jobs
Release-Held-New-Jobs Deactivate-Printer Activate-Printer
Restart-Printer Shutdown-Printer Startup-Printer
- Promote-Job Schedule-Job-After CUPS-Add-Printer
- CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class
- CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>
-10 AuthType Basic
-11 Require user @SYSTEM
-12 Order deny,allow
-13 </Limit>
+ Promote-Job Schedule-Job-After CUPS-Accept-Jobs
+ CUPS-Reject-Jobs>
+17 AuthType Default
+18 Require user varies by OS
+19 Order deny,allow
+20 </Limit>
The "Order deny,allow" line at the end of both Limit
@@ -602,7 +618,7 @@ management operations.
1 <Policy lab999>
2 # Job- and subscription-related operations must be done
- by the owner, a lab technician, or an adminstrator...
+ by the owner, a lab technician, or an administrator...
3 <Limit Send-Document Send-URI Hold-Job Release-Job
Restart-Job Purge-Jobs Set-Job-Attributes
Create-Job-Subscription Renew-Subscription
@@ -615,7 +631,7 @@ management operations.
7 </Limit>
8
9 # All administration operations require a lab technician
- or an adminstrator to authenticate...
+ or an administrator to authenticate...
10 <Limit Pause-Printer Resume-Printer
Set-Printer-Attributes Enable-Printer Disable-Printer
Pause-Printer-After-Current-Job Hold-New-Jobs
@@ -623,7 +639,7 @@ management operations.
Restart-Printer Shutdown-Printer Startup-Printer
Promote-Job Schedule-Job-After CUPS-Accept-Jobs
CUPS-Reject-Jobs CUPS-Set-Default>
-11 AuthType Basic
+11 AuthType Default
12 Require user @lab999 @SYSTEM
13 Order allow,deny
14 Allow from 10.0.2.0/24
diff --git a/doc/help/spec-ppd.html b/doc/help/spec-ppd.html
index 07562a660..b8f420dde 100644
--- a/doc/help/spec-ppd.html
+++ b/doc/help/spec-ppd.html
@@ -8,7 +8,7 @@