On Mon, 2006-07-31 at 12:19 -0700, David Jonas wrote:
On Fri, 2006-07-28 at 15:56 -0700, David Jonas wrote:
Hello everyone,
I've been working with the quota plugin, attempting to use the dict backend. It seems the sql dict class is not getting loaded. I dropped a couple lines in dict_class_lookup(dict.c) and it seems the only class that gets loaded is "proxy". Any idea how to get the sql driver to load in the quota/dict module?
I added the code to load the driver in src/imap/main.c following the example from dict-client registration. Modified the Makefile, etc, got it to compile. But it seg faults when imap is run. Traced it to src/lib-dict/dict-sql.c:
/* @UNSAFE */ drivers = array_get(&sql_drivers, &count); dict_sql_classes = i_new(struct dict, count + 1);
So, the comments don't lie. It is unsafe.
Actually the @UNSAFE means pretty different thing. It's just a pointer that the code is doing there memory allocation calculations and that if you aren't careful you can cause security holes in there.
Looks like that is why the dict-server is the default with the proxy backend only. I guess I'll poke around more. Advice on how to skirt this would be appreciated.
After I just yesterday added Berkeley DB support for lib-dict, I thought maybe everyone should just use dict via the proxy. The dict server is linked against all the necessary libraries, and it's probably faster to make it go through dict server anyway. Otherwise it gets a bit difficult to figure out how the linking should work..