]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Another small round of configure script fixes - we should be using
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 14 Sep 2000 18:54:14 +0000 (18:54 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 14 Sep 2000 18:54:14 +0000 (18:54 +0000)
HAVE_MALLINFO rather than depending on libmalloc; the mallinfo function
might be provided in the standard C library...

Added code to get the IP address corresponding to the server name, and
then compare it against incoming client connections so that host.domain.com
accesses are logged with the server name instead of an IP address or other
nonsense.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@1369 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
config.h.in
configure.in
scheduler/client.c
scheduler/client.h
scheduler/dirsvc.c
scheduler/ipp.c
scheduler/listen.c
scheduler/main.c

index 9a9f1819e3ca23a59a9ee9028b7160015f34940b..656f780a9656ed372f9964706a3ede6d57370acd 100644 (file)
@@ -114,11 +114,15 @@ CHANGES IN CUPS v1.1.3
          option values separated by commas.
        - Added new scheduler malloc logging in debug mode
          (provides summary of total arena size, allocated,
-          and free bytes once every 5 minutes)
+          and free bytes once a minute)
        - The EPM-based distributions didn't install the
          correct symlinks for a few man pages.
-       - Fixed a memory leak in DeletePrinter() in the
-         scheduler - wasn't freeing filters.
+       - Fixed a memory leak in the scheduler - wasn't
+         freeing old filters when deleting or renaming
+         printers.
+       - The web interfaces now correctly link to the
+         localhost address when accessing printers from
+         the local system.
 
 
 CHANGES IN CUPS v1.1.2
index e924e25d78ec52b56e9c85a720d83bc949188d74..94926d5473cd3bdc5e316c680041188ad4c8ff30 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: config.h.in,v 1.30 2000/09/14 15:36:24 mike Exp $"
+ * "$Id: config.h.in,v 1.31 2000/09/14 18:54:11 mike Exp $"
  *
  *   Configuration file for the Common UNIX Printing System (CUPS).
  *
 #undef HAVE_WAIT3
 
 /*
- * Do we have the mallinfo function in libmalloc and malloc.h?
+ * Do we have the mallinfo function and malloc.h?
  */
 
-#undef HAVE_LIBMALLOC
+#undef HAVE_MALLINFO
 #undef HAVE_MALLOC_H
 
 /*
- * End of "$Id: config.h.in,v 1.30 2000/09/14 15:36:24 mike Exp $".
+ * End of "$Id: config.h.in,v 1.31 2000/09/14 18:54:11 mike Exp $".
  */
index b2ef3b72b159d31abcb310ec763d95bd9ff83c34..815d6b585dd694c89bc67b9cf1831c5e62c938e1 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: configure.in,v 1.55 2000/09/14 18:04:09 mike Exp $"
+dnl "$Id: configure.in,v 1.56 2000/09/14 18:54:12 mike Exp $"
 dnl
 dnl   Configuration script for the Common UNIX Printing System (CUPS).
 dnl
@@ -151,12 +151,12 @@ fi
 AC_CHECK_LIB(sec,getspent)
 
 LIBMALLOC=""
-AC_CHECK_LIB(c,mallinfo,LIBS="$LIBS",LIBS="$LIBS")
+AC_CHECK_LIB(c,mallinfo,LIBS="$LIBS"; AC_DEFINE(HAVE_MALLINFO),LIBS="$LIBS")
 if test "$ac_cv_lib_c_mallinfo" = "no"; then
        AC_CHECK_LIB(malloc,mallinfo,
                     LIBS="$LIBS"
                     LIBMALLOC="-lmalloc"
-                    AC_DEFINE(HAVE_LIBMALLOC),
+                    AC_DEFINE(HAVE_MALLINFO),
                     LIBS="$LIBS")
 fi
 AC_SUBST(LIBMALLOC)
@@ -555,5 +555,5 @@ AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$fontpath")
 AC_OUTPUT(Makedefs cups.sh)
 
 dnl
-dnl End of "$Id: configure.in,v 1.55 2000/09/14 18:04:09 mike Exp $".
+dnl End of "$Id: configure.in,v 1.56 2000/09/14 18:54:12 mike Exp $".
 dnl
index a923b22382dae372095c98fcd9c2f15505207bd5..6df48ac2dd4e1dec71cd5334fd75c68d5db5ff19 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: client.c,v 1.70 2000/09/14 16:38:36 mike Exp $"
+ * "$Id: client.c,v 1.71 2000/09/14 18:54:13 mike Exp $"
  *
  *   Client routines for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -119,7 +119,15 @@ AcceptClient(listener_t *lis)      /* I - Listener socket */
   else
     host = NULL;
 
