Lua issues

From: Iosif Fettich <>
Date: Tue, 25 Aug 2015 19:21:14 +0300 (EEST)


I've tried to test a needed lua script on an up-to-date Fedora 21 box, by
downloading the source rpm and tinkering with it.

The script I'd want to get working looks like

if odkim.internal_ip(ctx) == 0 then
     author = odkim.get_mtasymbol(ctx, "{auth_author}")
     if author == nil then
         -- domains_to_sign_for = odkim.db_open( "file:/etc/opendkim/MyDomains" );
         domains_to_sign_for = odkim.get_dbhandle(ctx, DB_DOMAINS);
         from    = odkim.get_fromdomain(ctx)
         odkim.log(ctx, "From:" .. from )
         if domains_to_sign_for == nil then
             odkim.log(ctx, "LUA error... NO DOMAINS defined?")
             return nil
             if odkim.db_check(domains_to_sign_for, from) == 1 then
                 odkim.set_result(ctx, SMFIS_REJECT)
                 host = odkim.get_clienthost(ctx)
                 odkim.log(ctx, "Message rejected. External host " .. host ..  " attempted to send as " .. from .. "." )
                 return nil
         -- odkim.db_close( domains_to_sign_for );
--  That's it!
return nil
and there are [at least] two issues I'm having with it.
a) as presented, opendkim exits with segmentation fault at launchtime when 
/etc/opendkim.conf says
#SetupPolicyScript /etc/opendkim/setup_dont_spoof_localusers.lua
ScreenPolicyScript /etc/opendkim/setup_dont_spoof_localusers.lua
but starts OK if the conf file says
SetupPolicyScript /etc/opendkim/setup_dont_spoof_localusers.lua
#ScreenPolicyScript /etc/opendkim/setup_dont_spoof_localusers.lua
Why would that be...?!
b) even when starting OK, as SetupPolicyScript, the script will report 
"LUA error... NO DOMAINS defined?" in the logfile, as long as I'm trying 
to use
   domains_to_sign_for = odkim.get_dbhandle(ctx, DB_DOMAINS);
However, if I out-comment this line and do use instead the (above 
out-commented) db_open/db_close pair, things work OK, messages are 
rejected as wanted.
Why wouldn't
odkim.get_dbhandle(ctx, DB_DOMAINS)
not work...?
My build opendkim displays
$ opendkim -V
opendkim: OpenDKIM Filter v2.10.3
         Compiled with OpenSSL 1.0.1k-fips 8 Jan 2015
         SMFI_VERSION 0x1000001
         libmilter version 1.0.1
         Supported signing algorithms:
         Supported canonicalization algorithms:
         Active code options:
         libopendkim 2.10.3:
and the source package was installed via
# yum install opendkim-2.10.3-1.fc21.src.rpm
followed by make, make install etc.
Many thanks in advance for any clou.
Iosif Fettich
Received on Tue Aug 25 2015 - 16:21:30 PST

This archive was generated by hypermail 2.3.0 : Tue Aug 25 2015 - 16:27:00 PST