Prev: Stopping spam from a specifig subnet (relayed through a freemailprovider)
Next: Postfix + LDAP + NSCD problems with trivial-rewrite
From: Gary Smith on 5 May 2010 17:57 I have a content filter in which I need the sasl_username. This works for most of our outgoing email. The problem is sometimes locally generated email is submitted without SASL (as they are in the mynetworks table). This leaves sasl_username blank. So to get around this I have wrapped ${sasl_username} in [] and in my scripts I check if "$4 == "[]". If I don't wrap it in something it ordinal position of the arguments change which breaks the script. When the script is completed, I replace $4 with -- and submit back to queue. master.cf tempsa unix - n n - 32 pipe -o content_filter= flags=Rq user=filter argv=/etc/postfix/scripts/tempsa.sh -f ${sender} [${sasl_username}] ${recipient} I was wondering if there is a better way to do this when we need to pass this type of argument to a content filter? Gary-
From: Noel Jones on 5 May 2010 18:08 On 5/5/2010 4:57 PM, Gary Smith wrote: > I have a content filter in which I need the sasl_username. This works for most of our outgoing email. The problem is sometimes locally generated email is submitted without SASL (as they are in the mynetworks table). This leaves sasl_username blank. So to get around this I have wrapped ${sasl_username} in [] and in my scripts I check if "$4 == "[]". If I don't wrap it in something it ordinal position of the arguments change which breaks the script. When the script is completed, I replace $4 with -- and submit back to queue. > > master.cf > tempsa unix - n n - 32 pipe > -o content_filter= > flags=Rq user=filter argv=/etc/postfix/scripts/tempsa.sh -f ${sender} [${sasl_username}] ${recipient} > > I was wondering if there is a better way to do this when we need to pass this type of argument to a content filter? > > Gary- one options is: ... ${sasl_username:unknown} ${recipient} ie. if $sasl_username is empty, substitute "unknown" But nothing particularly wrong with what you're doing already. -- Noel Jones
From: Gary Smith on 5 May 2010 18:10
> ... ${sasl_username:unknown} ${recipient} > > ie. if $sasl_username is empty, substitute "unknown" > > But nothing particularly wrong with what you're doing already. That will work better for me since I won't have to parse out the sasl_username from the [] if it's empty. I can just check for the unknown value. Thanks |