3 messages in net.sourceforge.lists.courier-usersRe: [courier-users] bug: don't accept...
FromSent OnAttachments
Giacomo A. CatenazziFeb 2, 2004 1:59 pm 
Derrick T. WoolworthFeb 4, 2004 8:37 am 
Jeff JansenFeb 5, 2004 7:49 am.patch
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [courier-users] bug: don't accept user "Postmaster"Actions...
From:Jeff Jansen (ivb_@sil.org)
Date:Feb 5, 2004 7:49:53 am
List:net.sourceforge.lists.courier-users
Attachments:

On Wednesday 04 February 2004 16:49, Derrick T. Woolworth wrote:

This is a good point. I've noticed this and tried to find a way around the problem with setting a default domain and creating an alias, but I've not been able to get any configuration to work.

I needed courier to accept a bare "postmaster" for some program that we used to run so I wrote following patch. It works for me but I admit that I threw it together pretty quickly so YMMV.

Jeff Jansen

diff -Naur courier-0.44.0.orig/courier/module.esmtp/esmtp.c
courier-0.44.0/courier/module.esmtp/esmtp.c --- courier-0.44.0.orig/courier/module.esmtp/esmtp.c Wed Mar 6 05:13:46 2002 +++ courier-0.44.0/courier/module.esmtp/esmtp.c Wed Nov 5 16:52:48 2003 @@ -38,6 +38,23 @@ return (0); }

+static int ispostmaster(struct rw_info *info) +{ +char *r, *s; + + r=rfc822_gettok(info->ptr); + for(s=r; *s; s++) + *s = tolower(*s); + + if(strcmp(r,"postmaster") == 0) + { + free(r); + return(1); + } + free(r); + return (0); +} + static struct rfc822token *rfc822check(int err_code, struct rw_info *info, int allow_faxdomain) { @@ -81,6 +98,10 @@

if (s == 0 && seen1dot) return (p); } + + /* bare postmaster is valid name */ + + if (ispostmaster(info) == 1) return(info->ptr); /*return code is irrelevant -
should be a rfc822token */

(*info->err_func)(err_code, "Syntax error.", info); return (0); @@ -91,6 +112,10 @@ struct rfc822token *p, *q;

if (rfc822check(513, info, 1) == 0) return (-1); + + /* bare postmaster account is valid local address - */ + + if (ispostmaster(info) == 1) return(0);

/* Rewrite @foobar:foo@bar into foo@bar if @foobar is us.