If using LDAP as a userdb with a "quota_rule" configured, the order of the LDAP entry can distort userdb results, depending on where the quota attribute is found.
For instance, with this "dovecot-ldap.conf" snippet:
user_attrs = homeDirectory=home,uidNumber=uid,gidNumber=gid,quotaKb=quota_rule=*:storage=%$
And this example LDAP entry:
dn: uid=testuser,ou=people,dc=domain.com uid: testuser homeDirectory: /mail/testuser gidNumber: 100 cn: testuser quotaKb: 20480 uidNumber: 121212
When db_ldap_result_iterate_next_all() runs, "quotaKb" is encountered, which causes "ctx->template" to be set.
On the next iteration, "uidNumber" is encountered, but "ctx->template" is still set, causing the "uid" value to be prepended with "*:storage=".
This is reflected by an error in the log as:
Invalid UID value '*:storage=121212'
This can be fixed by adding a line after 1118 to src/auth/db-ldap.c:
ctx->template = NULL;
Hope this is helpful to someone, -Rich