Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/gnu/dist/postfix/src Resolve conflicts.



details:   https://anonhg.NetBSD.org/src/rev/0c01839395c7
branches:  trunk
changeset: 583665:0c01839395c7
user:      rpaulo <rpaulo%NetBSD.org@localhost>
date:      Thu Aug 18 22:06:28 2005 +0000

description:
Resolve conflicts.

diffstat:

 gnu/dist/postfix/src/qmgr/qmgr_message.c    |   61 +-
 gnu/dist/postfix/src/smtp/smtp_addr.c       |  152 ++--
 gnu/dist/postfix/src/smtp/smtp_connect.c    |  500 +++++++++++++--
 gnu/dist/postfix/src/smtp/smtp_unalias.c    |   10 +-
 gnu/dist/postfix/src/smtpd/smtpd.c          |  887 ++++++++++++++++++++++++---
 gnu/dist/postfix/src/smtpd/smtpd_check.c    |  593 +++++++++++++++---
 gnu/dist/postfix/src/smtpd/smtpd_peer.c     |  188 +++--
 gnu/dist/postfix/src/util/Makefile.in       |  242 ++++++-
 gnu/dist/postfix/src/util/inet_addr_host.c  |  117 ++-
 gnu/dist/postfix/src/util/inet_addr_list.c  |   47 +-
 gnu/dist/postfix/src/util/inet_addr_list.h  |   10 +-
 gnu/dist/postfix/src/util/inet_addr_local.c |  504 ++++++++++++++-
 gnu/dist/postfix/src/util/inet_connect.c    |   93 ++-
 gnu/dist/postfix/src/util/inet_listen.c     |  103 ++-
 gnu/dist/postfix/src/util/match_list.c      |    9 +-
 gnu/dist/postfix/src/util/match_ops.c       |  110 +-
 gnu/dist/postfix/src/util/sys_defs.h        |  166 ++++-
 gnu/dist/postfix/src/util/valid_hostname.c  |  213 ++++-
 18 files changed, 3249 insertions(+), 756 deletions(-)

diffs (truncated from 6883 to 300 lines):

diff -r 8633c8016a67 -r 0c01839395c7 gnu/dist/postfix/src/qmgr/qmgr_message.c
--- a/gnu/dist/postfix/src/qmgr/qmgr_message.c  Thu Aug 18 22:06:25 2005 +0000
+++ b/gnu/dist/postfix/src/qmgr/qmgr_message.c  Thu Aug 18 22:06:28 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: qmgr_message.c,v 1.12 2004/07/28 23:19:42 heas Exp $   */
+/*     $NetBSD: qmgr_message.c,v 1.13 2005/08/18 22:06:28 rpaulo Exp $ */
 
 /*++
 /* NAME
@@ -133,6 +133,7 @@
 #include <verp_sender.h>
 #include <mail_proto.h>
 #include <qmgr_user.h>
+#include <split_addr.h>
 
 /* Client stubs. */
 
@@ -184,6 +185,10 @@
     message->client_addr = 0;
     message->client_proto = 0;
     message->client_helo = 0;
+    message->sasl_method = 0;
+    message->sasl_username = 0;
+    message->sasl_sender = 0;
+    message->rewrite_context = 0;
     qmgr_rcpt_list_init(&message->rcpt_list);
     message->rcpt_count = 0;
     message->rcpt_limit = var_qmgr_msg_rcpt_limit;
@@ -231,8 +236,7 @@
 static void qmgr_message_oldstyle_scan(QMGR_MESSAGE *message)
 {
     VSTRING *buf;
-    long    orig_offset,
-            extra_offset;
+    long    orig_offset, extra_offset;
     int     rec_type;
     char   *start;
 
@@ -562,6 +566,34 @@
                    myfree(message->client_helo);
                message->client_helo = mystrdup(value);
            }
