Re: [Exim] Re: request for version 4.10 (local_scan)

Pàgina inicial
Delete this message
Reply to this message
Autor: Peter Benie
Data:  
A: exim-users
Assumptes nous: Re: [Exim] Re: request for version 4.10 (local_scan)
Assumpte: Re: [Exim] Re: request for version 4.10 (local_scan)
Derrick 'dman' Hudson writes ("[Exim] Re: request for version 4.10 (local_scan)"):
> | I'm still not at all sure that I should actually be touching the dlopen
> | stuff at all.
>
> What I would find ideal is if you included a basic dlopen
> implementation (such as that patch has) in the standard release. Then
> the prepackaged versions (.deb, .rpm, whatever else) would have the
> dynamic loading functionality already built-in and each user wouldn't
> need to patch and build their own version. It would make your exim
> release self-contained and extensible from the outside.


I second this. I want the ability to switch from rolling my own rpms to
using a vendor rpm. To do this, we all have to be using the same
interface to the loaded library.

> | Once you can add options to the runtime configuration for
> | local_scan(), you can then write a local_scan() that does all the
> | dlopen stuff itself - and can handle multiple functions, etc., etc.
>
> As you can see, though, I (well, David really) have already written
> the local_scan that does all the dlopen stuff. All that remains is
> copying it to your source tree :-).


Please don't copy this patch in its current form. It has a few weaknesses:

1) It casts pointer to object into pointer to function
This means that it can't be implemented on architectures where
these types have different widths. (Very many programs that use
dlsym make this error.) Instead, dlsym should be used to retrieve a
method table containing the functions exported by the library.

2) It's overly restrictive about the way it handles the ABI version.
local_scan_version_fn should be given a minimum and maxiumum version
supported by the caller so it pick a version with which it is happy.

3) It doesn't check the return value of malloc.

4) I think that it leaks memory, but exim's documentation of
local_scan isn't very clear about who owns the memory in *return_text.
Using store_get avoids the issue.

5) If the symbol, local_scan, is exists but is NULL, dlerror gets
called anyway. (This is unlikely to cause problems in practice.)

6) dlerror should be called when dlopen fails.

My wishlist for local_scan:

I'd like to see dlopened libraries called by name from the ACLs
(for HELO, MAIL and RCPT as well as DATA) rather than just having one
hook.

I'd like an ACL for handling message reception from the command line.

I'd like the ability to accept and freeze a message on reception.

Peter