Hi all.
I’m having some issues with the way email aliases are stored in the $USER_DATA/mail/$domain.conf
files. In the current format, periods and single quotes in an alias will break things. Has anyone found a solution for the following two problems?
PROBLEM 1 – periods
Periods, of course, are allowed in the local-part of email addresses as long as they are not consecutive and not the first or last character. But the is_mail_new()
function (in func/domain.sh
) can’t handle an alias with a period.
Say I have a user with the following email aliases:
billbailey
bill_bailey
bill.bailey
bailey
The is_mail_new()
function will return with an error: mail alias bailey is already exists
. Why? Because in the grep -w $1
part of the check, the -w
treats the period as a word boundary. So it sees bill.bailey
as two different entries in the ALIAS list.
PROBLEM 2 – single quotes
Single quotes are also allowed in the local-part (along with many other special characters). But due to the way user data is stored in the $USER_DATA/mail/$domain.conf
files, having a single quote in an alias completely breaks things.
Say I have a user with the following aliases:
patoreilly
pat_oreilly
pat_o'reilly
poreilly
The is_mail_new() function will fail in this case because the awk -F "ALIAS='" '{print $2}' $USER_DATA/mail/$domain.conf
part of the check will return the following:
patoreilly,pat_oreilly,pat_o
Because the value of the ALIAS variable (and all the variables) in the $USER_DATA/mail/$domain.conf
file is contained within single quotes, the awk
command will ignore everything past the single quote in o'reilly
. Unless code that deals with the values of other user data variables uses a different (and more robust) method of extracting the values, I imagine they must all break if a single quote is present.
Any ideas?
Cheers
–Dan