Fwd: Postfix - PATCH: warn_if_reject breaks reject_unlisted_recipient

Scott Kitterman ubuntu at kitterman.com
Fri Apr 11 22:37:37 BST 2008


Lamont,

Do we want this patch for Hardy?  I'm not in a position to test until next 
Wed.

Scott K

...... Forwarded Message .......
From: wietse at porcupine.org (Wietse Venema)
To: John Tobin <tobinjt at cs.tcd.ie>
Cc: Postfix users <postfix-users at postfix.org>
Date: Fri, 11 Apr 2008 15:15:18 -0400 (EDT)
Subj: PATCH: warn_if_reject breaks reject_unlisted_recipient

>Wietse Venema:
>> John Tobin:
>> > G'day all,
>> > 
>> > On our mail system I want to list every restriction we use in
>> > smtpd_recipient_restrictions twice: once with warn_if_reject, and once
>> > without.  This will allow me to see all the restrictions that would 
have
>> > caused a rejection, not just the first.
>> > 
>> > This works properly for everything except reject_unlisted_sender and
>> > reject_unlisted_recipient - when I have
>> >     warn_if_reject reject_unlisted_recipient, reject_unlisted_recipient
>> > in smtpd_recipient_restrictions unknown recipients are not rejected.
>> 
>> That's a bug. The code that implements reject_unlisted_recipient
>> is skipped if it has somehow already executed for that recipient.
>
>The fix turns out to be simpler than first impressions led me to
>believe.  This patch will work for Postfix 2.1 and later.
>
>	Wietse
>
>*** /var/tmp/postfix-2.6-20080324/src/smtpd/smtpd_check.c	Tue Feb 12 
20:45:23 2008
>--- ./smtpd_check.c	Fri Apr 11 14:44:30 2008
>***************
>*** 4300,4306 ****
>  	return (0);
>      if (state->recipient_rcptmap_checked == 1)
>  	return (0);
>!     state->recipient_rcptmap_checked = 1;
>      return (check_rcpt_maps(state, recipient, SMTPD_NAME_RECIPIENT));
>  }
>  
>--- 4300,4308 ----
>  	return (0);
>      if (state->recipient_rcptmap_checked == 1)
>  	return (0);
>!     if (state->warn_if_reject == 0)
>! 	/* We really validate the recipient address. */
>! 	state->recipient_rcptmap_checked = 1;
>      return (check_rcpt_maps(state, recipient, SMTPD_NAME_RECIPIENT));
>  }
>  
>***************
>*** 4317,4323 ****
>  	return (0);
>      if (state->sender_rcptmap_checked == 1)
>  	return (0);
>!     state->sender_rcptmap_checked = 1;
>      return (check_rcpt_maps(state, sender, SMTPD_NAME_SENDER));
>  }
>  
>--- 4319,4327 ----
>  	return (0);
>      if (state->sender_rcptmap_checked == 1)
>  	return (0);
>!     if (state->warn_if_reject == 0)
>! 	/* We really validate the sender address. */
>! 	state->sender_rcptmap_checked = 1;
>      return (check_rcpt_maps(state, sender, SMTPD_NAME_SENDER));
>  }
>  
>




More information about the ubuntu-devel mailing list