]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror 1.1.x changes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sun, 20 Jul 2003 03:13:10 +0000 (03:13 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sun, 20 Jul 2003 03:13:10 +0000 (03:13 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@3812 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES-1.1.txt
cups/http-addr.c
cups/http.h
scheduler/client.c
scheduler/client.h
scheduler/conf.c
scheduler/listen.c

index 3842a29d052f4e93a5ca5839878890d6ca87229e..77e5ee1a4e612ea7b981f9a885cbcfe19711ce18 100644 (file)
@@ -3,6 +3,10 @@ CHANGES-1.1.txt
 
 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)
index 12c5e7f5de1040fa1a8b198c68862e79f7048a1c..754ba16c84c0ad8cab1550abf43d41d3767c0879 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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).
  *
@@ -23,6 +23,7 @@
  *
  * 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.
  */
@@ -104,8 +126,9 @@ httpAddrLoad(const struct hostent *host,    /* I - Host entry */
  * '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 &&
@@ -277,5 +300,5 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
 
 
 /*
- * 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 $".
  */
index 0c3d77518575d83f4eef294243e91f35d9e70731..13c37fe9a440cb531ee199db761d9f88de1f0c24 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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).
@@ -388,6 +388,7 @@ extern void         httpSetCookie(http_t *http, const char *cookie);
 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,
@@ -409,5 +410,5 @@ extern char         *httpAddrString(const http_addr_t *addr,
 #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 $".
  */
index 4c6ffccd1dbf41f4a6682db627c391fbe95f5ee2..27a3331b8c30e2f969d17d236c121f6ce5124e00 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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.
  *
@@ -356,7 +356,6 @@ CloseAllClients(void)
 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 */
@@ -464,10 +463,7 @@ CloseClient(client_t *con) /* I - Client to close */
     */
 
     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);
@@ -3008,20 +3004,15 @@ pipe_command(client_t *con,             /* I - Client connection */
 
   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));
@@ -3356,5 +3347,5 @@ CDSAWriteFunc(SSLConnectionRef connection,        /* I  - SSL/TLS connection */
 
 
 /*
- * 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 $".
  */
index df2fb3a0ba6167aae6eff011ac04164094880326..c91ba4c86cd9391bd8d84ae8a6fab3988ac656b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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.
  *
@@ -66,7 +66,10 @@ typedef struct
  * 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);
@@ -107,5 +110,5 @@ extern int  WriteClient(client_t *con);
 
 
 /*
- * 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 $".
  */
index 4dd7c318c4545999c849bb6f93283a1e135ed805..05c51eb0de8c3931c20474abf75c7cc3382c52b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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).
  *
@@ -2026,7 +2026,7 @@ get_address(const char  *value,           /* I - Value string */
   * Decode the hostname and port number as needed...
   */
 
-  if (hostname[0] && strcmp(hostname, "*") != 0)
+  if (hostname[0] && strcmp(hostname, "*"))
   {
     if ((host = httpGetHostByName(hostname)) == NULL)
     {
@@ -2293,5 +2293,5 @@ CDSAGetServerCerts(void)
 
 
 /*
- * 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 $".
  */
index cbb69665590230b20e1b1c12b42d2bb4fa64e42e..35dad7ba6f9982d227468e05f4058483fd868304 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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.
@@ -153,6 +153,26 @@ StartListening(void)
     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.",
@@ -235,5 +255,5 @@ StopListening(void)
 
 
 /*
- * 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 $".
  */