-CHANGES.txt - 2006-07-18
+CHANGES.txt - 2006-08-29
------------------------
+CHANGES IN CUPS V1.2.3
+
+ - The scheduler did not send job-state or
+ job-config-changed events when a job was held,
+ released, or changed (STR #1947)
+ - The scheduler now aborts if the configuration file and
+ directory checks fail (STR #1941)
+ - Fixed a problem with ippPort() not using the port
+ number that was set via the client.conf file or
+ CUPS_SERVER environment variable (STR #1945)
+ - HTTP headers were not buffered (STR #1899)
+ - Some IPP printers (HP) did not like UTF-8 job names
+ (STR #1837)
+ - The CUPS desktop icon is now localized for Polish (STR
+ #1920)
+ - Printer options were not always honored when printing
+ from Windows clients (STR #1839)
+ - The openssl command would lock up the scheduler when
+ generating an encryption certificate on some platforms
+ due to a lack of entropy for the random number
+ generator (STR #1876)
+ - The web admin page did not recognize that "Listen 631"
+ enabled remote access (STR #1908)
+ - The web admin page did not check whether changes were
+ made to the Basic Server Settings check boxes (STR
+ #1908)
+ - The IPP backend could generate N*N copies in certain
+ edge cases.
+ - The scheduler did not restore remote printers properly
+ when BrowseShortNames was enabled (STR #1893)
+ - Polling did not handle changes to the network
+ environment on Mac OS X (STR #1896)
+ - The "make test" subscription tests used invalid
+ notify-recipient-uri values (STR #1910)
+ - Printers could be left in an undefined state on system
+ sleep (STR #1905)
+ - The Berkeley and System V commands did not always use
+ the expected character set (STR #1915)
+ - Remote printing fixes (STR #1881)
+ - The cupstestppd utility did not validate translation
+ strings for custom options properly.
+ - Multi-language PPD files were not properly localized in
+ the web interface (STR #1913)
+ - The admin page's simple settings options did not check
+ for local domain socket or IPv6 addresses and did not
+ use "localhost" as the listen address.
+ - An empty BrowseProtocols, BrowseLocalProtocols, or
+ BrowseRemoteProtocols line would crash the scheduler
+ instead of disabling the corresponding browsing options.
+ - The scheduler now logs IPP operation status as debug
+ messages instead of info or error.
+ - cupsFileRewind() didn't clear the end-of-file state.
+ - cupstestppd didn't report the actual misspelling of the
+ 1284DeviceID attribute (STR #1849)
+ - BrowseRelay didn't work on Debian (STR #1887)
+ - configure --without-languages didn't work (STR #1879)
+ - Manually added remote printers did not work (STR #1881)
+ - The <cups/backend.h> header was not installed.
+ - Updated the build files for Autoconf 2.60 (STR #1853)
+ - The scheduler incorrectly terminated the polling
+ processes after receiving a partial log line.
+ - The cups-lpd mini-daemon reported "No printer-state
+ attribute found" errors when reporting the queue status
+ (PR #6250, STR #1821)
+ - SNMP backend improvements (STR #1737, STR #1742, STR
+ #1790, STR #1835, STR #1880)
+ - The scheduler erroneously reported an error with the
+ CGI pipe (STR #1860)
+ - Fixed HP-UX compile problems (STR #1858, STR #1859)
+ - cupstestppd crashed with some PPD files (STR #1864)
+ - The <cups/dir.h> and <cups/file.h> header files did not
+ work with C++.
+
+
CHANGES IN CUPS V1.2.2
- Documentation updates (STR #1765, STR #1780)
#
-# "$Id: Makedefs.in 5609 2006-05-30 20:31:10Z mike $"
+# "$Id: Makedefs.in 5799 2006-08-03 00:54:38Z mike $"
#
# Common makefile definitions for the Common UNIX Printing System (CUPS).
#
# We have to define these first because autoconf uses ${prefix}
# and ${exec_prefix} for most of the other directories...
#
+# The "datarootdir" variable may not get defined if you are using
+# a version of autoconf prior to 2.60.
+#
# This is immediately followed by definition in ALL CAPS for the
# needed directories...
#
bindir = @bindir@
datadir = @datadir@
+datarootdir = @datarootdir@
exec_prefix = @exec_prefix@
includedir = @includedir@
infodir = @infodir@
#
-# End of "$Id: Makedefs.in 5609 2006-05-30 20:31:10Z mike $"
+# End of "$Id: Makedefs.in 5799 2006-08-03 00:54:38Z mike $"
#
#
-# "$Id: Makefile 5547 2006-05-19 12:44:29Z mike $"
+# "$Id: Makefile 5902 2006-08-29 15:51:19Z mike $"
#
# Top-level Makefile for the Common UNIX Printing System (CUPS).
#
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \
$(INSTALL_DATA) init/Localizable.strings $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \
elif test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
- echo Installing LaunchDaemons configuration file...; \
+ echo Installing LaunchDaemons configuration files...; \
$(INSTALL_DATA) init/org.cups.cupsd.plist $(BUILDROOT)$(DEFAULT_LAUNCHD_CONF); \
+ $(INSTALL_DATA) init/org.cups.cups-lpd.plist $(BUILDROOT)/System/Library/LaunchDaemons; \
else \
echo Installing RC script...; \
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDDIR)/cups; \
# Run the test suite...
#
-check test: all
+test: all
echo Running CUPS test suite...
cd test; ./run-stp-tests.sh
+check: all
+ echo Running CUPS test suite with defaults...
+ cd test; ./run-stp-tests.sh 1 0 n
+
+
#
# Make software distributions using EPM (http://www.easysw.com/epm/)...
#
-EPMFLAGS = -v
+EPMFLAGS = -v --output-dir dist $(EPMARCH)
-aix bsd deb depot inst osx pkg rpm setld slackware swinstall tardist:
+aix bsd deb depot inst pkg rpm setld slackware swinstall tardist:
epm $(EPMFLAGS) -f $@ cups packaging/cups.list
epm:
- epm $(EPMFLAGS) cups packaging/cups.list
+ epm $(EPMFLAGS) -s packaging/installer.gif cups packaging/cups.list
+
+osx:
+ epm $(EPMFLAGS) -f osx -s packaging/installer.tif cups packaging/cups.list
+
+.PHONEY: dist
+dist: all
+ $(RM) -r dist
+ $(MAKE) $(MFLAGS) epm
+ case `uname` in \
+ *BSD*) $(MAKE) $(MFLAGS) bsd;; \
+ Darwin*) $(MAKE) $(MFLAGS) osx;; \
+ IRIX*) $(MAKE) $(MFLAGS) tardist;; \
+ Linux*) $(MAKE) $(MFLAGS) rpm;; \
+ SunOS*) $(MAKE) $(MFLAGS) pkg;; \
+ esac
#
-# End of "$Id: Makefile 5547 2006-05-19 12:44:29Z mike $".
+# End of "$Id: Makefile 5902 2006-08-29 15:51:19Z mike $".
#
-README - CUPS v1.2.0 - 2006-05-08
+README - CUPS v1.2.3 - 2006-08-28
---------------------------------
Looking for compile instructions? Read the file "INSTALL.txt"
/*
- * "$Id: backend-private.h 5592 2006-05-27 03:11:52Z mike $"
+ * "$Id: backend-private.h 5771 2006-07-20 18:06:20Z mike $"
*
* Backend support definitions for the Common UNIX Printing System (CUPS).
*
* C++ magic...
*/
-# ifdef _cplusplus
+# ifdef __cplusplus
extern "C" {
-# endif /* _cplusplus */
+# endif /* __cplusplus */
/*
extern ssize_t backendRunLoop(int print_fd, int device_fd, int use_bc);
-# ifdef _cplusplus
+# ifdef __cplusplus
}
-# endif /* _cplusplus */
+# endif /* __cplusplus */
#endif /* !_CUPS_BACKEND_PRIVATE_H_ */
/*
- * End of "$Id: backend-private.h 5592 2006-05-27 03:11:52Z mike $".
+ * End of "$Id: backend-private.h 5771 2006-07-20 18:06:20Z mike $".
*/
/*
- * "$Id: ieee1284.c 5591 2006-05-26 19:51:59Z mike $"
+ * "$Id: ieee1284.c 5866 2006-08-23 03:03:49Z mike $"
*
* IEEE-1284 support functions for the Common UNIX Printing System (CUPS).
*
if (!strcasecmp(manufacturer, "Hewlett-Packard"))
strcpy(manufacturer, "HP");
+ else if (!strcasecmp(manufacturer, "Lexmark International"))
+ strcpy(manufacturer, "Lexmark");
}
else
{
{
if (!strncasecmp(mfg, "Hewlett-Packard", 15))
strlcpy(make_model, "HP", make_model_size);
+ else if (!strncasecmp(mfg, "Lexmark International", 21))
+ strlcpy(make_model, "Lexmark", make_model_size);
else
strlcpy(make_model, mfg, make_model_size);
/*
- * End of "$Id: ieee1284.c 5591 2006-05-26 19:51:59Z mike $".
+ * End of "$Id: ieee1284.c 5866 2006-08-23 03:03:49Z mike $".
*/
/*
- * "$Id: ipp.c 5724 2006-07-12 19:42:35Z mike $"
+ * "$Id: ipp.c 5889 2006-08-24 21:44:35Z mike $"
*
* IPP backend for the Common UNIX Printing System (CUPS).
*
ipp_attribute_t *format_sup; /* document-format-supported */
ipp_attribute_t *printer_state; /* printer-state attribute */
ipp_attribute_t *printer_accepting; /* printer-is-accepting-jobs */
- int copies; /* Number of copies remaining */
+ int copies, /* Number of copies for job */
+ copies_remaining; /* Number of copies remaining */
const char *content_type; /* CONTENT_TYPE environment variable */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
int version; /* IPP version */
- int reasons; /* Number of printer-state-reasons */
static const char * const pattrs[] =
{ /* Printer attributes we want */
"copies-supported",
if ((content_type = getenv("CONTENT_TYPE")) == NULL)
content_type = "application/octet-stream";
+ if (!strncmp(content_type, "printer/", 8))
+ content_type = "application/vnd.cups-raw";
+
/*
* Extract the hostname and printer name from the URI...
*/
* See if the printer supports multiple copies...
*/
+ copies = atoi(argv[4]);
+
if (copies_sup || argc < 7)
- copies = 1;
+ {
+ copies_remaining = 1;
+
+ if (argc < 7)
+ copies = 1;
+ }
else
- copies = atoi(argv[4]);
+ copies_remaining = copies;
/*
* Then issue the print-job request...
*/
- reasons = 0;
job_id = 0;
- while (copies > 0)
+ while (copies_remaining > 0)
{
/*
* Build the IPP request...
fprintf(stderr, "DEBUG: requesting-user-name = \"%s\"\n", argv[2]);
- if (argv[3][0])
+ /*
+ * Only add a "job-name" attribute if the remote server supports
+ * copy generation - some IPP implementations like HP's don't seem
+ * to like UTF-8 job names (STR #1837)...
+ */
+
+ if (argv[3][0] && copies_sup)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
argv[3]);
* number of copies to 1...
*/
- content_type = "application/postscript";
- copies = 1;
+ content_type = "application/postscript";
+ copies = 1;
+ copies_remaining = 1;
}
}
#endif /* __APPLE__ */
*/
cupsEncodeOptions(request, num_options, options);
+
ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_INTEGER, "copies",
- atoi(argv[4]));
+ copies);
}
cupsFreeOptions(num_options, options);
if (ipp_status <= IPP_OK_CONFLICT && argc > 6)
{
fprintf(stderr, "PAGE: 1 %d\n", copies_sup ? atoi(argv[4]) : 1);
- copies --;
+ copies_remaining --;
}
else if (ipp_status == IPP_SERVICE_UNAVAILABLE ||
ipp_status == IPP_PRINTER_BUSY)
break;
else
- copies --;
+ copies_remaining --;
/*
* Wait for the job to complete...
#endif /* __APPLE__ */
exit(CUPS_BACKEND_AUTH_REQUIRED);
+
+ return (NULL); /* Eliminate compiler warning */
}
}
/*
- * End of "$Id: ipp.c 5724 2006-07-12 19:42:35Z mike $".
+ * End of "$Id: ipp.c 5889 2006-08-24 21:44:35Z mike $".
*/
/*
- * "$Id: lpd.c 5495 2006-05-05 17:58:07Z mike $"
+ * "$Id: lpd.c 5886 2006-08-24 19:53:17Z mike $"
*
* Line Printer Daemon backend for the Common UNIX Printing System (CUPS).
*
/* We want to pass utf-8 characters, not re-map them (3071945) */
sanitize_title = 0;
+ /* Get the default timeout from a system preference... */
{
CFPropertyListRef pvalue; /* Preference value */
SInt32 toval; /* Timeout value */
/*
- * End of "$Id: lpd.c 5495 2006-05-05 17:58:07Z mike $".
+ * End of "$Id: lpd.c 5886 2006-08-24 19:53:17Z mike $".
*/
/*
- * "$Id: runloop.c 5726 2006-07-12 20:00:11Z mike $"
+ * "$Id: runloop.c 5776 2006-07-26 20:55:13Z mike $"
*
* Common run loop API for the Common UNIX Printing System (CUPS).
*
*/
#include "backend-private.h"
-#include <sys/select.h>
+#ifdef __hpux
+# include <sys/time.h>
+#else
+# include <sys/select.h>
+#endif /* __hpux */
/*
/*
- * End of "$Id: runloop.c 5726 2006-07-12 20:00:11Z mike $".
+ * End of "$Id: runloop.c 5776 2006-07-26 20:55:13Z mike $".
*/
/*
- * "$Id: snmp.c 5736 2006-07-13 19:59:36Z mike $"
+ * "$Id: snmp.c 5898 2006-08-28 18:54:10Z mike $"
*
* SNMP discovery backend for the Common UNIX Printing System (CUPS).
*
* packed integer value.
* compare_cache() - Compare two cache entries.
* debug_printf() - Display some debugging information.
+ * do_request() - Do a non-blocking IPP request.
* fix_make_model() - Fix common problems in the make-and-model
* string.
* free_array() - Free an array of strings.
* get_interface_addresses() - Get the broadcast address(es) associated
* with an interface.
* hex_debug() - Output hex debugging data...
- * list_devices() - List all of the devices we found...
+ * list_device() - List a device we found...
* open_snmp_socket() - Open the SNMP broadcast socket.
* password_cb() - Handle authentication requests.
* probe_device() - Probe a device to discover whether it is a
} snmp_packet_t;
+/*
+ * Private CUPS API to set the last error...
+ */
+
+extern void _cupsSetError(ipp_status_t status, const char *message);
+
+
/*
* Local functions...
*/
static int asn1_size_packed(int integer);
static int compare_cache(snmp_cache_t *a, snmp_cache_t *b);
static void debug_printf(const char *format, ...);
+static ipp_t *do_request(http_t *http, ipp_t *request,
+ const char *resource);
static void fix_make_model(char *make_model,
const char *old_make_model,
int make_model_size);
static void free_cache(void);
static http_addrlist_t *get_interface_addresses(const char *ifname);
static void hex_debug(unsigned char *buffer, size_t len);
-static void list_devices(void);
+static void list_device(snmp_cache_t *cache);
static int open_snmp_socket(void);
static const char *password_cb(const char *prompt);
static void probe_device(snmp_cache_t *device);
static unsigned DeviceTypeRequest;
static unsigned DeviceDescRequest;
static int HostNameLookups = 0;
+static int MaxRunTime = 10;
static struct timeval StartTime;
char *argv[]) /* I - Command-line arguments */
{
int fd; /* SNMP socket */
+#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+ struct sigaction action; /* Actions for POSIX signals */
+#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
cupsSetPasswordCB(password_cb);
+ /*
+ * Catch SIGALRM signals...
+ */
+
+#ifdef HAVE_SIGSET
+ sigset(SIGALRM, alarm_handler);
+#elif defined(HAVE_SIGACTION)
+ memset(&action, 0, sizeof(action));
+
+ sigemptyset(&action.sa_mask);
+ sigaddset(&action.sa_mask, SIGALRM);
+ action.sa_handler = alarm_handler;
+ sigaction(SIGALRM, &action, NULL);
+#else
+ signal(SIGALRM, alarm_handler);
+#endif /* HAVE_SIGSET */
+
/*
* Open the SNMP socket...
*/
scan_devices(fd);
- /*
- * Display the results...
- */
-
- list_devices();
-
/*
* Close, free, and return with no errors...
*/
debug_printf("DEBUG: add_cache(addr=%p, addrname=\"%s\", uri=\"%s\", "
"id=\"%s\", make_and_model=\"%s\")\n",
- addr, addrname, uri ? uri : "(null)", id ? id : "(null)",
+ addr, addrname, uri ? uri : "(null)", id ? id : "(null)",
make_and_model ? make_and_model : "(null)");
temp = calloc(1, sizeof(snmp_cache_t));
temp->make_and_model = strdup(make_and_model);
cupsArrayAdd(Devices, temp);
+
+ if (uri)
+ list_device(temp);
}
(void)sig;
+#if !defined(HAVE_SIGSET) && !defined(HAVE_SIGACTION)
+ signal(SIGALRM, alarm_handler);
+#endif /* !HAVE_SIGSET && !HAVE_SIGACTION */
+
if (DebugLevel)
write(2, "DEBUG: ALARM!\n", 14);
}
}
+/*
+ * 'do_request()' - Do a non-blocking IPP request.
+ */
+
+static ipp_t * /* O - Response data or NULL */
+do_request(http_t *http, /* I - HTTP connection to server */
+ ipp_t *request, /* I - IPP request */
+ const char *resource) /* I - HTTP resource for POST */
+{
+ ipp_t *response; /* IPP response data */
+ http_status_t status; /* Status of HTTP request */
+ ipp_state_t state; /* State of IPP processing */
+
+
+ /*
+ * Setup the HTTP variables needed...
+ */
+
+ httpClearFields(http);
+ httpSetLength(http, ippLength(request));
+ httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
+
+ /*
+ * Do the POST request...
+ */
+
+ debug_printf("DEBUG: %.3f POST %s...\n", run_time(), resource);
+
+ if (httpPost(http, resource))
+ {
+ if (httpReconnect(http))
+ {
+ _cupsSetError(IPP_DEVICE_ERROR, "Unable to reconnect");
+ return (NULL);
+ }
+ else if (httpPost(http, resource))
+ {
+ _cupsSetError(IPP_GONE, "Unable to POST");
+ return (NULL);
+ }
+ }
+
+ /*
+ * Send the IPP data...
+ */
+
+ request->state = IPP_IDLE;
+ status = HTTP_CONTINUE;
+
+ while ((state = ippWrite(http, request)) != IPP_DATA)
+ if (state == IPP_ERROR)
+ {
+ status = HTTP_ERROR;
+ break;
+ }
+ else if (httpCheck(http))
+ {
+ if ((status = httpUpdate(http)) != HTTP_CONTINUE)
+ break;
+ }
+
+ /*
+ * Get the server's return status...
+ */
+
+ debug_printf("DEBUG: %.3f Getting response...\n", run_time());
+
+ while (status == HTTP_CONTINUE)
+ if (httpWait(http, 1000))
+ status = httpUpdate(http);
+ else
+ {
+ status = HTTP_ERROR;
+ http->error = ETIMEDOUT;
+ }
+
+ if (status != HTTP_OK)
+ {
+ /*
+ * Flush any error message...
+ */
+
+ httpFlush(http);
+ response = NULL;
+ }
+ else
+ {
+ /*
+ * Read the response...
+ */
+
+ response = ippNew();
+
+ while ((state = ippRead(http, response)) != IPP_DATA)
+ if (state == IPP_ERROR)
+ {
+ /*
+ * Delete the response...
+ */
+
+ ippDelete(response);
+ response = NULL;
+
+ _cupsSetError(IPP_SERVICE_UNAVAILABLE, strerror(errno));
+ break;
+ }
+ }
+
+ /*
+ * Delete the original request and return the response...
+ */
+
+ ippDelete(request);
+
+ if (response)
+ {
+ ipp_attribute_t *attr; /* status-message attribute */
+
+
+ attr = ippFindAttribute(response, "status-message", IPP_TAG_TEXT);
+
+ _cupsSetError(response->request.status.status_code,
+ attr ? attr->values[0].string.text :
+ 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 :
+ _cupsSetError(IPP_SERVICE_UNAVAILABLE, httpStatus(status));
+ break;
+ }
+ }
+
+ return (response);
+}
+
+
/*
* 'fix_make_model()' - Fix common problems in the make-and-model string.
*/
_cups_strcpy(mmptr, mmptr + 7);
}
+ if ((mmptr = strstr(make_model, " Network")) != NULL)
+ {
+ /*
+ * Drop unnecessary informational text, e.g. "Xerox DocuPrint N2025
+ * Network LaserJet - 2.12" becomes "Xerox DocuPrint N2025"...
+ */
+
+ *mmptr = '\0';
+ }
+
if ((mmptr = strchr(make_model, ',')) != NULL)
{
/*
/*
- * 'list_devices()' - List all of the devices we found...
+ * 'list_device()' - List a device we found...
*/
static void
-list_devices(void)
+list_device(snmp_cache_t *cache) /* I - Cached device */
{
- snmp_cache_t *cache; /* Cached device */
-
-
- for (cache = (snmp_cache_t *)cupsArrayFirst(Devices);
- cache;
- cache = (snmp_cache_t *)cupsArrayNext(Devices))
- if (cache->uri)
- printf("network %s \"%s\" \"%s %s\" \"%s\"\n",
- cache->uri,
- cache->make_and_model ? cache->make_and_model : "Unknown",
- cache->make_and_model ? cache->make_and_model : "Unknown",
- cache->addrname, cache->id ? cache->id : "");
+ if (cache->uri)
+ printf("network %s \"%s\" \"%s %s\" \"%s\"\n",
+ cache->uri,
+ cache->make_and_model ? cache->make_and_model : "Unknown",
+ cache->make_and_model ? cache->make_and_model : "Unknown",
+ cache->addrname, cache->id ? cache->id : "");
}
debug_printf("DEBUG: %.3f Probing %s...\n", run_time(), device->addrname);
- if ((http = httpConnect(device->addrname, 631)) != NULL)
+ if (device->make_and_model &&
+ (!strncasecmp(device->make_and_model, "Xerox", 5) ||
+ !strncasecmp(device->make_and_model, "Kyocera", 7)))
+ {
+ /*
+ * Xerox and Kyocera printers often lock up on IPP probes, so exclude
+ * them from the IPP connection test...
+ */
+
+ http = NULL;
+ }
+ else
+ {
+ /*
+ * Otherwise, try connecting for up to 1 second...
+ */
+
+ alarm(1);
+ http = httpConnect(device->addrname, 631);
+ alarm(0);
+ }
+
+ if (http);
{
/*
* IPP is supported...
};
- debug_printf("DEBUG: %s supports IPP!\n", device->addrname);
-
/*
* Use non-blocking IO...
*/
i < (int)(sizeof(resources) / sizeof(resources[0]));
i ++)
{
+ /*
+ * Stop early if we are out of time...
+ */
+
+ if (MaxRunTime > 0 && run_time() >= MaxRunTime)
+ break;
+
/*
* Don't look past /ipp if we have found a working URI...
*/
httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
device->addrname, 631, resources[i]);
- debug_printf("DEBUG: Trying %s (num_uris=%d)\n", uri, num_uris);
-
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
- response = cupsDoRequest(http, request, resources[i]);
+ response = do_request(http, request, resources[i]);
- debug_printf("DEBUG: %s %s (%s)\n", uri,
+ debug_printf("DEBUG: %.3f %s %s (%s)\n", run_time(), uri,
ippErrorString(cupsLastError()), cupsLastErrorString());
if (response && response->request.status.status_code == IPP_OK)
int linenum; /* Line number */
const char *cups_serverroot; /* CUPS_SERVERROOT env var */
const char *debug; /* CUPS_DEBUG_LEVEL env var */
+ const char *runtime; /* CUPS_MAX_RUN_TIME env var */
/*
if ((debug = getenv("CUPS_DEBUG_LEVEL")) != NULL)
DebugLevel = atoi(debug);
+ if ((runtime = getenv("CUPS_MAX_RUN_TIME")) != NULL)
+ MaxRunTime = atoi(runtime);
+
/*
* Find the snmp.conf file...
*/
!strcasecmp(value, "yes") ||
!strcasecmp(value, "true") ||
!strcasecmp(value, "double");
+ else if (!strcasecmp(line, "MaxRunTime"))
+ MaxRunTime = atoi(value);
else
fprintf(stderr, "ERROR: Unknown directive %s on line %d of %s!\n",
line, linenum, filename);
for (device = (snmp_cache_t *)cupsArrayFirst(Devices);
device;
device = (snmp_cache_t *)cupsArrayNext(Devices))
- if (!device->uri)
+ if (MaxRunTime > 0 && run_time() >= MaxRunTime)
+ break;
+ else if (!device->uri)
probe_device(device);
debug_printf("DEBUG: %.3f Scan complete!\n", run_time());
addr->ipv4.sin_port = htons(port);
- signal(SIGALRM, alarm_handler);
alarm(1);
status = connect(fd, (void *)addr, httpAddrLength(addr));
device->make_and_model = strdup(make_model);
}
+
+ list_device(device);
}
/*
- * End of "$Id: snmp.c 5736 2006-07-13 19:59:36Z mike $".
+ * End of "$Id: snmp.c 5898 2006-08-28 18:54:10Z mike $".
*/
/*
- * "$Id: lpc.c 5023 2006-01-29 14:39:44Z mike $"
+ * "$Id: lpc.c 5833 2006-08-16 20:05:58Z mike $"
*
* "lpc" command for the Common UNIX Printing System (CUPS).
*
*params; /* Pointer to parameters */
+ _cupsSetLocale();
+
/*
* Connect to the scheduler...
*/
/*
- * End of "$Id: lpc.c 5023 2006-01-29 14:39:44Z mike $".
+ * End of "$Id: lpc.c 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: lpq.c 5638 2006-06-06 20:08:13Z mike $"
+ * "$Id: lpq.c 5838 2006-08-17 14:41:42Z mike $"
*
* "lpq" command for the Common UNIX Printing System (CUPS).
*
longstatus; /* Show file details */
int num_dests; /* Number of destinations */
cups_dest_t *dests; /* Destinations */
- cups_lang_t *language; /* Language */
+ _cupsSetLocale();
+
/*
* Check for command-line options...
*/
interval = 0;
longstatus = 0;
all = 0;
- language = cupsLangDefault();
num_dests = 0;
+ dests = NULL;
for (i = 1; i < argc; i ++)
if (argv[i][0] == '+')
/*
- * End of "$Id: lpq.c 5638 2006-06-06 20:08:13Z mike $".
+ * End of "$Id: lpq.c 5838 2006-08-17 14:41:42Z mike $".
*/
/*
- * "$Id: lpr.c 5235 2006-03-06 13:02:23Z mike $"
+ * "$Id: lpr.c 5838 2006-08-17 14:41:42Z mike $"
*
* "lpr" command for the Common UNIX Printing System (CUPS).
*
ssize_t bytes; /* Bytes copied */
off_t filesize; /* Size of temp file */
int temp; /* Temporary file descriptor */
- cups_lang_t *language; /* Language information */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Signal action */
struct sigaction oldaction; /* Old signal action */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ _cupsSetLocale();
+
deletefile = 0;
printer = NULL;
num_dests = 0;
options = NULL;
num_files = 0;
title = NULL;
- language = cupsLangDefault();
for (i = 1; i < argc; i ++)
if (argv[i][0] == '-')
/*
- * End of "$Id: lpr.c 5235 2006-03-06 13:02:23Z mike $".
+ * End of "$Id: lpr.c 5838 2006-08-17 14:41:42Z mike $".
*/
/*
- * "$Id: lprm.c 5719 2006-07-11 21:04:48Z mike $"
+ * "$Id: lprm.c 5878 2006-08-24 15:55:42Z mike $"
*
* "lprm" command for the Common UNIX Printing System (CUPS).
*
ipp_t *request; /* IPP request */
ipp_t *response; /* IPP response */
ipp_op_t op; /* Operation */
- cups_lang_t *language; /* Language */
int num_dests; /* Number of destinations */
cups_dest_t *dests, /* Destinations */
*defdest; /* Default destination */
http_encryption_t encryption; /* Encryption? */
+ _cupsSetLocale();
+
/*
* Setup to cancel individual print jobs...
*/
response = NULL;
http = NULL;
encryption = cupsEncryption();
- language = cupsLangDefault();
/*
* Open a connection to the server...
}
/*
- * If nothing has been cancelled yet, cancel the current job on the specified
+ * If nothing has been canceled yet, cancel the current job on the specified
* (or default) printer...
*/
/*
- * End of "$Id: lprm.c 5719 2006-07-11 21:04:48Z mike $".
+ * End of "$Id: lprm.c 5878 2006-08-24 15:55:42Z mike $".
*/
/*
- * "$Id: admin.c 5572 2006-05-22 18:47:09Z mike $"
+ * "$Id: admin.c 5878 2006-08-24 15:55:42Z mike $"
*
* Administration CGI for the Common UNIX Printing System (CUPS).
*
int num_settings; /* Number of server settings */
cups_option_t *settings; /* Server settings */
+ const char *debug_logging, /* DEBUG_LOGGING value */
+ *remote_admin, /* REMOTE_ADMIN value */
+ *remote_printers,
+ /* REMOTE_PRINTERS value */
+ *share_printers,/* SHARE_PRINTERS value */
+ *user_cancel_any;
+ /* USER_CANCEL_ANY value */
- num_settings = 0;
- num_settings = cupsAddOption(CUPS_SERVER_DEBUG_LOGGING,
- cgiGetVariable("DEBUG_LOGGING") ? "1" : "0",
- num_settings, &settings);
- num_settings = cupsAddOption(CUPS_SERVER_REMOTE_ADMIN,
- cgiGetVariable("REMOTE_ADMIN") ? "1" : "0",
- num_settings, &settings);
- num_settings = cupsAddOption(CUPS_SERVER_REMOTE_PRINTERS,
- cgiGetVariable("REMOTE_PRINTERS") ? "1" : "0",
- num_settings, &settings);
- num_settings = cupsAddOption(CUPS_SERVER_SHARE_PRINTERS,
- cgiGetVariable("SHARE_PRINTERS") ? "1" : "0",
- num_settings, &settings);
- num_settings = cupsAddOption(CUPS_SERVER_USER_CANCEL_ANY,
- cgiGetVariable("USER_CANCEL_ANY") ? "1" : "0",
- num_settings, &settings);
-
-
- if (!_cupsAdminSetServerSettings(http, num_settings, settings))
+ /*
+ * Get the checkbox values from the form...
+ */
+
+ debug_logging = cgiGetVariable("DEBUG_LOGGING") ? "1" : "0";
+ remote_admin = cgiGetVariable("REMOTE_ADMIN") ? "1" : "0";
+ remote_printers = cgiGetVariable("REMOTE_PRINTERS") ? "1" : "0";
+ share_printers = cgiGetVariable("SHARE_PRINTERS") ? "1" : "0";
+ user_cancel_any = cgiGetVariable("USER_CANCEL_ANY") ? "1" : "0";
+
+ /*
+ * Get the current server settings...
+ */
+
+ if (!_cupsAdminGetServerSettings(http, &num_settings, &settings))
{
cgiStartHTML(cgiText(_("Change Settings")));
cgiSetVariable("MESSAGE",
cgiText(_("Unable to change server settings:")));
cgiSetVariable("ERROR", cupsLastErrorString());
cgiCopyTemplateLang("error.tmpl");
+ cgiEndHTML();
+ return;
+ }
+
+ /*
+ * See if the settings have changed...
+ */
+
+ if (strcmp(debug_logging, cupsGetOption(CUPS_SERVER_DEBUG_LOGGING,
+ num_settings, settings)) ||
+ strcmp(remote_admin, cupsGetOption(CUPS_SERVER_REMOTE_ADMIN,
+ num_settings, settings)) ||
+ strcmp(remote_printers, cupsGetOption(CUPS_SERVER_REMOTE_PRINTERS,
+ num_settings, settings)) ||
+ strcmp(share_printers, cupsGetOption(CUPS_SERVER_SHARE_PRINTERS,
+ num_settings, settings)) ||
+ strcmp(user_cancel_any, cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY,
+ num_settings, settings)))
+ {
+ /*
+ * Settings *have* changed, so save the changes...
+ */
+
+ cupsFreeOptions(num_settings, settings);
+
+ num_settings = 0;
+ num_settings = cupsAddOption(CUPS_SERVER_DEBUG_LOGGING,
+ debug_logging, num_settings, &settings);
+ num_settings = cupsAddOption(CUPS_SERVER_REMOTE_ADMIN,
+ remote_admin, num_settings, &settings);
+ num_settings = cupsAddOption(CUPS_SERVER_REMOTE_PRINTERS,
+ remote_printers, num_settings, &settings);
+ num_settings = cupsAddOption(CUPS_SERVER_SHARE_PRINTERS,
+ share_printers, num_settings, &settings);
+ num_settings = cupsAddOption(CUPS_SERVER_USER_CANCEL_ANY,
+ user_cancel_any, num_settings, &settings);
+
+ if (!_cupsAdminSetServerSettings(http, num_settings, settings))
+ {
+ cgiStartHTML(cgiText(_("Change Settings")));
+ cgiSetVariable("MESSAGE",
+ cgiText(_("Unable to change server settings:")));
+ cgiSetVariable("ERROR", cupsLastErrorString());
+ cgiCopyTemplateLang("error.tmpl");
+ }
+ else
+ {
+ cgiSetVariable("refresh_page", "5;URL=/admin/?OP=redirect");
+ cgiStartHTML(cgiText(_("Change Settings")));
+ cgiCopyTemplateLang("restart.tmpl");
+ }
}
else
{
+ /*
+ * No changes...
+ */
+
cgiSetVariable("refresh_page", "5;URL=/admin/?OP=redirect");
cgiStartHTML(cgiText(_("Change Settings")));
- cgiCopyTemplateLang("restart.tmpl");
+ cgiCopyTemplateLang("norestart.tmpl");
}
cupsFreeOptions(num_settings, settings);
/*
- * End of "$Id: admin.c 5572 2006-05-22 18:47:09Z mike $".
+ * End of "$Id: admin.c 5878 2006-08-24 15:55:42Z mike $".
*/
/*
- * "$Id: ipp-var.c 5572 2006-05-22 18:47:09Z mike $"
+ * "$Id: ipp-var.c 5838 2006-08-17 14:41:42Z mike $"
*
* CGI <-> IPP variable routines for the Common UNIX Printing System (CUPS).
*
*/
num_attrs = 0;
+ attrs[0] = NULL; /* Eliminate compiler warning */
while ((ch = getc(in)) != EOF)
if (ch == '\\')
/*
- * End of "$Id: ipp-var.c 5572 2006-05-22 18:47:09Z mike $".
+ * End of "$Id: ipp-var.c 5838 2006-08-17 14:41:42Z mike $".
*/
dnl
-dnl "$Id: cups-common.m4 5466 2006-04-26 19:52:27Z mike $"
+dnl "$Id: cups-common.m4 5843 2006-08-17 18:49:31Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
AC_CONFIG_HEADER(config.h)
dnl Versio number information...
-CUPS_VERSION="1.2svn"
+CUPS_VERSION="1.2.3"
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'`"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
dnl
-dnl End of "$Id: cups-common.m4 5466 2006-04-26 19:52:27Z mike $".
+dnl End of "$Id: cups-common.m4 5843 2006-08-17 18:49:31Z mike $".
dnl
dnl
-dnl "$Id: cups-defaults.m4 5745 2006-07-18 13:45:56Z mike $"
+dnl "$Id: cups-defaults.m4 5804 2006-08-04 16:51:58Z mike $"
dnl
dnl Default cupsd configuration settings for the Common UNIX Printing System
dnl (CUPS).
dnl Default langugages...
AC_ARG_WITH(languages, [ --with-languages set installed languages, default="de es ja pl sv" ],
- LANGUAGES="$withval",
+ if test "x$withval" != xno; then
+ LANGUAGES="$withval"
+ fi,
LANGUAGES="de es ja pl sv")
AC_SUBST(LANGUAGES)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP")
dnl
-dnl End of "$Id: cups-defaults.m4 5745 2006-07-18 13:45:56Z mike $".
+dnl End of "$Id: cups-defaults.m4 5804 2006-08-04 16:51:58Z mike $".
dnl
dnl
-dnl "$Id: cups-directories.m4 5696 2006-06-26 18:34:20Z mike $"
+dnl "$Id: cups-directories.m4 5905 2006-08-29 20:48:59Z mike $"
dnl
dnl Directory stuff for the Common UNIX Printing System (CUPS).
dnl
sharedstatedir="/usr/com"
fi
+dnl Fix "datarootdir" variable if it hasn't been specified...
+if test "$datarootdir" = "\${prefix}/share"; then
+ if test "$prefix" = "/"; then
+ datarootdir="/usr/share"
+ else
+ datarootdir="$prefix/share"
+ fi
+fi
+
dnl Fix "datadir" variable if it hasn't been specified...
if test "$datadir" = "\${prefix}/share"; then
if test "$prefix" = "/"; then
else
datadir="$prefix/share"
fi
+elif test "$datadir" = "\${datarootdir}"; then
+ datadir="$datarootdir"
fi
dnl Fix "includedir" variable if it hasn't been specified...
dnl Xinetd support...
XINETD=""
-for dir in /private/etc/xinetd.d /etc/xinetd.d /usr/local/etc/xinetd.d; do
- if test -d $dir; then
- XINETD="$dir"
- break
- fi
-done
+
+if test ! -x /sbin/launchd; then
+ for dir in /private/etc/xinetd.d /etc/xinetd.d /usr/local/etc/xinetd.d; do
+ if test -d $dir; then
+ XINETD="$dir"
+ break
+ fi
+ done
+fi
AC_SUBST(XINETD)
if test x$cachedir = x; then
if test "x$uname" = xDarwin; then
- CUPS_CACHEDIR="$localstatedir/tmp/cups"
+ CUPS_CACHEDIR="$localstatedir/spool/cups/cache"
else
CUPS_CACHEDIR="$localstatedir/cache/cups"
fi
AC_SUBST(CUPS_STATEDIR)
dnl
-dnl End of "$Id: cups-directories.m4 5696 2006-06-26 18:34:20Z mike $".
+dnl End of "$Id: cups-directories.m4 5905 2006-08-29 20:48:59Z mike $".
dnl
dnl
-dnl "$Id: cups-manpages.m4 5466 2006-04-26 19:52:27Z mike $"
+dnl "$Id: cups-manpages.m4 5799 2006-08-03 00:54:38Z mike $"
dnl
dnl Manpage stuff for the Common UNIX Printing System (CUPS).
dnl
-dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
+dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
dnl
dnl Fix "mandir" variable...
+if test "$mandir" = "\${datarootdir}/man" -a "$prefix" = "/"; then
+ # New GNU "standards" break previous ones, so make sure we use
+ # the right default location for the operating system...
+ mandir="\${prefix}/man"
+fi
+
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/"; then
case "$uname" in
Darwin* | Linux | GNU | *BSD* | AIX*)
AC_SUBST(MAN8DIR)
dnl
-dnl End of "$Id: cups-manpages.m4 5466 2006-04-26 19:52:27Z mike $".
+dnl End of "$Id: cups-manpages.m4 5799 2006-08-03 00:54:38Z mike $".
dnl
dnl
-dnl "$Id: configure.in 5609 2006-05-30 20:31:10Z mike $"
+dnl "$Id: configure.in 5804 2006-08-04 16:51:58Z mike $"
dnl
dnl Configuration script for the Common UNIX Printing System (CUPS).
dnl
INSTALL_LANGUAGES="install-languages"
UNINSTALL_LANGUAGES="uninstall-languages"
for lang in $LANGUAGES; do
- LANGFILES="$LANGFILES doc/$lang/index.html"
- LANGFILES="$LANGFILES templates/$lang/edit-config.tmpl"
- LANGFILES="$LANGFILES templates/$lang/header.tmpl"
+ if test -f doc/$lang/index.html.in; 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
done
fi
chmod +x cups-config
dnl
-dnl End of "$Id: configure.in 5609 2006-05-30 20:31:10Z mike $".
+dnl End of "$Id: configure.in 5804 2006-08-04 16:51:58Z mike $".
dnl
#! /bin/sh
#
-# "$Id: cups-config.in 5688 2006-06-23 20:33:08Z mike $"
+# "$Id: cups-config.in 5799 2006-08-03 00:54:38Z mike $"
#
# CUPS configuration utility.
#
includedir=@includedir@
libdir=@libdir@
imagelibdir=@libdir@
+datarootdir=@datadir@
datadir=@datadir@
sysconfdir=@sysconfdir@
cups_datadir=@CUPS_DATADIR@
done
#
-# End of "$Id: cups-config.in 5688 2006-06-23 20:33:08Z mike $".
+# End of "$Id: cups-config.in 5799 2006-08-03 00:54:38Z mike $".
#
#
-# "$Id: Makefile 5628 2006-06-05 15:25:23Z mike $"
+# "$Id: Makefile 5801 2006-08-03 02:20:57Z mike $"
#
# API library Makefile for the Common UNIX Printing System (CUPS).
#
HEADERS = \
adminutil.h \
array.h \
+ backend.h \
cups.h \
dir.h \
file.h \
#
-# End of "$Id: Makefile 5628 2006-06-05 15:25:23Z mike $".
+# End of "$Id: Makefile 5801 2006-08-03 02:20:57Z mike $".
#
/*
- * "$Id: adminutil.c 5753 2006-07-18 19:53:24Z mike $"
+ * "$Id: adminutil.c 5878 2006-08-24 15:55:42Z mike $"
*
* Administration utility API definitions for the Common UNIX Printing
* System (CUPS).
linenum; /* Current line number */
time_t curtime; /* Current time */
struct tm *curdate; /* Current date */
- static const char *pattrs[] = /* Printer attributes we want */
+ static const char * const pattrs[] = /* Printer attributes we want */
{
"job-hold-until-supported",
"job-hold-until-default",
if (!value)
continue;
- if (!strcasecmp(line, "Port"))
- {
- remote_access = 1;
- }
- else if (!strcasecmp(line, "Listen"))
+ if (!strcasecmp(line, "Port") || !strcasecmp(line, "Listen"))
{
char *port; /* Pointer to port number, if any */
if ((port = strrchr(value, ':')) != NULL)
*port = '\0';
+ else if (isdigit(*value & 255))
+ {
+ /*
+ * Listen on a port number implies remote access...
+ */
+
+ remote_access = 1;
+ continue;
+ }
- if (strcasecmp(value, "localhost") && strcmp(value, "127.0.0.1"))
+ if (strcasecmp(value, "localhost") && strcmp(value, "127.0.0.1")
+#ifdef AF_LOCAL
+ && *value != '/'
+#endif /* AF_LOCAL */
+#ifdef AF_INET6
+ && strcmp(value, "::1")
+#endif /* AF_INET6 */
+ )
remote_access = 1;
}
else if (!strcasecmp(line, "Browsing"))
in_location = 0;
}
else if (!strcasecmp(line, "Allow") && in_admin_location &&
- strcasecmp(value, "localhost") && strcasecmp(value, "127.0.0.1"))
+ strcasecmp(value, "localhost") && strcasecmp(value, "127.0.0.1")
+#ifdef AF_LOCAL
+ && *value != '/'
+#endif /* AF_LOCAL */
+#ifdef AF_INET6
+ && strcmp(value, "::1")
+#endif /* AF_INET6 */
+ )
{
remote_admin = 1;
}
{
cupsFilePuts(temp, "# Only listen for connections from the local "
"machine.\n");
- cupsFilePrintf(temp, "Listen 127.0.0.1:%d\n", ippPort());
+ cupsFilePrintf(temp, "Listen localhost:%d\n", ippPort());
}
#ifdef CUPS_DEFAULT_DOMAINSOCKET
{
cupsFilePuts(temp,
"# Only listen for connections from the local machine.\n");
- cupsFilePrintf(temp, "Listen 127.0.0.1:%d\n", ippPort());
+ cupsFilePrintf(temp, "Listen localhost:%d\n", ippPort());
}
#ifdef CUPS_DEFAULT_DOMAINSOCKET
* Read cupsd.conf via a HTTP GET request...
*/
- if ((fd = cupsTempFd(name, sizeof(name))) < 0)
+ if ((fd = cupsTempFd(name, namesize)) < 0)
{
*name = '\0';
/*
- * End of "$Id: adminutil.c 5753 2006-07-18 19:53:24Z mike $".
+ * End of "$Id: adminutil.c 5878 2006-08-24 15:55:42Z mike $".
*/
/*
- * "$Id: attr.c 5119 2006-02-16 15:52:06Z mike $"
+ * "$Id: attr.c 5826 2006-08-15 19:04:11Z mike $"
*
* PPD model-specific attribute routines for the Common UNIX Printing System
* (CUPS).
* @since CUPS 1.1.19@
*/
-ppd_attr_t * /* O - Attribute or NULL if not found */
-ppdFindAttr(ppd_file_t *ppd, /* I - PPD file data */
- const char *name, /* I - Attribute name */
- const char *spec) /* I - Specifier string or NULL */
+ppd_attr_t * /* O - Attribute or NULL if not found */
+ppdFindAttr(ppd_file_t *ppd, /* I - PPD file data */
+ const char *name, /* I - Attribute name */
+ const char *spec) /* I - Specifier string or NULL */
{
- ppd_attr_t key; /* Search key */
+ ppd_attr_t key, /* Search key */
+ *attr; /* Current attribute */
+ int diff; /* Current difference */
+
+ DEBUG_printf(("ppdFindAttr(ppd=%p, name=\"%s\", spec=\"%s\")\n", ppd,
+ name ? name : "(null)", spec ? spec : "(null)"));
/*
* Range check input...
* Return the first matching attribute, if any...
*/
- return ((ppd_attr_t *)cupsArrayFind(ppd->sorted_attrs, &key));
+ if ((attr = (ppd_attr_t *)cupsArrayFind(ppd->sorted_attrs, &key)) != NULL)
+ return (attr);
+ else if (spec)
+ return (NULL);
+
+ /*
+ * No match found, loop through the sorted attributes to see if we can
+ * find a "wildcard" match for the attribute...
+ */
+
+ for (attr = (ppd_attr_t *)cupsArrayFirst(ppd->sorted_attrs);
+ attr;
+ attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs))
+ {
+ if ((diff = strcasecmp(attr->name, name)) == 0)
+ break;
+
+ if (diff > 0)
+ {
+ /*
+ * All remaining attributes are > than the one we are trying to find...
+ */
+
+ cupsArrayIndex(ppd->sorted_attrs, cupsArrayCount(ppd->sorted_attrs));
+
+ return (NULL);
+ }
+ }
+
+ return (attr);
}
/*
- * End of "$Id: attr.c 5119 2006-02-16 15:52:06Z mike $".
+ * End of "$Id: attr.c 5826 2006-08-15 19:04:11Z mike $".
*/
/*
- * "$Id: cups.h 5233 2006-03-06 03:39:28Z mike $"
+ * "$Id: cups.h 5805 2006-08-04 16:52:31Z mike $"
*
* API definitions for the Common UNIX Printing System (CUPS).
*
* Constants...
*/
-# define CUPS_VERSION 1.0200
+# define CUPS_VERSION 1.0203
# define CUPS_VERSION_MAJOR 1
# define CUPS_VERSION_MINOR 2
-# define CUPS_VERSION_PATCH 0
+# define CUPS_VERSION_PATCH 3
# define CUPS_DATE_ANY -1
#endif /* !_CUPS_CUPS_H_ */
/*
- * End of "$Id: cups.h 5233 2006-03-06 03:39:28Z mike $".
+ * End of "$Id: cups.h 5805 2006-08-04 16:52:31Z mike $".
*/
*
* This set of APIs abstracts enumeration of directory entries.
*
- * Copyright 1997-2005 by Easy Software Products, all rights reserved.
+ * Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* C++ magic...
*/
-# ifdef _cplusplus
+# ifdef __cplusplus
extern "C" {
-# endif /* _cplusplus */
+# endif /* __cplusplus */
/*
extern void cupsDirRewind(cups_dir_t *dp);
-# ifdef _cplusplus
+# ifdef __cplusplus
}
-# endif /* _cplusplus */
+# endif /* __cplusplus */
#endif /* !_CUPS_DIR_H_ */
/*
/*
- * "$Id: file.c 5324 2006-03-23 16:47:46Z mike $"
+ * "$Id: file.c 5812 2006-08-09 22:42:51Z mike $"
*
* File functions for the Common UNIX Printing System (CUPS).
*
fp->pos = 0;
fp->ptr = NULL;
fp->end = NULL;
+ fp->eof = 0;
return (0);
}
/*
- * End of "$Id: file.c 5324 2006-03-23 16:47:46Z mike $".
+ * End of "$Id: file.c 5812 2006-08-09 22:42:51Z mike $".
*/
/*
- * "$Id: file.h 5319 2006-03-21 15:28:29Z mike $"
+ * "$Id: file.h 5769 2006-07-20 17:17:14Z mike $"
*
* Public file definitions for the Common UNIX Printing System (CUPS).
*
* our own file functions allows us to provide transparent support of
* gzip'd print files, PPD files, etc.
*
- * Copyright 1997-2005 by Easy Software Products, all rights reserved.
+ * Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* C++ magic...
*/
-# ifdef _cplusplus
+# ifdef __cplusplus
extern "C" {
-# endif /* _cplusplus */
+# endif /* __cplusplus */
/*
extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf, size_t bytes);
-# ifdef _cplusplus
+# ifdef __cplusplus
}
-# endif /* _cplusplus */
+# endif /* __cplusplus */
#endif /* !_CUPS_FILE_H_ */
/*
- * End of "$Id: file.h 5319 2006-03-21 15:28:29Z mike $".
+ * End of "$Id: file.h 5769 2006-07-20 17:17:14Z mike $".
*/
/*
- * "$Id: http.c 5753 2006-07-18 19:53:24Z mike $"
+ * "$Id: http.c 5889 2006-08-24 21:44:35Z mike $"
*
* HTTP routines for the Common UNIX Printing System (CUPS).
*
DEBUG_printf(("httpPrintf: %s", buf));
- if (http->wused)
+ if (http->data_encoding == HTTP_ENCODE_FIELDS)
+ return (httpWrite2(http, buf, bytes));
+ else
{
- DEBUG_puts(" flushing existing data...");
+ if (http->wused)
+ {
+ DEBUG_puts(" flushing existing data...");
- if (httpFlushWrite(http) < 0)
- return (-1);
- }
+ if (httpFlushWrite(http) < 0)
+ return (-1);
+ }
- return (http_write(http, buf, bytes));
+ return (http_write(http, buf, bytes));
+ }
}
httpFlushWrite(http);
}
- if ((length + http->wused) <= sizeof(http->wbuffer))
+ if ((length + http->wused) < sizeof(http->wbuffer))
{
/*
* Write to buffer...
if (httpReconnect(http))
return (-1);
+ /*
+ * Flush any written data that is pending...
+ */
+
+ if (http->wused)
+ httpFlushWrite(http);
+
/*
* Send the request header...
*/
- http->state = request;
+ http->state = request;
+ http->data_encoding = HTTP_ENCODE_FIELDS;
+
if (request == HTTP_POST || request == HTTP_PUT)
http->state ++;
return (-1);
}
+ httpFlushWrite(http);
httpGetLength2(http);
httpClearFields(http);
/*
- * End of "$Id: http.c 5753 2006-07-18 19:53:24Z mike $".
+ * End of "$Id: http.c 5889 2006-08-24 21:44:35Z mike $".
*/
/*
- * "$Id: http.h 5716 2006-07-11 17:56:57Z mike $"
+ * "$Id: http.h 5889 2006-08-24 21:44:35Z mike $"
*
* Hyper-Text Transport Protocol definitions for the Common UNIX Printing
* System (CUPS).
# include <winsock2.h>
# include <ws2tcpip.h>
# else
-# ifdef __sgi /* IRIX needs this for IPv6 support!?! */
-# define INET6
+# ifdef __sgi
+# define INET6 /* IRIX IPv6 support... */
# endif /* __sgi */
# include <unistd.h>
# include <sys/time.h>
# if !defined(__APPLE__) || !defined(TCP_NODELAY)
# include <netinet/tcp.h>
# endif /* !__APPLE__ || !TCP_NODELAY */
+# if defined(AF_UNIX) && !defined(AF_LOCAL)
+# define AF_LOCAL AF_UNIX /* Older UNIX's have old names... */
+# endif /* AF_UNIX && !AF_LOCAL */
# ifdef AF_LOCAL
# include <sys/un.h>
# endif /* AF_LOCAL */
typedef enum http_encoding_e /**** HTTP transfer encoding values ****/
{
HTTP_ENCODE_LENGTH, /* Data is sent with Content-Length */
- HTTP_ENCODE_CHUNKED /* Data is chunked */
+ HTTP_ENCODE_CHUNKED, /* Data is chunked */
+ HTTP_ENCODE_FIELDS /* Sending HTTP fields */
} http_encoding_t;
typedef enum http_encryption_e /**** HTTP encryption values ****/
#endif /* !_CUPS_HTTP_H_ */
/*
- * End of "$Id: http.h 5716 2006-07-11 17:56:57Z mike $".
+ * End of "$Id: http.h 5889 2006-08-24 21:44:35Z mike $".
*/
/*
- * "$Id: i18n.h 5366 2006-04-02 16:11:04Z mike $"
+ * "$Id: i18n.h 5833 2006-08-16 20:05:58Z mike $"
*
* (Private) localization support for the Common UNIX Printing System (CUPS).
*
extern void _cupsMessageFree(cups_array_t *a);
extern cups_array_t *_cupsMessageLoad(const char *filename);
extern const char *_cupsMessageLookup(cups_array_t *a, const char *m);
+extern void _cupsSetLocale(void);
# ifdef __cplusplus
}
#endif /* !_CUPS_I18N_H_ */
/*
- * End of "$Id: i18n.h 5366 2006-04-02 16:11:04Z mike $".
+ * End of "$Id: i18n.h 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: ipp-support.c 5246 2006-03-08 13:22:09Z mike $"
+ * "$Id: ipp-support.c 5905 2006-08-29 20:48:59Z mike $"
*
* Internet Printing Protocol support functions for the Common UNIX
* Printing System (CUPS).
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
+ DEBUG_puts("ippPort()");
+
+ if (!cg->ipp_port)
+ {
+ /*
+ * See if the server definition includes the port number...
+ */
+
+ DEBUG_puts("ippPort: Not initialized...");
+
+ cupsServer();
+
+#ifdef DEBUG
+ if (cg->ipp_port)
+ puts("ippPort: Set via cupsServer()...");
+#endif /* DEBUG */
+ }
+
if (!cg->ipp_port)
{
if ((ipp_port = getenv("IPP_PORT")) != NULL)
+ {
+ DEBUG_puts("ippPort: Set via IPP_PORT...");
portnum = atoi(ipp_port);
+ }
else if ((port = getservbyname("ipp", NULL)) == NULL)
+ {
+ DEBUG_puts("ippPort: Set via CUPS_DEFAULT_IPP_PORT...");
portnum = CUPS_DEFAULT_IPP_PORT;
+ }
else
+ {
+ DEBUG_puts("ippPort: Set via ipp service entry...");
portnum = ntohs(port->s_port);
+ }
if (portnum > 0)
cg->ipp_port = portnum;
}
+ DEBUG_printf(("ippPort: Returning %d...\n", cg->ipp_port));
+
return (cg->ipp_port);
}
void
ippSetPort(int p) /* I - Port number to use */
{
+ DEBUG_printf(("ippSetPort(p=%d)\n", p));
+
_cupsGlobals()->ipp_port = p;
}
/*
- * End of "$Id: ipp-support.c 5246 2006-03-08 13:22:09Z mike $".
+ * End of "$Id: ipp-support.c 5905 2006-08-29 20:48:59Z mike $".
*/
/*
- * "$Id: ipp.h 5138 2006-02-21 10:49:06Z mike $"
+ * "$Id: ipp.h 5878 2006-08-24 15:55:42Z mike $"
*
* Internet Printing Protocol definitions for the Common UNIX Printing
* System (CUPS).
IPP_JOB_HELD, /* Job is held for printing */
IPP_JOB_PROCESSING, /* Job is currently printing */
IPP_JOB_STOPPED, /* Job has been stopped */
- IPP_JOB_CANCELLED, /* Job has been cancelled */
+ IPP_JOB_CANCELED, /* Job has been canceled */
IPP_JOB_ABORTED, /* Job has aborted due to error */
IPP_JOB_COMPLETED /* Job has completed successfully */
} ipp_jstate_t;
+#define IPP_JOB_CANCELLED IPP_JOB_CANCELED
typedef enum ipp_pstate_e /**** Printer States.... */
{
IPP_TEMPORARY_ERROR, /* server-error-temporary-error */
IPP_NOT_ACCEPTING, /* server-error-not-accepting-jobs */
IPP_PRINTER_BUSY, /* server-error-busy */
- IPP_ERROR_JOB_CANCELLED, /* server-error-job-canceled */
+ IPP_ERROR_JOB_CANCELED, /* server-error-job-canceled */
IPP_MULTIPLE_JOBS_NOT_SUPPORTED, /* server-error-multiple-document-jobs-not-supported */
IPP_PRINTER_IS_DEACTIVATED /* server-error-printer-is-deactivated */
} ipp_status_t;
+#define IPP_ERROR_JOB_CANCELLED IPP_ERROR_JOB_CANCELED
typedef unsigned char ipp_uchar_t; /**** Unsigned 8-bit integer/character ****/
#endif /* !_CUPS_IPP_H_ */
/*
- * End of "$Id: ipp.h 5138 2006-02-21 10:49:06Z mike $".
+ * End of "$Id: ipp.h 5878 2006-08-24 15:55:42Z mike $".
*/
/*
- * "$Id: langprintf.c 4924 2006-01-13 01:55:20Z mike $"
+ * "$Id: langprintf.c 5833 2006-08-16 20:05:58Z mike $"
*
* Localized printf/puts functions for the Common UNIX Printing
* System (CUPS).
*
* _cupsLangPrintf() - Print a formatted message string to a file.
* _cupsLangPuts() - Print a static message string to a file.
+ * _cupsSetLocale() - Set the current locale.
*/
/*
/*
- * End of "$Id: langprintf.c 4924 2006-01-13 01:55:20Z mike $".
+ * '_cupsSetLocale()' - Set the current locale.
+ */
+
+void
+_cupsSetLocale(void)
+{
+#ifdef LC_TIME
+ const char *lc_time; /* Current LC_TIME value */
+ char new_lc_time[255], /* New LC_TIME value */
+ *charset; /* Pointer to character set */
+#endif /* LC_TIME */
+
+
+ /*
+ * Set the locale so that times, etc. are displayed properly.
+ *
+ * Unfortunately, while we need the localized time value, we *don't*
+ * want to use the localized charset for the time value, so we need
+ * to set LC_TIME to the locale name with .UTF-8 on the end (if
+ * the locale includes a character set specifier...)
+ */
+
+ setlocale(LC_ALL, "");
+
+#ifdef LC_TIME
+ if ((lc_time = setlocale(LC_TIME, NULL)) == NULL)
+ lc_time = setlocale(LC_ALL, NULL);
+
+ if (lc_time)
+ {
+ strlcpy(new_lc_time, lc_time, sizeof(new_lc_time));
+ if ((charset = strchr(new_lc_time, '.')) == NULL)
+ charset = new_lc_time + strlen(new_lc_time);
+
+ strlcpy(charset, ".UTF-8", sizeof(new_lc_time) - (charset - new_lc_time));
+ }
+ else
+ strcpy(new_lc_time, "C");
+
+ setlocale(LC_TIME, new_lc_time);
+#endif /* LC_TIME */
+}
+
+
+/*
+ * End of "$Id: langprintf.c 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: language.c 5753 2006-07-18 19:53:24Z mike $"
+ * "$Id: language.c 5769 2006-07-20 17:17:14Z mike $"
*
* I18N/language support for the Common UNIX Printing System (CUPS).
*
*d = *d * 8 + *s - '0';
s ++;
}
+
+ d ++;
}
else
{
/*
- * End of "$Id: language.c 5753 2006-07-18 19:53:24Z mike $".
+ * End of "$Id: language.c 5769 2006-07-20 17:17:14Z mike $".
*/
_cupsMessageLoad
_cupsMessageLookup
_cupsSetError
+_cupsSetLocale
_cupsStrAlloc
_cupsStrFlush
_cupsStrFormatd
/*
- * "$Id: localize.c 5391 2006-04-14 12:26:50Z mike $"
+ * "$Id: localize.c 5826 2006-08-15 19:04:11Z mike $"
*
* PPD custom option routines for the Common UNIX Printing System (CUPS).
*
* Range check input...
*/
+ DEBUG_printf(("ppdLocalize(ppd=%p)\n", ppd));
+
if (!ppd)
return (-1);
strlcpy(ll_CC, lang->language, sizeof(ll_CC));
strlcpy(ll, lang->language, sizeof(ll));
+ DEBUG_printf((" lang->language=\"%s\", ll=\"%s\", ll_CC=\"%s\"...\n",
+ lang->language, ll, ll_CC));
+
/*
* Now lookup all of the groups, options, choices, etc.
*/
ppd_attr_t *attr; /* Current attribute */
+ DEBUG_printf(("ppd_text(ppd=%p, keyword=\"%s\", spec=\"%s\", "
+ "ll_CC=\"%s\", ll=\"%s\")\n",
+ ppd, keyword, spec, ll_CC, ll));
+
/*
* Look for Keyword.ll_CC, then Keyword.ll...
*/
- snprintf(lkeyword, sizeof(lkeyword), "%s.%s", keyword, ll_CC);
+ snprintf(lkeyword, sizeof(lkeyword), "%s.%s", ll_CC, keyword);
if ((attr = ppdFindAttr(ppd, lkeyword, spec)) == NULL)
{
- snprintf(lkeyword, sizeof(lkeyword), "%s.%s", keyword, ll);
+ snprintf(lkeyword, sizeof(lkeyword), "%s.%s", ll, keyword);
attr = ppdFindAttr(ppd, lkeyword, spec);
}
+#ifdef DEBUG
+ if (attr)
+ printf(" *%s %s/%s: \"%s\"\n", attr->name, attr->spec, attr->text,
+ attr->value ? attr->value : "");
+ else
+ puts(" NOT FOUND");
+#endif /* DEBUG */
+
/*
* Return text if we find it...
*/
/*
- * End of "$Id: localize.c 5391 2006-04-14 12:26:50Z mike $".
+ * End of "$Id: localize.c 5826 2006-08-15 19:04:11Z mike $".
*/
/*
- * "$Id: notify.c 4961 2006-01-20 22:19:13Z mike $"
+ * "$Id: notify.c 5878 2006-08-24 15:55:42Z mike $"
*
* Notification routines for the Common UNIX Printing System (CUPS).
*
case IPP_JOB_STOPPED :
state = _cupsLangString(lang, _("stopped"));
break;
- case IPP_JOB_CANCELLED :
+ case IPP_JOB_CANCELED :
state = _cupsLangString(lang, _("canceled"));
break;
case IPP_JOB_ABORTED :
/*
- * End of "$Id: notify.c 4961 2006-01-20 22:19:13Z mike $".
+ * End of "$Id: notify.c 5878 2006-08-24 15:55:42Z mike $".
*/
/*
- * "$Id: ppd.c 5333 2006-03-24 00:52:21Z mike $"
+ * "$Id: ppd.c 5826 2006-08-15 19:04:11Z mike $"
*
* PPD file routines for the Common UNIX Printing System (CUPS).
*
if ((ret = strcasecmp(a->name, b->name)) != 0)
return (ret);
- else if (a->spec[0] && b->spec[0])
- return (strcasecmp(a->spec, b->spec));
else
- return (0);
+ return (strcasecmp(a->spec, b->spec));
}
/*
- * End of "$Id: ppd.c 5333 2006-03-24 00:52:21Z mike $".
+ * End of "$Id: ppd.c 5826 2006-08-15 19:04:11Z mike $".
*/
/*
- * "$Id: testi18n.c 5444 2006-04-20 18:16:54Z mike $"
+ * "$Id: testi18n.c 5838 2006-08-17 14:41:42Z mike $"
*
* Internationalization test for Common UNIX Printing System (CUPS).
*
/* "A != <CJK U+4E42>." - use Windows 950 (Big5) or EUC-TW */
cups_utf8_t utf8dest[1024]; /* UTF-8 destination string */
cups_utf32_t utf32dest[1024]; /* UTF-32 destination string */
- _cups_vmap_t *vmap; /* VBCS charmap pointer */
/*
fputs("_cupsCharmapGet(CUPS_EUC_JP): ", stdout);
- if ((vmap = (_cups_vmap_t *)_cupsCharmapGet(CUPS_EUC_JP)) == NULL)
+ if (!_cupsCharmapGet(CUPS_EUC_JP))
{
errors ++;
puts("FAIL");
fputs("_cupsCharmapGet(CUPS_EUC_TW): ", stdout);
- if ((vmap = (_cups_vmap_t *)_cupsCharmapGet(CUPS_EUC_TW)) == NULL)
+ if (!_cupsCharmapGet(CUPS_EUC_TW))
{
errors ++;
puts("FAIL");
/*
- * End of "$Id: testi18n.c 5444 2006-04-20 18:16:54Z mike $"
+ * End of "$Id: testi18n.c 5838 2006-08-17 14:41:42Z mike $"
*/
/*
- * "$Id: testppd.c 5700 2006-06-26 19:20:39Z mike $"
+ * "$Id: testppd.c 5826 2006-08-15 19:04:11Z mike $"
*
* PPD test program for the Common UNIX Printing System (CUPS).
*
else
{
int i, j, k; /* Looping vars */
+ ppd_attr_t *attr; /* Current attribute */
ppd_group_t *group; /* Option group */
ppd_option_t *option; /* Option */
+ char lang[255]; /* LANG environment variable */
+ if (argc > 2)
+ {
+ snprintf(lang, sizeof(lang), "LANG=%s", argv[2]);
+ putenv(lang);
+ }
+
ppdLocalize(ppd);
for (i = ppd->num_groups, group = ppd->groups;
i --, group ++)
{
printf("%s (%s):\n", group->name, group->text);
-
+
for (j = group->num_options, option = group->options;
j > 0;
j --, option ++)
option->choices[k].text);
}
}
+
+ puts("Attributes:");
+
+ for (attr = (ppd_attr_t *)cupsArrayFirst(ppd->sorted_attrs);
+ attr;
+ attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs))
+ printf(" *%s %s/%s: \"%s\"\n", attr->name, attr->spec,
+ attr->text, attr->value ? attr->value : "");
}
}
/*
- * End of "$Id: testppd.c 5700 2006-06-26 19:20:39Z mike $".
+ * End of "$Id: testppd.c 5826 2006-08-15 19:04:11Z mike $".
*/
/*
- * "$Id: transcode.c 5373 2006-04-06 20:03:32Z mike $"
+ * "$Id: transcode.c 5838 2006-08-17 14:41:42Z mike $"
*
* Transcoding support for the Common UNIX Printing System (CUPS).
*
const cups_utf8_t *src, /* I - Source string */
const int maxout) /* I - Max output */
{
- size_t srclen; /* Source string length */
int i; /* Looping variable */
cups_utf8_t ch; /* Character value */
cups_utf8_t next; /* Next character value */
*/
*dest++ = 0xfeff;
- srclen = strlen((char *)src);
for (i = maxout - 1; *src && i > 0; i --)
{
*/
-void * /* O - Charset map pointer */
+static void * /* O - Charset map pointer */
get_charmap(
const cups_encoding_t encoding) /* I - Encoding */
{
/*
- * End of "$Id: transcode.c 5373 2006-04-06 20:03:32Z mike $"
+ * End of "$Id: transcode.c 5838 2006-08-17 14:41:42Z mike $"
*/
/*
- * "$Id: usersys.c 5182 2006-02-26 04:10:27Z mike $"
+ * "$Id: usersys.c 5902 2006-08-29 15:51:19Z mike $"
*
* User, system, and password routines for the Common UNIX Printing
* System (CUPS).
#ifdef WIN32
# include <windows.h>
#endif /* WIN32 */
+#include "debug.h"
/*
linenum = 0;
while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum) != NULL)
+ {
+ DEBUG_printf(("cupsServer: %d: %s %s\n", linenum, line,
+ value ? value : "(null)"));
+
if (!strcasecmp(line, "ServerName") && value)
{
/*
* Got it!
*/
+ DEBUG_puts("cupsServer: Got a ServerName line!");
server = value;
break;
}
+ }
cupsFileClose(fp);
}
* Copy the server name over and set the port number, if any...
*/
+ DEBUG_printf(("cupsServer: Using server \"%s\"...\n", server));
+
strlcpy(cg->server, server, sizeof(cg->server));
if (cg->server[0] != '/' && (port = strrchr(cg->server, ':')) != NULL &&
{
*port++ = '\0';
+ DEBUG_printf(("cupsServer: Using port %d...\n", atoi(port)));
ippSetPort(atoi(port));
}
snprintf(filename, sizeof(filename), "%s/.cups/client.conf", home);
if ((fp = cupsFileOpen(filename, "r")) != NULL)
+ {
+ DEBUG_printf(("cups_open_client_conf: Using \"%s\"...\n", filename));
return (fp);
+ }
snprintf(filename, sizeof(filename), "%s/.cupsrc", home);
if ((fp = cupsFileOpen(filename, "r")) != NULL)
+ {
+ DEBUG_printf(("cups_open_client_conf: Using \"%s\"...\n", filename));
return (fp);
+ }
}
snprintf(filename, sizeof(filename), "%s/client.conf", cg->cups_serverroot);
/*
- * End of "$Id: usersys.c 5182 2006-02-26 04:10:27Z mike $".
+ * End of "$Id: usersys.c 5902 2006-08-29 15:51:19Z mike $".
*/
[Desktop Entry]
Categories=Application;System;X-Red-Hat-Base;
-Comment=CUPS Web Interface
-Comment[en_US]=CUPS Web Interface
Encoding=UTF-8
Exec=htmlview http://localhost:631/
GenericName=
-GenericName[en_US]=
Icon=cups
MimeType=
-Name=Manage Printing
Path=
StartupNotify=false
Terminal=false
X-DCOP-ServiceType=
X-KDE-SubstituteUID=false
X-KDE-Username=
+Name=Manage Printing
+Name[en_US]=Manage Printing
+Comment=CUPS Web Interface
+Comment[en_US]=CUPS Web Interface
Name[es]=Administrar impresión
Comment[es]=Interfaz Web de CUPS
+Name[pl]=ZarzÄ…dzanie drukowaniem
+Comment[pl]=Interfejs WWW CUPS
<P>The default setting is <VAR>off</VAR>.</P>
+<H2 CLASS="title"><A NAME="MaxRunTime">MaxRunTime</A></H2>
+
+<H3>Examples</H3>
+
+<PRE CLASS="command">
+MaxRunTime 10
+MaxRunTime 300
+</PRE>
+
+<H3>Description</H3>
+
+<P>The <CODE>MaxRunTime</CODE> directive specifies the maxium
+number of seconds that the SNMP backend will spend looking for
+printer devices on the network.</P>
+
+<P>The default setting is <VAR>10</VAR>.</P>
+
</BODY>
</HTML>
<HTML>
<!-- SECTION: Getting Started -->
<HEAD>
- <TITLE>Translating CUPS</TITLE>
+ <TITLE>Translating and Customizing CUPS</TITLE>
</HEAD>
<BODY>
<UL>
+ <LI><VAR>desktop/cups.desktop</VAR> - the GNOME/KDE
+ desktop file pointing to the CUPS web interface</LI>
+
<LI><VAR>doc/images/button-*.gif</VAR> - the web
interface button images</LI>
<LI><VAR>templates/*.tmpl</VAR> - the web interface
template files</LI>
-
+
</UL>
-<P>With the exception of the message catalogs, localization files
-are placed in subdirectories under the <VAR>doc</VAR> and
-<VAR>templates</VAR> using the locale name. Locale names are
-either <VAR>ll</VAR> or <VAR>ll_CC</VAR>, where "ll" is the
-2-letter language code and "CC" is the 2-letter country code.</P>
+<P>With the exception of the message catalogs and desktop file,
+localization files are placed in subdirectories under the
+<VAR>doc</VAR> and <VAR>templates</VAR> using the locale name.
+Locale names are either <VAR>ll</VAR> or <VAR>ll_CC</VAR>, where
+"ll" is the 2-letter language code and "CC" is the 2-letter
+country code.</P>
<P>All non-image files must be encoded using the UTF-8 character
set.</P>
<H2 CLASS="title"><A NAME="SUBMIT">Submitting a Translation for CUPS</A></H2>
-<P>To submit a translation for inclusion in CUPS, translate all
-of the button images, template files, the
+<P>To submit a translation for inclusion in CUPS, translate the
+desktop file, all of the button images, template files, the
<VAR>index.html.in</VAR> file, and the message catalog. Place
these files in the correct subdirectory in the CUPS source code
archive and run the following command to create an archive with
your files:</P>
<PRE CLASS="command">
-tar cvf <I>ll_CC</I>.tar.gz doc/<I>ll_CC</I> locale/<I>ll_CC</I>.po templates/<I>ll_CC</I>
+tar cvf <I>ll_CC</I>.tar.gz desktop/cups.desktop doc/<I>ll_CC</I> \
+ locale/cups_<I>ll_CC</I>.po templates/<I>ll_CC</I>
</PRE>
<P>Replace "ll_CC" with the locale name for your translation.
translation to the report.</P>
+<H2 CLASS="title"><A NAME="DESKTOP">The Desktop File</A></H2>
+
+<P>The <VAR>desktop/cups.desktop</VAR> file provides a link to
+the CUPS web interface from desktop environments such as
+GNOME and KDE. To translate this file, add two lines to the
+bottom with the <tt>Name</tt> and <tt>Comment</tt> keys:</P>
+
+<PRE CLASS="command">
+Name[<I>ll_CC</I>]=<I>Translation of "Manage Printing"</I>
+Comment[<I>ll_CC</I>]=<I>Translation of "CUPS Web Interface"</I>
+</PRE>
+
+
<H2 CLASS="title"><A NAME="IMAGES">Button Images</A></H2>
<P>The web interface button images are used to activate functions
<VAR>Btns</VAR menu in the Gimp tool window.</P>
<P>When you have created all of the button images, edit the
-<VAR>doc/Makefile</VAR> file and add the locale name to the
+<VAR>Makedefs</VAR> file and add the locale name to the
<CODE>LANGUAGES</CODE> variable. You can then run "make
install" in the <VAR>doc</VAR> subdirectory to test the
translated buttons.</P>
<PRE CLASS="command">
cd locale
-cp cups.pot fr_CA.po
+cp cups.pot cups_fr_CA.po
</PRE>
-<P>Alternatively, you can copy the existing <VAR>fr.po</VAR>
+<P>Alternatively, you can copy the existing <VAR>cups_fr.po</VAR>
message catalog and then make any necessary changes.</P>
<P>Once you have make your copy of the file, edit it using your
to the desired language.</P>
<P>Finally, add your locale to the <CODE>LANGUAGES</CODE>
-variable in the <VAR>locale/Makefile</VAR> file and run the "make
+variable in the <VAR>Makedefs</VAR> file and run the "make
install" command in the <VAR>locale</VAR> subdirectory to test
the translation.</P>
<VAR>templates/fr_CA</VAR> subdirectory. After you have
translated all of the templates, add the locale to the
<CODE>LANGUAGES</CODE> variable in the
-<VAR>templates/Makefile</VAR> and run "make install" in the
+<VAR>Makedefs</VAR> file and run "make install" in the
<VAR>templates</VAR> subdirectory to test the translation.</P>
<DIV CLASS="table"><TABLE SUMMARY="Web Interface Template Files">
<TD>This template is used as the first form when modifying a
printer.</TD>
</TR>
+<TR>
+ <TD>norestart.tmpl</TD>
+ <TD>This template shows "server not restarted because no
+ changes were made to the configuration".</TD>
+</TR>
<TR>
<TD>option-boolean.tmpl</TD>
<TD>This template is used to select a boolean PPD option.</TD>
/*
- * "$Id: pstops.c 5622 2006-06-01 23:43:21Z mike $"
+ * "$Id: pstops.c 5886 2006-08-24 19:53:17Z mike $"
*
* PostScript filter for the Common UNIX Printing System (CUPS).
*
break;
}
+ puts("%%BeginSetup");
+
+ do_setup(doc, ppd);
+
if (!strncmp(line, "%%BeginSetup", 12))
{
while (strncmp(line, "%%EndSetup", 10))
doc->num_options = include_feature(ppd, line, doc->num_options,
&(doc->options));
}
- else
+ else if (strncmp(line, "%%BeginSetup", 12))
fwrite(line, 1, linelen, stdout);
if ((linelen = cupsFileGetLine(fp, line, linesize)) == 0)
else
fputs("ERROR: Missing %%EndSetup!\n", stderr);
}
- else
- puts("%%BeginSetup");
-
- do_setup(doc, ppd);
puts("%%EndSetup");
/*
- * End of "$Id: pstops.c 5622 2006-06-01 23:43:21Z mike $".
+ * End of "$Id: pstops.c 5886 2006-08-24 19:53:17Z mike $".
*/
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Disabled</key>
+ <true/>
+ <key>Label</key>
+ <string>org.cups.cups-lpd</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>/usr/libexec/cups/daemon/cups-lpd</string>
+ <string>-o</string>
+ <string>document-format=application/octet-stream</string>
+ </array>
+ <key>Sockets</key>
+ <dict>
+ <key>Listeners</key>
+ <dict>
+ <key>SockServiceName</key>
+ <string>printer</string>
+ <key>SockType</key>
+ <string>stream</string>
+ </dict>
+ </dict>
+ <key>UserName</key>
+ <string>lp</string>
+ <key>inetdCompatibility</key>
+ <dict>
+ <key>Wait</key>
+ <false/>
+ </dict>
+</dict>
+</plist>
.\" EMail: cups-info@cups.org
.\" WWW: http://www.cups.org
.\"
-.TH snmp.conf 5 "Common UNIX Printing System" "18 April 2006" "Easy Software Products"
+.TH snmp.conf 5 "Common UNIX Printing System" "31 July 2006" "Easy Software Products"
.SH NAME
snmp.conf \- snmp configuration file for cups
.SH DESCRIPTION
Specifies whether the addresses of printers should be converted
to hostnames or left as numeric IP addresses. The default is
"off".
+.TP 5
+MaxRunTime \fIseconds\fR
+.br
+Specifies the maximum number of seconds that the SNMP backend
+will scan the network for printers.
.SH SEE ALSO
http://localhost:631/help
.SH COPYRIGHT
#
-# "$Id: cups.list.in 5745 2006-07-18 13:45:56Z mike $"
+# "$Id: cups.list.in 5900 2006-08-28 19:26:39Z mike $"
#
# ESP Package Manager (EPM) file list for the Common UNIX Printing
# System (CUPS).
$prefix=@prefix@
$exec_prefix=@exec_prefix@
$bindir=@bindir@
+$datarootdir=@datarootdir@
$datadir=@datadir@
$includedir=@includedir@
$infodir=@infodir@
$SERVERBIN=@CUPS_SERVERBIN@
$SERVERROOT=@CUPS_SERVERROOT@
$STATEDIR=@CUPS_STATEDIR@
-
+$XINETD=@XINETD@
$LIB32DIR=@LIB32DIR@
$LIB64DIR=@LIB64DIR@
%if DSOLIBS
%subpackage libs
%system hpux
-f 0755 root sys $LIBDIR/libcups.sl.2 cups/libcups.sl.2
+f 0755 root sys $LIBDIR/libcups.sl.2 cups/libcups.sl.2 nostrip()
l 0755 root sys $LIBDIR/libcups.sl libcups.sl.2
-f 0755 root sys $LIBDIR/libcupsimage.sl.2 filter/libcupsimage.sl.2
+f 0755 root sys $LIBDIR/libcupsimage.sl.2 filter/libcupsimage.sl.2 nostrip()
l 0755 root sys $LIBDIR/libcupsimage.sl libcupsimage.sl.2
%system aix
-f 0755 root sys $LIBDIR/libcups_s.a cups/libcups_s.a
-f 0755 root sys $LIBDIR/libcupsimage_s.a filter/libcupsimage_s.a
+f 0755 root sys $LIBDIR/libcups_s.a cups/libcups_s.a nostrip()
+f 0755 root sys $LIBDIR/libcupsimage_s.a filter/libcupsimage_s.a nostrip()
%system darwin
-f 0755 root sys $LIBDIR/libcups.2.dylib cups/libcups.2.dylib
+f 0755 root sys $LIBDIR/libcups.2.dylib cups/libcups.2.dylib nostrip()
l 0755 root sys $LIBDIR/libcups.dylib libcups.2.dylib
-f 0755 root sys $LIBDIR/libcupsimage.2.dylib filter/libcupsimage.2.dylib
+f 0755 root sys $LIBDIR/libcupsimage.2.dylib filter/libcupsimage.2.dylib nostrip()
l 0755 root sys $LIBDIR/libcupsimage.dylib libcupsimage.2.dylib
%system !hpux !aix !darwin
-f 0755 root sys $LIBDIR/libcups.so.2 cups/libcups.so.2
+f 0755 root sys $LIBDIR/libcups.so.2 cups/libcups.so.2 nostrip()
l 0755 root sys $LIBDIR/libcups.so libcups.so.2
-f 0755 root sys $LIBDIR/libcupsimage.so.2 filter/libcupsimage.so.2
+f 0755 root sys $LIBDIR/libcupsimage.so.2 filter/libcupsimage.so.2 nostrip()
l 0755 root sys $LIBDIR/libcupsimage.so libcupsimage.so.2
%system all
%subpackage
%if LIB32DIR
%subpackage libs
-f 0755 root sys $LIB32DIR/libcups.so.2 cups/libcups.32.so.2
+f 0755 root sys $LIB32DIR/libcups.so.2 cups/libcups.32.so.2 nostrip()
l 0755 root sys $LIB32DIR/libcups.so libcups.so.2
-f 0755 root sys $LIB32DIR/libcupsimage.so.2 filter/libcupsimage.32.so.2
+f 0755 root sys $LIB32DIR/libcupsimage.so.2 filter/libcupsimage.32.so.2 nostrip()
l 0755 root sys $LIB32DIR/libcupsimage.so libcupsimage.so.2
%system all
%subpackage
%if LIB64DIR
%subpackage libs
-f 0755 root sys $LIB64DIR/libcups.so.2 cups/libcups.64.so.2
+f 0755 root sys $LIB64DIR/libcups.so.2 cups/libcups.64.so.2 nostrip()
l 0755 root sys $LIB64DIR/libcups.so libcups.so.2
-f 0755 root sys $LIB64DIR/libcupsimage.so.2 filter/libcupsimage.64.so.2
+f 0755 root sys $LIB64DIR/libcupsimage.so.2 filter/libcupsimage.64.so.2 nostrip()
l 0755 root sys $LIB64DIR/libcupsimage.so libcupsimage.so.2
%system all
%subpackage
# Data files
%subpackage de
-f 0644 root sys $LOCALEDIR/es/cups_de.po locale/cups_de.po
+f 0644 root sys $LOCALEDIR/de/cups_de.po locale/cups_de.po
%subpackage es
f 0644 root sys $LOCALEDIR/es/cups_es.po locale/cups_es.po
%subpackage ja
f 0644 root sys $AMANDIR/man$MAN8DIR/cups-lpd.$MAN8EXT man/cups-lpd.$MAN8EXT
%subpackage
-# Startup script
-%system all
+# Startup scripts
+%system darwin
+f 0644 root sys /System/Library/LaunchDaemons/org.cups.cupsd.plist init/org.cups.cupsd.plist
+%postinstall <<EOF
+rm -f /System/Library/StartupItems/PrintingServices/PrintingServices
+launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist || exit 0
+launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist
+EOF
+%subpackage lpd
+f 0644 root sys /System/Library/LaunchDaemons/org.cups.cups-lpd.plist init/org.cups.cups-lpd.plist
+%postinstall <<EOF
+rm -f /etc/xinetd.d/cups-lpd
+launchctl unload /System/Library/LaunchDaemons/org.cups.cups-lpd.plist || exit 0
+launchctl load /System/Library/LaunchDaemons/org.cups.cupsd-lpd.plist
+EOF
+%subpackage
+
+%system !darwin
i 0755 root sys cups init/cups.sh
+%subpackage lpd
+%if XINETD
+f 0644 root sys $XINETD/cups-lpd init/cups-lpd
+%endif
+%subpackage
#
-# End of "$Id: cups.list.in 5745 2006-07-18 13:45:56Z mike $".
+# End of "$Id: cups.list.in 5900 2006-08-28 19:26:39Z mike $".
#
auth.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
auth.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
auth.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h ../cups/file.h
-auth.o: ../cups/http.h ../cups/i18n.h ../cups/debug.h sysman.h statbuf.h
-auth.o: cert.h auth.h client.h policy.h printers.h classes.h job.h conf.h
-auth.o: banners.h dirsvc.h network.h subscriptions.h
+auth.o: ../cups/http.h ../cups/i18n.h ../cups/transcode.h ../cups/debug.h
+auth.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
+auth.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
banners.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
banners.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
banners.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
banners.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h
-banners.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/debug.h
-banners.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
-banners.o: classes.h job.h conf.h banners.h dirsvc.h network.h
+banners.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/transcode.h
+banners.o: ../cups/debug.h sysman.h statbuf.h cert.h auth.h client.h policy.h
+banners.o: printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
banners.o: subscriptions.h ../cups/dir.h
cert.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
cert.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
cert.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
cert.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h ../cups/file.h
-cert.o: ../cups/http.h ../cups/i18n.h ../cups/debug.h sysman.h statbuf.h
-cert.o: cert.h auth.h client.h policy.h printers.h classes.h job.h conf.h
-cert.o: banners.h dirsvc.h network.h subscriptions.h
+cert.o: ../cups/http.h ../cups/i18n.h ../cups/transcode.h ../cups/debug.h
+cert.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
+cert.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
classes.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
classes.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
classes.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
classes.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h
-classes.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/debug.h
-classes.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
-classes.o: classes.h job.h conf.h banners.h dirsvc.h network.h
+classes.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/transcode.h
+classes.o: ../cups/debug.h sysman.h statbuf.h cert.h auth.h client.h policy.h
+classes.o: printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
classes.o: subscriptions.h
client.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/md5.h
client.o: ../cups/ipp-private.h ../cups/ipp.h cupsd.h ../cups/string.h
client.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
client.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h
-client.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/debug.h
-client.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
-client.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
+client.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/transcode.h
+client.o: ../cups/debug.h sysman.h statbuf.h cert.h auth.h client.h policy.h
+client.o: printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
+client.o: subscriptions.h
conf.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
conf.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
conf.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
conf.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h ../cups/file.h
-conf.o: ../cups/http.h ../cups/i18n.h ../cups/debug.h sysman.h statbuf.h
-conf.o: cert.h auth.h client.h policy.h printers.h classes.h job.h conf.h
-conf.o: banners.h dirsvc.h network.h subscriptions.h ../cups/dir.h
+conf.o: ../cups/http.h ../cups/i18n.h ../cups/transcode.h ../cups/debug.h
+conf.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
+conf.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
+conf.o: ../cups/dir.h
dirsvc.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
dirsvc.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
dirsvc.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
dirsvc.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h
-dirsvc.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/debug.h
-dirsvc.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
-dirsvc.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
+dirsvc.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/transcode.h
+dirsvc.o: ../cups/debug.h sysman.h statbuf.h cert.h auth.h client.h policy.h
+dirsvc.o: printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
+dirsvc.o: subscriptions.h
env.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
env.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
env.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
env.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h ../cups/file.h
-env.o: ../cups/http.h ../cups/i18n.h ../cups/debug.h sysman.h statbuf.h
-env.o: cert.h auth.h client.h policy.h printers.h classes.h job.h conf.h
-env.o: banners.h dirsvc.h network.h subscriptions.h
+env.o: ../cups/http.h ../cups/i18n.h ../cups/transcode.h ../cups/debug.h
+env.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
+env.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
main.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
main.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
main.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
main.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h ../cups/file.h
-main.o: ../cups/http.h ../cups/i18n.h ../cups/debug.h sysman.h statbuf.h
-main.o: cert.h auth.h client.h policy.h printers.h classes.h job.h conf.h
-main.o: banners.h dirsvc.h network.h subscriptions.h
+main.o: ../cups/http.h ../cups/i18n.h ../cups/transcode.h ../cups/debug.h
+main.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
+main.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
ipp.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
ipp.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
ipp.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
ipp.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h ../cups/file.h
-ipp.o: ../cups/http.h ../cups/i18n.h ../cups/debug.h sysman.h statbuf.h
-ipp.o: cert.h auth.h client.h policy.h printers.h classes.h job.h conf.h
-ipp.o: banners.h dirsvc.h network.h subscriptions.h
+ipp.o: ../cups/http.h ../cups/i18n.h ../cups/transcode.h ../cups/debug.h
+ipp.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
+ipp.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
listen.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
listen.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
listen.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
listen.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h
-listen.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/debug.h
-listen.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
-listen.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
+listen.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/transcode.h
+listen.o: ../cups/debug.h sysman.h statbuf.h cert.h auth.h client.h policy.h
+listen.o: printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
+listen.o: subscriptions.h
job.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
job.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
job.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
job.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h ../cups/file.h
-job.o: ../cups/http.h ../cups/i18n.h ../cups/debug.h sysman.h statbuf.h
-job.o: cert.h auth.h client.h policy.h printers.h classes.h job.h conf.h
-job.o: banners.h dirsvc.h network.h subscriptions.h ../cups/backend.h
-job.o: ../cups/dir.h
+job.o: ../cups/http.h ../cups/i18n.h ../cups/transcode.h ../cups/debug.h
+job.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
+job.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
+job.o: ../cups/backend.h ../cups/dir.h
log.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
log.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
log.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
log.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h ../cups/file.h
-log.o: ../cups/http.h ../cups/i18n.h ../cups/debug.h sysman.h statbuf.h
-log.o: cert.h auth.h client.h policy.h printers.h classes.h job.h conf.h
-log.o: banners.h dirsvc.h network.h subscriptions.h
-network.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
-network.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
+log.o: ../cups/http.h ../cups/i18n.h ../cups/transcode.h ../cups/debug.h
+log.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
+log.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
+network.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/md5.h
+network.o: ../cups/ipp-private.h ../cups/ipp.h cupsd.h ../cups/string.h
network.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
network.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h
-network.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/debug.h
-network.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
-network.o: classes.h job.h conf.h banners.h dirsvc.h network.h
+network.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/transcode.h
+network.o: ../cups/debug.h sysman.h statbuf.h cert.h auth.h client.h policy.h
+network.o: printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
network.o: subscriptions.h
policy.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
policy.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
policy.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
policy.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h
-policy.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/debug.h
-policy.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
-policy.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
+policy.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/transcode.h
+policy.o: ../cups/debug.h sysman.h statbuf.h cert.h auth.h client.h policy.h
+policy.o: printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
+policy.o: subscriptions.h
printers.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
printers.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h
printers.o: ../cups/string.h ../cups/array.h ../cups/cups.h ../cups/ppd.h
printers.o: ../cups/array.h ../cups/file.h ../cups/language.h mime.h
printers.o: ../cups/ipp.h ../cups/file.h ../cups/http.h ../cups/i18n.h
-printers.o: ../cups/debug.h sysman.h statbuf.h cert.h auth.h client.h
-printers.o: policy.h printers.h classes.h job.h conf.h banners.h dirsvc.h
-printers.o: network.h subscriptions.h ../cups/transcode.h
+printers.o: ../cups/transcode.h ../cups/debug.h sysman.h statbuf.h cert.h
+printers.o: auth.h client.h policy.h printers.h classes.h job.h conf.h
+printers.o: banners.h dirsvc.h network.h subscriptions.h ../cups/dir.h
process.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
process.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
process.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
process.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h
-process.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/debug.h
-process.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
-process.o: classes.h job.h conf.h banners.h dirsvc.h network.h
+process.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/transcode.h
+process.o: ../cups/debug.h sysman.h statbuf.h cert.h auth.h client.h policy.h
+process.o: printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
process.o: subscriptions.h
quotas.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
quotas.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
quotas.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
quotas.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h
-quotas.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/debug.h
-quotas.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
-quotas.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
+quotas.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/transcode.h
+quotas.o: ../cups/debug.h sysman.h statbuf.h cert.h auth.h client.h policy.h
+quotas.o: printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
+quotas.o: subscriptions.h
server.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/md5.h
server.o: ../cups/ipp-private.h ../cups/ipp.h cupsd.h ../cups/string.h
server.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
server.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h
-server.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/debug.h
-server.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
-server.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
+server.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/transcode.h
+server.o: ../cups/debug.h sysman.h statbuf.h cert.h auth.h client.h policy.h
+server.o: printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
+server.o: subscriptions.h
statbuf.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
statbuf.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
statbuf.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
statbuf.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h
-statbuf.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/debug.h
-statbuf.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
-statbuf.o: classes.h job.h conf.h banners.h dirsvc.h network.h
+statbuf.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/transcode.h
+statbuf.o: ../cups/debug.h sysman.h statbuf.h cert.h auth.h client.h policy.h
+statbuf.o: printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
statbuf.o: subscriptions.h
subscriptions.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
subscriptions.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h
subscriptions.o: ../cups/string.h ../cups/array.h ../cups/cups.h
subscriptions.o: ../cups/ppd.h ../cups/array.h ../cups/file.h
subscriptions.o: ../cups/language.h mime.h ../cups/ipp.h ../cups/file.h
-subscriptions.o: ../cups/http.h ../cups/i18n.h ../cups/debug.h sysman.h
-subscriptions.o: statbuf.h cert.h auth.h client.h policy.h printers.h
-subscriptions.o: classes.h job.h conf.h banners.h dirsvc.h network.h
-subscriptions.o: subscriptions.h
+subscriptions.o: ../cups/http.h ../cups/i18n.h ../cups/transcode.h
+subscriptions.o: ../cups/debug.h sysman.h statbuf.h cert.h auth.h client.h
+subscriptions.o: policy.h printers.h classes.h job.h conf.h banners.h
+subscriptions.o: dirsvc.h network.h subscriptions.h
sysman.o: cupsd.h ../cups/http-private.h ../config.h ../cups/http.h
sysman.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/string.h
sysman.o: ../cups/array.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
sysman.o: ../cups/file.h ../cups/language.h mime.h ../cups/ipp.h
-sysman.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/debug.h
-sysman.o: sysman.h statbuf.h cert.h auth.h client.h policy.h printers.h
-sysman.o: classes.h job.h conf.h banners.h dirsvc.h network.h subscriptions.h
+sysman.o: ../cups/file.h ../cups/http.h ../cups/i18n.h ../cups/transcode.h
+sysman.o: ../cups/debug.h sysman.h statbuf.h cert.h auth.h client.h policy.h
+sysman.o: printers.h classes.h job.h conf.h banners.h dirsvc.h network.h
+sysman.o: subscriptions.h
filter.o: ../cups/debug.h ../cups/string.h ../config.h mime.h ../cups/array.h
filter.o: ../cups/ipp.h ../cups/file.h
-mime.o: ../cups/dir.h ../cups/string.h ../config.h mime.h ../cups/array.h
-mime.o: ../cups/ipp.h ../cups/file.h
+mime.o: ../cups/debug.h ../cups/dir.h ../cups/string.h ../config.h mime.h
+mime.o: ../cups/array.h ../cups/ipp.h ../cups/file.h
type.o: ../cups/string.h ../config.h mime.h ../cups/array.h ../cups/ipp.h
type.o: ../cups/file.h ../cups/debug.h
cups-deviced.o: util.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
cups-driverd.o: util.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
cups-driverd.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
cups-driverd.o: ../cups/language.h ../cups/file.h ../cups/string.h
-cups-driverd.o: ../config.h ../cups/dir.h
+cups-driverd.o: ../config.h ../cups/dir.h ../cups/transcode.h
cups-lpd.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/md5.h
cups-lpd.o: ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h ../cups/ppd.h
cups-lpd.o: ../cups/array.h ../cups/file.h ../cups/language.h
testdirsvc.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
testdirsvc.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
testdirsvc.o: ../cups/string.h ../config.h
+testlpd.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
+testlpd.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
+testlpd.o: ../cups/string.h ../config.h
testmime.o: ../cups/string.h ../config.h mime.h ../cups/array.h ../cups/ipp.h
testmime.o: ../cups/file.h ../cups/dir.h
testspeed.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
#
-# "$Id: Makefile 5736 2006-07-13 19:59:36Z mike $"
+# "$Id: Makefile 5868 2006-08-23 19:39:39Z mike $"
#
# Scheduler Makefile for the Common UNIX Printing System (CUPS).
#
cups-lpd.o \
cups-polld.o \
testdirsvc.o \
+ testlpd.o \
testmime.o \
testspeed.o \
util.o
cups-polld \
libmime.a \
testdirsvc \
+ testlpd \
testmime \
testspeed
$(CC) $(LDFLAGS) -o testdirsvc testdirsvc.o $(COMMONLIBS) $(NETLIBS)
+#
+# Make the test program, "testlpd".
+#
+
+testlpd: testlpd.o ../cups/libcups.a cups-lpd
+ echo Linking $@...
+ $(CC) $(LDFLAGS) -o testlpd testlpd.o ../cups/libcups.a \
+ $(COMMONLIBS) $(LIBZ) $(SSLLIBS)
+
+
#
# testmime
#
# Make the test program, "testspeed".
#
-testspeed: testspeed.o ../cups/$(LIBCUPS)
+testspeed: testspeed.o ../cups/libcups.a
echo Linking $@...
- $(CC) $(LDFLAGS) -o testspeed testspeed.o $(LIBS)
+ $(CC) $(LDFLAGS) -o testspeed testspeed.o ../cups/libcups.a \
+ $(COMMONLIBS) $(LIBZ) $(SSLLIBS)
#
#
-# End of "$Id: Makefile 5736 2006-07-13 19:59:36Z mike $".
+# End of "$Id: Makefile 5868 2006-08-23 19:39:39Z mike $".
#
/*
- * "$Id: auth.c 5643 2006-06-07 20:58:29Z mike $"
+ * "$Id: auth.c 5840 2006-08-17 14:55:30Z mike $"
*
* Authorization routines for the Common UNIX Printing System (CUPS).
*
static cupsd_authmask_t *add_deny(cupsd_location_t *loc);
static int compare_locations(cupsd_location_t *a,
cupsd_location_t *b);
-#if !HAVE_LIBPAM
+#if !HAVE_LIBPAM && !defined(HAVE_USERSEC_H)
static char *cups_crypt(const char *pw, const char *salt);
-#endif /* !HAVE_LIBPAM */
+#endif /* !HAVE_LIBPAM && !HAVE_USERSEC_H */
static char *get_md5_password(const char *username,
const char *group, char passwd[33]);
#if HAVE_LIBPAM
*/
char *authmsg; /* Authentication message */
- char *loginmsg; /* Login message */
int reenter; /* ??? */
}
-#if !HAVE_LIBPAM
+#if !HAVE_LIBPAM && !defined(HAVE_USERSEC_H)
/*
* 'cups_crypt()' - Encrypt the password using the DES or MD5 algorithms,
* as needed.
return (crypt(pw, salt));
}
}
-#endif /* !HAVE_LIBPAM */
+#endif /* !HAVE_LIBPAM && !HAVE_USERSEC_H */
/*
/*
- * End of "$Id: auth.c 5643 2006-06-07 20:58:29Z mike $".
+ * End of "$Id: auth.c 5840 2006-08-17 14:55:30Z mike $".
*/
/*
- * "$Id: client.c 5739 2006-07-16 15:21:18Z mike $"
+ * "$Id: client.c 5898 2006-08-28 18:54:10Z mike $"
*
* Client routines for the Common UNIX Printing System (CUPS) scheduler.
*
* cupsdAcceptClient() - Accept a new client.
* cupsdCloseAllClients() - Close all remote clients immediately.
* cupsdCloseClient() - Close a remote client.
+ * cupsdFlushHeader() - Flush the header fields to the client.
* cupsdReadClient() - Read data from a client.
* cupsdSendCommand() - Send output from a command via HTTP.
* cupsdSendError() - Send an error message via HTTP.
}
+/*
+ * 'cupsdFlushHeader()' - Flush the header fields to the client.
+ */
+
+void
+cupsdFlushHeader(cupsd_client_t *con) /* I - Client to flush to */
+{
+ httpFlushWrite(HTTP(con));
+
+ con->http.data_encoding = HTTP_ENCODE_LENGTH;
+}
+
+
/*
* 'cupsdReadClient()' - Read data from a client.
*/
httpPrintf(HTTP(con), "Upgrade: TLS/1.0,HTTP/1.1\r\n");
httpPrintf(HTTP(con), "Content-Length: 0\r\n");
httpPrintf(HTTP(con), "\r\n");
+ cupsdFlushHeader(con);
encrypt_client(con);
#else
httpPrintf(HTTP(con), "Allow: GET, HEAD, OPTIONS, POST, PUT\r\n");
httpPrintf(HTTP(con), "Content-Length: 0\r\n");
httpPrintf(HTTP(con), "\r\n");
+ cupsdFlushHeader(con);
}
else if (!is_path_absolute(con->uri))
{
httpPrintf(HTTP(con), "Upgrade: TLS/1.0,HTTP/1.1\r\n");
httpPrintf(HTTP(con), "Content-Length: 0\r\n");
httpPrintf(HTTP(con), "\r\n");
+ cupsdFlushHeader(con);
encrypt_client(con);
#else
httpPrintf(HTTP(con), "Content-Length: 0\r\n");
httpPrintf(HTTP(con), "\r\n");
+ cupsdFlushHeader(con);
}
}
if (httpPrintf(HTTP(con), "\r\n") < 0)
return (cupsdCloseClient(con));
+ cupsdFlushHeader(con);
+
cupsdLogRequest(con, HTTP_OK);
}
else if ((!strncmp(con->uri, "/admin/conf/", 12) &&
if (httpPrintf(HTTP(con), "\r\n") < 0)
return (cupsdCloseClient(con));
+ cupsdFlushHeader(con);
+
con->http.state = HTTP_WAITING;
break;
else if (httpPrintf(HTTP(con), "\r\n") < 0)
return (0);
+ cupsdFlushHeader(con);
+
con->http.state = HTTP_WAITING;
return (1);
* Send the HTTP status header...
*/
+ httpFlushWrite(HTTP(con));
+
+ con->http.data_encoding = HTTP_ENCODE_FIELDS;
+
if (httpPrintf(HTTP(con), "HTTP/%d.%d %d %s\r\n", con->http.version / 100,
con->http.version % 100, code, httpStatus(code)) < 0)
return (0);
if (httpPrintf(HTTP(con), "\r\n") < 0)
return (0);
else
+ {
+ cupsdFlushHeader(con);
return (1);
+ }
}
if (httpPrintf(HTTP(con), "Date: %s\r\n", httpGetDateString(time(NULL))) < 0)
if (!strchr(CGIStatusBuffer->buffer, '\n'))
break;
- if (ptr == NULL && errno)
+ if (ptr == NULL && !CGIStatusBuffer->bufused)
{
/*
* Fatal error on pipe - should never happen!
return (0);
}
else if (!strncasecmp(buf, "Status:", 7))
- cupsdSendError(con, atoi(buf + 7));
+ cupsdSendError(con, (http_status_t)atoi(buf + 7));
else
{
cupsdSendHeader(con, HTTP_OK, NULL);
if (con->http.version == HTTP_1_1)
{
- con->http.data_encoding = HTTP_ENCODE_CHUNKED;
-
if (httpPrintf(HTTP(con), "Transfer-Encoding: chunked\r\n") < 0)
return (0);
}
*/
if (con->field_col == 0)
+ {
con->got_fields = 1;
+
+ cupsdFlushHeader(con);
+
+ if (con->http.version == HTTP_1_1)
+ con->http.data_encoding = HTTP_ENCODE_CHUNKED;
+ }
else
con->field_col = 0;
}
make_certificate(void)
{
#if defined(HAVE_LIBSSL) && defined(HAVE_WAITPID)
- int pid, /* Process ID of command */
- status; /* Status of command */
- char command[1024], /* Command */
- *argv[11], /* Command-line arguments */
- *envp[MAX_ENV]; /* Environment variables */
+ int pid, /* Process ID of command */
+ status; /* Status of command */
+ char command[1024], /* Command */
+ *argv[11], /* Command-line arguments */
+ *envp[MAX_ENV + 1], /* Environment variables */
+ home[1024], /* HOME environment variable */
+ infofile[1024], /* Type-in information for cert */
+ seedfile[1024]; /* Random number seed file */
+ int envc, /* Number of environment variables */
+ bytes; /* Bytes written */
+ cups_file_t *fp; /* Seed/info file */
+ int infofd; /* Info file descriptor */
/*
- * Run the "openssl" command to generate a self-signed certificate
- * that is good for 10 years:
+ * Run the "openssl" command to seed the random number generator and
+ * generate a self-signed certificate that is good for 10 years:
+ *
+ * openssl rand -rand seedfile 1
*
* openssl req -new -x509 -keyout ServerKey \
* -out ServerCertificate -days 3650 -nodes
+ *
+ * The seeding step is crucial in ensuring that the openssl command
+ * does not block on systems without sufficient entropy...
*/
if (!cupsFileFind("openssl", getenv("PATH"), 1, command, sizeof(command)))
return (0);
}
+ if (access("/dev/urandom", 0))
+ {
+ /*
+ * If the system doesn't provide /dev/urandom, then any random source
+ * will probably be blocking-style, so generate some random data to
+ * use as a seed for the certificate. Note that we have already
+ * seeded the random number generator in cupsdInitCerts()...
+ */
+
+ cupsdLogMessage(CUPSD_LOG_INFO,
+ "Seeding the random number generator...");
+
+ snprintf(home, sizeof(home), "HOME=%s", TempDir);
+
+ /*
+ * Write the seed file...
+ */
+
+ if ((fp = cupsTempFile2(seedfile, sizeof(seedfile))) == NULL)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to create seed file %s - %s",
+ seedfile, strerror(errno));
+ return (0);
+ }
+
+ for (bytes = 0; bytes < 262144; bytes ++)
+ cupsFilePutChar(fp, random());
+
+ cupsFileClose(fp);
+
+ /*
+ * Run the openssl command to seed its random number generator...
+ */
+
+ argv[0] = "openssl";
+ argv[1] = "rand";
+ argv[2] = "-rand";
+ argv[3] = seedfile;
+ argv[4] = "1";
+ argv[5] = NULL;
+
+ envc = cupsdLoadEnv(envp, MAX_ENV);
+ envp[envc++] = home;
+ envp[envc] = NULL;
+
+ if (!cupsdStartProcess(command, argv, envp, -1, -1, -1, -1, 1, &pid))
+ {
+ unlink(seedfile);
+ return (0);
+ }
+
+ while (waitpid(pid, &status, 0) < 0)
+ if (errno != EINTR)
+ {
+ status = 1;
+ break;
+ }
+
+ cupsdFinishProcess(pid, command, sizeof(command));
+
+ /*
+ * Remove the seed file, as it is no longer needed...
+ */
+
+ unlink(seedfile);
+
+ if (status)
+ {
+ if (WIFEXITED(status))
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "Unable to seed random number generator - "
+ "the openssl command stopped with status %d!",
+ WEXITSTATUS(status));
+ else
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "Unable to seed random number generator - "
+ "the openssl command crashed on signal %d!",
+ WTERMSIG(status));
+
+ return (0);
+ }
+ }
+
+ /*
+ * Create a file with the certificate information fields...
+ *
+ * Note: This assumes that the default questions are asked by the openssl
+ * command...
+ */
+
+ if ((fp = cupsTempFile2(infofile, sizeof(infofile))) == NULL)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "Unable to create certificate information file %s - %s",
+ infofile, strerror(errno));
+ return (0);
+ }
+
+ cupsFilePrintf(fp, ".\n.\n.\n%s\n.\n%s\n%s\n",
+ ServerName, ServerName, ServerAdmin);
+ cupsFileClose(fp);
+
cupsdLogMessage(CUPSD_LOG_INFO,
"Generating SSL server key and certificate...");
cupsdLoadEnv(envp, MAX_ENV);
- if (!cupsdStartProcess(command, argv, envp, -1, -1, -1, -1, 1, &pid))
+ infofd = open(infofile, O_RDONLY);
+
+ if (!cupsdStartProcess(command, argv, envp, infofd, -1, -1, -1, 1, &pid))
+ {
+ close(infofd);
+ unlink(infofile);
return (0);
+ }
+
+ close(infofd);
+ unlink(infofile);
while (waitpid(pid, &status, 0) < 0)
if (errno != EINTR)
if (httpPrintf(HTTP(con), "\r\n") < 0)
return (0);
+ cupsdFlushHeader(con);
+
con->http.data_encoding = HTTP_ENCODE_LENGTH;
con->http.data_remaining = filestats->st_size;
/*
- * End of "$Id: client.c 5739 2006-07-16 15:21:18Z mike $".
+ * End of "$Id: client.c 5898 2006-08-28 18:54:10Z mike $".
*/
/*
- * "$Id: client.h 5305 2006-03-18 03:05:12Z mike $"
+ * "$Id: client.h 5889 2006-08-24 21:44:35Z mike $"
*
* Client definitions for the Common UNIX Printing System (CUPS) scheduler.
*
extern void cupsdCloseAllClients(void);
extern int cupsdCloseClient(cupsd_client_t *con);
extern void cupsdDeleteAllListeners(void);
+extern void cupsdFlushHeader(cupsd_client_t *con);
extern void cupsdPauseListening(void);
extern int cupsdProcessIPPRequest(cupsd_client_t *con);
extern int cupsdReadClient(cupsd_client_t *con);
/*
- * End of "$Id: client.h 5305 2006-03-18 03:05:12Z mike $".
+ * End of "$Id: client.h 5889 2006-08-24 21:44:35Z mike $".
*/
/*
- * "$Id: conf.c 5736 2006-07-13 19:59:36Z mike $"
+ * "$Id: conf.c 5905 2006-08-29 20:48:59Z mike $"
*
* Configuration routines for the Common UNIX Printing System (CUPS).
*
* writable by the user and group in the cupsd.conf file...
*/
- check_permissions(CacheDir, NULL, 0775, RunUser, Group, 1, 1);
-/* check_permissions(CacheDir, "ppd", 0755, RunUser, Group, 1, 1);*/
-
- check_permissions(StateDir, NULL, 0755, RunUser, Group, 1, 1);
- check_permissions(StateDir, "certs", RunUser ? 0711 : 0511, User,
- SystemGroupIDs[0], 1, 1);
-
- check_permissions(ServerRoot, NULL, 0755, RunUser, Group, 1, 0);
- check_permissions(ServerRoot, "ppd", 0755, RunUser, Group, 1, 1);
- check_permissions(ServerRoot, "ssl", 0700, RunUser, Group, 1, 0);
- check_permissions(ServerRoot, "cupsd.conf", ConfigFilePerm, RunUser, Group,
- 0, 0);
- check_permissions(ServerRoot, "classes.conf", 0600, RunUser, Group, 0, 0);
- check_permissions(ServerRoot, "printers.conf", 0600, RunUser, Group, 0, 0);
- check_permissions(ServerRoot, "passwd.md5", 0600, User, Group, 0, 0);
+ if (check_permissions(CacheDir, NULL, 0775, RunUser, Group, 1, 1) < 0 ||
+ check_permissions(StateDir, NULL, 0755, RunUser, Group, 1, 1) < 0 ||
+ check_permissions(StateDir, "certs", RunUser ? 0711 : 0511, User,
+ SystemGroupIDs[0], 1, 1) < 0 ||
+ check_permissions(ServerRoot, NULL, 0755, RunUser, Group, 1, 0) < 0 ||
+ check_permissions(ServerRoot, "ppd", 0755, RunUser, Group, 1, 1) < 0 ||
+ check_permissions(ServerRoot, "ssl", 0700, RunUser, Group, 1, 0) < 0 ||
+ check_permissions(ServerRoot, "cupsd.conf", ConfigFilePerm, RunUser,
+ Group, 0, 0) < 0 ||
+ check_permissions(ServerRoot, "classes.conf", 0600, RunUser, Group,
+ 0, 0) < 0 ||
+ check_permissions(ServerRoot, "printers.conf", 0600, RunUser, Group,
+ 0, 0) < 0 ||
+ check_permissions(ServerRoot, "passwd.md5", 0600, User, Group, 0, 0) < 0)
+ return (0);
/*
* Update TempDir to the default if it hasn't been set already...
"TMPDIR (%s) has the wrong permissions!", tmpdir);
else
cupsdSetString(&TempDir, tmpdir);
-
- if (!TempDir)
- cupsdLogMessage(CUPSD_LOG_INFO, "Using default TempDir of %s/tmp...",
- RequestRoot);
}
if (!TempDir)
+ {
+ cupsdLogMessage(CUPSD_LOG_INFO, "Using default TempDir of %s/tmp...",
+ RequestRoot);
cupsdSetStringf(&TempDir, "%s/tmp", RequestRoot);
+ }
}
/*
* permissions...
*/
- check_permissions(RequestRoot, NULL, 0710, RunUser, Group, 1, 1);
+ if (check_permissions(RequestRoot, NULL, 0710, RunUser, Group, 1, 1) < 0)
+ return (0);
if (!strncmp(TempDir, RequestRoot, strlen(RequestRoot)) ||
access(TempDir, 0))
* is under the spool directory or does not exist...
*/
- check_permissions(TempDir, NULL, 01770, RunUser, Group, 1, 1);
+ if (check_permissions(TempDir, NULL, 01770, RunUser, Group, 1, 1) < 0)
+ return (0);
}
if (!strncmp(TempDir, RequestRoot, strlen(RequestRoot)))
if (MaxActiveJobs > (MaxFDs / 3))
MaxActiveJobs = MaxFDs / 3;
- if (Classification && strcasecmp(Classification, "none") == 0)
+ if (Classification && !strcasecmp(Classification, "none"))
cupsdClearString(&Classification);
if (Classification)
* 'check_permissions()' - Fix the mode and ownership of a file or directory.
*/
-static int /* O - 0 on success, -1 on error */
+static int /* O - 0 on success, -1 on error, 1 on warning */
check_permissions(const char *filename, /* I - File/directory name */
const char *suffix, /* I - Additional file/directory name */
int mode, /* I - Permissions */
dir_created = 1;
}
else
- return (-1);
+ return (create_dir ? -1 : 1);
}
/*
cupsdLogMessage(CUPSD_LOG_ERROR,
"Unable to change ownership of \"%s\" - %s", filename,
strerror(errno));
- return (-1);
+ return (1);
}
}
cupsdLogMessage(CUPSD_LOG_ERROR,
"Unable to change permissions of \"%s\" - %s", filename,
strerror(errno));
- return (-1);
+ return (1);
}
}
*valend; /* End of value */
+ /*
+ * Empty protocol line yields NULL pointer...
+ */
+
+ if (!s)
+ return (0);
+
/*
* Loop through the value string,...
*/
/*
- * End of "$Id: conf.c 5736 2006-07-13 19:59:36Z mike $".
+ * End of "$Id: conf.c 5905 2006-08-29 20:48:59Z mike $".
*/
/*
- * "$Id: cups-lpd.c 5455 2006-04-24 13:49:59Z mike $"
+ * "$Id: cups-lpd.c 5878 2006-08-24 15:55:42Z mike $"
*
* Line Printer Daemon interface for the Common UNIX Printing System (CUPS).
*
request = ippNewRequest(CUPS_GET_PRINTERS);
- ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+ ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
(int)(sizeof(requested) / sizeof(requested[0])),
NULL, requested);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
- ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+ ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
(int)(sizeof(requested) / sizeof(requested[0])),
NULL, requested);
if (state)
{
if ((attr = ippFindAttribute(response, "printer-state",
- IPP_TAG_INTEGER)) == NULL)
+ IPP_TAG_ENUM)) == NULL)
syslog(LOG_ERR, "No printer-state attribute found in "
"response from server!");
else
return (1);
}
else
- syslog(LOG_INFO, "Job ID %d cancelled", id);
+ syslog(LOG_INFO, "Job ID %d canceled", id);
}
httpClose(http);
/*
- * End of "$Id: cups-lpd.c 5455 2006-04-24 13:49:59Z mike $".
+ * End of "$Id: cups-lpd.c 5878 2006-08-24 15:55:42Z mike $".
*/
/*
- * "$Id: cups-polld.c 5753 2006-07-18 19:53:24Z mike $"
+ * "$Id: cups-polld.c 5871 2006-08-23 20:55:33Z mike $"
*
* Polling daemon for the Common UNIX Printing System (CUPS).
*
*
* Contents:
*
- * main() - Open sockets and poll until we are killed...
- * dequote() - Remote quotes from a string.
- * poll_server() - Poll the server for the given set of printers or classes.
+ * main() - Open sockets and poll until we are killed...
+ * dequote() - Remote quotes from a string.
+ * poll_server() - Poll the server for the given set of printers or
+ * classes.
+ * sighup_handler() - Handle 'hangup' signals to restart polling.
*/
/*
#include <errno.h>
#include <cups/language.h>
#include <cups/string.h>
+#include <signal.h>
+
+
+/*
+ * Local globals...
+ */
+
+static int restart_polling = 1;
/*
static char *dequote(char *d, const char *s, int dlen);
static int poll_server(http_t *http, int sock, int port, int interval,
const char *prefix);
+static void sighup_handler(int sig);
/*
int seconds, /* Seconds left from poll */
remain; /* Total remaining time to sleep */
char prefix[1024]; /* Prefix for log messages */
+#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+ struct sigaction action; /* Actions for POSIX signals */
+#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ /*
+ * Catch hangup signals for when the network changes...
+ */
+
+#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+ sigset(SIGHUP, sighup_handler);
+#elif defined(HAVE_SIGACTION)
+ memset(&action, 0, sizeof(action));
+
+ sigemptyset(&action.sa_mask);
+ sigaddset(&action.sa_mask, SIGHUP);
+ action.sa_handler = sighup_handler;
+ sigaction(SIGHUP, &action, NULL);
+#else
+ signal(SIGHUP, sighup_handler);
+#endif /* HAVE_SIGSET */
+
/*
* Don't buffer log messages...
*/
}
/*
- * Open a connection to the server...
+ * Loop forever, asking for available printers and classes...
*/
- while ((http = httpConnectEncrypt(argv[1], atoi(argv[2]),
- cupsEncryption())) == NULL)
+ for (http = NULL;;)
{
- fprintf(stderr, "ERROR: %s Unable to connect to %s on port %s: %s\n",
- prefix, argv[1], argv[2],
- h_errno ? hstrerror(h_errno) : strerror(errno));
- sleep(interval);
- }
+ /*
+ * Open a connection to the server...
+ */
- /*
- * Loop forever, asking for available printers and classes...
- */
+ if (restart_polling || !http)
+ {
+ restart_polling = 0;
+ httpClose(http);
+
+ if ((http = httpConnectEncrypt(argv[1], atoi(argv[2]),
+ cupsEncryption())) == NULL)
+ {
+ fprintf(stderr, "ERROR: %s Unable to connect to %s on port %s: %s\n",
+ prefix, argv[1], argv[2],
+ h_errno ? hstrerror(h_errno) : strerror(errno));
+ }
+ }
- for (;;)
- {
/*
* Get the printers and classes...
*/
remain = interval;
- if ((seconds = poll_server(http, sock, port, interval, prefix)) > 0)
+ if (http && (seconds = poll_server(http, sock, port, interval, prefix)) > 0)
remain -= seconds;
/*
* Sleep for any remaining time...
*/
- if (remain > 0)
+ if (remain > 0 && !restart_polling)
sleep(remain);
}
}
* Do the request and get back a response...
*/
+ seconds = time(NULL);
response = cupsDoRequest(http, request, "/");
if (cupsLastError() > IPP_OK_CONFLICT)
fprintf(stderr, "DEBUG: %s Found %d printers.\n", prefix, max_count);
count = 0;
- seconds = time(NULL);
max_count = max_count / interval + 1;
/*
sleep(1);
}
- if (!attr)
+ if (!attr || restart_polling)
break;
}
/*
- * End of "$Id: cups-polld.c 5753 2006-07-18 19:53:24Z mike $".
+ * 'sighup_handler()' - Handle 'hangup' signals to restart polling.
+ */
+
+static void
+sighup_handler(int sig) /* I - Signal number */
+{
+ (void)sig;
+
+ restart_polling = 1;
+
+#if !defined(HAVE_SIGSET) && !defined(HAVE_SIGACTION)
+ signal(SIGHUP, sighup_handler);
+#endif /* !HAVE_SIGSET && !HAVE_SIGACTION */
+}
+
+
+/*
+ * End of "$Id: cups-polld.c 5871 2006-08-23 20:55:33Z mike $".
*/
/*
- * "$Id: dirsvc.c 5724 2006-07-12 19:42:35Z mike $"
+ * "$Id: dirsvc.c 5889 2006-08-24 21:44:35Z mike $"
*
* Directory services routines for the Common UNIX Printing System (CUPS).
*
}
+/*
+ * 'cupsdRestartPolling()' - Restart polling servers as needed.
+ */
+
+void
+cupsdRestartPolling(void)
+{
+ int i; /* Looping var */
+ cupsd_dirsvc_poll_t *pollp; /* Current polling server */
+
+
+ for (i = 0, pollp = Polled; i < NumPolled; i ++, pollp ++)
+ if (pollp->pid)
+ kill(pollp->pid, SIGHUP);
+}
+
+
/*
* 'cupsdSaveRemoteCache()' - Save the remote printer cache.
*/
if (cupsdCheckAuth(address, srcname, len, 1, &(Relays[i].from)))
if (sendto(BrowseSocket, packet, bytes, 0,
(struct sockaddr *)&(Relays[i].to),
- sizeof(http_addr_t)) <= 0)
+ httpAddrLength(&(Relays[i].to))) <= 0)
{
cupsdLogMessage(CUPSD_LOG_ERROR,
"cupsdUpdateCUPSBrowse: sendto failed for relay %d - %s.",
if (!strchr(PollStatusBuffer->buffer, '\n'))
break;
- if (ptr == NULL)
+ if (ptr == NULL && !PollStatusBuffer->bufused)
{
/*
* All polling processes have died; stop polling...
else
return;
+ if (hptr && !*hptr)
+ *hptr = '.'; /* Resource FQDN */
+
if ((p = cupsdFindClass(name)) == NULL && BrowseShortNames)
{
if ((p = cupsdFindClass(resource + 9)) != NULL)
else
return;
+ if (hptr && !*hptr)
+ *hptr = '.'; /* Resource FQDN */
+
if ((p = cupsdFindPrinter(name)) == NULL && BrowseShortNames)
{
if ((p = cupsdFindPrinter(resource + 10)) != NULL)
sendto(BrowseSocket, packet, bytes, 0,
(struct sockaddr *)&(iface->broadcast),
- sizeof(struct sockaddr_in));
+ httpAddrLength(&(iface->broadcast)));
}
}
else if ((iface = cupsdNetIFFind(b->iface)) != NULL)
sendto(BrowseSocket, packet, bytes, 0,
(struct sockaddr *)&(iface->broadcast),
- sizeof(struct sockaddr_in));
+ httpAddrLength(&(iface->broadcast)));
}
}
}
if (sendto(BrowseSocket, packet, bytes, 0,
(struct sockaddr *)&(b->to),
- sizeof(struct sockaddr_in)) <= 0)
+ httpAddrLength(&(b->to))) <= 0)
{
/*
* Unable to send browse packet, so remove this address from the
/*
- * End of "$Id: dirsvc.c 5724 2006-07-12 19:42:35Z mike $".
+ * End of "$Id: dirsvc.c 5889 2006-08-24 21:44:35Z mike $".
*/
/*
- * "$Id: dirsvc.h 5305 2006-03-18 03:05:12Z mike $"
+ * "$Id: dirsvc.h 5833 2006-08-16 20:05:58Z mike $"
*
* Directory services definitions for the Common UNIX Printing System
* (CUPS) scheduler.
*/
extern void cupsdLoadRemoteCache(void);
+extern void cupsdRestartPolling(void);
extern void cupsdSaveRemoteCache(void);
extern void cupsdSendBrowseDelete(cupsd_printer_t *p);
extern void cupsdSendBrowseList(void);
/*
- * End of "$Id: dirsvc.h 5305 2006-03-18 03:05:12Z mike $".
+ * End of "$Id: dirsvc.h 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: ipp.c 5736 2006-07-13 19:59:36Z mike $"
+ * "$Id: ipp.c 5907 2006-08-30 02:18:28Z mike $"
*
* IPP routines for the Common UNIX Printing System (CUPS) scheduler.
*
#ifdef CUPSD_USE_CHUNKING
/*
* Because older versions of CUPS (1.1.17 and older) and some IPP
- * clients do not implement chunking properly, we should not use
+ * clients do not implement chunking properly, we cannot use
* chunking by default. This may become the default in future
* CUPS releases, or we might add a configuration directive for
* it.
if (con->http.version == HTTP_1_1)
{
- con->http.data_encoding = HTTP_ENCODE_CHUNKED;
-
httpPrintf(HTTP(con), "Transfer-Encoding: chunked\r\n\r\n");
+ cupsdFlushHeader(con);
+
+ con->http.data_encoding = HTTP_ENCODE_CHUNKED;
}
else
#endif /* CUPSD_USE_CHUNKING */
{
- con->http.data_encoding = HTTP_ENCODE_LENGTH;
- con->http.data_remaining = ippLength(con->response);
+ size_t length; /* Length of response */
- if (con->http.data_remaining < INT_MAX)
- con->http._data_remaining = con->http.data_remaining;
- else
- con->http._data_remaining = INT_MAX;
+
+ length = ippLength(con->response);
httpPrintf(HTTP(con), "Content-Length: " CUPS_LLFMT "\r\n\r\n",
- CUPS_LLCAST con->http.data_remaining);
+ CUPS_LLCAST length);
+ cupsdFlushHeader(con);
+
+ con->http.data_encoding = HTTP_ENCODE_LENGTH;
+ con->http.data_remaining = length;
}
cupsdLogMessage(CUPSD_LOG_DEBUG2,
cupsd_printer_t *pclass, /* Class */
*member; /* Member printer/class */
cups_ptype_t dtype; /* Destination type */
- const char *dest; /* Printer or class name */
ipp_attribute_t *attr; /* Printer attribute */
int modify; /* Non-zero if we just modified */
char newname[IPP_MAX_NAME]; /* New class name */
sizeof(method), username, sizeof(username), host,
sizeof(host), &port, resource, sizeof(resource));
- if ((dest = cupsdValidateDest(host, resource, &dtype, &member)) == NULL)
+ if (!cupsdValidateDest(host, resource, &dtype, &member))
{
/*
* Bad URI...
ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-id", job->id);
job->state = ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_ENUM,
"job-state", IPP_JOB_STOPPED);
- job->state_value = job->state->values[0].integer;
+ job->state_value = (ipp_jstate_t)job->state->values[0].integer;
job->sheets = ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_INTEGER,
"job-media-sheets-completed", 0);
ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-printer-uri", NULL,
cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_job_state_reasons(%p[%d], %d)",
con, con->http.fd, job ? job->id : 0);
- switch (job ? job->state_value : IPP_JOB_CANCELLED)
+ switch (job ? job->state_value : IPP_JOB_CANCELED)
{
case IPP_JOB_PENDING :
dest = cupsdFindDest(job->dest);
"job-state-reasons", NULL, "job-stopped");
break;
- case IPP_JOB_CANCELLED :
+ case IPP_JOB_CANCELED :
ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_KEYWORD,
"job-state-reasons", NULL, "job-canceled-by-user");
break;
cupsd_job_t *job) /* I - Job */
{
char uuid[1024]; /* job-uuid string */
- ipp_attribute_t *attr; /* job-uuid attribute */
_cups_md5_state_t md5state; /* MD5 state */
unsigned char md5sum[16]; /* MD5 digest/sum */
* First see if the job already has a job-uuid attribute; if so, return...
*/
- if ((attr = ippFindAttribute(job->attrs, "job-uuid", IPP_TAG_URI)) != NULL)
+ if (ippFindAttribute(job->attrs, "job-uuid", IPP_TAG_URI))
return;
/*
cupsdCancelJobs(NULL, username, purge);
cupsdLogMessage(CUPSD_LOG_INFO, "All jobs were %s by \"%s\".",
- purge ? "purged" : "cancelled", get_username(con));
+ purge ? "purged" : "canceled", get_username(con));
}
else
{
cupsdCancelJobs(dest, username, purge);
cupsdLogMessage(CUPSD_LOG_INFO, "All jobs on \"%s\" were %s by \"%s\".",
- dest, purge ? "purged" : "cancelled", get_username(con));
+ dest, purge ? "purged" : "canceled", get_username(con));
}
con->response->request.status.status_code = IPP_OK;
}
/*
- * See if the job is already completed, cancelled, or aborted; if so,
+ * See if the job is already completed, canceled, or aborted; if so,
* we can't cancel...
*/
- if (job->state_value >= IPP_JOB_CANCELLED)
+ if (job->state_value >= IPP_JOB_CANCELED)
{
switch (job->state_value)
{
- case IPP_JOB_CANCELLED :
+ case IPP_JOB_CANCELED :
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("Job #%d is already cancelled - can\'t cancel."),
+ _("Job #%d is already canceled - can\'t cancel."),
jobid);
break;
*/
cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
- "Job cancelled by \"%s\".", username);
+ "Job canceled by \"%s\".", username);
cupsdCancelJob(job, 0);
cupsdCheckJobs();
- cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was cancelled by \"%s\".", jobid,
+ cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was canceled by \"%s\".", jobid,
username);
con->response->request.status.status_code = IPP_OK;
*/
ippAddString(con->response, IPP_TAG_SUBSCRIPTION,
- IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ (ipp_tag_t)(IPP_TAG_KEYWORD | IPP_TAG_COPY),
"notify-events", NULL, name);
}
else
count ++;
attr = ippAddStrings(con->response, IPP_TAG_SUBSCRIPTION,
- IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ (ipp_tag_t)(IPP_TAG_KEYWORD | IPP_TAG_COPY),
"notify-events", count, NULL, NULL);
for (mask = 1, count = 0; mask < CUPSD_EVENT_ALL; mask <<= 1)
http_status_t status; /* Policy status */
int i; /* Looping var */
ipp_attribute_t *attr; /* Current attribute */
- const char *dest; /* Destination */
cups_ptype_t dtype; /* Destination type (printer or class) */
char scheme[HTTP_MAX_URI],
/* Scheme portion of URI */
if (!strcmp(resource, "/"))
{
- dest = NULL;
dtype = (cups_ptype_t)0;
printer = NULL;
}
else if (!strncmp(resource, "/printers", 9) && strlen(resource) <= 10)
{
- dest = NULL;
dtype = (cups_ptype_t)0;
printer = NULL;
}
else if (!strncmp(resource, "/classes", 8) && strlen(resource) <= 9)
{
- dest = NULL;
dtype = CUPS_PRINTER_CLASS;
printer = NULL;
}
- else if ((dest = cupsdValidateDest(host, resource, &dtype, &printer)) == NULL)
+ else if (!cupsdValidateDest(host, resource, &dtype, &printer))
{
/*
* Bad URI...
ipp_attribute_t *uri) /* I - Printer URI */
{
http_status_t status; /* Policy status */
- const char *dest; /* Destination */
cups_ptype_t dtype; /* Destination type (printer or class) */
char method[HTTP_MAX_URI],
/* Method portion of URI */
sizeof(method), username, sizeof(username), host,
sizeof(host), &port, resource, sizeof(resource));
- if ((dest = cupsdValidateDest(host, resource, &dtype, &printer)) == NULL)
+ if (!cupsdValidateDest(host, resource, &dtype, &printer))
{
/*
* Bad URI...
cupsdHoldJob(job);
+ cupsdAddEvent(CUPSD_EVENT_JOB_STATE, job->printer, job,
+ "Job held by user.");
+
if ((newattr = ippFindAttribute(con->request, "job-hold-until",
IPP_TAG_KEYWORD)) == NULL)
newattr = ippFindAttribute(con->request, "job-hold-until", IPP_TAG_NAME);
*/
cupsdSetJobHoldUntil(job, attr->values[0].string.text);
+
+ cupsdAddEvent(CUPSD_EVENT_JOB_CONFIG_CHANGED, job->printer, job,
+ "Job job-hold-until value changed by user.");
}
cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was held by \"%s\".", jobid,
ipp_attribute_t *attr; /* Current attribute */
int jobid; /* Job ID */
cupsd_job_t *job; /* Current job */
- const char *src, /* Source printer/class */
- *dest; /* Destination */
+ const char *src; /* Source printer/class */
cups_ptype_t stype, /* Source type (printer or class) */
dtype; /* Destination type (printer or class) */
char method[HTTP_MAX_URI], /* Method portion of URI */
sizeof(method), username, sizeof(username), host,
sizeof(host), &port, resource, sizeof(resource));
- if ((dest = cupsdValidateDest(host, resource, &dtype, &dprinter)) == NULL)
+ if (!cupsdValidateDest(host, resource, &dtype, &dprinter))
{
/*
* Bad URI...
attr->value_tag = IPP_TAG_KEYWORD;
attr->values[0].string.text = _cupsStrAlloc("no-hold");
+
+ cupsdAddEvent(CUPSD_EVENT_JOB_CONFIG_CHANGED, job->printer, job,
+ "Job job-hold-until value changed by user.");
}
/*
cupsdReleaseJob(job);
+ cupsdAddEvent(CUPSD_EVENT_JOB_STATE, job->printer, job,
+ "Job released by user.");
+
cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was released by \"%s\".", jobid,
username);
ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-id", jobid);
ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_ENUM, "job-state",
- job ? job->state_value : IPP_JOB_CANCELLED);
+ job ? job->state_value : IPP_JOB_CANCELED);
add_job_state_reasons(con, job);
con->response->request.status.status_code = IPP_OK;
_cupsLangString(con->language, message), ap);
va_end(ap);
- cupsdLogMessage(status >= IPP_BAD_REQUEST ? CUPSD_LOG_ERROR : CUPSD_LOG_INFO,
- "%s %s: %s",
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "%s %s: %s",
ippOpString(con->request->request.op.operation_id),
ippErrorString(status), formatted);
}
else
- cupsdLogMessage(status >= IPP_BAD_REQUEST ? CUPSD_LOG_ERROR : CUPSD_LOG_INFO,
- "%s %s",
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "%s %s",
ippOpString(con->request->request.op.operation_id),
ippErrorString(status));
resource[HTTP_MAX_URI];
/* Resource portion of URI */
int port; /* Port portion of URI */
+ int event; /* Events? */
cupsdLogMessage(CUPSD_LOG_DEBUG2, "set_job_attrs(%p[%d], %s)", con,
cupsdLoadJob(job);
+ event = 0;
+
for (attr = con->request->attrs; attr; attr = attr->next)
{
if (attr->group_tag != IPP_TAG_JOB || !attr->name)
return;
}
else if (con->response->request.status.status_code == IPP_OK)
+ {
cupsdSetJobPriority(job, attr->values[0].integer);
+ event |= CUPSD_EVENT_JOB_CONFIG_CHANGED;
+ }
}
else if (!strcmp(attr->name, "job-state"))
{
else if (con->response->request.status.status_code == IPP_OK)
{
job->state->values[0].integer = attr->values[0].integer;
- job->state_value = attr->values[0].integer;
+ job->state_value = (ipp_jstate_t)attr->values[0].integer;
+
+ event |= CUPSD_EVENT_JOB_STATE;
}
break;
}
break;
- case IPP_JOB_CANCELLED :
+ case IPP_JOB_CANCELED :
case IPP_JOB_ABORTED :
case IPP_JOB_COMPLETED :
if (job->state_value > IPP_JOB_PROCESSING)
if (JobHistory)
{
job->state->values[0].integer = attr->values[0].integer;
- job->state_value = attr->values[0].integer;
+ job->state_value = (ipp_jstate_t)attr->values[0].integer;
cupsdSaveJob(job);
}
}
cupsdReleaseJob(job);
else
cupsdHoldJob(job);
+
+ event |= CUPSD_EVENT_JOB_CONFIG_CHANGED | CUPSD_EVENT_JOB_STATE;
}
}
else if (attr->value_tag == IPP_TAG_DELETEATTR)
job->attrs->last = job->attrs->prev;
_ippFreeAttr(attr2);
+
+ event |= CUPSD_EVENT_JOB_CONFIG_CHANGED;
}
}
else
*/
copy_attribute(job->attrs, attr, 0);
+
+ event |= CUPSD_EVENT_JOB_CONFIG_CHANGED;
}
}
cupsdSaveJob(job);
+ /*
+ * Send events as needed...
+ */
+
+ if (event & CUPSD_EVENT_JOB_STATE)
+ cupsdAddEvent(CUPSD_EVENT_JOB_STATE, job->printer, job,
+ job->state_value == IPP_JOB_HELD ?
+ "Job held by user." : "Job restarted by user.");
+
+ if (event & CUPSD_EVENT_JOB_CONFIG_CHANGED)
+ cupsdAddEvent(CUPSD_EVENT_JOB_CONFIG_CHANGED, job->printer, job,
+ "Job options changed by user.");
+
/*
* Start jobs if possible...
*/
/*
- * End of "$Id: ipp.c 5736 2006-07-13 19:59:36Z mike $".
+ * End of "$Id: ipp.c 5907 2006-08-30 02:18:28Z mike $".
*/
/*
- * "$Id: job.c 5719 2006-07-11 21:04:48Z mike $"
+ * "$Id: job.c 5889 2006-08-24 21:44:35Z mike $"
*
* Job management routines for the Common UNIX Printing System (CUPS).
*
*/
cupsdLogMessage(CUPSD_LOG_WARN,
- "Printer/class %s has gone away; cancelling job %d!",
+ "Printer/class %s has gone away; canceling job %d!",
job->dest, job->id);
cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
cupsdHoldSignals();
- cupsdStopAllJobs();
+ cupsdStopAllJobs(1);
cupsdSaveAllJobs();
for (job = (cupsd_job_t *)cupsArrayFirst(Jobs);
*/
void
-cupsdStopAllJobs(void)
+cupsdStopAllJobs(int force) /* I - 1 = Force all filters to stop */
{
cupsd_job_t *job; /* Current job */
job = (cupsd_job_t *)cupsArrayNext(ActiveJobs))
if (job->state_value == IPP_JOB_PROCESSING)
{
- cupsdStopJob(job, 1);
+ cupsdStopJob(job, force);
job->state->values[0].integer = IPP_JOB_PENDING;
job->state_value = IPP_JOB_PENDING;
}
break;
}
- if (ptr == NULL)
+ if (ptr == NULL && !job->status_buffer->bufused)
{
/*
* See if all of the filters and the backend have returned their
}
else if (!strcasecmp(line, "State"))
{
- job->state_value = atoi(value);
+ job->state_value = (ipp_jstate_t)atoi(value);
if (job->state_value < IPP_JOB_PENDING)
job->state_value = IPP_JOB_PENDING;
/* PRINTER env variable */
rip_max_cache[255];
/* RIP_MAX_CACHE env variable */
- int remote_job; /* Remote print job? */
static char *options = NULL;/* Full list of options */
static int optlength = 0; /* Length of option buffer */
if (job->num_files == 0)
{
- cupsdLogMessage(CUPSD_LOG_ERROR, "Job ID %d has no files! Cancelling it!",
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Job ID %d has no files! Canceling it!",
job->id);
cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
FilterLevel += job->cost;
- /*
- * Determine if we are printing to a remote printer...
- */
-
- remote_job = printer->raw && job->num_files > 1 &&
- !strncmp(printer->device_uri, "ipp://", 6);
-
/*
* Add decompression filters, if any...
*/
- if (!remote_job && job->compressions[job->current_file])
+ if (!printer->raw && job->compressions[job->current_file])
{
/*
* Add gziptoany filter to the front of the list...
* For remote jobs, we send all of the files in the argument list.
*/
- if (remote_job)
+ if (printer->remote && job->num_files > 1)
argv = calloc(7 + job->num_files, sizeof(char *));
else
argv = calloc(8, sizeof(char *));
argv[4] = copies;
argv[5] = options;
- if (remote_job)
+ if (printer->remote && job->num_files > 1)
{
for (i = 0; i < job->num_files; i ++)
{
envp[envc ++] = device_uri;
envp[envc ++] = printer_name;
- if ((filter = (mime_filter_t *)cupsArrayLast(filters)) != NULL)
+ if (!printer->remote &&
+ (filter = (mime_filter_t *)cupsArrayLast(filters)) != NULL)
{
snprintf(final_content_type, sizeof(final_content_type),
"FINAL_CONTENT_TYPE=%s/%s",
- filter->src->super, filter->src->type);
+ filter->dst->super, filter->dst->type);
envp[envc ++] = final_content_type;
}
cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] envp[%d]=\"DEVICE_URI=%s\"",
job->id, i, sani_uri);
- if (remote_job)
+ if (printer->remote)
job->current_file = job->num_files;
else
job->current_file ++;
slot, filterfds[slot][0], filterfds[slot][1]);
cupsdClosePipe(filterfds[slot]);
- if (remote_job)
+ if (printer->remote && job->num_files > 1)
{
for (i = 0; i < job->num_files; i ++)
free(argv[i + 6]);
cupsArrayDelete(filters);
- if (remote_job)
+ if (printer->remote && job->num_files > 1)
{
for (i = 0; i < job->num_files; i ++)
free(argv[i + 6]);
/*
- * End of "$Id: job.c 5719 2006-07-11 21:04:48Z mike $".
+ * End of "$Id: job.c 5889 2006-08-24 21:44:35Z mike $".
*/
/*
- * "$Id: job.h 5393 2006-04-14 18:17:18Z mike $"
+ * "$Id: job.h 5833 2006-08-16 20:05:58Z mike $"
*
* Print job definitions for the Common UNIX Printing System (CUPS) scheduler.
*
extern void cupsdSaveJob(cupsd_job_t *job);
extern void cupsdSetJobHoldUntil(cupsd_job_t *job, const char *when);
extern void cupsdSetJobPriority(cupsd_job_t *job, int priority);
-extern void cupsdStopAllJobs(void);
+extern void cupsdStopAllJobs(int force);
extern void cupsdStopJob(cupsd_job_t *job, int force);
extern void cupsdUpdateJob(cupsd_job_t *job);
/*
- * End of "$Id: job.h 5393 2006-04-14 18:17:18Z mike $".
+ * End of "$Id: job.h 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: main.c 5634 2006-06-06 17:48:27Z mike $"
+ * "$Id: main.c 5878 2006-08-24 15:55:42Z mike $"
*
* Scheduler main loop for the Common UNIX Printing System (CUPS).
*
* inactivity...
*/
- if (timeout.tv_sec == 86400 && Launchd && LaunchdTimeout &&
+ if (timeout.tv_sec == 86400 && Launchd && LaunchdTimeout && !NumPolled &&
(!Browsing || !(BrowseLocalProtocols & BROWSE_DNSSD) ||
cupsArrayCount(Printers) == 0))
{
kCFBooleanTrue);
if ((Browsing && BrowseLocalProtocols && cupsArrayCount(Printers)) ||
- cupsArrayCount(ActiveJobs))
+ cupsArrayCount(ActiveJobs) || NumPolled)
CFDictionaryAddValue(cupsd_dict, CFSTR(LAUNCH_JOBKEY_RUNATLOAD),
kCFBooleanTrue);
else
#endif /* HAVE_WAITPID */
{
/*
- * Ignore SIGTERM errors - that comes when a job is cancelled...
+ * Ignore SIGTERM errors - that comes when a job is canceled...
*/
cupsdFinishProcess(pid, name, sizeof(name));
/*
- * End of "$Id: main.c 5634 2006-06-06 17:48:27Z mike $".
+ * End of "$Id: main.c 5878 2006-08-24 15:55:42Z mike $".
*/
/*
- * "$Id: mime.h 5487 2006-05-03 19:28:29Z mike $"
+ * "$Id: mime.h 5771 2006-07-20 18:06:20Z mike $"
*
* MIME type/conversion database definitions for the Common UNIX Printing System (CUPS).
*
* C++ magic...
*/
-# ifdef _cplusplus
+# ifdef __cplusplus
extern "C" {
-# endif /* _cplusplus */
+# endif /* __cplusplus */
/*
extern mime_filter_t *mimeNextFilter(mime_t *mime);
extern int mimeNumFilters(mime_t *mime);
-# ifdef _cplusplus
+# ifdef __cplusplus
}
-# endif /* _cplusplus */
+# endif /* __cplusplus */
#endif /* !_CUPS_MIME_H_ */
/*
- * End of "$Id: mime.h 5487 2006-05-03 19:28:29Z mike $".
+ * End of "$Id: mime.h 5771 2006-07-20 18:06:20Z mike $".
*/
/*
- * "$Id: policy.c 5247 2006-03-08 13:43:38Z mike $"
+ * "$Id: policy.c 5838 2006-08-17 14:41:42Z mike $"
*
* Policy routines for the Common UNIX Printing System (CUPS).
*
{
cupsdLogMessage(CUPSD_LOG_CRIT, "cupsdCheckPolicy: p=%p, con=%p!", p, con);
- return (0);
+ return ((http_status_t)0);
}
/*
if ((po = cupsdFindPolicyOp(p, con->request->request.op.operation_id)) == NULL)
{
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdCheckPolicy: No matching operation, returning 0!");
- return (0);
+ return ((http_status_t)0);
}
con->best = po;
/*
- * End of "$Id: policy.c 5247 2006-03-08 13:43:38Z mike $".
+ * End of "$Id: policy.c 5838 2006-08-17 14:41:42Z mike $".
*/
/*
- * "$Id: printers.c 5724 2006-07-12 19:42:35Z mike $"
+ * "$Id: printers.c 5828 2006-08-15 21:21:45Z mike $"
*
* Printer routines for the Common UNIX Printing System (CUPS).
*
else
snprintf(resource, sizeof(resource), "/printers/%s", p->name);
- if ((auth = cupsdFindBest(resource, HTTP_POST)) == NULL)
+ if ((auth = cupsdFindBest(resource, HTTP_POST)) == NULL ||
+ auth->type == AUTH_NONE)
auth = cupsdFindPolicyOp(p->op_policy_ptr, IPP_PRINT_JOB);
if (auth)
printer_type = p->type;
- p->raw = 0;
+ p->raw = 0;
+ p->remote = 0;
if (p->type & CUPS_PRINTER_REMOTE)
{
ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL,
p->uri);
- p->raw = 1;
+ p->raw = 1;
+ p->remote = 1;
}
else
{
* Print all files directly...
*/
- p->raw = 1;
+ p->raw = 1;
+ p->remote = 1;
}
else
{
/*
- * End of "$Id: printers.c 5724 2006-07-12 19:42:35Z mike $".
+ * End of "$Id: printers.c 5828 2006-08-15 21:21:45Z mike $".
*/
/*
- * "$Id: printers.h 5330 2006-03-23 21:07:20Z mike $"
+ * "$Id: printers.h 5828 2006-08-15 21:21:45Z mike $"
*
* Printer definitions for the Common UNIX Printing System (CUPS) scheduler.
*
char *device_uri; /* Device URI */
char *port_monitor; /* Port monitor */
int raw; /* Raw queue? */
+ int remote; /* Remote queue? */
mime_type_t *filetype; /* Pseudo-filetype for printer */
cups_array_t *filetypes; /* Supported file types */
void *job; /* Current job in queue */
/*
- * End of "$Id: printers.h 5330 2006-03-23 21:07:20Z mike $".
+ * End of "$Id: printers.h 5828 2006-08-15 21:21:45Z mike $".
*/
/*
- * "$Id: statbuf.c 5447 2006-04-21 20:07:51Z mike $"
+ * "$Id: statbuf.c 5889 2006-08-24 21:44:35Z mike $"
*
* Status buffer routines for the Common UNIX Printing System (CUPS)
* scheduler.
lineptr = NULL;
}
- if (lineptr == NULL)
+ if (!lineptr)
{
/*
* End of file...
/*
- * End of "$Id: statbuf.c 5447 2006-04-21 20:07:51Z mike $".
+ * End of "$Id: statbuf.c 5889 2006-08-24 21:44:35Z mike $".
*/
/*
- * "$Id: subscriptions.c 5716 2006-07-11 17:56:57Z mike $"
+ * "$Id: subscriptions.c 5878 2006-08-24 15:55:42Z mike $"
*
* Subscription routines for the Common UNIX Printing System (CUPS) scheduler.
*
"job-stopped");
break;
- case IPP_JOB_CANCELLED :
+ case IPP_JOB_CANCELED :
ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
IPP_TAG_KEYWORD, "job-state-reasons", NULL,
"job-canceled-by-user");
void
cupsdUpdateNotifierStatus(void)
{
- char *ptr, /* Pointer to end of line in buffer */
- message[1024]; /* Pointer to message text */
+ char message[1024]; /* Pointer to message text */
int loglevel; /* Log level for message */
- while ((ptr = cupsdStatBufUpdate(NotifierStatusBuffer, &loglevel,
- message, sizeof(message))) != NULL)
+ while (cupsdStatBufUpdate(NotifierStatusBuffer, &loglevel,
+ message, sizeof(message)))
if (!strchr(NotifierStatusBuffer->buffer, '\n'))
break;
}
{
int pid; /* Notifier process ID */
int fds[2]; /* Pipe file descriptors */
- int envc; /* Number of environment variables */
char *argv[4], /* Command-line arguments */
*envp[MAX_ENV], /* Environment variables */
user_data[128], /* Base-64 encoded user data */
* Setup the environment...
*/
- envc = cupsdLoadEnv(envp, (int)(sizeof(envp) / sizeof(envp[0])));
+ cupsdLoadEnv(envp, (int)(sizeof(envp) / sizeof(envp[0])));
/*
* Create pipes as needed...
/*
- * End of "$Id: subscriptions.c 5716 2006-07-11 17:56:57Z mike $".
+ * End of "$Id: subscriptions.c 5878 2006-08-24 15:55:42Z mike $".
*/
/*
- * "$Id: sysman.c 5305 2006-03-18 03:05:12Z mike $"
+ * "$Id: sysman.c 5833 2006-08-16 20:05:58Z mike $"
*
* System management definitions for the Common UNIX Printing System (CUPS).
*
Sleeping = 1;
- cupsdStopAllJobs();
+ cupsdStopAllJobs(0);
cupsdSaveAllJobs();
for (p = (cupsd_printer_t *)cupsArrayFirst(Printers);
p->browse_time = 0;
cupsdSendBrowseList();
+ cupsdRestartPolling();
}
else
cupsdLogMessage(CUPSD_LOG_DEBUG,
/*
- * End of "$Id: sysman.c 5305 2006-03-18 03:05:12Z mike $".
+ * End of "$Id: sysman.c 5833 2006-08-16 20:05:58Z mike $".
*/
--- /dev/null
+/*
+ * "$Id: testlpd.c 5868 2006-08-23 19:39:39Z mike $"
+ *
+ * cups-lpd test program for the Common UNIX Printing System (CUPS).
+ *
+ * Copyright 2006 by Easy Software Products, all rights reserved.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Easy Software Products and are protected by Federal
+ * copyright law. Distribution and use rights are outlined in the file
+ * "LICENSE.txt" which should have been included with this file. If this
+ * file is missing or damaged please contact Easy Software Products
+ * at:
+ *
+ * Attn: CUPS Licensing Information
+ * Easy Software Products
+ * 44141 Airport View Drive, Suite 204
+ * Hollywood, Maryland 20636 USA
+ *
+ * Voice: (301) 373-9600
+ * EMail: cups-info@cups.org
+ * WWW: http://www.cups.org
+ *
+ * Contents:
+ *
+ * main() - Simulate an LPD client.
+ * do_command() - Send the LPD command and wait for a response.
+ * print_job() - Submit a file for printing.
+ * print_waiting() - Print waiting jobs.
+ * remove_job() - Cancel a print job.
+ * status_long() - Show the long printer status.
+ * status_short() - Show the short printer status.
+ * usage() - Show program usage...
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include <cups/cups.h>
+#include <cups/string.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <signal.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+
+/*
+ * Local functions...
+ */
+
+static int do_command(int outfd, int infd, const char *command);
+static int print_job(int outfd, int infd, char *dest, char **args);
+static int print_waiting(int outfd, int infd, char *dest);
+static int remove_job(int outfd, int infd, char *dest, char **args);
+static int status_long(int outfd, int infd, char *dest, char **args);
+static int status_short(int outfd, int infd, char *dest, char **args);
+static void usage(void);
+
+
+/*
+ * 'main()' - Simulate an LPD client.
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments */
+ char *argv[]) /* I - Command-line arguments */
+{
+ int i; /* Looping var */
+ int status; /* Test status */
+ char *op, /* Operation to test */
+ **opargs, /* Remaining arguments */
+ *dest; /* Destination */
+ int cupslpd_argc; /* Argument count for cups-lpd */
+ char *cupslpd_argv[1000]; /* Arguments for cups-lpd */
+ int cupslpd_stdin[2], /* Standard input for cups-lpd */
+ cupslpd_stdout[2], /* Standard output for cups-lpd */
+ cupslpd_pid; /* Process ID for cups-lpd */
+
+
+ /*
+ * Collect command-line arguments...
+ */
+
+ op = NULL;
+ opargs = NULL;
+ dest = NULL;
+ cupslpd_argc = 1;
+ cupslpd_argv[0] = (char *)"cups-lpd";
+
+ for (i = 1; i < argc; i ++)
+ if (!strncmp(argv[i], "-o", 2))
+ {
+ cupslpd_argv[cupslpd_argc++] = argv[i];
+
+ if (argv[i][2])
+ {
+ i ++;
+
+ if (i >= argc)
+ usage();
+
+ cupslpd_argv[cupslpd_argc++] = argv[i];
+ }
+ }
+ else if (argv[i][0] == '-')
+ usage();
+ else if (!op)
+ op = argv[i];
+ else if (!dest)
+ dest = argv[i];
+ else
+ {
+ opargs = argv + i;
+ break;
+ }
+
+ if (!op ||
+ (!strcmp(op, "print-job") && (!dest || !opargs)) ||
+ (!strcmp(op, "remove-job") && (!dest || !opargs)) ||
+ (strcmp(op, "print-job") && strcmp(op, "print-waiting") &&
+ strcmp(op, "remove-job") && strcmp(op, "status-long") &&
+ strcmp(op, "status-short")))
+ usage();
+
+ /*
+ * Run the cups-lpd program using pipes...
+ */
+
+ cupslpd_argv[cupslpd_argc] = NULL;
+
+ pipe(cupslpd_stdin);
+ pipe(cupslpd_stdout);
+
+ if ((cupslpd_pid = fork()) < 0)
+ {
+ /*
+ * Error!
+ */
+
+ perror("testlpd: Unable to fork");
+ return (1);
+ }
+ else if (cupslpd_pid == 0)
+ {
+ /*
+ * Child goes here...
+ */
+
+ close(0);
+ dup(cupslpd_stdin[0]);
+ close(cupslpd_stdin[0]);
+ close(cupslpd_stdin[1]);
+
+ close(1);
+ dup(cupslpd_stdout[1]);
+ close(cupslpd_stdout[0]);
+ close(cupslpd_stdout[1]);
+
+ execv("./cups-lpd", cupslpd_argv);
+
+ perror("testlpd: Unable to exec ./cups-lpd");
+ exit(errno);
+ }
+ else
+ {
+ close(cupslpd_stdin[0]);
+ close(cupslpd_stdout[1]);
+ }
+
+ /*
+ * Do the operation test...
+ */
+
+ if (!strcmp(op, "print-job"))
+ status = print_job(cupslpd_stdin[1], cupslpd_stdout[0], dest, opargs);
+ else if (!strcmp(op, "print-waiting"))
+ status = print_waiting(cupslpd_stdin[1], cupslpd_stdout[0], dest);
+ else if (!strcmp(op, "remove-job"))
+ status = remove_job(cupslpd_stdin[1], cupslpd_stdout[0], dest, opargs);
+ else if (!strcmp(op, "status-long"))
+ status = status_long(cupslpd_stdin[1], cupslpd_stdout[0], dest, opargs);
+ else if (!strcmp(op, "status-short"))
+ status = status_short(cupslpd_stdin[1], cupslpd_stdout[0], dest, opargs);
+
+ /*
+ * Kill the test program...
+ */
+
+ close(cupslpd_stdin[1]);
+ close(cupslpd_stdout[0]);
+ kill(cupslpd_pid, SIGTERM);
+
+ /*
+ * Return the test status...
+ */
+
+ return (status);
+}
+
+
+/*
+ * 'do_command()' - Send the LPD command and wait for a response.
+ */
+
+static int /* O - Status from cups-lpd */
+do_command(int outfd, /* I - Command file descriptor */
+ int infd, /* I - Response file descriptor */
+ const char *command) /* I - Command line to send */
+{
+ int len; /* Length of command line */
+ char status; /* Status byte */
+
+
+ printf("COMMAND: %02X %s", command[0], command + 1);
+
+ len = strlen(command);
+
+ if (write(outfd, command, len) < len)
+ {
+ puts(" Write failed!");
+ return (-1);
+ }
+
+ if (read(infd, &status, 1) < 1)
+ puts("IN: ERROR");
+ else
+ printf("IN: %d\n", status);
+
+ return (status);
+}
+
+
+/*
+ * 'print_job()' - Submit a file for printing.
+ */
+
+static int /* O - Status from cups-lpd */
+print_job(int outfd, /* I - Command file descriptor */
+ int infd, /* I - Response file descriptor */
+ char *dest, /* I - Destination */
+ char **args) /* I - Arguments */
+{
+ int fd; /* Print file descriptor */
+ char command[1024], /* Command buffer */
+ control[1024], /* Control file */
+ buffer[8192]; /* Print buffer */
+ int status; /* Status of command */
+ struct stat fileinfo; /* File information */
+ char *jobname; /* Job name */
+ int sequence; /* Sequence number */
+ int bytes; /* Bytes read/written */
+
+
+ /*
+ * Check the print file...
+ */
+
+ if (stat(args[0], &fileinfo))
+ {
+ perror(args[0]);
+ return (-1);
+ }
+
+ if ((fd = open(args[0], O_RDONLY)) < 0)
+ {
+ perror(args[0]);
+ return (-1);
+ }
+
+ /*
+ * Send the "receive print job" command...
+ */
+
+ snprintf(command, sizeof(command), "\002%s\n", dest);
+ if ((status = do_command(outfd, infd, command)) != 0)
+ {
+ close(fd);
+ return (status);
+ }
+
+ /*
+ * Format a control file string that will be used to submit the job...
+ */
+
+ if ((jobname = strrchr(args[0], '/')) != NULL)
+ jobname ++;
+ else
+ jobname = args[0];
+
+ sequence = (int)getpid() % 1000;
+
+ snprintf(control, sizeof(control),
+ "Hlocalhost\n"
+ "P%s\n"
+ "J%s\n"
+ "ldfA%03.3dlocalhost\n"
+ "UdfA%03.3dlocalhost\n"
+ "N%s\n",
+ cupsUser(), jobname, sequence, sequence, jobname);
+
+ /*
+ * Send the control file...
+ */
+
+ bytes = strlen(control);
+
+ snprintf(command, sizeof(command), "\002%d cfA%03.3dlocalhost\n",
+ bytes, sequence);
+
+ if ((status = do_command(outfd, infd, command)) != 0)
+ {
+ close(fd);
+ return (status);
+ }
+
+ bytes ++;
+
+ if (write(outfd, control, bytes) < bytes)
+ {
+ printf("CONTROL: Unable to write %d bytes!\n", bytes);
+ close(fd);
+ return (-1);
+ }
+
+ printf("CONTROL: Wrote %d bytes.\n", bytes);
+
+ if (read(infd, command, 1) < 1)
+ {
+ puts("IN: ERROR");
+ close(fd);
+ return (-1);
+ }
+ else
+ {
+ status = command[0];
+
+ printf("IN: %d\n", status);
+ }
+
+ /*
+ * Send the data file...
+ */
+
+ snprintf(command, sizeof(command), "\003%d dfA%03.3dlocalhost\n",
+ (int)fileinfo.st_size, sequence);
+
+ if ((status = do_command(outfd, infd, command)) != 0)
+ {
+ close(fd);
+ return (status);
+ }
+
+ while ((bytes = read(fd, buffer, sizeof(buffer))) > 0)
+ {
+ if (write(outfd, buffer, bytes) < bytes)
+ {
+ printf("DATA: Unable to write %d bytes!\n", bytes);
+ close(fd);
+ return (-1);
+ }
+ }
+
+ write(outfd, "", 1);
+
+ close(fd);
+
+ printf("DATA: Wrote %d bytes.\n", (int)fileinfo.st_size);
+
+ if (read(infd, command, 1) < 1)
+ {
+ puts("IN: ERROR");
+ close(fd);
+ return (-1);
+ }
+ else
+ {
+ status = command[0];
+
+ printf("IN: %d\n", status);
+ }
+
+ return (status);
+}
+
+
+/*
+ * 'print_waiting()' - Print waiting jobs.
+ */
+
+static int /* O - Status from cups-lpd */
+print_waiting(int outfd, /* I - Command file descriptor */
+ int infd, /* I - Response file descriptor */
+ char *dest) /* I - Destination */
+{
+ char command[1024]; /* Command buffer */
+
+
+ /*
+ * Send the "print waiting jobs" command...
+ */
+
+ snprintf(command, sizeof(command), "\001%s\n", dest);
+
+ return (do_command(outfd, infd, command));
+}
+
+
+/*
+ * 'remove_job()' - Cancel a print job.
+ */
+
+static int /* O - Status from cups-lpd */
+remove_job(int outfd, /* I - Command file descriptor */
+ int infd, /* I - Response file descriptor */
+ char *dest, /* I - Destination */
+ char **args) /* I - Arguments */
+{
+ int i; /* Looping var */
+ char command[1024]; /* Command buffer */
+
+ /*
+ * Send the "remove jobs" command...
+ */
+
+ snprintf(command, sizeof(command), "\005%s", dest);
+
+ for (i = 0; args[i]; i ++)
+ {
+ strlcat(command, " ", sizeof(command));
+ strlcat(command, args[i], sizeof(command));
+ }
+
+ strlcat(command, "\n", sizeof(command));
+
+ return (do_command(outfd, infd, command));
+}
+
+
+/*
+ * 'status_long()' - Show the long printer status.
+ */
+
+static int /* O - Status from cups-lpd */
+status_long(int outfd, /* I - Command file descriptor */
+ int infd, /* I - Response file descriptor */
+ char *dest, /* I - Destination */
+ char **args) /* I - Arguments */
+{
+ char command[1024], /* Command buffer */
+ buffer[8192]; /* Status buffer */
+ int bytes; /* Bytes read/written */
+
+
+ /*
+ * Send the "send short status" command...
+ */
+
+ if (args)
+ snprintf(command, sizeof(command), "\004%s %s\n", dest, args[0]);
+ else
+ snprintf(command, sizeof(command), "\004%s\n", dest);
+
+ bytes = strlen(command);
+
+ if (write(outfd, command, bytes) < bytes)
+ return (-1);
+
+ /*
+ * Read the status back...
+ */
+
+ while ((bytes = read(infd, buffer, sizeof(buffer))) > 0)
+ {
+ fwrite(buffer, 1, bytes, stdout);
+ fflush(stdout);
+ }
+
+ return (0);
+}
+
+
+/*
+ * 'status_short()' - Show the short printer status.
+ */
+
+static int /* O - Status from cups-lpd */
+status_short(int outfd, /* I - Command file descriptor */
+ int infd, /* I - Response file descriptor */
+ char *dest, /* I - Destination */
+ char **args) /* I - Arguments */
+{
+ char command[1024], /* Command buffer */
+ buffer[8192]; /* Status buffer */
+ int bytes; /* Bytes read/written */
+
+
+ /*
+ * Send the "send short status" command...
+ */
+
+ if (args)
+ snprintf(command, sizeof(command), "\003%s %s\n", dest, args[0]);
+ else
+ snprintf(command, sizeof(command), "\003%s\n", dest);
+
+ bytes = strlen(command);
+
+ if (write(outfd, command, bytes) < bytes)
+ return (-1);
+
+ /*
+ * Read the status back...
+ */
+
+ while ((bytes = read(infd, buffer, sizeof(buffer))) > 0)
+ {
+ fwrite(buffer, 1, bytes, stdout);
+ fflush(stdout);
+ }
+
+ return (0);
+}
+
+
+/*
+ * 'usage()' - Show program usage...
+ */
+
+static void
+usage(void)
+{
+ puts("Usage: testlpd [options] print-job printer user filename [... filename]");
+ puts(" testlpd [options] print-waiting [printer or user]");
+ puts(" testlpd [options] remove-job printer [user [job-id]]");
+ puts(" testlpd [options] status-long [printer or user]");
+ puts(" testlpd [options] status-short [printer or user]");
+ puts("");
+ puts("Options:");
+ puts(" -o name=value");
+
+ exit(0);
+}
+
+
+/*
+ * End of "$Id: testlpd.c 5868 2006-08-23 19:39:39Z mike $".
+ */
/*
- * "$Id: accept.c 5104 2006-02-15 03:21:04Z mike $"
+ * "$Id: accept.c 5833 2006-08-16 20:05:58Z mike $"
*
* "accept", "disable", "enable", and "reject" commands for the Common
* UNIX Printing System (CUPS).
int cancel; /* Cancel jobs? */
+ _cupsSetLocale();
+
/*
* See what operation we're supposed to do...
*/
/*
- * End of "$Id: accept.c 5104 2006-02-15 03:21:04Z mike $".
+ * End of "$Id: accept.c 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: cancel.c 5696 2006-06-26 18:34:20Z mike $"
+ * "$Id: cancel.c 5833 2006-08-16 20:05:58Z mike $"
*
* "cancel" command for the Common UNIX Printing System (CUPS).
*
ipp_op_t op; /* Operation */
+ _cupsSetLocale();
+
/*
* Setup to cancel individual print jobs...
*/
/*
- * End of "$Id: cancel.c 5696 2006-06-26 18:34:20Z mike $".
+ * End of "$Id: cancel.c 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: cupsaddsmb.c 5753 2006-07-18 19:53:24Z mike $"
+ * "$Id: cupsaddsmb.c 5833 2006-08-16 20:05:58Z mike $"
*
* "cupsaddsmb" command for the Common UNIX Printing System (CUPS).
*
cups_dest_t *dests; /* Printers */
+ _cupsSetLocale();
+
/*
* Parse command-line arguments...
*/
/*
- * End of "$Id: cupsaddsmb.c 5753 2006-07-18 19:53:24Z mike $".
+ * End of "$Id: cupsaddsmb.c 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: cupstestdsc.c 5392 2006-04-14 17:50:39Z mike $"
+ * "$Id: cupstestdsc.c 5838 2006-08-17 14:41:42Z mike $"
*
* DSC test program for the Common UNIX Printing System (CUPS).
*
int num_files; /* Number of files tested */
+ _cupsSetLocale();
+
/*
* Collect command-line arguments...
*/
saw_end_setup, /* %%EndSetup seen? */
saw_page, /* %%Page seen? */
saw_trailer, /* %%Trailer seen? */
- saw_eof, /* %%EOF seen? */
saw_long_line; /* Saw long lines? */
saw_end_comments = 0;
saw_end_prolog = 0;
saw_end_setup = 0;
- saw_eof = 0;
saw_long_line = 0;
saw_page = 0;
saw_pages = 0;
/*
- * End of "$Id: cupstestdsc.c 5392 2006-04-14 17:50:39Z mike $".
+ * End of "$Id: cupstestdsc.c 5838 2006-08-17 14:41:42Z mike $".
*/
/*
- * "$Id: cupstestppd.c 5549 2006-05-19 19:39:28Z mike $"
+ * "$Id: cupstestppd.c 5833 2006-08-16 20:05:58Z mike $"
*
* PPD test program for the Common UNIX Printing System (CUPS).
*
"JCL", "PAGE", "PROLOG" };
+ _cupsSetLocale();
+
/*
* Display PPD files for each file listed on the command-line...
*/
* Look for default keywords with no matching option...
*/
- for (i = 0; i < ppd->num_attrs; i ++)
+ for (j = 0; j < ppd->num_attrs; j ++)
{
- attr = ppd->attrs[i];
+ attr = ppd->attrs[j];
if (!strcmp(attr->name, "DefaultColorSpace") ||
!strcmp(attr->name, "DefaultFont") ||
* Check that the default option value matches a choice...
*/
- for (j = 0; j < option->num_choices; j ++)
- if (!strcmp(option->choices[j].choice, attr->value))
+ for (k = 0; k < option->num_choices; k ++)
+ if (!strcmp(option->choices[k].choice, attr->value))
break;
- if (j >= option->num_choices)
+ if (k >= option->num_choices)
{
if (verbose >= 0)
{
char *languages, /* Copy of attribute value */
*langstart, /* Start of current language */
*langptr, /* Pointer into languages */
- keyword[PPD_MAX_NAME]; /* Localization keyword */
+ keyword[PPD_MAX_NAME], /* Localization keyword */
+ ckeyword[PPD_MAX_NAME]; /* Custom option keyword */
+ ppd_coption_t *coption; /* Custom option */
+ ppd_cparam_t *cparam; /* Custom parameter */
languages = strdup(attr->value);
option->keyword);
for (j = 0; j < option->num_choices; j ++)
{
- if (!ppdFindAttr(ppd, keyword, option->choices[j].choice))
+ if (!strcasecmp(option->choices[j].choice, "Custom") &&
+ (coption = ppdFindCustomOption(ppd,
+ option->keyword)) != NULL)
+ {
+ snprintf(ckeyword, sizeof(ckeyword), "%s.Custom%s",
+ langstart, option->keyword);
+
+ if (!ppdFindAttr(ppd, ckeyword, "True"))
+ {
+ if (verbose >= 0)
+ {
+ if (!errors && !verbose)
+ _cupsLangPuts(stdout, _(" FAIL\n"));
+
+ _cupsLangPrintf(stdout,
+ _(" **FAIL** Missing \"%s\" "
+ "translation string for option %s, "
+ "choice %s!\n"),
+ langstart, ckeyword + 1 + strlen(langstart),
+ "True");
+ }
+
+ errors ++;
+ }
+
+ if (strcasecmp(option->keyword, "PageSize"))
+ {
+ for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
+ cparam;
+ cparam = (ppd_cparam_t *)cupsArrayNext(coption->params))
+ {
+ snprintf(ckeyword, sizeof(ckeyword), "%s.ParamCustom%s",
+ langstart, option->keyword);
+ if (!ppdFindAttr(ppd, ckeyword, cparam->name))
+ {
+ if (verbose >= 0)
+ {
+ if (!errors && !verbose)
+ _cupsLangPuts(stdout, _(" FAIL\n"));
+
+ _cupsLangPrintf(stdout,
+ _(" **FAIL** Missing \"%s\" "
+ "translation string for option %s, "
+ "choice %s!\n"),
+ langstart,
+ ckeyword + 1 + strlen(langstart),
+ cparam->name);
+ }
+
+ errors ++;
+ }
+ }
+ }
+ }
+ else if (!ppdFindAttr(ppd, keyword, option->choices[j].choice))
{
if (verbose >= 0)
{
if (!errors && !verbose)
_cupsLangPuts(stdout, _(" FAIL\n"));
- _cupsLangPuts(stdout,
- _(" **FAIL** 1284DeviceId must be 1284DeviceID!\n"
- " REF: Page 72, section 5.5\n"));
+ _cupsLangPrintf(stdout,
+ _(" **FAIL** %s must be 1284DeviceID!\n"
+ " REF: Page 72, section 5.5\n"),
+ attr->name);
}
errors ++;
* Look for default keywords with no corresponding option...
*/
- for (i = 0; i < ppd->num_attrs; i ++)
+ for (j = 0; j < ppd->num_attrs; j ++)
{
- attr = ppd->attrs[i];
+ attr = ppd->attrs[j];
if (!strcmp(attr->name, "DefaultColorSpace") ||
!strcmp(attr->name, "DefaultColorSep") ||
/*
- * End of "$Id: cupstestppd.c 5549 2006-05-19 19:39:28Z mike $".
+ * End of "$Id: cupstestppd.c 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: lp.c 5235 2006-03-06 13:02:23Z mike $"
+ * "$Id: lp.c 5833 2006-08-16 20:05:58Z mike $"
*
* "lp" command for the Common UNIX Printing System (CUPS).
*
return (0);
#endif /* __sun */
+ _cupsSetLocale();
+
silent = 0;
printer = NULL;
num_dests = 0;
/*
- * End of "$Id: lp.c 5235 2006-03-06 13:02:23Z mike $".
+ * End of "$Id: lp.c 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: lpadmin.c 5545 2006-05-18 21:00:56Z mike $"
+ * "$Id: lpadmin.c 5833 2006-08-16 20:05:58Z mike $"
*
* "lpadmin" command for the Common UNIX Printing System (CUPS).
*
cups_option_t *options; /* Options */
+ _cupsSetLocale();
+
http = NULL;
printer = NULL;
num_options = 0;
/*
- * End of "$Id: lpadmin.c 5545 2006-05-18 21:00:56Z mike $".
+ * End of "$Id: lpadmin.c 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: lpinfo.c 4925 2006-01-13 02:52:47Z mike $"
+ * "$Id: lpinfo.c 5833 2006-08-16 20:05:58Z mike $"
*
* "lpinfo" command for the Common UNIX Printing System (CUPS).
*
int long_status; /* Long listing? */
+ _cupsSetLocale();
+
http = NULL;
long_status = 0;
/*
- * End of "$Id: lpinfo.c 4925 2006-01-13 02:52:47Z mike $".
+ * End of "$Id: lpinfo.c 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: lpmove.c 5023 2006-01-29 14:39:44Z mike $"
+ * "$Id: lpmove.c 5833 2006-08-16 20:05:58Z mike $"
*
* "lpmove" command for the Common UNIX Printing System (CUPS).
*
*dest; /* New destination */
+ _cupsSetLocale();
+
dest = NULL;
dests = NULL;
http = NULL;
/*
- * End of "$Id: lpmove.c 5023 2006-01-29 14:39:44Z mike $".
+ * End of "$Id: lpmove.c 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: lpoptions.c 5753 2006-07-18 19:53:24Z mike $"
+ * "$Id: lpoptions.c 5833 2006-08-16 20:05:58Z mike $"
*
* Printer option program for the Common UNIX Printing System (CUPS).
*
*option; /* Current option */
+ _cupsSetLocale();
+
/*
* Loop through the command-line arguments...
*/
/*
- * End of "$Id: lpoptions.c 5753 2006-07-18 19:53:24Z mike $".
+ * End of "$Id: lpoptions.c 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: lppasswd.c 4924 2006-01-13 01:55:20Z mike $"
+ * "$Id: lppasswd.c 5833 2006-08-16 20:05:58Z mike $"
*
* MD5 password program for the Common UNIX Printing System (CUPS).
*
#endif /* HAVE_SIGACTION && !HAVE_SIGSET*/
+ _cupsSetLocale();
+
/*
* Check to see if stdin, stdout, and stderr are still open...
*/
/*
- * End of "$Id: lppasswd.c 4924 2006-01-13 01:55:20Z mike $".
+ * End of "$Id: lppasswd.c 5833 2006-08-16 20:05:58Z mike $".
*/
/*
- * "$Id: lpstat.c 5638 2006-06-06 20:08:13Z mike $"
+ * "$Id: lpstat.c 5833 2006-08-16 20:05:58Z mike $"
*
* "lpstat" command for the Common UNIX Printing System (CUPS).
*
char op; /* Last operation on command-line */
- /*
- * Set the locale so that times, etc. are displayed properly.
- *
- * Unfortunately, while we need the localized time value, we *don't*
- * want to use the localized charset for the time value, so we need
- * to set LC_TIME to the locale name with .UTF-8 on the end (if
- * the locale includes a character set specifier...)
- */
-
- setlocale(LC_ALL, "");
-
-#ifdef LC_TIME
- {
- const char *lc_time; /* Current LC_TIME value */
- char new_lc_time[255], /* New LC_TIME value */
- *charset; /* Pointer to character set */
-
- if ((lc_time = setlocale(LC_TIME, NULL)) == NULL)
- lc_time = setlocale(LC_ALL, NULL);
+ _cupsSetLocale();
- if (lc_time)
- {
- strlcpy(new_lc_time, lc_time, sizeof(new_lc_time));
- if ((charset = strchr(new_lc_time, '.')) == NULL)
- charset = new_lc_time + strlen(new_lc_time);
-
- strlcpy(charset, ".UTF-8", sizeof(new_lc_time) - (charset - new_lc_time));
- }
- else
- strcpy(new_lc_time, "C");
-
- setlocale(LC_TIME, new_lc_time);
- }
-#endif /* LC_TIME */
-
/*
* Parse command-line options...
*/
/*
- * End of "$Id: lpstat.c 5638 2006-06-06 20:08:13Z mike $".
+ * End of "$Id: lpstat.c 5833 2006-08-16 20:05:58Z mike $".
*/
#
-# "$Id: Makefile 5609 2006-05-30 20:31:10Z mike $"
+# "$Id: Makefile 5878 2006-08-24 15:55:42Z mike $"
#
# Template makefile for the Common UNIX Printing System (CUPS).
#
maintenance.tmpl \
modify-class.tmpl \
modify-printer.tmpl \
+ norestart.tmpl \
option-boolean.tmpl \
option-conflict.tmpl \
option-header.tmpl \
#
-# End of "$Id: Makefile 5609 2006-05-30 20:31:10Z mike $".
+# End of "$Id: Makefile 5878 2006-08-24 15:55:42Z mike $".
#
--- /dev/null
+<p>No se ha reiniciado el servidor debido a que no se han hecho
+cambios en la configuración...</p>
-<P><A HREF="{job_printer_uri}">Job {job_id}</A> has been cancelled.
+<P><A HREF="{job_printer_uri}">Job {job_id}</A> has been canceled.
<TD>{job_media_sheets_completed=0?Unknown:{?job_media_sheets_completed}}</TD>
<TD>{job_state=3?pending since<BR>{time_at_creation}:{job_state=4?held since<BR>{time_at_creation}:
{job_state=5?processing since<BR>{time_at_processing}:{job_state=6?stopped:
-{job_state=7?cancelled at<BR>{time_at_completed}:{job_state=8?aborted:completed at<BR>{time_at_completed}}}}}}} </TD>
+{job_state=7?canceled at<BR>{time_at_completed}:{job_state=8?aborted:completed at<BR>{time_at_completed}}}}}}} </TD>
<TD>
{job_preserved>0?
<A HREF="/jobs/?op=restart-job&job_id={job_id}&job_printer_uri={job_printer_uri}">
--- /dev/null
+<p>The server was not restarted because no changes were made to
+the configuration...</p>
#
-# "$Id: 4.2-cups-printer-ops.test 5493 2006-05-05 16:33:57Z mike $"
+# "$Id: 4.2-cups-printer-ops.test 5833 2006-08-16 20:05:58Z mike $"
#
# Verify that the CUPS printer operations work.
#
ATTR name requesting-user-name $user
GROUP subscription
- ATTR uri notify-recipient testnotify
+ ATTR uri notify-recipient testnotify://
ATTR keyword notify-events printer-added,printer-modified,printer-deleted
# What statuses are OK?
}
#
-# End of "$Id: 4.2-cups-printer-ops.test 5493 2006-05-05 16:33:57Z mike $"
+# End of "$Id: 4.2-cups-printer-ops.test 5833 2006-08-16 20:05:58Z mike $"
#
#
-# "$Id: 4.4-subscription-ops.test 4840 2005-11-14 21:53:30Z mike $"
+# "$Id: 4.4-subscription-ops.test 5833 2006-08-16 20:05:58Z mike $"
#
# Verify that the CUPS subscription operations work.
#
ATTR uri printer-uri $method://$hostname:$port/printers/Test1
GROUP subscription
- ATTR uri notify-recipient testnotify
+ ATTR uri notify-recipient testnotify://
ATTR keyword notify-events printer-state-changed
ATTR integer notify-lease-duration 5
ATTR uri printer-uri $method://$hostname:$port/printers/Test1
GROUP subscription
- ATTR uri notify-recipient testnotify
+ ATTR uri notify-recipient testnotify://
ATTR keyword notify-events printer-state-changed
ATTR integer notify-lease-duration 5
GROUP subscription
- ATTR uri notify-recipient testnotify
+ ATTR uri notify-recipient testnotify://
ATTR keyword notify-events printer-config-changed
ATTR integer notify-lease-duration 5
}
#
-# End of "$Id: 4.4-subscription-ops.test 4840 2005-11-14 21:53:30Z mike $"
+# End of "$Id: 4.4-subscription-ops.test 5833 2006-08-16 20:05:58Z mike $"
#
/*
- * "$Id: ipptest.c 5741 2006-07-17 18:36:20Z mike $"
+ * "$Id: ipptest.c 5878 2006-08-24 15:55:42Z mike $"
*
* IPP test command for the Common UNIX Printing System (CUPS).
*
return;
}
- printf(" %s (%s) = ", attr->name, get_tag_string(attr->value_tag));
+ printf(" %s (%s%s) = ", attr->name,
+ attr->num_values > 1 ? "1setOf " : "",
+ get_tag_string(attr->value_tag));
switch (attr->value_tag)
{
/*
- * End of "$Id: ipptest.c 5741 2006-07-17 18:36:20Z mike $".
+ * End of "$Id: ipptest.c 5878 2006-08-24 15:55:42Z mike $".
*/
cat >$pkgdir/Resources/postflight <<EOF
#!/bin/sh
-# Remove old startup item, we use launchd now...
+# Remove old startup item and xinetd config file, we use launchd now...
rm -f /System/Library/StartupItems/PrintingServices/PrintingServices
+rm -f /etc/xinetd.d/cups-lpd
# Tell launchd to reload cupsd...
launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist || exit 0
+launchctl unload /System/Library/LaunchDaemons/org.cups.cups-lpd.plist || exit 0
launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist
+launchctl load /System/Library/LaunchDaemons/org.cups.cupsd-lpd.plist
EOF
else
cat >$pkgdir/Resources/postflight <<EOF