[Dovecot] New %%h variable for shared namespaces (was: New generic userdb lookup api)

Timo Sirainen tss at iki.fi
Fri Oct 31 17:12:13 EET 2008


On Tue, 2008-10-28 at 14:11 +0100, Sascha Wilde wrote:
> Sascha Wilde <wilde at intevation.de> writes:
> > Ok, as discussed I have made some changes (hopefully improvements) in
> > the new "auth-master" API for userdb requests...
> 
> And using this new I finally put a first alpha version of the missing
> %%h variable for shared name spaces together.
> 
> See http://hg.intevation.org/kolab/dovecot-1.2_kolab-branch/rev/e83efa40a1dc

The auth connection could be kept alive longer than for one lookup if
you put the auth_connection to shared_storage. That'd require creating
struct shared_storage, but it should be pretty easy (see e.g. struct
cydir_storage or maildir_storage).

There's no need to i_new() struct auth_user_reply. It could just be
allocated from stack. And I suppose memset(&reply, 0, sizeof(reply))
before using.

Use t_strdup(reply->home) and you won't leak memory (it gets freed
"later"). The current i_strdup() will leak memory.

You could check if %h is even needed before doing the lookup. Just a
while ago I added var_has_key() that makes it easy. If %h is used and
the home lookup fails, fail the namespace creation.

Use mail_storage_set_critical() rather than i_error() (and i_info()).
Although looks like I'm also using i_error() there already, I should fix
it. :)

Hmm. The auth-master.h API could use a small change too:
auth_master_init() shouldn't try to connect to auth socket yet (so it
would never fail). auth_master_user_lookup() instead would try to
connect there if the connection is missing.
-------------- 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/20081031/1b8a06f1/attachment-0001.bin 


More information about the dovecot mailing list