Re: [exim] Combining server_condition

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Torsten Müller
Ημερομηνία:  
Προς: 'Mailing List'
Αντικείμενο: Re: [exim] Combining server_condition


Am 16.04.2021 um 15:16 schrieb Jeremy Harris via Exim-users:
> On 16/04/2021 13:59, Torsten Müller via Exim-users wrote:
>> Now both MySQL queries work like expected,
>> the first lookup yielded: 1, the second yielded: 0
>
> The way you have coded that ${lookup } you are getting
> a "no" string result if the MySQL lookup returns *anything*.
>
> Including "0".


Thanks Jeremey ,
you are absolutely right.

I modified the MySQL queries accordingly and changed yes with no
and no with yes in the server_condition. After some tests it seems
to work now everything right.

Thank you Jeremy, Evgeniy and Heiko.

For other users, searching the archives:

auth_plain:
         driver = plaintext
         public_name = PLAIN
         server_prompts = :
         server_condition = ${if or{\
            {bool{${lookup mysql {MYSQL_AUTH_GWUSERPLAIN}{yes}{no}}}}\
            {bool{${lookup mysql {MYSQL_AUTH_PLAIN}{yes}{no}}}}\
         }}
         server_set_id = $2


MYSQL_AUTH_PLAIN = SELECT username from MYSQL_SMTPAUTH_TABLE where
MYSQL_SMTPAUTH_USER_FIELD = '${quote_mysql:$2}' AND
MYSQL_SMTPAUTH_PASS_FIELD = '${quote_mysql:$3}' AND
MYSQL_SMTPAUTH_PASS_FIELD != ''

MYSQL_AUTH_GWUSERPLAIN = SELECT username from MYSQL_SMTPAUTH_TABLE where
concat(MYSQL_SMTPAUTH_USER_FIELD , '@', punycode) = '${quote_mysql:$2}'
AND MYSQL_SMTPAUTH_PASS_FIELD = '${quote_mysql:$3}' AND
MYSQL_SMTPAUTH_PASS_FIELD != ''

Greetings from Schönebeck / Elbe
Torsten