]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
snapshot-20010201
authorWietse Venema <wietse@porcupine.org>
Thu, 1 Feb 2001 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:27:09 +0000 (06:27 +0000)
16 files changed:
postfix/HISTORY
postfix/RESTRICTION_CLASS
postfix/conf/sample-local.cf
postfix/mantools/postlink
postfix/src/dns/dns_lookup.c
postfix/src/dns/dns_strtype.c
postfix/src/global/mail_params.h
postfix/src/global/mail_version.h
postfix/src/local/Makefile.in
postfix/src/nqmgr/Makefile.in
postfix/src/nqmgr/qmgr_job.c
postfix/src/nqmgr/qmgr_message.c
postfix/src/util/Makefile.in
postfix/src/util/dict_mysql.c
postfix/src/util/sane_time.c [new file with mode: 0644]
postfix/src/util/sane_time.h [new file with mode: 0644]

index 3091eb7ba84ea8c09dae5cf521d6584dfbcd1e13..bba61fb249174027d1ded5b8a66b9c42b1e4fdbb 100644 (file)
@@ -4824,7 +4824,27 @@ Apologies for any names omitted.
        can do their own manual page processing. See scripts in
        the mantools directory.
 
-       Updated the reference to sendmail in the html/index.html page.
+       Documentation: updated the reference to sendmail in the
+       html/index.html page.
 
-       Added note about the Cisco PIX "fixup smtp" bug when "."
-       and "CRLF" arrive in separate packets. File:  html/faq.html.
+       Documentation: added note about the Cisco PIX "fixup smtp"
+       bug that causes mail delivery problems when "." and "CRLF"
+       arrive in separate packets. File:  html/faq.html.
+
+20010131
+
+       The code that reports a DNS lookup error now includes the
+       record type that was being looked up, so that people will
+       not misinterpret an MX lookup problem as an A record lookup
+       problem.  File:  dns/dns_lookup.c.
+
+20010201
+
+       Bugfix: another missing initialization in the mysql client.
+       File: util/dict_mysql.c.
+
+       Sanitized time routine by Patrik Rak, to make his nqmgr
+       robust against people who set their clock back.  Files:
+       util/sane_time.[hc].
+
+       Bumped the default mailbox file size limits to 50MB.
index 22f3d324c482f9de77c6040eb0588c21082a1292..f623d28786bcea0bf4f4b1a11d54f9293636599c 100644 (file)
@@ -5,11 +5,11 @@ The Postfix SMTP server allows you to specify UCE restrictions on
 the right-hand side of SMTPD access tables, so that you can have
 different UCE restrictions for different clients or users.
 
