[Dovecot] getenv() in plugin not working
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
I'm trying to setup the dovecot DRAC plugin as described here:
<snip>
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...
Appears this is the problem - I found this for dovecot v2 and it seems to be working fine:
http://sourceforge.jp/projects/dovecot2-drac/
Might wanna make a note on the wiki page that the DRAC setup is only for dovecot 1.x?
Thanks,
Josh
On 2011-11-14 10:58 PM, Trutwin, Joshua JTRUTWIN@CSBSJU.EDU wrote:
Might wanna make a note on the wiki page that the DRAC setup is only for dovecot 1.x?
Why? You were on the wiki for v1, so obviously it is (or may be) only meant for v1.
--
Best regards,
Charles
On Tue, 2011-11-15 at 03:58 +0000, Trutwin, Joshua wrote:
Appears this is the problem - I found this for dovecot v2 and it seems to be working fine:
http://sourceforge.jp/projects/dovecot2-drac/
Might wanna make a note on the wiki page that the DRAC setup is only for dovecot 1.x?
I changed the wiki2 link to this URL.
participants (3)
-
Charles Marcus
-
Timo Sirainen
-
Trutwin, Joshua