Dynamically Loaded Lookups

Problem Space

We currently have a problem packaging Exim because you have to decide at compile time which lookups you wish to support. This leads to either a binary with a lot of library dependancies, or forcing a subset of lookups on the end users.

Dynamically loading the lookups you need may help with this problem.

Proposal

Have a directory of lookup dynamically loaded modules, with a main config option pointing to them:-

lookup_module_directory = /usr/lib/exim/lookups

When you hit a lookup phrase:-

${lookup whoson {$sender_host_address}{yes}{no}}

then you look through the list of currently known (loaded) lookups. If this lookup is not in the list then you dynamically load the module lookup_whoson.so, fix it up, and add it to the end of the lookup_list[] - it can now be used as per ususal.

We would need a method to pick up any additional data (think LDAP servers, MySql server/db/user/pass) for the lookup which would need to be done in a way that does not require exim to have foreknowledge of the lookup type.

Alternative

Have a set of initial directives of the form:-

lookup_function mysql = lookup_mysql.so args....

and then when mysql is seen it causes a load of the module. The args are then passed to the module init function (allowing module specific data such as db/user/server/pass to be specified.

This would also allow another lookup type to be defined

lookup_function othermysql = lookup_mysql.so args....

which would then allow multiple different mysql databases to be used, if that was appropriate.

Issues

We may wish to restrict what filters and user specified things can do - for example they do not need to see into any system authentication database!

Contributors

This came out of an IRC discussion between myself and David Woodhouse. Its a roughing out of the issues to get something down in semi-permanent form. Further refining or comments would be appreciated...

Comments

Some references:

EximWiki: NigelMetheringham/DynamicallyLoadedLookups (last edited 2008-09-25 11:39:31 by localhost)