OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
"DOT response with hostname" patch on postfix 2.5

From: ram (ramnetcore.co.in)
Date: Tue Apr 22 2008 - 07:58:42 CDT


Some time ago a patch was posted on this list to get postfix respond
with hostname in the DSN

I am trying this patch on postfix 2.5.1 but that doesnt work
When I try to patch by hand, I am lost at "postfix/src/smtpd/smtpd.c"
The line numbers dont match , but I think the code base has also
changed

Can I get the updated patch for 2.5.1 stable if possible

-----

> The patch below is for snapshot 2.5-20071205. After applying the patch,
> run "make -f Makefile.in" in the "proto/", "man/" and "html/" directories
> to update the documentation.
>
> Index: postfix/mantools/postlink
> *** postfix/mantools/postlink:1.1.1.7 Sun Oct 7 17:08:07 2007
> --- postfix/mantools/postlink Mon Oct 22 14:44:35 2007
> ***************
> *** 456,461 ****
> --- 457,463 ----
> s;\bsmtpd_delay_reject\b;<a href="postconf.5.html#smtpd_delay_reject">$&</a>;g;
> s;\bsmtpd_discard_ehlo_keyword_address_maps\b;<a href="postconf.5.html#smtpd_discard_ehlo_keyword_address_maps">$&</a>;g;
> s;\bsmtpd_discard_ehlo_keywords\b;<a href="postconf.5.html#smtpd_discard_ehlo_keywords">$&</a>;g;
> + s;\bsmtpd_dot_response_name\b;<a href="postconf.5.html#smtpd_dot_response_name">$&</a>;g;
> s;\bsmtpd_end_of_data_restrictions\b;<a href="postconf.5.html#smtpd_end_of_data_restrictions">$&</a>;g;
> s;\bsmtpd_error_sleep_time\b;<a href="postconf.5.html#smtpd_error_sleep_time">$&</a>;g;
> s;\bsmtpd_etrn_restrictions\b;<a href="postconf.5.html#smtpd_etrn_restrictions">$&</a>;g;
> Index: postfix/proto/postconf.proto
> *** postfix/proto/postconf.proto:1.1.1.8 Sun Oct 7 17:08:16 2007
> --- postfix/proto/postconf.proto Mon Oct 22 14:44:35 2007
> ***************
> *** 10523,10528 ****
> --- 10523,10545 ----
>
> <p> This feature is available in Postfix 2.3 and later. </p>
>
> + %PARAM smtpd_dot_response_name
> +
> + <p> Include the specified MTA name in 250 responses to end-of-data. This
> + makes message tracking easier through clustered servers behind a
> + load-balancer. Sending systems (such as Postfix) that log the end-of-data
> + (DOT) response will now record which machine in the cluster received
> + the message. </p>
> +
> + <p> Example: </p>
> +
> + <pre>
> + # Easiest to use $myhostname when different on each cluster node:
> + smtpd_dot_response_name = $myhostname
> + </pre>
> +
> + <p> This feature is available in Postfix 2.5 and later. </p>
> +
> %PARAM smtpd_tls_always_issue_session_ids yes
>
> <p> Force the Postfix SMTP server to issue a TLS session id, even
> Index: postfix/src/global/mail_params.h
> *** postfix/src/global/mail_params.h:1.1.1.7 Sun Oct 7 17:08:35 2007
> --- postfix/src/global/mail_params.h Mon Oct 22 14:44:36 2007
> ***************
> *** 1074,1079 ****
> --- 1074,1083 ----
> #define DEF_SMTPD_BANNER "$myhostname ESMTP $mail_name"
> extern char *var_smtpd_banner;
>
> + #define VAR_SMTPD_DOT_NAME "smtpd_dot_response_name"
> + #define DEF_SMTPD_DOT_NAME ""
> + extern char *var_smtpd_dot_name;
> +
> #define VAR_SMTPD_TMOUT "smtpd_timeout"
> #define DEF_SMTPD_TMOUT "300s"
> extern int var_smtpd_tmout;
> Index: postfix/src/smtpd/smtpd.c
> *** postfix/src/smtpd/smtpd.c:1.1.1.10 Sun Oct 7 17:09:05 2007
> --- postfix/src/smtpd/smtpd.c Mon Oct 22 14:44:37 2007
> ***************
> *** 831,836 ****
> --- 831,838 ----
> /* terminate the session with a 221 code.
> /* .PP
> /* Available in Postfix version 2.5 and later:
> + /* .IP "\fBsmtpd_dot_response_name (empty)\fR"
> + /* Include the specified MTA name in 250 responses to end-of-data.
> /* .IP "\fBsmtpd_client_port_logging (no)\fR"
> /* Enable logging of the remote SMTP client port in addition to
> /* the hostname and IP address.
> ***************
> *** 1129,1134 ****
> --- 1131,1137 ----
> char *var_milt_data_macros;
> char *var_milt_eod_macros;
> char *var_milt_unk_macros;
> + char *var_smtpd_dot_name;
> bool var_smtpd_client_port_log;
>
> /*
> ***************
> *** 2848,2856 ****
> state->error_count = 0;
> state->error_mask = 0;
> state->junk_cmds = 0;
> if (state->queue_id)
> ! smtpd_chat_reply(state,
> ! "250 2.0.0 Ok: queued as %s", state->queue_id);
> else
> smtpd_chat_reply(state, "%s", STR(state->proxy_buffer));
> } else if ((state->err & CLEANUP_STAT_DEFER) != 0) {
> --- 2851,2867 ----
> state->error_count = 0;
> state->error_mask = 0;
> state->junk_cmds = 0;
> + /*
> + * We assume that transparent pre-queue proxies will expose any
> + * hostname sent by the final non-proxy SMTP server.
> + */
> if (state->queue_id)
> ! if (*var_smtpd_dot_name)
> ! smtpd_chat_reply(state, "250 2.0.0 %s Ok: queued as %s",
> ! var_smtpd_dot_name, state->queue_id);
> ! else
> ! smtpd_chat_reply(state, "250 2.0.0 Ok: queued as %s",
> ! state->queue_id);
> else
> smtpd_chat_reply(state, "%s", STR(state->proxy_buffer));
> } else if ((state->err & CLEANUP_STAT_DEFER) != 0) {
> ***************
> *** 4717,4722 ****
> --- 4728,4734 ----
> #endif
> VAR_SMTPD_TLS_LEVEL, DEF_SMTPD_TLS_LEVEL, &var_smtpd_tls_level, 0, 0,
> VAR_SMTPD_SASL_TYPE, DEF_SMTPD_SASL_TYPE, &var_smtpd_sasl_type, 1, 0,
> + VAR_SMTPD_DOT_NAME, DEF_SMTPD_DOT_NAME, &var_smtpd_dot_name, 0, 0,
> VAR_SMTPD_MILTERS, DEF_SMTPD_MILTERS, &var_smtpd_milters, 0, 0,
> VAR_MILT_CONN_MACROS, DEF_MILT_CONN_MACROS, &var_milt_conn_macros, 0, 0,
> VAR_MILT_HELO_MACROS, DEF_MILT_HELO_MACROS, &var_milt_helo_macros, 0, 0,
>