divert(-1) # # Copyright (c) 2003, 2004 Victor Ustugov # This hack is under BSD License # Redistributions of source code must retain the above copyright notice # # hacks disscussion's maillist - http://www.mta.org.ua/mailman/listinfo/sendmail-conf # # # Verify Recipient (RCPT TO envelope field) # # проверка корректности адресов получателей # используется check_mail_address.pl (http://victor.corvax.kiev.ua/check_mail_address/) # dnl используется для исключения из встречной проверки сообщений от авторизованных отправителей dnl define(`confVERIFY_RECIPIENT_SKIP', `AUTH')dnl dnl dnl используется для исключения из встречной проверки исходящих сообщений dnl define(`confVERIFY_RECIPIENT_SKIP', `OUTGOING')dnl dnl подробнее об исходящих сообщениях см. HACK(`is_outgoing') dnl dnl используется для исключения из встречной проверки сообщений, MAIL FROM которых указан в access_db в виде: dnl VerifyRecipient:mailbox@subdomain.maildomain OK dnl VerifyRecipient:subdomain.maildomain VERIFY dnl VerifyRecipient:@subdomain2.maildomain VERIFY dnl VerifyRecipient:maildomain OK dnl VerifyRecipient:subdomain2.maildomain2 VERIFY dnl VerifyRecipient:subdomain3.maildomain2 VERIFY dnl VerifyRecipient: SKIP dnl define(`confVERIFY_RECIPIENT_SKIP', `EXCLUDED')dnl dnl dnl будут проверены: dnl домен subdomain.maildomain с поддоменами за исключением адреса mailbox@subdomain.maildomain dnl домен subdomain2.maildomain без поддоменов dnl весь остальной домен maildomain в поддоменами проверятся не будет dnl домены subdomain2.maildomain2 и subdomain3.maildomain2 с поддоменами dnl по политике по умолчанию остальные адреса проверятся не будут dnl divert(0) VERSIONID(`$Id: verify_recipient.m4,v 8.12-0.03 2003/09/12 10:10:26 corvax Exp $')dnl divert(-1) dnl ifelse_strstr(confVERIFY_RECIPIENT_SKIP, `EXCLUDED', `dnl ifdef(`_ACCESS_TABLE_', `dnl', `dnl errprint(`*** ERROR: HACK(verify_recipient) requires FEATURE(access_db) ')')') dnl HACK(`precheck_envelope')dnl dnl ifdef(`confRCPT_TO_CHECKER',, `define(`confRCPT_TO_CHECKER', `/usr/local/scripts/check_mail_address.pl')') dnl dnl LOCAL_CONFIG dnl dnl Krcpt_to_check program `'confRCPT_TO_CHECKER dnl dnl LOCAL_RULESETS dnl dnl SLocal_check_rcpt # R $* $: $>Parse0 $>3 $1 R $* $: $1 R $* < @ $=w . > $: $1 < @ $2 . > R $* < @ $=w > $: $1 < @ $2 > R $* $: $1 $| $>verify_recipient $1 R $+ $| < error: $* User unknown > $#error $: 554 5.1.7 Unroutable address R $+ $| < error: $+ > $+ $#error $: 554 $1 R $+ $| $* $: $1 R <$-> $* $: $2 Sverify_recipient ifelse_strstr(confVERIFY_RECIPIENT_SKIP, `AUTH', `dnl # skip checks for authentificated senders R $* $: $&{auth_type} $| $1 R $+ $| $* $@ SKIP_AUTH R $* $| $* $: $2 ') dnl ifelse_strstr(confVERIFY_RECIPIENT_SKIP, `OUTGOING', `dnl # skip checks for outgoing messages R $* $: $&{IsOutgoing} $| $1 R YES $| $* $@ SKIP_OUTGOING R $* $| $* $: $2 ') dnl R $+ < @ $+ > $* $: $1@$2 R $+ . $: $1 ifelse_strstr(confVERIFY_RECIPIENT_SKIP, `EXCLUDED', `dnl # skip checks for excluded messages R $* $: $1 R $+ @ $+ $: < $(access VerifyRecipient:$1@$2 $: ? $) > $1 @ $2 R $+ @ $+ $: < $(access VerifyRecipient:@$2 $: ? $) > $1 @ $2 R $+ @ $+ $: $>D <$2> R <$*> $: <$1> $2 R $+ @ $+ $: < $(access VerifyRecipient: $: ? $) > $1 @ $2 R $* $@ SKIP_EXCLUDED R $* $@ SKIP_EXCLUDED R <$*> $* $: $2 ') dnl R <$*> $+ @ $+ $: < $(rcpt_to_check $2@$3 $) > dnl