+           if (strcmp(name, MAIL_ATTR_SASL_METHOD) == 0) {
+               if (message->sasl_method == 0)
+                   message->sasl_method = mystrdup(value);
+               else
+                   msg_warn("%s: ignoring multiple %s attribute: %s",
+                          message->queue_id, MAIL_ATTR_SASL_METHOD, value);
+           }
+           if (strcmp(name, MAIL_ATTR_SASL_USERNAME) == 0) {
+               if (message->sasl_username == 0)
+                   message->sasl_username = mystrdup(value);
+               else
+                   msg_warn("%s: ignoring multiple %s attribute: %s",
+                        message->queue_id, MAIL_ATTR_SASL_USERNAME, value);
+           }
+           if (strcmp(name, MAIL_ATTR_SASL_SENDER) == 0) {
+               if (message->sasl_sender == 0)
+                   message->sasl_sender = mystrdup(value);
+               else
+                   msg_warn("%s: ignoring multiple %s attribute: %s",
+                          message->queue_id, MAIL_ATTR_SASL_SENDER, value);
+           }
+           if (strcmp(name, MAIL_ATTR_RWR_CONTEXT) == 0) {
+               if (message->rewrite_context == 0)
+                   message->rewrite_context = mystrdup(value);
+               else
+                   msg_warn("%s: ignoring multiple %s attribute: %s",
+                          message->queue_id, MAIL_ATTR_RWR_CONTEXT, value);
+           }
            /* Optional tracing flags. */
            else if (strcmp(name, MAIL_ATTR_TRACE_FLAGS) == 0) {
                message->tflags = DEL_REQ_TRACE_FLAGS(atoi(value));
@@ -635,6 +667,14 @@
        message->client_proto = mystrdup("");
     if (message->client_helo == 0)
        message->client_helo = mystrdup("");
+    if (message->sasl_method == 0)
+       message->sasl_method = mystrdup("");
+    if (message->sasl_username == 0)
+       message->sasl_username = mystrdup("");
+    if (message->sasl_sender == 0)
+       message->sasl_sender = mystrdup("");
+    if (message->rewrite_context == 0)
+       message->rewrite_context = mystrdup(MAIL_ATTR_RWR_LOCAL);
 
     /*
      * Clean up.
@@ -1180,6 +1220,14 @@
        myfree(message->client_proto);
     if (message->client_helo)
        myfree(message->client_helo);
+    if (message->sasl_method)
+       myfree(message->sasl_method);
+    if (message->sasl_username)
+       myfree(message->sasl_username);
+    if (message->sasl_sender)
+       myfree(message->sasl_sender);
+    if (message->rewrite_context)
+       myfree(message->rewrite_context);
     qmgr_rcpt_list_free(&message->rcpt_list);
     qmgr_message_count--;
     myfree((char *) message);
@@ -1229,10 +1277,17 @@
         * queue file and *before* resolving new recipients. Since all those
         * operations are encapsulated so nicely by this routine, the defer
         * log reset has to be done here as well.
+        * 
+        * Likewise remove a trace file with results from address verification,
+        * "what if" testing, or verbose delivery.
         */
        if (mail_queue_remove(MAIL_QUEUE_DEFER, queue_id) && errno != ENOENT)
            msg_fatal("%s: %s: remove %s %s: %m", myname,
                      queue_id, MAIL_QUEUE_DEFER, queue_id);
+       if (message->tflags != 0
+       && mail_queue_remove(MAIL_QUEUE_TRACE, queue_id) && errno != ENOENT)
+           msg_fatal("%s: %s: remove %s %s: %m", myname,
+                     queue_id, MAIL_QUEUE_TRACE, queue_id);
        qmgr_message_sort(message);
        qmgr_message_resolve(message);
        qmgr_message_sort(message);
diff -r 8633c8016a67 -r 0c01839395c7 gnu/dist/postfix/src/smtp/smtp_addr.c
--- a/gnu/dist/postfix/src/smtp/smtp_addr.c     Thu Aug 18 22:06:25 2005 +0000
+++ b/gnu/dist/postfix/src/smtp/smtp_addr.c     Thu Aug 18 22:06:28 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smtp_addr.c,v 1.9 2004/11/13 05:45:33 heas Exp $       */
+/*     $NetBSD: smtp_addr.c,v 1.10 2005/08/18 22:07:14 rpaulo Exp $    */
 
 /*++
 /* NAME
@@ -8,10 +8,11 @@
 /* SYNOPSIS
 /*     #include "smtp_addr.h"
 /*
-/*     DNS_RR *smtp_domain_addr(name, misc_flags, why)
+/*     DNS_RR *smtp_domain_addr(name, misc_flags, why, found_myself)
 /*     char    *name;
 /*     int     misc_flags;
 /*     VSTRING *why;
+/*     int     *found_myself;
 /*
 /*     DNS_RR *smtp_host_addr(name, misc_flags, why)
 /*     char    *name;
@@ -28,7 +29,9 @@
 /*     exchanger hosts listed for the named domain. Addresses are
 /*     returned in most-preferred first order. The result is truncated
 /*     so that it contains only hosts that are more preferred than the
-/*     local mail server itself.
+/*     local mail server itself. The found_myself result parameter
+/*     is updated when the local MTA is MX host for the specified
+/*     destination.
 /*
 /*     When no mail exchanger is listed in the DNS for \fIname\fR, the
 /*     request is passed to smtp_host_addr().
@@ -48,11 +51,11 @@
 /*
 /*     All routines either return a DNS_RR pointer, or return a null
 /*     pointer and set the \fIsmtp_errno\fR global variable accordingly:
-/* .IP SMTP_RETRY
+/* .IP SMTP_ERR_RETRY
 /*     The request failed due to a soft error, and should be retried later.
-/* .IP SMTP_FAIL
+/* .IP SMTP_ERR_FAIL
 /*     The request attempt failed due to a hard error.
-/* .IP SMTP_LOOP
+/* .IP SMTP_ERR_LOOP
 /*     The local machine is the best mail exchanger.
 /* .PP
 /*     In addition, a textual description of the problem is made available
@@ -81,31 +84,6 @@
 #include <unistd.h>
 #include <errno.h>
 
-#ifndef INADDR_NONE
-#define INADDR_NONE 0xffffffff
-#endif
-
- /*
-  * Older systems don't have h_errno. Even modern systems don't have
-  * hstrerror().
-  */
-#ifdef NO_HERRNO
-
-static int h_errno = TRY_AGAIN;
-
-#define  HSTRERROR(err) "Host not found"
-
-#else
-
-#define  HSTRERROR(err) (\
-        err == TRY_AGAIN ? "Host not found, try again" : \
-        err == HOST_NOT_FOUND ? "Host not found" : \
-        err == NO_DATA ? "Host name has no address" : \
-        err == NO_RECOVERY ? "Name server failure" : \
-        strerror(errno) \
-    )
-#endif
-
 /* Utility library. */
 
 #include <msg.h>
