CHANGES IN CUPS V1.1.20rc1
+ - The scheduler now passes the first port that is bound
+ to the local loopback or "any" addresses to the CGI
+ programs rather than the port that the browser
+ connected to (STR #103)
- The cupstestppd program now checks for bad
JobPatchFile attributes and incorrect versions of the
Manufacturer attribute for HP printers (STR #155)
/*
- * "$Id: http-addr.c,v 1.1.2.10 2003/01/24 20:45:11 mike Exp $"
+ * "$Id: http-addr.c,v 1.1.2.11 2003/07/20 03:13:07 mike Exp $"
*
* HTTP address routines for the Common UNIX Printing System (CUPS).
*
*
* Contents:
*
+ * httpAddrAny() - Check for the "any" address.
* httpAddrEqual() - Compare two addresses.
* httpAddrLoad() - Load a host entry address into an HTTP address.
* httpAddrLocalhost() - Check for the local loopback address.
#include "string.h"
+/*
+ * 'httpAddrAny()' - Check for the "any" address.
+ */
+
+int /* O - 1 if "any", 0 otherwise */
+httpAddrAny(const http_addr_t *addr) /* I - Address to check */
+{
+#ifdef AF_INET6
+ if (addr->addr.sa_family == AF_INET6 &&
+ IN6_IS_ADDR_UNSPECIFIED(&(addr->ipv6.sin6_addr)))
+ return (1);
+#endif /* AF_INET6 */
+
+ if (addr->addr.sa_family == AF_INET &&
+ ntohl(addr->ipv4.sin_addr.s_addr) == 0x00000000)
+ return (1);
+
+ return (0);
+}
+
+
/*
* 'httpAddrEqual()' - Compare two addresses.
*/
* 'httpAddrLocalhost()' - Check for the local loopback address.
*/
-int /* O - 1 if local host, 1 otherwise */
-httpAddrLocalhost(const http_addr_t *addr) /* I - Address to check */
+int /* O - 1 if local host, 0 otherwise */
+httpAddrLocalhost(const http_addr_t *addr)
+ /* I - Address to check */
{
#ifdef AF_INET6
if (addr->addr.sa_family == AF_INET6 &&
/*
- * End of "$Id: http-addr.c,v 1.1.2.10 2003/01/24 20:45:11 mike Exp $".
+ * End of "$Id: http-addr.c,v 1.1.2.11 2003/07/20 03:13:07 mike Exp $".
*/
/*
- * "$Id: http.h,v 1.33.2.18 2003/05/09 18:35:38 mike Exp $"
+ * "$Id: http.h,v 1.33.2.19 2003/07/20 03:13:07 mike Exp $"
*
* Hyper-Text Transport Protocol definitions for the Common UNIX Printing
* System (CUPS).
extern int httpWait(http_t *http, int msec);
/**** New in CUPS 1.2 ****/
+extern int httpAddrAny(const http_addr_t *addr);
extern int httpAddrEqual(const http_addr_t *addr1,
const http_addr_t *addr2);
extern void httpAddrLoad(const struct hostent *host, int port,
#endif /* !_IPP_HTTP_H_ */
/*
- * End of "$Id: http.h,v 1.33.2.18 2003/05/09 18:35:38 mike Exp $".
+ * End of "$Id: http.h,v 1.33.2.19 2003/07/20 03:13:07 mike Exp $".
*/
/*
- * "$Id: client.c,v 1.91.2.63 2003/07/20 01:36:50 mike Exp $"
+ * "$Id: client.c,v 1.91.2.64 2003/07/20 03:13:08 mike Exp $"
*
* Client routines for the Common UNIX Printing System (CUPS) scheduler.
*
void
CloseClient(client_t *con) /* I - Client to close */
{
- int status; /* Exit status of pipe command */
#if defined(HAVE_LIBSSL)
SSL_CTX *context; /* Context for encryption */
SSL *conn; /* Connection for encryption */
*/
if (con->pipe_pid)
- {
kill(con->pipe_pid, SIGKILL);
- waitpid(con->pipe_pid, &status, WNOHANG);
- }
LogMessage(L_DEBUG2, "CloseClient() %d Closing data file %d.",
con->http.fd, con->file);
snprintf(lang, sizeof(lang), "LANG=%s",
con->language ? con->language->language : "C");
+ sprintf(ipp_port, "IPP_PORT=%d", LocalPort);
#ifdef AF_INET6
if (con->http.hostaddr.addr.sa_family == AF_INET6)
- {
- sprintf(ipp_port, "IPP_PORT=%d", ntohs(con->http.hostaddr.ipv6.sin6_port));
sprintf(server_port, "SERVER_PORT=%d",
ntohs(con->http.hostaddr.ipv6.sin6_port));
- }
else
#endif /* AF_INET6 */
- {
- sprintf(ipp_port, "IPP_PORT=%d", ntohs(con->http.hostaddr.ipv4.sin_port));
sprintf(server_port, "SERVER_PORT=%d",
ntohs(con->http.hostaddr.ipv4.sin_port));
- }
if (strcmp(con->http.hostname, "localhost") == 0)
strlcpy(server_name, "SERVER_NAME=localhost", sizeof(server_name));
/*
- * End of "$Id: client.c,v 1.91.2.63 2003/07/20 01:36:50 mike Exp $".
+ * End of "$Id: client.c,v 1.91.2.64 2003/07/20 03:13:08 mike Exp $".
*/
/*
- * "$Id: client.h,v 1.17.2.9 2003/03/31 16:48:26 mike Exp $"
+ * "$Id: client.h,v 1.17.2.10 2003/07/20 03:13:09 mike Exp $"
*
* Client definitions for the Common UNIX Printing System (CUPS) scheduler.
*
* Globals...
*/
-VAR int ListenBackLog VALUE(SOMAXCONN);
+VAR int ListenBackLog VALUE(SOMAXCONN),
+ /* Max backlog of pending connections */
+ LocalPort VALUE(631);
+ /* Local port to use */
VAR int NumListeners VALUE(0);
/* Number of listening sockets */
VAR listener_t *Listeners VALUE(NULL);
/*
- * End of "$Id: client.h,v 1.17.2.9 2003/03/31 16:48:26 mike Exp $".
+ * End of "$Id: client.h,v 1.17.2.10 2003/07/20 03:13:09 mike Exp $".
*/
/*
- * "$Id: conf.c,v 1.77.2.40 2003/04/23 18:55:28 mike Exp $"
+ * "$Id: conf.c,v 1.77.2.41 2003/07/20 03:13:09 mike Exp $"
*
* Configuration routines for the Common UNIX Printing System (CUPS).
*
* Decode the hostname and port number as needed...
*/
- if (hostname[0] && strcmp(hostname, "*") != 0)
+ if (hostname[0] && strcmp(hostname, "*"))
{
if ((host = httpGetHostByName(hostname)) == NULL)
{
/*
- * End of "$Id: conf.c,v 1.77.2.40 2003/04/23 18:55:28 mike Exp $".
+ * End of "$Id: conf.c,v 1.77.2.41 2003/07/20 03:13:09 mike Exp $".
*/
/*
- * "$Id: listen.c,v 1.9.2.10 2003/03/31 19:20:16 mike Exp $"
+ * "$Id: listen.c,v 1.9.2.11 2003/07/20 03:13:10 mike Exp $"
*
* Server listening routines for the Common UNIX Printing System (CUPS)
* scheduler.
LogMessage(L_DEBUG, "StartListening: address=%s port=%d", s,
ntohs(lis->address.ipv4.sin_port));
+ /*
+ * Save the first port that is bound to the local loopback or
+ * "any" address...
+ */
+
+ if (httpAddrLocalhost(&(lis->address)) ||
+ httpAddrAny(&(lis->address)))
+ {
+#ifdef AF_INET6
+ if (lis->address.addr.sa_family == AF_INET6)
+ LocalPort = ntohs(lis->address.ipv6.sin6_port);
+ else
+#endif /* AF_INET6 */
+ LocalPort = ntohs(lis->address.ipv4.sin_port);
+ }
+
+ /*
+ * Create a socket for listening...
+ */
+
if ((lis->fd = socket(lis->address.addr.sa_family, SOCK_STREAM, 0)) == -1)
{
LogMessage(L_ERROR, "StartListening: Unable to open listen socket - %s.",
/*
- * End of "$Id: listen.c,v 1.9.2.10 2003/03/31 19:20:16 mike Exp $".
+ * End of "$Id: listen.c,v 1.9.2.11 2003/07/20 03:13:10 mike Exp $".
*/