/usr/src/postfix-2.0.3 /usr/src Published by Erik Aronesty at http://zoneedit.com/doc/postfix/contrib/patch-release-2.0.3-tagbl-0.1.diff This is against Postfix' 2.0.3 release. *** ./html/uce.html.tagbl Sun Feb 2 19:57:09 2003 --- ./html/uce.html Sat Dec 21 19:52:34 2002 *************** *** 419,426 ****
warn_if_reject -
tag_if_reject -
reject_unauth_pipelining
See generic restrictions. --- 419,424 ---- *************** *** 1142,1157 ****

- - -

tag_if_reject -
Same as warn_if_reject, except the text portion of the error code - is prepended to the message headers. Intended to be used with - rbl and rhsbl restrictions. default_rbl_tag will be used as the - template for the header, if this modifier precedes an rbl restriction. - -

-

reject_unauth_pipelining
Reject the request when --- 1140,1145 ---- *** ./src/global/mail_params.h.tagbl Sun Feb 2 19:57:09 2003 --- ./src/global/mail_params.h Sun Feb 2 19:56:29 2003 *************** *** 1250,1256 **** #define CHECK_ETRN_ACL "check_etrn_access" #define WARN_IF_REJECT "warn_if_reject" - #define TAG_IF_REJECT "tag_if_reject" #define LOG_RECIPIENT "log_recipient" #define REJECT_RBL "reject_rbl" /* LaMont compatibility */ --- 1250,1255 ---- *************** *** 1267,1276 **** #define DEF_DEF_RBL_REPLY "$rbl_code Service unavailable; $rbl_class [$rbl_what] blocked using $rbl_domain${rbl_reason?; $rbl_reason}" extern char *var_def_rbl_reply; - #define VAR_DEF_RBL_TAG "default_rbl_tag" - #define DEF_DEF_RBL_TAG "$rbl_code X-Spam: $rbl_class [$rbl_what] tagged using $rbl_domain${rbl_reason?; $rbl_reason}" - extern char *var_def_rbl_tag; - #define REJECT_MAPS_RBL "reject_maps_rbl" /* backwards compat */ #define VAR_MAPS_RBL_CODE "maps_rbl_reject_code" #define DEF_MAPS_RBL_CODE 554 --- 1266,1271 ---- *** ./src/smtpd/smtpd.c.tagbl Sun Feb 2 19:57:09 2003 --- ./src/smtpd/smtpd.c Wed Jan 15 08:28:54 2003 *************** *** 431,437 **** int var_smtpd_hist_thrsh; char *var_smtpd_exp_filter; char *var_def_rbl_reply; - char *var_def_rbl_tag; char *var_relay_rcpt_maps; int var_local_rcpt_code; int var_virt_alias_code; --- 431,436 ---- *************** *** 1043,1062 **** rec_fprintf(state->cleanup, REC_TYPE_NORM, "\tid %s; %s", state->queue_id, mail_date(state->time)); } - #ifdef RECEIVED_ENVELOPE_FROM quote_822_local(state->buffer, state->sender); rec_fprintf(state->cleanup, REC_TYPE_NORM, "\t(envelope-from %s)", STR(state->buffer)); #endif - - /* - * Prepend other header, if any. Used by tag_if_reject. - */ - if (state->prepend_headers) { - rec_fprintf(state->cleanup, REC_TYPE_NORM, STR(state->prepend_headers)); - } - smtpd_chat_reply(state, "354 End data with ."); /* --- 1042,1052 ---- *************** *** 1711,1717 **** static CONFIG_RAW_TABLE raw_table[] = { VAR_SMTPD_EXP_FILTER, DEF_SMTPD_EXP_FILTER, &var_smtpd_exp_filter, 1, 0, VAR_DEF_RBL_REPLY, DEF_DEF_RBL_REPLY, &var_def_rbl_reply, 1, 0, - VAR_DEF_RBL_TAG, DEF_DEF_RBL_TAG, &var_def_rbl_tag, 1, 0, 0, }; --- 1701,1706 ---- *** ./src/smtpd/smtpd_check.c.tagbl Sun Feb 2 19:57:09 2003 --- ./src/smtpd/smtpd_check.c Sun Feb 2 19:56:32 2003 *************** *** 772,778 **** va_list ap; int warn_if_reject; const char *whatsup; - const char *header; /* * Do not reject mail if we were asked to warn only. However, --- 772,777 ---- *************** *** 814,820 **** * earlier problem instead. */ if (!warn_if_reject && state->defer_if_reject.active && STR(error_text)[0] == '5') { ! state->warn_if_reject = state->defer_if_reject.active = state->tag_if_reject = 0; return (smtpd_check_reject(state, state->defer_if_reject.class, "%s", STR(state->defer_if_reject.reason))); } --- 813,819 ---- * earlier problem instead. */ if (!warn_if_reject && state->defer_if_reject.active && STR(error_text)[0] == '5') { ! state->warn_if_reject = state->defer_if_reject.active = 0; return (smtpd_check_reject(state, state->defer_if_reject.class, "%s", STR(state->defer_if_reject.reason))); } *************** *** 841,863 **** if (var_soft_bounce && STR(error_text)[0] == '5') STR(error_text)[0] = '4'; - /* - * Tag reject mail - * If this rejection was preceded by a tag_if_reject modifier, then modify - * the mail headers with the "tag" only. Implies warn_if_reject. - * Don't tag mail when soft bouncing. - * Don't tag mail unless you've formatted the error reply as a header. - * - */ - - if (state->tag_if_reject && STR(error_text)[0] == '5') { - header = STR(error_text); - while (isdigit(*header)) ++header; - while (isspace(*header)) ++header; - smtpd_prepend_header(state, header); - } - - /* * Log what is happening. When the sysadmin discards policy violation * postmaster notices, this may be the only trace left that service was --- 840,845 ---- *************** *** 868,889 **** return (warn_if_reject ? 0 : SMTPD_CHECK_REJECT); } - static void smtpd_prepend_header(SMTPD_STATE *state, const char *header) - { - if (header && *header) { - if (state->prepend_headers) { - /* This is probably very wrong, unless the header-writer parses - * it, and places each in it's own record. Needs to be tested - * with more than 1 tag/reject. - */ - VSTRING_ADDCH(state->prepend_headers, '\n'); - } else { - state->prepend_headers = vstring_alloc(50); - } - vstring_strcat(state->prepend_headers, header); - } - } - /* defer_if - prepare to change our mind */ static void defer_if(SMTPD_DEFER *defer, int error_class, const char *fmt,...) --- 850,855 ---- *************** *** 2358,2364 **** rbl_exp.class = reply_class; for (;;) { if (template == 0) ! template = state->tag_if_reject ? var_def_rbl_tag : var_def_rbl_reply; if (mac_expand(why, template, MAC_EXP_FLAG_NONE, STR(expand_filter), rbl_expand_lookup, (char *) &rbl_exp) == 0) --- 2324,2330 ---- rbl_exp.class = reply_class; for (;;) { if (template == 0) ! template = var_def_rbl_reply; if (mac_expand(why, template, MAC_EXP_FLAG_NONE, STR(expand_filter), rbl_expand_lookup, (char *) &rbl_exp) == 0) *************** *** 2593,2606 **** state->warn_if_reject = state->recursion; continue; } - - if (strcasecmp(name, TAG_IF_REJECT) == 0) { - /* Tag implies warn. Tag must be cleared when warn is cleared. */ - if (state->warn_if_reject == 0) - state->warn_if_reject = state->recursion; - state->tag_if_reject = 1; - continue; - } /* * Spoof the is_map_command() routine, so that we do not have to make --- 2559,2564 ---- *************** *** 2862,2868 **** msg_info("%s: name=%s status=%d", myname, name, status); if (state->warn_if_reject >= state->recursion) ! state->warn_if_reject = state->tag_if_reject = 0; if (status != 0) break; --- 2820,2826 ---- msg_info("%s: name=%s status=%d", myname, name, status); if (state->warn_if_reject >= state->recursion) ! state->warn_if_reject = 0; if (status != 0) break; *************** *** 2893,2899 **** #define SMTPD_CHECK_RESET() { \ state->recursion = 0; \ state->warn_if_reject = 0; \ - state->tag_if_reject = 0; \ state->defer_if_reject.active = 0; \ } --- 2851,2856 ---- /usr/src