Am 04.02.2016 um 20:54 schrieb Timo Sirainen:
> On 04 Feb 2016, at 19:41, Thomas Möhle <[email protected]> wrote:
>>
>> Am 04.02.2016 um 17:43 schrieb Timo Sirainen:
>>> On 04 Feb 2016, at 03:44, Thomas Möhle <[email protected]> wrote:
>>>>
>>>> Hello,
>>>>
>>>> I would like to use the users password within a mail-filter script.
>>>> Dovecots %w variable is only available within dovecot-auth, is there any
>>>> way to access the password for a mail-filter?
>>>
>>> Something like this should work in recent versions:
>>>
>>> passdb {
>>> ..
>>> override_fields = userdb_pass=%w
>>> }
>>>
>>> plugin {
>>> mail_filter = mail-filter %{userdb:pass}
>>> }
>>>
>>
>> Thanks for that idea, unfortunately %{ seems to be misinterpreted and
>> the mail-filter script recieves the rest of the string "userdb:pass}" as
>> a parameter, instead of the password.
>
> Do you have v2.2.19 or newer? That's required for %{userdb:*} to work.
> Without that you'd need to override the whole mail_filter in your
> passdb/userdb.
I had v2.2.18 (Ubuntu 15.10) installed, so I updated to v2.2.21 now.
>> So, do I get this right? During login the content of dovecots %w
>> variable is supposed to be stored in a userdb field, called userdb_pass,
>> and the %{x} is supposed to get the content of that field?
>
> Mostly, yes. You need the "pass" field to be in userdb to access it in mail
> processes. The password is only available in passdb though, so you need to
> store it with userdb_ prefix to get it saved into userdb extra fields instead
> of passdb extra fields.
>
Unfortunately it still doesn't work. The filter-script does not recieve
any data from that variable.
I tried replacing the %w with %u, to see, if the filter-script would at
least recieve the username then, but that doesn't work, either. So I'm
not sure, if %{userdb:pass} isn't read correctly, or if "override_fields
= userdb_pass=%w" doesn't set it right.