[Dovecot] LDAP Lookup not returning value in maxStorage

Nikita Koshikov
Tue, 27 Mar 2012 06:14:25 -0000

On Tue, 27 Mar 2012 13:57:04 +1300
Bruce, Andrew wrote:

> Hi there,
>
> We're setting up a Dovecot virtual email setup - we've got
everything
> working perfect with LDAP logins authenticating against AD and so
> forth, but we're having issues with retrieving the maxStorage value
> from AD (this is a pre-setup field in AD that we'd like to use to set
> per user quotas).
>
> In our LDAP lookup, we have the maxStorage entry listed under
> user_attrs for the quota (user_attrs >
maxStorage=quota_rule=*:storage=%$M), and in the debug logs, can see
> it trying to get the entry, but it fails with:
> Mar 27 13:19:27 auth: Debug: ldap(username at site,192.168.1.5): user
> search: base=dc=site,dc=local scope=subtree
> filter=(&(objectClass=person)(| (userPrincipalName=username at site)
> (|(mail=username at site)(samAccountName=username at site))))
> fields=maxStorage
> Mar 27 13:19:27 auth: Debug: ldap(username at site,192.168.1.5): no
> fields returned by the server
>
> At this point, we then see the default quota applied.
>
Try to change your quota rule to be like:
maxStorage=quota_rule=*:bytes=%$
                        ^^^^^^^^^
And put the value in bytes to maxStorage - if I remember correct - this is
integer field and no K\M\G values is valid here.

PS We successfully using maxStorage field to obtain non-default quota from AD,
dovecot version 2.0.x
>
> If we change the name of the field from maxStorage to instanceType we
> see the value show up in the logs and passed through to the quota
> system and applied successfully:
> Mar 27 11:09:01 auth: Debug: ldap(username at site,192.168.1.5): user
> search: base=dc=site,dc=local scope=subtree
> filter=(&(objectClass=person)(| (userPrincipalName=username at site)
> (|(mail=username at site)(samAccountName=username at site))))
> fields=instanceType
> Mar 27 11:09:01 auth: Debug: ldap(username at site,192.168.1.5): result:
> instanceType(quota_rule=*:storage=%$M)=*:storage=4M
> Mar 27 11:09:01 auth: Debug: master out: USER   3901227009
> username at site    quota_rule=*:storage=4M
>
>
> Which seems a bit weird.
>
> If we use ldapsearch and pass it the same search string and look for
> the field maxStorage, we clearly see the field and the value being
> returned.  The result looks the same if we also lookup instanceType.
>
> We're using Dovecot 2.0.9.
>
> Does anyone have any idea as to why we can't use this field?
>
> Thanks,
>
> Andrew