[Dovecot] getenv() in plugin not working

Trutwin, Joshua JTRUTWIN at CSBSJU.EDU
Tue Nov 15 05:34:55 EET 2011


Hi - new to the list, can't find much on this using google.

I'm trying to setup the dovecot DRAC plugin as described here:

http://wiki.dovecot.org/HowTo/PopBSMTPAndDovecot#DRAC

DRAC is installed and running using this startup command:

/usr/local/sbin/rpc.dracd -i -e 5 /etc/postfix/dracd.db

I downloaded the drac.c file linked on the above URL: http://www.dovecot.org/patches/1.1/drac.c and built it using this command:

gcc -Wall -W -shared -fPIC -DHAVE_CONFIG_H drac.c -I/usr/include/dovecot -L/usr/lib64/dovecot -o drac.so -ldrac

Then I copied drac.so to /usr/lib64/dovecot (this is an x86_64 SL 6.1 system - dovecot 2.0.9) and modified my /etc/dovecot/conf.d/20-imap.conf file:

  mail_plugin_dir = /usr/lib64/dovecot
  mail_plugins = drac

Restart dovecot and try to login and getting these messages for ANY login attempts:

dovecot: imap-login: Login: user=<snip>, method=PLAIN, rip=<snip>, lip=<snip>, mpid=4018, TLS
server dovecot: imap(<snip>: Error: DRAC: IP environment not given

I traced the "IP environment not given" to the drac.c plugin file, and the code is pretty simple:

void drac_init(void)
{
        const char *ip_str;
        struct ip_addr ip;

        ip_str = getenv("IP");

        if (ip_str == NULL)
                i_error("DRAC: IP environment not given");


Is there anything special that needs to be done for getenv("IP") to report the login IP?  I tried to put getenv("RIP") for remote ip and even getenv("USER") as well but always get NULL.  Is this API only for dovecot 1.x?  If so is there a 2.0 equivalent?  The rest of the plugin is very basic...

I think this is the last step in getting this setup running.  I'd have to have this one last piece force me to run that icky perl program instead.

Thank you,

Let me know if anything else is needed.

Josh




More information about the dovecot mailing list