-  if (host == NULL)
+  if (con->http.hostaddr.sin_addr.s_addr == ServerAddr.sin_addr.s_addr)
+  {
+   /*
+    * Map accesses from the same host to the server name.
+    */
+
+    strncpy(con->http.hostname, ServerName, sizeof(con->http.hostname) - 1);
+  }
+  else if (host == NULL)
     sprintf(con->http.hostname, "%d.%d.%d.%d", (address >> 24) & 255,
             (address >> 16) & 255, (address >> 8) & 255, address & 255);
   else
@@ -1781,5 +1789,5 @@ pipe_command(client_t *con,       /* I - Client connection */
 
 
 /*
- * End of "$Id: client.c,v 1.70 2000/09/14 16:38:36 mike Exp $".
+ * End of "$Id: client.c,v 1.71 2000/09/14 18:54:13 mike Exp $".
  */
index 767eaf1584b2b5c257766e868e0eaaf3c7f37863..7092f675d9c56e20dbb3b824e93beaf1159fabdf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: client.h,v 1.12 2000/09/07 19:54:05 mike Exp $"
+ * "$Id: client.h,v 1.13 2000/09/14 18:54:13 mike Exp $"
  *
  *   Client definitions for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -73,6 +73,7 @@ VAR int                       NumClients      VALUE(0);
                                        /* Number of HTTP clients */
 VAR client_t           *Clients        VALUE(NULL);
                                        /* HTTP clients */
+VAR struct sockaddr_in ServerAddr;     /* Server IP address */
 
 
 /*
@@ -96,5 +97,5 @@ extern void   StopListening(void);
 extern int     WriteClient(client_t *con);
 
 /*
- * End of "$Id: client.h,v 1.12 2000/09/07 19:54:05 mike Exp $".
+ * End of "$Id: client.h,v 1.13 2000/09/14 18:54:13 mike Exp $".
  */
index 604826ac2baf3524488bb944410f55f85f098f0c..b9d1af0b4f759ccec8d082101f93867721de06ed 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: dirsvc.c,v 1.60 2000/09/12 18:35:01 mike Exp $"
+ * "$Id: dirsvc.c,v 1.61 2000/09/14 18:54:13 mike Exp $"
  *
  *   Directory services routines for the Common UNIX Printing System (CUPS).
  *
@@ -440,6 +440,7 @@ UpdateBrowseList(void)
 
          if (p->type & CUPS_PRINTER_REMOTE)
          {
+            DeletePrinterFilters(p);
             strcat(p->name, "@");
            strcat(p->name, p->hostname);
            SetPrinterAttrs(p);
@@ -502,6 +503,7 @@ UpdateBrowseList(void)
 
          if (p->type & CUPS_PRINTER_REMOTE)
          {
+            DeletePrinterFilters(p);
             strcat(p->name, "@");
            strcat(p->name, p->hostname);
            SetPrinterAttrs(p);
@@ -876,5 +878,5 @@ StopPolling(void)
 
 
 /*
- * End of "$Id: dirsvc.c,v 1.60 2000/09/12 18:35:01 mike Exp $".
+ * End of "$Id: dirsvc.c,v 1.61 2000/09/14 18:54:13 mike Exp $".
  */
index 305c8e9f01936826d59bf3a613e31c1a47cf290c..0a4ce323ab762ceb650a06d6b37d54ab6ebea36e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp.c,v 1.96 2000/09/13 12:49:55 mike Exp $"
+ * "$Id: ipp.c,v 1.97 2000/09/14 18:54:13 mike Exp $"
  *
  *   IPP routines for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -608,9 +608,10 @@ add_class(client_t        *con,            /* I - Client connection */
   else if (pclass->type & CUPS_PRINTER_REMOTE)
   {
    /*
-    * Rename the remote class to "Class@server"...
+    * Rename the remote class to "Class"...
     */
 
+    DeletePrinterFilters(pclass);
     snprintf(pclass->name, sizeof(pclass->name), "%s@%s", resource + 10,
              pclass->hostname);
     SetPrinterAttrs(pclass);
@@ -973,6 +974,7 @@ add_printer(client_t        *con,   /* I - Client connection */
     * Rename the remote printer to "Printer@server"...
     */
 
+    DeletePrinterFilters(printer);
     snprintf(printer->name, sizeof(printer->name), "%s@%s", resource + 10,
              printer->hostname);
     SetPrinterAttrs(printer);
@@ -4849,5 +4851,5 @@ validate_user(client_t   *con,            /* I - Client connection */
 
 
 /*
- * End of "$Id: ipp.c,v 1.96 2000/09/13 12:49:55 mike Exp $".
+ * End of "$Id: ipp.c,v 1.97 2000/09/14 18:54:13 mike Exp $".
  */
index e75c944dcb0909fd9c77681d6a4cd9f520de6439..55475ad994bdab2d175ecf4c44a0e2431efc0905 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: listen.c,v 1.5 2000/09/07 19:54:05 mike Exp $"
+ * "$Id: listen.c,v 1.6 2000/09/14 18:54:14 mike Exp $"
  *
  *   Server listening routines for the Common UNIX Printing System (CUPS)
  *   scheduler.
@@ -89,10 +89,38 @@ StartListening(void)
   int          i,              /* Looping var */
                val;            /* Parameter value */
   listener_t   *lis;           /* Current listening socket */
+  struct hostent *host;                /* Host entry for server address */
 
 
   LogMessage(L_DEBUG, "StartListening() NumListeners=%d", NumListeners);
 
+ /*
+  * Get the server's IP address...
+  */
+
+  memset(&ServerAddr, 0, sizeof(ServerAddr));
+
+  if ((host = gethostbyname(ServerName)) != NULL)
+  {
+   /*
+    * Found the server's address!
+    */
+
+    memcpy((char *)&(ServerAddr.sin_addr), host->h_addr, host->h_length);
+    ServerAddr.sin_family = host->h_addrtype;
+  }
+  else
+  {
+   /*
+    * Didn't find it!  Use an address of 0...
+    */
+
+    LogMessage(L_ERROR, "StartListening() Unable to find IP address for server name \"%s\"!\n",
+               ServerName);
+
+    ServerAddr.sin_family = AF_INET;
+  }
+
  /*
   * Setup socket listeners...
   */
@@ -174,5 +202,5 @@ StopListening(void)
 
 
 /*
- * End of "$Id: listen.c,v 1.5 2000/09/07 19:54:05 mike Exp $".
+ * End of "$Id: listen.c,v 1.6 2000/09/14 18:54:14 mike Exp $".
  */
index 0ae624cace5535690d72ab41a20b31920af3e746..14c7f28e536906c2becce9e38f61760b0378853b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: main.c,v 1.44 2000/09/14 15:36:26 mike Exp $"
+ * "$Id: main.c,v 1.45 2000/09/14 18:54:14 mike Exp $"
  *
  *   Scheduler main loop for the Common UNIX Printing System (CUPS).
  *
@@ -39,9 +39,9 @@
 #include <sys/resource.h>
 #include <syslog.h>
 
-#if defined(HAVE_MALLOC_H) && defined(HAVE_LIBMALLOC)
+#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
 #  include <malloc.h>
-#endif /* HAVE_MALLOC_H && HAVE_LIBMALLOC */
+#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
 
 
 /*
@@ -73,6 +73,9 @@ main(int  argc,                       /* I - Number of command-line arguments */
   listener_t           *lis;           /* Current listener */
   time_t               activity;       /* Activity timer */
   time_t               senddoc_time;   /* Send-Document time */
+#ifdef HAVE_MALLINFO
+  time_t               mallinfo_time;  /* Malloc information time */
+#endif /* HAVE_MALLINFO */
   struct timeval       timeout;        /* select() timeout */
   struct rlimit                limit;          /* Runtime limit */
 #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
@@ -425,26 +428,30 @@ main(int  argc,                   /* I - Number of command-line arguments */
       senddoc_time = time(NULL);
     }
 
+#ifdef HAVE_MALLINFO
    /*
-    * Update the root certificate and log memory usage once every 5 minutes...
+    * Log memory usage every minute...
     */
 
-    if ((time(NULL) - RootCertTime) >= 300)
+    if ((time(NULL) - mallinfo_time) >= 60 && LogLevel >= L_DEBUG)
     {
-#if defined(HAVE_MALLOC_H) && defined(HAVE_LIBMALLOC)
       struct mallinfo mem;     /* Malloc information */
 
 
-     /*
-      * Log memory usage...
-      */
-
       mem = mallinfo();
       LogMessage(L_DEBUG, "mallinfo: arena = %d, used = %d, free = %d\n",
                  mem.arena, mem.usmblks + mem.uordblks,
                 mem.fsmblks + mem.fordblks);
-#endif /* HAVE_MALLOC_H && HAVE_LIBMALLOC */
+      mallinfo_time = time(NULL);
+    }
+#endif /* HAVE_MALLINFO */
 
+   /*
+    * Update the root certificate once every 5 minutes...
+    */
+
+    if ((time(NULL) - RootCertTime) >= 300)
+    {
      /*
       * Update the root certificate...
       */
@@ -647,5 +654,5 @@ usage(void)
 
 
 /*
- * End of "$Id: main.c,v 1.44 2000/09/14 15:36:26 mike Exp $".
+ * End of "$Id: main.c,v 1.45 2000/09/14 18:54:14 mike Exp $".
  */