]> git.pld-linux.org Git - packages/postfix.git/blobdiff - postfix-ident.patch
- update to 2.5.1 stable (by Eero Hänninen)
[packages/postfix.git] / postfix-ident.patch
index 42acb3fabc1dd24aa3362b30959e461b6cdfbb29..209dfcf5220dc1dff58cbcaa867ff7cf9fbd546d 100644 (file)
@@ -11,106 +11,6 @@ diff -urN -x '*~' postfix-2.2.5/src/global/mail_params.h postfix-2.2.5-ident/src
   /*
    * SMTPD messages
    */
-diff -urN -x '*~' postfix-2.2.5/src/smtpd/Makefile.in postfix-2.2.5-ident/src/smtpd/Makefile.in
---- postfix-2.2.5/src/smtpd/Makefile.in        2005-04-29 23:12:28.000000000 +0200
-+++ postfix-2.2.5-ident/src/smtpd/Makefile.in  2006-02-22 15:56:31.000000000 +0100
-@@ -1,10 +1,10 @@
- SHELL = /bin/sh
- SRCS  = smtpd.c smtpd_token.c smtpd_check.c smtpd_chat.c smtpd_state.c \
-       smtpd_peer.c smtpd_sasl_proto.c smtpd_sasl_glue.c smtpd_proxy.c \
--      smtpd_xforward.c
-+      smtpd_xforward.c smtpd_ident.c
- OBJS  = smtpd.o smtpd_token.o smtpd_check.o smtpd_chat.o smtpd_state.o \
-       smtpd_peer.o smtpd_sasl_proto.o smtpd_sasl_glue.o smtpd_proxy.o \
--      smtpd_xforward.o
-+      smtpd_xforward.o smtpd_ident.o
- HDRS  = smtpd_token.h smtpd_check.h smtpd_chat.h smtpd_sasl_proto.h \
-       smtpd_sasl_glue.h smtpd_proxy.h
- TESTSRC       = smtpd_token_test.c
-diff -urN -x '*~' postfix-2.2.5/src/smtpd/smtpd.c postfix-2.2.5-ident/src/smtpd/smtpd.c
---- postfix-2.2.5/src/smtpd/smtpd.c    2006-02-22 16:20:15.000000000 +0100
-+++ postfix-2.2.5-ident/src/smtpd/smtpd.c      2006-02-22 16:17:23.000000000 +0100
-@@ -900,6 +900,7 @@
- char   *var_local_rwr_clients;
- char   *var_smtpd_ehlo_dis_words;
- char   *var_smtpd_ehlo_dis_maps;
-+char   *var_smtpd_ident_lookup;
- bool    var_smtpd_use_tls;
- bool    var_smtpd_enforce_tls;
-@@ -961,6 +962,11 @@
- int     smtpd_input_transp_mask;
-  /*
-+  * Hosts that should be ident-queried
-+  */
-+NAMADR_LIST *smtpd_ident_lookup;
-+
-+ /*
-   * Forward declarations.
-   */
- static void helo_reset(SMTPD_STATE *);
-@@ -1951,10 +1957,18 @@
-      * intermediate proxy.
-      */
-     if (!state->proxy || state->xforward.flags == 0) {
--      out_fprintf(out_stream, REC_TYPE_NORM,
--                  "Received: from %s (%s [%s])",
--                  state->helo_name ? state->helo_name : state->name,
--                  state->name, state->rfc_addr);
-+      if (namadr_list_match(smtpd_ident_lookup, state->name, state->addr)) {
-+              out_fprintf(out_stream, REC_TYPE_NORM,
-+                          "Received: from %s (%s [%s] ident=%s)",
-+                          state->helo_name ? state->helo_name : state->name,
-+                          state->name, state->rfc_addr,
-+                          state->ident_user);
-+      } else {
-+              out_fprintf(out_stream, REC_TYPE_NORM,
-+                          "Received: from %s (%s [%s])",
-+                          state->helo_name ? state->helo_name : state->name,
-+                          state->name, state->rfc_addr);
-+      }
- #ifdef USE_TLS
-       if (var_smtpd_tls_received_header && state->tls_context) {
-           out_fprintf(out_stream, REC_TYPE_NORM,
-@@ -3229,6 +3243,9 @@
-     xclient_hosts = namadr_list_init(MATCH_FLAG_NONE, var_xclient_hosts);
-     xforward_hosts = namadr_list_init(MATCH_FLAG_NONE, var_xforward_hosts);
-     hogger_list = namadr_list_init(MATCH_FLAG_NONE, var_smtpd_hoggers);
-+    smtpd_ident_lookup =
-+      namadr_list_init(match_parent_style(VAR_SMTPD_IDENT_LOOKUP),
-+                       var_smtpd_ident_lookup);
-     if (getuid() == 0 || getuid() == var_owner_uid)
-       smtpd_check_init();
-     debug_peer_init();
-@@ -3430,6 +3447,7 @@
-       VAR_SMTPD_SASL_TLS_OPTS, DEF_SMTPD_SASL_TLS_OPTS, &var_smtpd_sasl_tls_opts, 0, 0,
- #endif
-       VAR_REJECT_REPLY_MSG_ACCESS_DENIED, DEF_REJECT_REPLY_MSG_ACCESS_DENIED, &var_reject_reply_msg_access_denied, 1, 0, 
-+      VAR_SMTPD_IDENT_LOOKUP, DEF_SMTPD_IDENT_LOOKUP, &var_smtpd_ident_lookup, 0, 0,
-       0,
-     };
-     static CONFIG_RAW_TABLE raw_table[] = {
-diff -urN -x '*~' postfix-2.2.5/src/smtpd/smtpd.h postfix-2.2.5-ident/src/smtpd/smtpd.h
---- postfix-2.2.5/src/smtpd/smtpd.h    2005-01-30 22:45:31.000000000 +0100
-+++ postfix-2.2.5-ident/src/smtpd/smtpd.h      2006-02-22 15:56:31.000000000 +0100
-@@ -75,6 +75,7 @@
-     char   *addr;                     /* client host address string */
-     char   *namaddr;                  /* combined name and address */
-     char   *rfc_addr;                 /* address for RFC 2821 */
-+    char   *ident_user;                       /* user name returned by ident RFC 1413 */
-     struct sockaddr_storage sockaddr; /* binary client endpoint */
-     int     peer_code;                        /* 2=ok, 4=soft, 5=hard */
-     int     error_count;              /* reset after DOT */
-@@ -232,6 +233,8 @@
- extern void smtpd_peer_init(SMTPD_STATE *state);
- extern void smtpd_peer_reset(SMTPD_STATE *state);
-+extern char *smtpd_ident(struct sockaddr_in *peer_addr, struct sockaddr_in *smtpd_addr);
-+
- #define       SMTPD_PEER_CODE_OK      2
- #define SMTPD_PEER_CODE_TEMP  4
- #define SMTPD_PEER_CODE_PERM  5
 diff -urN -x '*~' postfix-2.2.5/src/smtpd/smtpd_ident.c postfix-2.2.5-ident/src/smtpd/smtpd_ident.c
 --- postfix-2.2.5/src/smtpd/smtpd_ident.c      1970-01-01 01:00:00.000000000 +0100
 +++ postfix-2.2.5-ident/src/smtpd/smtpd_ident.c        2006-02-22 15:56:31.000000000 +0100
@@ -253,10 +153,106 @@ diff -urN -x '*~' postfix-2.2.5/src/smtpd/smtpd_ident.c postfix-2.2.5-ident/src/
 +    return_val = mystrdup(ident_user);
 +    return return_val;
 +}
-diff -urN -x '*~' postfix-2.2.5/src/smtpd/smtpd_peer.c postfix-2.2.5-ident/src/smtpd/smtpd_peer.c
---- postfix-2.2.5/src/smtpd/smtpd_peer.c       2005-01-30 22:42:18.000000000 +0100
-+++ postfix-2.2.5-ident/src/smtpd/smtpd_peer.c 2006-02-22 16:21:40.000000000 +0100
-@@ -56,6 +56,7 @@
+--- postfix-2.3-RC9/src/smtpd/Makefile.in.orig 2006-07-09 19:45:31.000000000 +0200
++++ postfix-2.3-RC9/src/smtpd/Makefile.in      2006-07-11 20:17:09.605127872 +0200
+@@ -1,10 +1,10 @@
+ SHELL = /bin/sh
+ SRCS  = smtpd.c smtpd_token.c smtpd_check.c smtpd_chat.c smtpd_state.c \
+       smtpd_peer.c smtpd_sasl_proto.c smtpd_sasl_glue.c smtpd_proxy.c \
+-      smtpd_xforward.c smtpd_dsn_fix.c smtpd_milter.c
++      smtpd_xforward.c smtpd_dsn_fix.c smtpd_milter.c smtpd_ident.c
+ OBJS  = smtpd.o smtpd_token.o smtpd_check.o smtpd_chat.o smtpd_state.o \
+       smtpd_peer.o smtpd_sasl_proto.o smtpd_sasl_glue.o smtpd_proxy.o \
+-      smtpd_xforward.o smtpd_dsn_fix.o smtpd_milter.o
++      smtpd_xforward.o smtpd_dsn_fix.o smtpd_milter.o smtpd_ident.o
+ HDRS  = smtpd_token.h smtpd_check.h smtpd_chat.h smtpd_sasl_proto.h \
+       smtpd_sasl_glue.h smtpd_proxy.h smtpd_dsn_fix.h smtpd_milter.h
+ TESTSRC       = smtpd_token_test.c
+--- postfix-2.3-RC9/src/smtpd/smtpd.c.orig     2006-07-11 20:13:27.780850288 +0200
++++ postfix-2.3-RC9/src/smtpd/smtpd.c  2006-07-11 20:27:06.515383720 +0200
+@@ -1024,6 +1024,7 @@
+ char   *var_local_rwr_clients;
+ char   *var_smtpd_ehlo_dis_words;
+ char   *var_smtpd_ehlo_dis_maps;
++char   *var_smtpd_ident_lookup;
+ char   *var_smtpd_tls_level;
+ bool    var_smtpd_use_tls;
+@@ -1119,6 +1120,11 @@
+ int     smtpd_input_transp_mask;
+  /*
++  * Hosts that should be ident-queried
++  */
++NAMADR_LIST *smtpd_ident_lookup;
++
++ /*
+   * Forward declarations.
+   */
+ static void helo_reset(SMTPD_STATE *);
+@@ -2503,10 +2509,18 @@
+      * intermediate proxy.
+      */
+     if (!state->proxy || state->xforward.flags == 0) {
+-      out_fprintf(out_stream, REC_TYPE_NORM,
+-                  "Received: from %s (%s [%s])",
+-                  state->helo_name ? state->helo_name : state->name,
+-                  state->name, state->rfc_addr);
++      if (namadr_list_match(smtpd_ident_lookup, state->name, state->addr)) {
++              out_fprintf(out_stream, REC_TYPE_NORM,
++                      "Received: from %s (%s [%s] ident=%s)",
++                      state->helo_name ? state->helo_name : state->name,
++                      state->name, state->rfc_addr,
++                      state->ident_user);
++      } else {
++              out_fprintf(out_stream, REC_TYPE_NORM,
++                      "Received: from %s (%s [%s])",
++                      state->helo_name ? state->helo_name : state->name,
++                      state->name, state->rfc_addr);
++      }
+ #define VSTRING_STRDUP(s) vstring_strcpy(vstring_alloc(strlen(s) + 1), (s))
+@@ -4451,6 +4451,9 @@
+     xclient_hosts = namadr_list_init(MATCH_FLAG_NONE, var_xclient_hosts);
+     xforward_hosts = namadr_list_init(MATCH_FLAG_NONE, var_xforward_hosts);
+     hogger_list = namadr_list_init(MATCH_FLAG_NONE, var_smtpd_hoggers);
++    smtpd_ident_lookup =
++           namadr_list_init(match_parent_style(VAR_SMTPD_IDENT_LOOKUP),
++                var_smtpd_ident_lookup);
+     /*
+      * Open maps before dropping privileges so we can read passwords etc.
+@@ -4513,6 +4513,7 @@
+       VAR_MILT_DAEMON_NAME, DEF_MILT_DAEMON_NAME, &var_milt_daemon_name, 1, 0,
+       VAR_MILT_V, DEF_MILT_V, &var_milt_v, 1, 0,
+       VAR_REJECT_REPLY_MSG_ACCESS_DENIED, DEF_REJECT_REPLY_MSG_ACCESS_DENIED, &var_reject_reply_msg_access_denied, 1, 0,
++      VAR_SMTPD_IDENT_LOOKUP, DEF_SMTPD_IDENT_LOOKUP, &var_smtpd_ident_lookup, 0, 0,
+       0,
+     };
+     static CONFIG_RAW_TABLE raw_table[] = {
+--- postfix-2.3-RC9/src/smtpd/smtpd.h.orig     2006-07-09 21:49:21.000000000 +0200
++++ postfix-2.3-RC9/src/smtpd/smtpd.h  2006-07-11 20:30:43.993322048 +0200
+@@ -77,6 +77,7 @@
+     char   *addr;                     /* client host address string */
+     char   *namaddr;                  /* combined name and address */
+     char   *rfc_addr;                 /* address for RFC 2821 */
++    char   *ident_user;                       /* user name returned by ident RFC 1413 */
+     int     addr_family;              /* address family */
+     struct sockaddr_storage sockaddr; /* binary client endpoint */
+     int     name_status;              /* 2=ok 4=soft 5=hard 6=forged */
+@@ -266,6 +267,8 @@
+ extern void smtpd_peer_init(SMTPD_STATE *state);
+ extern void smtpd_peer_reset(SMTPD_STATE *state);
++extern char *smtpd_ident(struct sockaddr_in *peer_addr, struct sockaddr_in *smtpd_addr);
++
+ #define       SMTPD_PEER_CODE_OK      2
+ #define SMTPD_PEER_CODE_TEMP  4
+ #define SMTPD_PEER_CODE_PERM  5
+--- postfix-2.3-RC9/src/smtpd/smtpd_peer.c.orig        2006-07-08 02:51:33.000000000 +0200
++++ postfix-2.3-RC9/src/smtpd/smtpd_peer.c     2006-07-11 20:41:04.935924424 +0200
+@@ -98,6 +98,7 @@
  
  #include <sys_defs.h>
  #include <sys/socket.h>
@@ -264,16 +260,15 @@ diff -urN -x '*~' postfix-2.2.5/src/smtpd/smtpd_peer.c postfix-2.2.5-ident/src/s
  #include <netinet/in.h>
  #include <arpa/inet.h>
  #include <stdio.h>                    /* strerror() */
-@@ -74,13 +75,17 @@
+@@ -116,6 +117,7 @@
  
  /* Global library. */
  
 +#include <namadr_list.h>
  #include <mail_proto.h>
-+#include <mail_params.h>
  #include <valid_mailhost_addr.h>
- /* Application-specific. */
+ #include <mail_params.h>
+@@ -124,6 +126,8 @@
  
  #include "smtpd.h"
  
@@ -282,32 +277,33 @@ diff -urN -x '*~' postfix-2.2.5/src/smtpd/smtpd_peer.c postfix-2.2.5-ident/src/s
  /* smtpd_peer_init - initialize peer information */
  
  void    smtpd_peer_init(SMTPD_STATE *state)
-@@ -88,6 +93,8 @@
-     char   *myname = "smtpd_peer_init";
-     SOCKADDR_SIZE sa_len;
+@@ -131,6 +135,9 @@
+     const char *myname = "smtpd_peer_init";
+     SOCKADDR_SIZE sa_length;
      struct sockaddr *sa;
 +    struct sockaddr_in serv_sin;
 +    char *ident_user = NULL;
++    size_t sa_len;
      INET_PROTO_INFO *proto_info = inet_proto_info();
  
      sa = (struct sockaddr *) & (state->sockaddr);
-@@ -108,6 +115,7 @@
-       state->addr = mystrdup(CLIENT_ADDR_UNKNOWN);
-       state->rfc_addr = mystrdup(CLIENT_ADDR_UNKNOWN);
-       state->peer_code = SMTPD_PEER_CODE_PERM;
+@@ -177,6 +177,7 @@
+       state->addr_family = AF_UNSPEC;
+       state->name_status = SMTPD_PEER_CODE_PERM;
+       state->reverse_name_status = SMTPD_PEER_CODE_PERM;
 +      state->ident_user = mystrdup("NO-USER");
+       state->port = mystrdup(CLIENT_PORT_UNKNOWN);
      }
-     /*
-@@ -218,6 +226,7 @@
+
+@@ -302,6 +310,7 @@
            if (aierr) {
                msg_warn("%s: hostname %s verification failed: %s",
                         state->addr, state->name, MAI_STRERROR(aierr));
 +              state->ident_user = mystrdup("NO-USER");
                REJECT_PEER_NAME(state, (TEMP_AI_ERROR(aierr) ?
-                             SMTPD_PEER_CODE_TEMP : SMTPD_PEER_CODE_PERM));
+                           SMTPD_PEER_CODE_TEMP : SMTPD_PEER_CODE_FORGED));
            } else {
-@@ -239,6 +248,20 @@
+@@ -323,6 +332,20 @@
                freeaddrinfo(res0);
            }
        }
@@ -328,17 +324,20 @@ diff -urN -x '*~' postfix-2.2.5/src/smtpd/smtpd_peer.c postfix-2.2.5-ident/src/s
      }
  
      /*
-@@ -250,6 +273,7 @@
-       state->addr = mystrdup("127.0.0.1");    /* XXX bogus. */
-       state->rfc_addr = mystrdup("127.0.0.1");/* XXX bogus. */
-       state->peer_code = SMTPD_PEER_CODE_OK;
+@@ -390,7 +391,8 @@
+       state->name_status = SMTPD_PEER_CODE_OK;
+       state->reverse_name_status = SMTPD_PEER_CODE_OK;
+       state->port = mystrdup("0");            /* XXX bogus. */
+-    }
 +      state->ident_user = mystrdup("NO-USER");
-     }
++    }
  
      /*
-@@ -267,4 +291,5 @@
+      * Do the name[addr]:port formatting for pretty reports.
+@@ -410,5 +412,6 @@
      myfree(state->addr);
      myfree(state->namaddr);
      myfree(state->rfc_addr);
 +    myfree(state->ident_user);
+     myfree(state->port);
  }
This page took 0.079237 seconds and 4 git commands to generate.