-The only anomalies in this scheme are that (1) message header checks
-are still the same for every message, and (2) you must use a
-restriction class name (see below) if you want to specify a lookup
-table on the right-hand side of an access table (this is because
-Postfix needs to open those tables ahead of time).
+The only anomalies in this scheme are that (1) message header_checks
+and body_checks are still the same for every message, and (2) you
+must use a restriction class name (see below) if you want to specify
+a lookup table on the right-hand side of an access table (this is
+because Postfix needs to open those tables ahead of time).
 
 Restriction classes allow you to give easy-to-remember names to
 groups of UCE restrictions (such as permissive, restrictive, and
index caa48d5140764cf800bd1cc6b00267af7aa87c4e..f8ac3329ab876d0beea1cfd8f566adc9eea5de34 100644 (file)
@@ -202,10 +202,10 @@ local_destination_concurrency_limit = 2
 
 # The mailbox_size_limit parameter controls the maximal size of a
 # mailbox or maildir file (in fact, it limits the size of any file
-# that is written to upon local delivery) The default is 20MBytes.
+# that is written to upon local delivery) The default is 50 MBytes.
 # This limit must not be set smaller than the message size limit.
 # 
-mailbox_size_limit = 20480000
+mailbox_size_limit = 51200000
 
 # The local_destination_recipient_limit parameter limits the number
 # of recipients per local message delivery.  The default limit is
index 9078327190da6f5399db1b124ed149f46b40e7f7..1328075ee2fb34953115b4faa1c20d6d8070466e 100755 (executable)
@@ -45,5 +45,6 @@ exec sed '
        s/[<bB>]*relocated[</bB>]*(5)/<a href="relocated.5.html">&<\/a>/
        s/[<bB>]*trans[-</bB>]*\n*[ <bB>]*port[</bB>]*(5)/<a href="transport.5.html">&<\/a>/
        s/[<bB>]*virtual[</bB>]*(5)/<a href="virtual.5.html">&<\/a>/
+       s/[<bB>]*virtual[</bB>]*(8)/<a href="virtual.8.html">&<\/a>/
        s/RFC *\([0-9]*\)/<a href="http:\/\/www.faqs.org\/rfcs\/rfc\1.html">&<\/a>/
 ' "$@"
index a25334cea22177fa165b38e7f4f04bf209a27e7b..6f8e9d078f6a31480c7a3930dcf69ed5442d318d 100644 (file)
@@ -168,8 +168,8 @@ static int dns_query(const char *name, int type, int flags,
     len = res_search((char *) name, C_IN, type, reply->buf, sizeof(reply->buf));
     if (len < 0) {
        if (why)
-           vstring_sprintf(why, "Name service error for domain %s: %s",
-                           name, dns_strerror(h_errno));
+           vstring_sprintf(why, "Name service error for %s (%s) while looking up the %s record.",
+                           name, dns_strerror(h_errno), dns_strtype(type));
        if (msg_verbose)
            msg_info("dns_query: %s (%s): %s",
                     name, dns_strtype(type), dns_strerror(h_errno));
index f6f1fdff4323ddd96b92fbc894be02187af7060f..5be7113531a5518cf2fad859325847fda412755e 100644 (file)
@@ -60,6 +60,9 @@ static struct dns_type_map dns_type_map[] = {
 #ifdef T_A
     T_A, "A",
 #endif
+#ifdef T_AAAA
+    T_AAAA, "AAAA",
+#endif
 #ifdef T_NS
     T_NS, "NS",
 #endif
index 05aac24bf3dd3c82fd5b2e48b0250916c80703e5..8cac9394594ace1bb3f369a9feff9ba186e504fe 100644 (file)
@@ -384,7 +384,7 @@ extern char *var_mailbox_lock;
   * the message size limit is implemented, but that is not clean.
   */
 #define VAR_MAILBOX_LIMIT      "mailbox_size_limit"
-#define DEF_MAILBOX_LIMIT      (DEF_MESSAGE_LIMIT * 2)
+#define DEF_MAILBOX_LIMIT      (DEF_MESSAGE_LIMIT * 5)
 extern int var_mailbox_limit;
 
  /*
@@ -1214,7 +1214,7 @@ extern int var_virt_minimum_uid;
 extern char *var_virt_mailbox_base;
 
 #define VAR_VIRT_MAILBOX_LIMIT         "virtual_mailbox_limit"
-#define DEF_VIRT_MAILBOX_LIMIT         (2 * DEF_MESSAGE_LIMIT)
+#define DEF_VIRT_MAILBOX_LIMIT         (5 * DEF_MESSAGE_LIMIT)
 extern int var_virt_mailbox_limit;
 
 #define VAR_VIRT_MAILBOX_LOCK          "virtual_mailbox_lock"
index 3310517dc948dc5af000bb14878a840118d64b34..3564c0b1e76f09db9e25efbaa1f1bd32c7d93a2d 100644 (file)
@@ -15,7 +15,7 @@
   * Version of this program.
   */
 #define VAR_MAIL_VERSION       "mail_version"
-#define DEF_MAIL_VERSION       "Snapshot-20010130"
+#define DEF_MAIL_VERSION       "Snapshot-20010201"
 extern char *var_mail_version;
 
 /* LICENSE
index 437e89f835fdade187931dfcd4f56e6b8fce1121..ff36cf9bf6573415a8887ba61616a41df04c5e8a 100644 (file)
@@ -356,6 +356,7 @@ maildir.o: ../../include/get_hostname.h
 maildir.o: ../../include/sane_fsops.h
 maildir.o: ../../include/mail_copy.h
 maildir.o: ../../include/bounce.h
+maildir.o: ../../include/defer.h
 maildir.o: ../../include/sent.h
 maildir.o: ../../include/mail_params.h
 maildir.o: local.h
index eea19d355bef1fc83296eb67dcc80d266b8f6878..fec5f9bb1b5db806d2988db6f8f384eca3284f89 100644 (file)
@@ -169,9 +169,9 @@ qmgr_entry.o: ../../include/argv.h
 qmgr_job.o: qmgr_job.c
 qmgr_job.o: ../../include/sys_defs.h
 qmgr_job.o: ../../include/msg.h
-qmgr_job.o: ../../include/events.h
 qmgr_job.o: ../../include/htable.h
 qmgr_job.o: ../../include/mymalloc.h
+qmgr_job.o: ../../include/sane_time.h
 qmgr_job.o: qmgr.h
 qmgr_job.o: ../../include/vstream.h
 qmgr_job.o: ../../include/vbuf.h
@@ -182,7 +182,6 @@ qmgr_job.o: ../../include/argv.h
 qmgr_message.o: qmgr_message.c
 qmgr_message.o: ../../include/sys_defs.h
 qmgr_message.o: ../../include/msg.h
-qmgr_message.o: ../../include/events.h
 qmgr_message.o: ../../include/mymalloc.h
 qmgr_message.o: ../../include/vstring.h
 qmgr_message.o: ../../include/vbuf.h
@@ -192,6 +191,7 @@ qmgr_message.o: ../../include/valid_hostname.h
 qmgr_message.o: ../../include/argv.h
 qmgr_message.o: ../../include/stringops.h
 qmgr_message.o: ../../include/myflock.h
+qmgr_message.o: ../../include/sane_time.h
 qmgr_message.o: ../../include/dict.h
 qmgr_message.o: ../../include/mail_queue.h
 qmgr_message.o: ../../include/mail_params.h
index d9354103a0cab30e827ba1ecf5334bca0f84eacd..2b8ea133061fdcd95c01ef4906ad06663d8935d6 100644 (file)
@@ -59,9 +59,9 @@
 /* Utility library. */
 
 #include <msg.h>
-#include <events.h>
 #include <htable.h>
 #include <mymalloc.h>
+#include <sane_time.h>
 
 /* Application-specific. */
 
@@ -483,7 +483,7 @@ static QMGR_JOB *qmgr_job_candidate(QMGR_JOB *current)
             max_needed_entries,
             max_total_entries;
     int     delay;
-    time_t  now = event_time();
+    time_t  now = sane_time();
 
     /*
      * Fetch the result directly from the cache if the cache is still valid.
@@ -520,9 +520,6 @@ static QMGR_JOB *qmgr_job_candidate(QMGR_JOB *current)
      * And, because the leaf children are not ordered by the time since
      * queued, we have to exclude them from the early loop end test.
      * 
-     * By the way, the selection is reasonably resistant to OS time warping,
-     * too.
-     * 
      * However, don't bother searching if we can't find anything suitable
      * anyway.
      */
index 44e6b9735c9e88eb32ddc380b6a6594a528464db..3078f3ffe94a86c189ff9cf7c3ec1232b64e8344 100644 (file)
@@ -98,7 +98,6 @@
 /* Utility library. */
 
 #include <msg.h>
-#include <events.h>
 #include <mymalloc.h>
 #include <vstring.h>
 #include <vstream.h>
 #include <argv.h>
 #include <stringops.h>
 #include <myflock.h>
+#include <sane_time.h>
 
 /* Global library. */
 
@@ -148,7 +148,7 @@ static QMGR_MESSAGE *qmgr_message_create(const char *queue_name,
     message->refcount = 0;
     message->single_rcpt = 0;
     message->arrival_time = 0;
-    message->queued_time = event_time();
+    message->queued_time = sane_time();
     message->data_offset = 0;
     message->queue_id = mystrdup(queue_id);
     message->queue_name = mystrdup(queue_name);
index 6fb5ea0abe2f359103e5a5f62e66b6ecd903d714..edf47f4198806836a7ed3a3687cce029cc3ffd25 100644 (file)
@@ -22,7 +22,7 @@ SRCS  = argv.c argv_split.c attr.c basename.c binhash.c chroot_uid.c \
        stream_connect.c stream_trigger.c dict_regexp.c mac_expand.c \
        clean_env.c watchdog.c spawn_command.c duplex_pipe.c sane_rename.c \
        sane_link.c unescape.c timed_read.c timed_write.c dict_tcp.c \
-       hex_quote.c dict_alloc.c rand_sleep.c
+       hex_quote.c dict_alloc.c rand_sleep.c sane_time.c
 OBJS   = argv.o argv_split.o attr.o basename.o binhash.o chroot_uid.o \
        close_on_exec.o concatenate.o dict.o dict_db.o dict_dbm.o \
        dict_env.o dict_ht.o dict_ldap.o dict_mysql.o dict_ni.o dict_nis.o \
@@ -46,7 +46,7 @@ OBJS  = argv.o argv_split.o attr.o basename.o binhash.o chroot_uid.o \
        stream_connect.o stream_trigger.o dict_regexp.o mac_expand.o \
        clean_env.o watchdog.o spawn_command.o duplex_pipe.o sane_rename.o \
        sane_link.o unescape.o timed_read.o timed_write.o dict_tcp.o \
-       hex_quote.o dict_alloc.o rand_sleep.o
+       hex_quote.o dict_alloc.o rand_sleep.o sane_time.o
 HDRS   = argv.h attr.h binhash.h chroot_uid.h connect.h dict.h dict_db.h \
        dict_dbm.h dict_env.h dict_ht.h dict_ldap.h dict_mysql.h \
        dict_ni.h dict_nis.h dict_nisplus.h dir_forest.h events.h \
@@ -61,7 +61,8 @@ HDRS  = argv.h attr.h binhash.h chroot_uid.h connect.h dict.h dict_db.h \
        timed_connect.h timed_wait.h trigger.h username.h valid_hostname.h \
        vbuf.h vbuf_print.h vstream.h vstring.h vstring_vstream.h \
        dict_unix.h dict_pcre.h dict_regexp.h mac_expand.h clean_env.h \
-       watchdog.h spawn_command.h sane_fsops.h dict_tcp.h hex_quote.h
+       watchdog.h spawn_command.h sane_fsops.h dict_tcp.h hex_quote.h \
+       sane_time.h
 TESTSRC        = fifo_open.c fifo_rdwr_bug.c fifo_rdonly_bug.c select_bug.c \
        stream_test.c dup2_pass_on_exec.c
 WARN   = -W -Wformat -Wimplicit -Wmissing-prototypes \
@@ -77,7 +78,7 @@ TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
        inet_addr_host inet_addr_local mac_parse make_dirs msg_syslog \
        mystrtok sigdelay translit valid_hostname vstream_popen \
        vstring vstring_vstream doze select_bug stream_test mac_expand \
-       watchdog unescape hex_quote name_mask rand_sleep
+       watchdog unescape hex_quote name_mask rand_sleep sane_time
 
 LIB_DIR        = ../../lib
 INC_DIR        = ../../include
@@ -266,6 +267,11 @@ rand_sleep: $(LIB)
        $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS)
        mv junk $@.o
 
+sane_time: $(LIB)
+       mv $@.o junk
+       $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS)
+       mv junk $@.o
+
 depend: $(MAKES)
        (sed '1,/^# do not edit/!d' Makefile.in; \
        set -e; for i in [a-z][a-z0-9]*.c; do \
@@ -826,6 +832,10 @@ sane_rename.o: sane_rename.c
 sane_rename.o: sys_defs.h
 sane_rename.o: msg.h
 sane_rename.o: sane_fsops.h
+sane_time.o: sane_time.c
+sane_time.o: sys_defs.h
+sane_time.o: msg.h
+sane_time.o: sane_time.h
 scan_dir.o: scan_dir.c
 scan_dir.o: sys_defs.h
 scan_dir.o: msg.h
index 91498b416dbbfe1425bc27340c044d3b584f9bc9..55560815d4d59dc8acd0613506886ab67ed059bf 100644 (file)
@@ -344,7 +344,7 @@ static void plmysql_down_host(HOST *host)
  *    parse the map's config file
  *    allocate memory
  **********************************************************************/
-DICT   *dict_mysql_open(const char *name, int unused_flags, int unused_dict_flags)
+DICT   *dict_mysql_open(const char *name, int unused_open_flags, int dict_flags)
 {
     DICT_MYSQL *dict_mysql;
     int     connections;
@@ -353,6 +353,7 @@ DICT   *dict_mysql_open(const char *name, int unused_flags, int unused_dict_flag
                                           sizeof(DICT_MYSQL));
     dict_mysql->dict.lookup = dict_mysql_lookup;
     dict_mysql->dict.close = dict_mysql_close;
+    dict_mysql->dict.flags = dict_flags | DICT_FLAG_FIXED;
     dict_mysql->name = mysqlname_parse(name);
     dict_mysql->pldb = plmysql_init(dict_mysql->name->hostnames,
                                    dict_mysql->name->len_hosts);
diff --git a/postfix/src/util/sane_time.c b/postfix/src/util/sane_time.c
new file mode 100644 (file)
index 0000000..157c95e
--- /dev/null
@@ -0,0 +1,128 @@
+/*++
+/* NAME
+/*     sane_time 3
+/* SUMMARY
+/*     time(2) with backward time jump protection.
+/* SYNOPSIS
+/*     #include <sane_time.h>
+/*
+/*     time_t sane_time(void)
+/*
+/* DESCRIPTION
+/*     This module provides time(2) like call for applications
+/*     which need monotonically increasing time function rather
+/*     than the real exact time. It eliminates the need for various
+/*     workarounds all over the application which would handle
+/*     potential problems if time suddenly jumps backward.
+/*     Instead we choose to deal with this problem inside this
+/*     module and let the application focus on its own tasks.
+/*
+/*     sane_time() returns the current timestamp as obtained from
+/*     time(2) call, at least most of the time. In case this routine
+/*     detects that time has jumped backward, it keeps returning
+/*     whatever timestamp it returned before, until this timestamp
+/*     and the time(2) timestamp become synchronized again.
+/*     Additionally, the returned timestamp is slowly increased to
+/*     prevent the faked clock from freezing for too long.
+/* SEE ALSO
+/*     time(2) get current time
+/* DIAGNOSTICS
+/*     Warning message is logged if backward time jump is detected.
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Patrik Rak
+/*     Modra 6
+/*     155 00, Prague, Czech Republic
+/*--*/
+
+/* System library. */
+
+#include <sys_defs.h>
+
+/* Utility library. */
+
+#include <msg.h>
+
+/* Application-specific. */
+
+#include "sane_time.h"
+
+/*
+ * How many times shall we slow down the real clock when recovering from
+ * time jump.
+ */
+#define SLEW_FACTOR 2
+
+/* sane_time - get current time, protected against time warping */
+
+time_t  sane_time(void)
+{
+    time_t  now;
+    static time_t last_time,
+            last_real;
+    int     delta;
+    static int fraction;
+    static int warned;
+
+    now = time((time_t *) 0);
+
+    if ((delta = now - last_time) < 0 && last_time != 0) {
+       if ((delta = now - last_real) < 0) {
+           msg_warn("%sbackward time jump detected -- slewing clock",
+                    warned++ ? "another " : "");
+       } else {
+           delta += fraction;
+           last_time += delta / SLEW_FACTOR;
+           fraction = delta % SLEW_FACTOR;
+       }
+    } else {
+       if (warned) {
+           warned = 0;
+           msg_warn("backward time jump recovered -- back to normality");
+           fraction = 0;
+       }
+       last_time = now;
+    }
+    last_real = now;
+
+    return (last_time);
+}
+
+#ifdef TEST
+
+ /*
+  * Proof-of-concept test program. Repeatedly print current system time and
+  * time returned by sane_time(). Meanwhile, try stepping your system clock
+  * back and forth to see what happens.
+  */
+
+#include <stdlib.h>
+#include <msg_vstream.h>
+#include <iostuff.h>                   /* doze() */
+
+int     main(int argc, char **argv)
+{
+    int     delay = 1000000;
+    time_t  now;
+
+    msg_vstream_init(argv[0], VSTREAM_ERR);
+
+    if (argc == 2 && (delay = atol(argv[1]) * 1000) > 0)
+        /* void */ ;
+    else if (argc != 1)
+       msg_fatal("usage: %s [delay in ms (default 1 second)]", argv[0]);
+
+    for (;;) {
+       now = time((time_t *) 0);
+       vstream_printf("real: %s", ctime(&now));
+       now = sane_time();
+       vstream_printf("fake: %s\n", ctime(&now));
+       vstream_fflush(VSTREAM_OUT);
+       doze(delay);
+    }
+}
+
+#endif
diff --git a/postfix/src/util/sane_time.h b/postfix/src/util/sane_time.h
new file mode 100644 (file)
index 0000000..0fe50d9
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef _SANE_TIME_H_
+#define _SANE_TIME_H_
+
+/*++
+/* NAME
+/*     sane_time 3h
+/* SUMMARY
+/*     time(2) with backward time jump protection
+/* SYNOPSIS
+/*     #include <sane_time.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * System library.
+  */
+#include <time.h>
+
+ /*
+  * External interface.
+  */
+extern time_t sane_time(void);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Patrik Rak
+/*     Modra 6
+/*     155 00, Prague, Czech Republic
+/*--*/
+
+#endif