-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Illegal mix of collations error after upgrade to 0.7.3 #59
Comments
@willbrowningme Is there a db migration to change tables collation to |
@crazy-max hmm I do seem to remember this error. I don't think I did any migration, you can try adding DELIMITER $$
USE `anonaddy_database`$$
DROP PROCEDURE IF EXISTS `check_access`$$
CREATE PROCEDURE `check_access`(alias_email VARCHAR(254) charset utf8)
BEGIN
DECLARE no_alias_exists int(1);
DECLARE alias_action varchar(7) charset utf8;
DECLARE username_action varchar(7) charset utf8;
DECLARE additional_username_action varchar(7) charset utf8;
DECLARE domain_action varchar(7) charset utf8;
DECLARE alias_domain varchar(254) charset utf8;
SET alias_domain = SUBSTRING_INDEX(alias_email, '@', -1);
# We only want to carry out the checks if it is a full RCPT TO address without any + extension
IF LOCATE('+',alias_email) = 0 THEN
SET no_alias_exists = CASE WHEN NOT EXISTS(SELECT NULL FROM aliases WHERE email = alias_email) THEN 1 ELSE 0 END;
# If there is an alias, check if it is deactivated or deleted
IF NOT no_alias_exists THEN
SET alias_action = (SELECT
IF(deleted_at IS NULL,
'DISCARD',
'REJECT')
FROM
aliases
WHERE
email = alias_email
AND (active = 0
OR deleted_at IS NOT NULL));
END IF;
# If the alias is deactivated or deleted then increment its blocked count and return the alias_action
IF alias_action IN('DISCARD','REJECT') THEN
UPDATE
aliases
SET
emails_blocked = emails_blocked + 1
WHERE
email = alias_email;
SELECT alias_action;
ELSE
SELECT
(
SELECT
CASE
WHEN no_alias_exists
AND catch_all = 0 THEN "REJECT"
ELSE NULL
END
FROM
users
WHERE
alias_domain IN ( CONCAT(username, '.example.com')) ),
(
SELECT
CASE
WHEN no_alias_exists
AND catch_all = 0 THEN "REJECT"
WHEN active = 0 THEN "DISCARD"
ELSE NULL
END
FROM
additional_usernames
WHERE
alias_domain IN ( CONCAT(username, '.example.com')) ),
(
SELECT
CASE
WHEN no_alias_exists
AND catch_all = 0 THEN "REJECT"
WHEN active = 0 THEN "DISCARD"
ELSE NULL
END
FROM
domains
WHERE
domain = alias_domain) INTO username_action, additional_username_action, domain_action;
# If all actions are NULL then we can return 'DUNNO' which will prevent Postfix from trying substrings of the alias
IF username_action IS NULL AND additional_username_action IS NULL AND domain_action IS NULL THEN
SELECT 'DUNNO';
ELSEIF username_action IN('DISCARD','REJECT') THEN
SELECT username_action;
ELSEIF additional_username_action IN('DISCARD','REJECT') THEN
SELECT additional_username_action;
ELSE
SELECT domain_action;
END IF;
END IF;
ELSE
# This means the alias must have a + extension so we will ignore it
SELECT NULL;
END IF;
END$$
DELIMITER ; That should fix the issue. |
Had the same issue. Recreating the procedure like @willbrowningme suggested fixed it for me. |
@crazy-max works fine now. Thanks and great job 👍 |
Behaviour
Steps to reproduce this issue
Expected behaviour
Mail should be forwarded to recipient address.
Actual behaviour
Mail gets rejected. If I downgrade to
anonaddy/anonaddy:0.7.2
everything works again.See LOGS
Configuration
docker --version
) : Docker version 20.10.7, build f0df350docker-compose --version
) : docker-compose version 1.29.2, build 5becea4cuname -a
) : Linux 5.4.0-73-generic AnonAddy 0.8.4 #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linuxdocker-compose.yml
:Docker info
Logs
The text was updated successfully, but these errors were encountered: