From e673c4b49841d27c62c0b213c799f415c759c552 Mon Sep 17 00:00:00 2001 From: mike Date: Tue, 24 Feb 2004 21:36:59 +0000 Subject: [PATCH] Mirror 1.1.x changes. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@4070 7a7537e8-13f0-0310-91df-b6672ffda945 --- CHANGES-1.1.txt | 4 ++++ cups/util.c | 7 +++++-- scheduler/conf.c | 24 ++++++++++++++++++++++-- scheduler/listen.c | 26 +++++++++++++++++++++----- scheduler/printers.c | 14 ++++++++------ 5 files changed, 60 insertions(+), 15 deletions(-) diff --git a/CHANGES-1.1.txt b/CHANGES-1.1.txt index 44baca925..8e220a175 100644 --- a/CHANGES-1.1.txt +++ b/CHANGES-1.1.txt @@ -3,6 +3,10 @@ CHANGES-1.1.txt CHANGES IN CUPS V1.1.21rc1 + - The scheduler did not check for a valid Listen/Port + configuration (STR #499) + - The cupsPrintFiles() function did not always set the + last IPP error message (STR #538) - The pstops filter did not write the PostScript header line if the file began with a PJL escape sequence (STR #574) diff --git a/cups/util.c b/cups/util.c index d1310939b..105a4ee93 100644 --- a/cups/util.c +++ b/cups/util.c @@ -1,5 +1,5 @@ /* - * "$Id: util.c,v 1.81.2.31 2004/02/17 21:32:58 mike Exp $" + * "$Id: util.c,v 1.81.2.32 2004/02/24 21:36:59 mike Exp $" * * Printing utilities for the Common UNIX Printing System (CUPS). * @@ -1416,6 +1416,9 @@ cupsPrintFiles(const char *name, /* I - Printer or class name */ else if ((attr = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER)) == NULL) { DEBUG_puts("No job ID!"); + + last_error = IPP_SERVICE_UNAVAILABLE; + jobid = 0; } else @@ -1557,5 +1560,5 @@ cups_connect(const char *name, /* I - Destination (printer[@host]) */ /* - * End of "$Id: util.c,v 1.81.2.31 2004/02/17 21:32:58 mike Exp $". + * End of "$Id: util.c,v 1.81.2.32 2004/02/24 21:36:59 mike Exp $". */ diff --git a/scheduler/conf.c b/scheduler/conf.c index ccc50bff4..c9860bbb0 100644 --- a/scheduler/conf.c +++ b/scheduler/conf.c @@ -1,5 +1,5 @@ /* - * "$Id: conf.c,v 1.77.2.47 2004/02/05 16:20:12 mike Exp $" + * "$Id: conf.c,v 1.77.2.48 2004/02/24 21:36:59 mike Exp $" * * Configuration routines for the Common UNIX Printing System (CUPS). * @@ -437,6 +437,26 @@ ReadConfiguration(void) LogMessage(L_INFO, "Loaded configuration file \"%s\"", ConfigurationFile); + /* + * Check that we have at least one listen/port line; if not, report this + * as an error and exit! + */ + + if (NumListeners == 0) + { + /* + * No listeners! + */ + + LogMessage(L_EMERG, "No valid Listen or Port lines were found in the configuration file!"); + + /* + * Commit suicide... + */ + + kill(getpid(), SIGTERM); + } + /* * Set the default locale using the language and charset... */ @@ -2286,5 +2306,5 @@ CDSAGetServerCerts(void) /* - * End of "$Id: conf.c,v 1.77.2.47 2004/02/05 16:20:12 mike Exp $". + * End of "$Id: conf.c,v 1.77.2.48 2004/02/24 21:36:59 mike Exp $". */ diff --git a/scheduler/listen.c b/scheduler/listen.c index 35dad7ba6..cec74eeff 100644 --- a/scheduler/listen.c +++ b/scheduler/listen.c @@ -1,5 +1,5 @@ /* - * "$Id: listen.c,v 1.9.2.11 2003/07/20 03:13:10 mike Exp $" + * "$Id: listen.c,v 1.9.2.12 2004/02/24 21:36:59 mike Exp $" * * Server listening routines for the Common UNIX Printing System (CUPS) * scheduler. @@ -140,7 +140,7 @@ StartListening(void) * Setup socket listeners... */ - for (i = NumListeners, lis = Listeners; i > 0; i --, lis ++) + for (i = NumListeners, lis = Listeners, LocalPort = 0; i > 0; i --, lis ++) { httpAddrString(&(lis->address), s, sizeof(s)); @@ -158,8 +158,9 @@ StartListening(void) * "any" address... */ - if (httpAddrLocalhost(&(lis->address)) || - httpAddrAny(&(lis->address))) + if (!LocalPort && + (httpAddrLocalhost(&(lis->address)) || + httpAddrAny(&(lis->address)))) { #ifdef AF_INET6 if (lis->address.addr.sa_family == AF_INET6) @@ -226,6 +227,21 @@ StartListening(void) } } + /* + * Make sure that we are listening on localhost! + */ + + if (!LocalPort) + { + LogMessage(L_EMERG, "No Listen or Port lines were found to allow access via localhost!"); + + /* + * Commit suicide... + */ + + kill(getpid(), SIGTERM); + } + ResumeListening(); } @@ -255,5 +271,5 @@ StopListening(void) /* - * End of "$Id: listen.c,v 1.9.2.11 2003/07/20 03:13:10 mike Exp $". + * End of "$Id: listen.c,v 1.9.2.12 2004/02/24 21:36:59 mike Exp $". */ diff --git a/scheduler/printers.c b/scheduler/printers.c index 0ea932d8a..034880c3e 100644 --- a/scheduler/printers.c +++ b/scheduler/printers.c @@ -1,5 +1,5 @@ /* - * "$Id: printers.c,v 1.93.2.54 2004/02/05 16:20:12 mike Exp $" + * "$Id: printers.c,v 1.93.2.55 2004/02/24 21:36:59 mike Exp $" * * Printer routines for the Common UNIX Printing System (CUPS). * @@ -101,14 +101,16 @@ AddPrinter(const char *name) /* I - Name of printer */ SetString(&p->info, name); SetString(&p->hostname, ServerName); + if (NumListeners == 0) + SetStringf(&p->uri, "ipp://%s:%d/printers/%s", ServerName, ippPort(), name); #ifdef AF_INET6 - if (Listeners[0].address.addr.sa_family == AF_INET6) + else if (Listeners[0].address.addr.sa_family == AF_INET6) SetStringf(&p->uri, "ipp://%s:%d/printers/%s", ServerName, ntohs(Listeners[0].address.ipv6.sin6_port), name); - else #endif /* AF_INET6 */ - SetStringf(&p->uri, "ipp://%s:%d/printers/%s", ServerName, - ntohs(Listeners[0].address.ipv4.sin_port), name); + else + SetStringf(&p->uri, "ipp://%s:%d/printers/%s", ServerName, + ntohs(Listeners[0].address.ipv4.sin_port), name); SetStringf(&p->device_uri, "file:/dev/null"); p->state = IPP_PRINTER_STOPPED; @@ -2413,5 +2415,5 @@ write_irix_state(printer_t *p) /* I - Printer to update */ /* - * End of "$Id: printers.c,v 1.93.2.54 2004/02/05 16:20:12 mike Exp $". + * End of "$Id: printers.c,v 1.93.2.55 2004/02/24 21:36:59 mike Exp $". */ -- 2.39.2