[Dovecot] Different PROXY for IMAP and POP3 using LDAP-auth

Timo Sirainen tss at iki.fi
Tue Dec 15 21:35:14 EET 2009


On Sun, 2009-12-13 at 10:59 +0100, Ralf Becker wrote:

> +attr_names_r[i] = p_strdup(auth_request->pool, str_c(str));

auth_request->pool gets freed when this auth request finishes.

> +hash_insert(conn->user_attr_map,attr_names_r[i],
> +	hash_lookup(conn->user_attr_map,attr_names[i]));

Here you add it to conn->*_attr_map and it stays permanently there. So
it looks like it's leaking memory for each request, and also if there
are hash collisions it'll probably crash because there are entries that
point to freed memory.

So you probably should be doing something like first checking if there
already exists such an entry in hash, and if not then do i_strdup() for
the name before adding it to hash.

I was thinking about adding something like this to v2.0 code, but the
hash table updating is pretty ugly.. I think I'll wait adding this until
I'll do a larger rewrite of LDAP configuration.

-------------- 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/20091215/8ed2b694/attachment.bin 


More information about the dovecot mailing list