]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
snapshot-20010327
authorWietse Venema <wietse@porcupine.org>
Tue, 27 Mar 2001 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:27:13 +0000 (06:27 +0000)
postfix/HISTORY
postfix/src/flush/flush.c
postfix/src/global/mail_version.h
postfix/src/global/rewrite_clnt.c
postfix/src/master/master_conf.c
postfix/src/master/master_status.c
postfix/src/showq/showq.c
postfix/src/util/msg_syslog.c
postfix/src/util/watchdog.c
postfix/src/virtual/mailbox.c
postfix/src/virtual/virtual.c

index 5e509c65c09336bff655564041380a90fe3a16a0..e50e741feab19209fd712a81ec8c350957b8ddbf 100644 (file)
@@ -4988,3 +4988,8 @@ Apologies for any names omitted.
        Bugfix: the fast ETRN flush server could not handle [ipaddr]
        or domain names with one-character hostname part. It should
        be OK now. File: flush/flush.c.
+
+20010327
+
+       Speed up mailq (sendmail -bp) display by flushing output
+       after each file.  File: showq/showq.c.
index 29e2a3a509ae7c7f951e14104df2d39d02278b6a..c8c76c0d09a1b4c78b22d9909403092be35b786d 100644 (file)
 #include <utime.h>
 #include <errno.h>
 #include <ctype.h>
+#include <string.h>
 
 /* Utility library. */
 
 #include <vstring.h>
 #include <vstring_vstream.h>
 #include <myflock.h>
-#include <valid_hostname.h>
 #include <htable.h>
 #include <dict.h>
 #include <scan_dir.h>
 /* Application-specific. */
 
  /*
-  * Tunable parameters.
+  * Tunable parameters. The fast_flush_domains parameter is not defined here,
+  * because it is also used by the global library, and therefore is owned by
+  * the library.
   */
 int     var_fflush_refresh;
 int     var_fflush_purge;
@@ -176,7 +178,8 @@ static DOMAIN_LIST *flush_domains;
 
  /*
   * Some hard-wired policy: how many queue IDs we remember while we're
-  * flushing a logfile.
+  * flushing a logfile (duplicate elimination). Sites with 1000+ emails
+  * queued should arrange for permanent connectivity.
   */
 #define FLUSH_DUP_FILTER_SIZE  10000   /* graceful degradation */
 
@@ -187,8 +190,8 @@ static DOMAIN_LIST *flush_domains;
 #define STREQ(x,y)             (strcmp(x,y) == 0)
 
  /*
-  * Forward declarations for where we broke routines along their name space
-  * domain boundaries (actually, hostnames versus safe-to-use pathnames).
+  * Forward declarations resulting from breaking up routines according to
+  * name space: domain names versus safe-to-use pathnames.
   */
 static int flush_add_path(const char *, const char *);
 static int flush_send_path(const char *);
@@ -206,7 +209,7 @@ static VSTRING *flush_site_to_path(VSTRING *path, const char *site)
        path = vstring_alloc(10);
 
     /*
-     * Convert character values to hexadecimal.
+     * Mask characters that could upset the name-to-queue-file mapping code.
      */
     while ((ch = *(unsigned const char *) site++) != 0)
        if (ISALNUM(ch))
@@ -249,8 +252,7 @@ static int flush_add_service(const char *site, const char *queue_id)
      * Map site to path and update log.
      */
     site_path = flush_site_to_path((VSTRING *) 0, site);
-    status = valid_hostname(STR(site_path), DONT_GRIPE) ?
-       flush_add_path(STR(site_path), queue_id) : FLUSH_STAT_BAD;
+    status = flush_add_path(STR(site_path), queue_id);
     vstring_free(site_path);
 
     return (status);
@@ -263,6 +265,12 @@ static int flush_add_path(const char *path, const char *queue_id)
     char   *myname = "flush_add_path";
     VSTREAM *log;
 
+    /*
+     * Sanity check.
+     */
+    if (!mail_queue_id_ok(path))
+       return (FLUSH_STAT_BAD);
+
     /*
      * Open the logfile or bust.
      */
