On 2013-1-27 22:21 , Michiel Brandenburg wrote:
> Hi Wesley,
>> Is there a way to disable this filter only for SMTP Auth ?
> Sure there is, I use the following function
>
> # Checks authentication
> sub check_authenticated {
>
> load_sendmail_macros();
err.. that is not a mimedefang-function. Maybe you meant
'read_commands_file()'? That's only necessary if called from filter_sender or
filter_recipient.
> if ( defined( $SendmailMacros ) &&
> defined( $SendmailMacros{auth_authen})) {
This is written in a very confusing way (actually, just plain wrong). You are
testing two unrelated variables: First, you are testing the scalar
$SendmailMacros (which does not normally exist, so it will always be undefined
- or throw a compiler error), and an element of the %SendmailMacros hash. Yes,
perl is confusing this way... variables can have the same name but still be
different if they're of a different type ($foo vs %foo). To make the compiler
catch such an error, make sure you "use strict;" in your filter.
> return $SendmailMacros{auth_authen};
> }
> # check COMMANDS file for info, we use auth_authen
> # =auth_authen apex
> # =auth_ssf 0
> # =auth_type LOGIN
> # =auth_authen apex
> open( COMM, "<./COMMANDS" ) or return 0;
... and here you're implementing read_commands_file yourself... but written in
such a way that you don't extract the authenticated username.
> Make sure that sendmail passes along the macro auth_authen, think this is
> default not sure though.
Yes, that's default.
Much easier is to just use:
if ( $SendmailMacros{auth_authen} ) {
# connection has authenticated
...
}
Unless you are doing this check in filter_sender() or filter_recipient() (which
is really unlikely if you're doing content filtering), then you will have to
call read_commands_file() before doing the test.
--
Jan-Pieter Cornet
"Most seasonal greetings are sent by spammers and phishers."
signature.asc
Description: OpenPGP digital signature
_______________________________________________ NOTE: If there is a disclaimer or other legal boilerplate in the above message, it is NULL AND VOID. You may ignore it. Visit http://www.mimedefang.org and http://www.roaringpenguin.com MIMEDefang mailing list [email protected] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

