Password database extra fields and SQL

Dave dovecot-e51 at
Fri Apr 29 13:49:47 UTC 2016

Hi everyone,

	first post to the list, be gentle with me!

	Perhaps I'm missing something here, but it appears to me that many 
password database extra fields currently aren't much use inside SQL queries?

All boolean fields like nologin/nodelay/nopassword are set if the column 
is present in the returned query, regardless of value (including NULL)

For example, say you have a query like:

password_query = SELECT hash AS password, NULLIF(active = 1, 'y') AS 
nologin FROM users WHERE name = '%u'

Then nologin will always be set for this account, there's no realistic 
way to toggle the flag.

Has anyone come across any workarounds for this problem that don't 
sacrifice efficiency by performing multiple lookups?

I was considering what would happen if dovecot treated NULL fields as 
not present, but that immediately conflicts with advice to set password 
to NULL to satisfy the field requirement on nopassword. Any thoughts?


More information about the dovecot mailing list