Subject: | wrong interpretation of wildcard assignment |
First of all: Thank you very much for this module, which was of great help to me when developing Mail::Qmail::Filter::CheckDeliverability.
Only recently I noticed one case where it could not find the .qmail file for localpart@jira.mensa.de.
In /var/qmail/control/virtualdomains jira.mensa.de is mapped to "jira", and in /var/qmail/users/assign I have:
+jira-:vpopmail:89:89:/home/vpopmail/domains/mensa.de:-:jira-
So the appropriate file should be /home/vpopmail/domains/mensa.de/.qmail-jira-localpart or /home/vpopmail/domains/mensa.de/.qmail-jira-default, and in fact, qmail uses these files when delivering messages to relevant addresses.
Qmail::Deliverable, however, looks at different locations:
vpopmail@it-708:~> strace -e trace=stat perl -MQmail::Deliverable=dot_qmail -E 'dot_qmail shift' localpart@jira.mensa.de 2>&1 >/dev/null | fgrep .qmail
stat("/home/vpopmail/domains/mensa.de/.qmail-localpartjira-", 0x55cb85b504f0) = -1 ENOENT (No such file or directory)
stat("/home/vpopmail/domains/mensa.de/.qmail-localpartjira-default", 0x55cb85b504f0) = -1 ENOENT (No such file or directory)
stat("/home/vpopmail/domains/mensa.de/.qmail-default", 0x55cb85b504f0) = -1 ENOENT (No such file or directory)
I think that the concatenation of pre and ext in Qmail::Deliverable::qmail_user() is just the wrong way around. When I replace
$assign[5] = substr($local, $_) . $assign[5];
by
$assign[5] .= substr($local, $_);
it works correctly:
vpopmail@it-708:~> strace -e trace=stat perl -MQmail::Deliverable=dot_qmail -E 'dot_qmail shift' localpart@jira.mensa.de 2>&1 >/dev/null | fgrep .qmail
stat("/home/vpopmail/domains/mensa.de/.qmail-jira-localpart", 0x555bda6894f0) = -1 ENOENT (No such file or directory)
stat("/home/vpopmail/domains/mensa.de/.qmail-jira-default", {st_mode=S_IFREG|0600, st_size=86, ...}) = 0
Regards
Martin