@@ -279,12 +287,14 @@ static int flush_add_path(const char *path, const char *queue_id)
        msg_fatal("%s: lock fast flush logfile %s: %m", myname, path);
 
     /*
-     * Append the queue ID. With 15 bits if microsecond time, a queue ID is
+     * Append the queue ID. With 15 bits of microsecond time, a queue ID is
      * not recycled often enough for false hits to be a problem. If it does,
      * then we could add other signature information, such as the file size
      * in bytes.
      */
     vstream_fprintf(log, "%s\n", queue_id);
+    if (vstream_fflush(log))
+       msg_warn("write fast flush logfile %s: %m", path);
 
     /*
      * Clean up.
@@ -318,8 +328,7 @@ static int flush_send_service(const char *site)
      * Map site name to path name and flush the log.
      */
     site_path = flush_site_to_path((VSTRING *) 0, site);
-    status = valid_hostname(STR(site_path), DONT_GRIPE) ?
-       flush_send_path(STR(site_path)) : FLUSH_STAT_BAD;
+    status = flush_send_path(STR(site_path));
     vstring_free(site_path);
 
     return (status);
@@ -341,6 +350,12 @@ static int flush_send_path(const char *path)
     HTABLE *dup_filter;
     int     count;
 
+    /*
+     * Sanity check.
+     */
+    if (!mail_queue_id_ok(path))
+       return (FLUSH_STAT_BAD);
+
     /*
      * Open the logfile. If the file does not exist, then there is no queued
      * mail for this destination.
@@ -470,7 +485,7 @@ static int flush_refresh_service(int max_age)
        if (st.st_size == 0) {
            if (st.st_mtime + var_fflush_purge < event_time()) {
                if (unlink(STR(path)) < 0)
-                   msg_warn("remove %s: %m", STR(path));
+                   msg_warn("remove logfile %s: %m", STR(path));
                else if (msg_verbose)
                    msg_info("%s: unlink %s, empty and unchanged for %d days",
                             myname, STR(path), var_fflush_purge / 86400);
@@ -516,9 +531,7 @@ static void flush_service(VSTREAM *client_stream, char *unused_service,
      * This routine runs whenever a client connects to the UNIX-domain socket
      * dedicated to the fast flush service. What we see below is a little
      * protocol to (1) read a request from the client (the name of the site)
-     * and (2) acknowledge that we have received the request. Since the site
-     * name maps onto the file system, make sure the site name is a valid
-     * SMTP hostname.
+     * and (2) acknowledge that we have received the request.
      * 
      * All connection-management stuff is handled by the common code in
      * single_server.c.
index b11e3b0855c1f8c0eead955401ead863788c017c..45bad947db7982b20845b52add0ea466ecc190b3 100644 (file)
@@ -15,7 +15,7 @@
   * Version of this program.
   */
 #define VAR_MAIL_VERSION       "mail_version"
-#define DEF_MAIL_VERSION       "Snapshot-20010324"
+#define DEF_MAIL_VERSION       "Snapshot-20010327"
 extern char *var_mail_version;
 
 /* LICENSE
index dfb4cbce53c852819f2b0777a06e6142115bdc17..ba9049ad3b6d849f5a088ea078ec7e89daacc3ee 100644 (file)
@@ -46,6 +46,7 @@
 #include <sys_defs.h>
 #include <unistd.h>
 #include <errno.h>
+#include <string.h>
 
 /* Utility library. */
 
index 1bb8ba10057c3dca6d60b5b2f61251fd56f0e067..2c24cdb9c504afdef80c699ccbd56973b41c60c8 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <sys_defs.h>
 #include <unistd.h>
+#include <string.h>
 
 /* Utility library. */
 
