X-Git-Url: https://git.tld-linux.org/?p=packages%2Fpostfix.git;a=blobdiff_plain;f=postfix-ident.patch;h=21ad1231d68ff126d30bb8f9c0daea3a859b067d;hp=8cbd612f107998dbc7eafd93a72d92aa15dcc8a8;hb=e2a18a74cfad1a09bea3c679bbfd3052e43ccbab;hpb=60e32526139d97e9492a457ac550fe7bd9679df5 diff --git a/postfix-ident.patch b/postfix-ident.patch index 8cbd612..21ad123 100644 --- a/postfix-ident.patch +++ b/postfix-ident.patch @@ -172,22 +172,6 @@ diff -urN -x '*~' postfix-2.2.5/src/smtpd/smtpd_ident.c postfix-2.2.5-ident/src/ #define SMTPD_PEER_CODE_OK 2 #define SMTPD_PEER_CODE_TEMP 4 #define SMTPD_PEER_CODE_PERM 5 ---- postfix-2.8.3/src/smtpd/Makefile.in~ 2011-05-17 14:28:28.406666872 +0200 -+++ postfix-2.8.3/src/smtpd/Makefile.in 2011-05-17 14:31:06.946666872 +0200 -@@ -2,11 +2,11 @@ - 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_resolve.c \ -- smtpd_expand.c -+ smtpd_expand.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_resolve.o \ -- smtpd_expand.o -+ smtpd_expand.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 \ - smtpd_resolve.h smtpd_expand.h --- postfix-2.9.0/src/smtpd/smtpd.c.orig 2012-02-04 19:34:17.737149536 +0100 +++ postfix-2.9.0/src/smtpd/smtpd.c 2012-02-04 19:36:43.414073592 +0100 @@ -1208,6 +1208,7 @@ @@ -251,9 +235,25 @@ diff -urN -x '*~' postfix-2.2.5/src/smtpd/smtpd_ident.c postfix-2.2.5-ident/src/ VAR_UNV_FROM_WHY, DEF_UNV_FROM_WHY, &var_unv_from_why, 0, 0, VAR_UNV_RCPT_WHY, DEF_UNV_RCPT_WHY, &var_unv_rcpt_why, 0, 0, VAR_REJECT_TMPF_ACT, DEF_REJECT_TMPF_ACT, &var_reject_tmpf_act, 1, 0, ---- postfix-2.9.0/src/smtpd/smtpd_peer.c.orig 2012-02-04 19:34:17.294233547 +0100 -+++ postfix-2.9.0/src/smtpd/smtpd_peer.c 2012-02-04 19:40:48.203777370 +0100 -@@ -98,6 +98,7 @@ +--- postfix-2.10.0/src/smtpd/Makefile.in.orig 2013-03-12 18:39:01.000000000 +0100 ++++ postfix-2.10.0/src/smtpd/Makefile.in 2013-03-12 18:44:40.190592153 +0100 +@@ -2,11 +2,11 @@ + 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_resolve.c \ +- smtpd_expand.c smtpd_haproxy.c ++ smtpd_expand.c smtpd_haproxy.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_resolve.o \ +- smtpd_expand.o smtpd_haproxy.o ++ smtpd_expand.o smtpd_haproxy.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 \ + smtpd_resolve.h smtpd_expand.h +--- postfix-2.10.0/src/smtpd/smtpd_peer.c.orig 2013-03-12 19:14:53.347495658 +0100 ++++ postfix-2.10.0/src/smtpd/smtpd_peer.c 2013-03-12 22:24:19.932605940 +0100 +@@ -103,6 +103,7 @@ #include #include @@ -261,7 +261,7 @@ diff -urN -x '*~' postfix-2.2.5/src/smtpd/smtpd_ident.c postfix-2.2.5-ident/src/ #include #include #include /* strerror() */ -@@ -117,6 +118,7 @@ +@@ -123,6 +124,7 @@ /* Global library. */ @@ -269,74 +269,81 @@ diff -urN -x '*~' postfix-2.2.5/src/smtpd/smtpd_ident.c postfix-2.2.5-ident/src/ #include #include #include -@@ -125,6 +127,8 @@ - +@@ -133,6 +135,7 @@ #include "smtpd.h" + static INET_PROTO_INFO *proto_info; +extern NAMADR_LIST *smtpd_ident_lookup; -+ - /* smtpd_peer_init - initialize peer information */ - void smtpd_peer_init(SMTPD_STATE *state) -@@ -132,6 +136,9 @@ - const char *myname = "smtpd_peer_init"; - SOCKADDR_SIZE sa_length; - struct sockaddr *sa; + /* + * XXX If we make local endpoint (getsockname) information available to +@@ -295,6 +293,8 @@ + static void smtpd_peer_sockaddr_to_hostname(SMTPD_STATE *state) + { + struct sockaddr *sa = (struct sockaddr *) & (state->sockaddr); + struct sockaddr_in serv_sin; + char *ident_user = NULL; -+ SOCKADDR_SIZE sa_len; - INET_PROTO_INFO *proto_info = inet_proto_info(); - - sa = (struct sockaddr *) & (state->sockaddr); -@@ -171,6 +178,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); - } - -@@ -342,6 +350,7 @@ - if (aierr) { - msg_warn("hostname %s does not resolve to address %s: %s", - state->name, state->addr, MAI_STRERROR(aierr)); -+ state->ident_user = mystrdup("NO-USER"); - REJECT_PEER_NAME(state, (TEMP_AI_ERROR(aierr) ? + SOCKADDR_SIZE sa_length = state->sockaddr_len; + MAI_HOSTNAME_STR client_name; + int aierr; +@@ -345,6 +350,7 @@ + if (aierr) { + msg_warn("hostname %s does not resolve to address %s: %s", + state->name, state->addr, MAI_STRERROR(aierr)); ++ state->ident_user = mystrdup("NO-USER"); + REJECT_PEER_NAME(state, (TEMP_AI_ERROR(aierr) ? SMTPD_PEER_CODE_TEMP : SMTPD_PEER_CODE_FORGED)); - } else { -@@ -363,6 +372,20 @@ - freeaddrinfo(res0); - } + } else { +@@ -366,6 +372,19 @@ + freeaddrinfo(res0); } -+ -+ if (namadr_list_match(smtpd_ident_lookup, state->name, state->addr)) { -+ /* If getsockname fails, just forget it */ -+ sa_len = sizeof(serv_sin); -+ if (getsockname(vstream_fileno(state->client), (struct sockaddr *)&serv_sin, &sa_len) >= 0) { -+ ident_user = smtpd_ident((struct sockaddr_in *)sa, &serv_sin); -+ if (ident_user == NULL) -+ state->ident_user = mystrdup("NO-USER"); -+ else -+ state->ident_user = ident_user; -+ } else -+ msg_warn("getsockname failed while doing ident lookup: %s", strerror(errno)); -+ } else -+ state->ident_user = mystrdup("NO-USER"); } ++ if (namadr_list_match(smtpd_ident_lookup, state->name, state->addr)) { ++ /* If getsockname fails, just forget it */ ++ sa_length = sizeof(serv_sin); ++ if (getsockname(vstream_fileno(state->client), (struct sockaddr *)&serv_sin, &sa_length) >= 0) { ++ ident_user = smtpd_ident((struct sockaddr_in *)sa, &serv_sin); ++ if (ident_user == NULL) ++ state->ident_user = mystrdup("NO-USER"); ++ else ++ state->ident_user = ident_user; ++ } else ++ msg_warn("getsockname failed while doing ident lookup: %s", strerror(errno)); ++ } else ++ state->ident_user = mystrdup("NO-USER"); + } - /* -@@ -383,6 +406,7 @@ - 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"); - } + /* smtpd_peer_hostaddr_to_sockaddr - convert numeric string to binary */ +@@ -412,6 +431,7 @@ + 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"); + } - /* -@@ -401,5 +425,6 @@ - myfree(state->addr); - myfree(state->namaddr); - myfree(state->rfc_addr); -+ myfree(state->ident_user); - myfree(state->port); + /* smtpd_peer_no_client - peer went away, or peer info unavailable */ +@@ -426,6 +446,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); + } + +@@ -533,6 +554,7 @@ + } } + ++ + /* smtpd_peer_init - initialize peer information */ + + void smtpd_peer_init(SMTPD_STATE *state) +@@ -604,6 +626,8 @@ + myfree(state->namaddr); + if (state->rfc_addr) + myfree(state->rfc_addr); ++ if (state->ident_user) ++ myfree(state->ident_user); + if (state->port) + myfree(state->port); + if (state->dest_addr)