@@ -113,7 +91,8 @@
 #include <mymalloc.h>
 #include <inet_addr_list.h>
 #include <stringops.h>
-#include <myrand.h>
+#include <myaddrinfo.h>
+#include <inet_proto.h>
 
 /* Global library. */
 
@@ -134,17 +113,16 @@
 static void smtp_print_addr(char *what, DNS_RR *addr_list)
 {
     DNS_RR *addr;
-    struct in_addr in_addr;
+    MAI_HOSTADDR_STR hostaddr;
 
     msg_info("begin %s address list", what);
     for (addr = addr_list; addr; addr = addr->next) {
-       if (addr->data_len > sizeof(addr)) {
-           msg_warn("skipping address length %d", addr->data_len);
+       if (dns_rr_to_pa(addr, &hostaddr) == 0) {
+           msg_warn("skipping record type %s: %m", dns_strtype(addr->type));
        } else {
-           memcpy((char *) &in_addr, addr->data, sizeof(in_addr));
            msg_info("pref %4d host %s/%s",
                     addr->pref, addr->name,
-                    inet_ntoa(in_addr));
+                    hostaddr.buf);
        }
     }
     msg_info("end %s address list", what);
@@ -155,11 +133,13 @@
 static DNS_RR *smtp_addr_one(DNS_RR *addr_list, char *host, unsigned pref, VSTRING *why)
 {
     char   *myname = "smtp_addr_one";
-    struct in_addr inaddr;
-    DNS_FIXED fixed;
     DNS_RR *addr = 0;
     DNS_RR *rr;
-    struct hostent *hp;
+    int     aierr;
+    struct addrinfo *res0;
+    struct addrinfo *res;
+    INET_PROTO_INFO *proto_info = inet_proto_info();
+    int     found;
 
     if (msg_verbose)
        msg_info("%s: host %s", myname, host);
@@ -167,18 +147,22 @@
     /*
      * Interpret a numerical name as an address.
      */
-    if (ISDIGIT(host[0]) && (inaddr.s_addr = inet_addr(host)) != INADDR_NONE) {
-       memset((char *) &fixed, 0, sizeof(fixed));
-       return (dns_rr_append(addr_list,
-                             dns_rr_create(host, &fixed, pref,
-                                       (char *) &inaddr, sizeof(inaddr))));
+    if (hostaddr_to_sockaddr(host, (char *) 0, 0, &res0) == 0
+       && strchr((char *) proto_info->sa_family_list, res0->ai_family) != 0) {
+       if ((addr = dns_sa_to_rr(host, pref, res0->ai_addr)) == 0)
+           msg_fatal("host %s: conversion error for address family %d: %m",
+                   host, ((struct sockaddr *) (res0->ai_addr))->sa_family);
+       addr_list = dns_rr_append(addr_list, addr);
+       freeaddrinfo(res0);
+       return (addr_list);
     }
 
     /*
      * Use DNS lookup, but keep the option open to use native name service.
      */
     if (smtp_host_lookup_mask & SMTP_HOST_FLAG_DNS) {
-       switch (dns_lookup(host, T_A, RES_DEFNAMES, &addr, (VSTRING *) 0, why)) {
+       switch (dns_lookup_v(host, RES_DEFNAMES, &addr, (VSTRING *) 0, why,
+                            DNS_REQ_FLAG_ALL, proto_info->dns_atype_list)) {
        case DNS_OK:
            for (rr = addr; rr; rr = rr->next)
                rr->pref = pref;
@@ -194,7 +178,7 @@
        case DNS_NOTFOUND:
            if (smtp_errno != SMTP_ERR_RETRY)
                smtp_errno = SMTP_ERR_FAIL;
-           /* maybe gethostbyname() will succeed */
+           /* maybe native naming service will succeed */
            break;
        }
     }
@@ -202,29 +186,36 @@
     /*
      * Use the native name service which also looks in /etc/hosts.
      */
+#define RETRY_AI_ERROR(e) \
+        ((e) == EAI_AGAIN || (e) == EAI_MEMORY || (e) == EAI_SYSTEM)
+
     if (smtp_host_lookup_mask & SMTP_HOST_FLAG_NATIVE) {
-       memset((char *) &fixed, 0, sizeof(fixed));
-       if ((hp = gethostbyname(host)) == 0) {
-           vstring_sprintf(why, "%s: %s", host, HSTRERROR(h_errno));
+       if ((aierr = hostname_to_sockaddr(host, (char *) 0, 0, &res0)) != 0) {



Home | Main Index | Thread Index | Old Index