[Dovecot] recipient_delimiter -- feature request
Patrick Domack
patrickdk at patrickdk.com
Wed Jan 29 03:57:33 EET 2014
Quoting Patrick Domack <patrickdk at patrickdk.com>:
> To make it work the current way, is simple.
>
>
>
> I would love for it though, to lookup and see if an mailbox exists
> with the delim first, then if it doesn't lookup just the username
> part.
>
>
> Quoting Andrew Ray <andrew at freedomlives.net>:
>
>> Hi,
>>
>> It would be nice if the recipient_delimiter configuration option
>> supported multiple recipient delimiters as Postfix now does.
>> e.g. now if I set: recipient_delimiter = +- in Postfix, then
>> test-extension at sample.com and test+extension at sample.com are both
>> recognized.
>> But if I set: recipient_delimiter = +- in Dovecot, neither of the
>> above are recognized and instead test+-extension at sample.com is valid.
>>
>> Well, presently this feature isn't that important to me, but I
>> imagine it could be a source of confusion for people who are
>> migrating from say qmail to postfix (as I am doing) and notice
>> Postfix's cool ability to support both types of delimiters and
>> assume Dovecot will as well (as I did).
>>
>> Thanks,
>> Andrew Ray
>>
>> --
>>
>> Andrew Ray
>> +1 404-418-5443
>> +421 (0) 917 832 253
>> http://guns.freedomlives.net/
Well, to answer my own wishlist, this isn't by no means complete, as I
only use lmtp, so I didn't bother to patch lda, but logins already
worked good the way it was, so just needed lmtp to match with delim
first, then try again without it.
--- dovecot-2.2.10/src/lmtp/commands.c 2013-08-21 16:30:17.000000000 -0400
+++ dovecot-2.2.10/src/lmtp/commands.c 2014-01-28 20:18:12.303577376 -0500
@@ -387,7 +387,7 @@
return;
domain = strchr(address, '@');
- p = strstr(address, client->unexpanded_lda_set->recipient_delimiter);
+ p = strpbrk(address, client->unexpanded_lda_set->recipient_delimiter);
if (p != NULL && (domain == NULL || p < domain)) {
/* user+detail at domain */
*username_r = t_strdup_until(*username_r, p);
@@ -536,7 +536,7 @@
memset(&input, 0, sizeof(input));
input.module = input.service = "lmtp";
- input.username = username;
+ input.username = address;
input.local_ip = client->local_ip;
input.remote_ip = client->remote_ip;
input.local_port = client->local_port;
@@ -545,6 +545,16 @@
ret = mail_storage_service_lookup(storage_service, &input,
&rcpt.service_user, &error);
+ if (ret<=0 && strlen(detail)>0) {
+ input.username = username;
+ ret = mail_storage_service_lookup(storage_service, &input,
+ &rcpt.service_user, &error);
+ } else if(ret>0) {
+ username=t_strdup(address);
+ if(strlen(detail)>0)
+ detail = "";
+ }
+
if (ret < 0) {
prefix = t_strdup_printf(ERRSTR_TEMP_USERDB_FAIL_PREFIX,
username);
More information about the dovecot
mailing list