index 40ad1508a64db8db716cd047ec7eb43b7210f83c..de0cc4d28c3152dfbe89d3268ec837fdfaf36f2d 100644 (file)
@@ -113,7 +113,7 @@ static void master_status_event(int event, char *context)
     }
     if (proc->serv != serv)
        msg_panic("%s: pointer corruption: %p != %p",
-                 myname, (char *) proc->serv, (char *) serv);
+                 myname, (void *) proc->serv, (void *) serv);
 
     /*
      * Update our idea of the child process status. Allow redundant status
index 06fdb1c2533ece30cb3a251985b1ea46ff284660..55cab747a91f93b8e07ff78ad6d2ff710e82133a 100644 (file)
@@ -273,6 +273,7 @@ static void showq_service(VSTREAM *client, char *unused_service, char **argv)
                } else if (errno != ENOENT)
                    msg_fatal("open %s %s: %m", *queue, id);
                file_count++;
+               vstream_fflush(client);
            }
            vstream_fflush(client);
        }
index c2892d6286c5cddbee09a182d5f80afffa91beb5..fb93014572ade21ed3c31050eda2748f33037b2e 100644 (file)
@@ -48,6 +48,7 @@
 #include <stdarg.h>
 #include <errno.h>
 #include <syslog.h>
+#include <string.h>
 
 /* Application-specific. */
 
index 011b2fcb60afe78c0c734a82848e3c5ef48e6853..14504e90de3cec325a5612102618d3bf335c3fe6 100644 (file)
@@ -133,7 +133,7 @@ static void watchdog_event(int unused_sig)
     if ((wp = watchdog_curr) == 0)
        msg_panic("%s: no instance", myname);
     if (msg_verbose)
-       msg_info("%s: %p %d", myname, (char *) wp, wp->trip_run);
+       msg_info("%s: %p %d", myname, (void *) wp, wp->trip_run);
     if (++(wp->trip_run) < WATCHDOG_STEPS) {
        alarm(wp->timeout);
     } else {
@@ -169,7 +169,7 @@ WATCHDOG *watchdog_create(unsigned timeout, WATCHDOG_FN action, char *context)
     if (sigaction(SIGALRM, &sig_action, &wp->saved_action) < 0)
        msg_fatal("%s: sigaction(SIGALRM): %m", myname);
     if (msg_verbose)
-       msg_info("%s: %p %d", myname, (char *) wp, timeout);
+       msg_info("%s: %p %d", myname, (void *) wp, timeout);
     return (watchdog_curr = wp);
 }
 
@@ -187,7 +187,7 @@ void    watchdog_destroy(WATCHDOG *wp)
        alarm(wp->saved_time);
     myfree((char *) wp);
     if (msg_verbose)
-       msg_info("%s: %p", myname, (char *) wp);
+       msg_info("%s: %p", myname, (void *) wp);
 }
 
 /* watchdog_start - enable watchdog timer */
@@ -201,7 +201,7 @@ void    watchdog_start(WATCHDOG *wp)
     wp->trip_run = 0;
     alarm(wp->timeout);
     if (msg_verbose)
-       msg_info("%s: %p", myname, (char *) wp);
+       msg_info("%s: %p", myname, (void *) wp);
 }
 
 /* watchdog_stop - disable watchdog timer */
@@ -214,7 +214,7 @@ void    watchdog_stop(WATCHDOG *wp)
        msg_panic("%s: wrong watchdog instance", myname);
     alarm(0);
     if (msg_verbose)
-       msg_info("%s: %p", myname, (char *) wp);
+       msg_info("%s: %p", myname, (void *) wp);
 }
 
 /* watchdog_pat - pat the dog so it stays quiet */
@@ -226,7 +226,7 @@ void    watchdog_pat(void)
     if (watchdog_curr)
        watchdog_curr->trip_run = 0;
     if (msg_verbose)
-       msg_info("%s: %p", myname, (char *) watchdog_curr);
+       msg_info("%s: %p", myname, (void *) watchdog_curr);
 }
 
 #ifdef TEST
index 68f8c4f52ec2f6e050de49219fdd8188f54a5ac8..58894538e60fd3e2371626b46eb9e41e42cc8f21 100644 (file)
@@ -42,6 +42,7 @@
 #include <sys/stat.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <string.h>
 
 /* Utility library. */
 
index 86809ace59224463729352e40190e63e5d44e366..14c388e8aa195619d953762636ee7a34475df8a8 100644 (file)
 /* System library. */
 
 #include <sys_defs.h>
+#include <stdlib.h>
 
 /* Utility library. */