Ich habe jetzt eine stored Procedure angelegt, die offenbar tut, was ich will.
Für Interessierte:
DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `get_amavis_settings`(IN `address` VARCHAR(255)) BEGIN DECLARE menge INT DEFAULT 0; DECLARE position INT DEFAULT 0; DECLARE domain VARCHAR(255) DEFAULT ''; DECLARE mengeca INT DEFAULT 0; SELECT COUNT(*) FROM mail_virtual WHERE email = address INTO menge; IF menge > 0 THEN SELECT "Y" as local, 1 AS id, email AS sa_username, bypass_virus_checks, bypass_spam_checks, spam_tag2_level, spam_kill_level FROM mail_virtual WHERE email = address LIMIT 1; ELSE SELECT LOCATE('@', address) INTO position; SELECT SUBSTRING(address, position) INTO domain; SELECT COUNT(*) FROM mail_virtual WHERE iscatchall = 1 AND email LIKE domain INTO mengeca; IF mengeca > 0 THEN SELECT "Y" as local, 1 AS id, address AS sa_username, bypass_virus_checks, bypass_spam_checks, spam_tag2_level, spam_kill_level FROM mail_virtual WHERE iscatchall = 1 AND email LIKE domain LIMIT 1; ELSE SELECT 'N' AS local, '1' AS id, address AS sa_username, 'Y' AS bypass_virus_checks, 'Y' AS bypass_spam_checks, '999' AS spam_tag2_level, '999' AS spam_kill_level; END IF; END IF; END$$ DELIMITER ;
Aufgerufen wird dann aus amavis mit "CALL get_amavis_settings(%a);"
Mit freundlichen Grüßen / Kind regards Ronny Seffner -- Ronny Seffner | Alter Viehweg 1 | 01665 Klipphausen www.seffner.de | ronny@seffner.de | +49 35245 72950 7EA62E22D9CC4F0B74DCBCEA864623A568694DB8
lug-dd@mailman.schlittermann.de