[Dovecot] New generic userdb lookup api

Timo Sirainen tss at iki.fi
Fri Oct 24 19:24:12 EEST 2008


On Fri, 2008-10-24 at 16:19 +0200, Sascha Wilde wrote:
> Timo Sirainen <tss at iki.fi> writes:
> > Hmm. auth-client.c is about performing authentication as a
> > client. What you're doing is about doing a userdb lookup and
> > connecting to  dovecot-auth as a master. So different file, but I'm
> > not really sure  about the name. Perhaps auth-master.c and
> > auth_master_init/deinit()  auth_master_user_lookup() function?
> 
> Ok, I used auth-master.* -- the new code is in changeset f5ce17153a3d in
> my kolab-branch at
> http://hg.intevation.org/kolab/dovecot-1.2_kolab-branch/ and I made
> deliver use it in 94b00e377a25.
> 
> I had no time for thorough testing, but in my test-setup it seems to
> work like before, so at least I didn't break it completely...  ;-)

A couple of things:

1. It disconnects after each lookup. Not good if multiple lookups are
done. Then again it probably shouldn't keep the connection alive forever
since the imap connections can run for ages and most of the necessary
lookups are probably done close to each others. Maybe timeout after 1
minute of idling?

2. conn->to is for auth request timeout. It should be removed after
io_loop_run() so if 1. is fixed it won't leak timeouts. (The same
conn->to could actually be used for the two timeouts - one value when
looking up, another value when idling.)

3. Would be nice to get rid of the getenv()s :) The MAIL_CHROOT handling
could be moved to deliver (use it if reply->chroot == NULL). The debug
could be a parameter to auth_master_init().

4. You're leaking memory. Cleanest fix would be to add pool_t pool
parameter to auth_master_user_lookup() and allocate memory only from it
(also p_array_init(&reply->extra_fields) would be cleaner to do inside
the lookup code than require it to be done externally).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20081024/89d472d2/attachment.bin 


More information about the dovecot mailing list