[Exim] Re: Released: SpamAssassin at SMTP time in local_scan

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Derrick 'dman' Hudson
Date:  
À: exim-users
Sujet: [Exim] Re: Released: SpamAssassin at SMTP time in local_scan
--
On Tue, Jun 11, 2002 at 02:40:13PM +0100, David Woodhouse wrote:
|
| dsh8290@??? said:
| > Dynamic loading of local_scan. This would allow the various
| > local_scans to be packaged separately from exim itself and
| > configurable at runtime. I don't know how hard this is in C.

|
| Fairly trivial -- see below. I think it's even vaguely portable.


Cool, thanks!

| > In fact, this would be nice for the various lookups and mailstore
| > formats too. Packages could provide a base exim with the rest as
| > separate add-on modules loadable at runtime.

|
| Left as an exercise for the reader.


:-).

[patch snipped]

The patch applied cleanly and compiled out-of-the-box. I've made 2
changes so far :

1)  treat a path of "" the same as undefined
        (line 23 of local_scan.c)
        if (local_scan_path && *local_scan_path)


2) give the actual error message if loading the .so fails :

    if (!load_local_scan_library())
      {
        char *base_msg , *error_msg , *final_msg ;
        int final_length = -1 ;


        base_msg=US"Local configuration error - local_scan() library failure\n";
        error_msg = dlerror() ;


        final_length = strlen(base_msg) + strlen(error_msg) + 1 ;
        final_msg = (char*)malloc( final_length*sizeof(char) ) ;
        *final_msg = '\0' ;


        strcat( final_msg , base_msg ) ;
        strcat( final_msg , error_msg ) ;


        *return_text = final_msg ;
         return LOCAL_SCAN_TEMPREJECT;
      }


I added this because as I was testing, it was failing and I didn't
know why :-).

I'm not sure I've done this right. Is it ok to malloc() here? Will
that cause a memory leak, or will exim terminate soon enough for the
heap to automatically go away (or does exim take care of free()ing it
later?)? Also, is there a better way to put two strings together in
C? It would be much easier in the languages I usually use. (also,
what's that 'US' thing next to the string literal?)

I'm trying to load Marc's sa-exim as a .so now, but I always get this
error :
    /tmp/sa-exim-2.0b1.so: undefined symbol: log_write


In a wild attempt to correct this, I added this immediately preceding
the attempt to open sa-exim :

    void (*exim)(int argc , char** argv) = NULL;
    exim = dlopen( NULL , RTLD_NOW | RTLD_GLOBAL ) ;


but that didn't change anything.

What must be done in order for the .so to have access to the symbols
in exim?

TIA,
-D

--

If any of you lacks wisdom, he should ask God, who gives generously to
all without finding fault, and it will be given to him.  But when he
asks he must believe and not doubt, because he who doubts is like a wave
of the sea, blown and tossed by the wind.
        James 1:5-6


Jabber ID : dman@???
GnuPG key : http://dman.ddts.net/~dman/public_key.gpg
--
[ Content of type application/pgp-signature deleted ]
--