Zhang Huangbin wrote:
Magnus � wrote:
On Tuesday, August 19, 2008 at 04:48 CEST,
     Zhang Huangbin <[EMAIL PROTECTED]> wrote:

[...]

In my record:
----cut<<----
mysql> select username,restriction_class,restricteddomain from restrictions;
+----------+-----------------------+------------------+
| username | restriction_class     | restricteddomain |
+----------+-----------------------+------------------+
| [EMAIL PROTECTED] | internal_deliver_only | b.cn             |
+----------+-----------------------+------------------+
----cut<<----

Replace mysql lookup by hash file, it works:
----cut<<----
b.cn   OK
----cut<<----

So, what SQL query should i use in mysql lookup file?

Use any query that returns "OK" is the lookup key is "b.cn".

query = SELECT "OK" FROM restrictions WHERE restricteddomain = '%s'

Thanks Magnus. :)

It works. But which filed should i use to match 'username' ([EMAIL PROTECTED]) in query string?

query = SELECT "OK" FROM restrictions WHERE restricteddomain='%s' AND username='???'


as I said earlier, you can't check multiple fields at a time. you need a policy server. so your mysql table design doesn't match postfix capabilities.

In case this is not clear, you cannot implement this:
        if sender is foo and recipient is bar, then do blah
directly. you need restriction classes, but restriction classes must be defined ahead of time in main.cf. they cannot be results of sql lookup.



Reply via email to