I'll test very interesting plugin xexec. It seems very nice and can be used in many things. It's compiled perfect with dovecot 1.0, but certanly not with dovecot 1.1. It's stopped with next error: In file included from cmd-xexec.c:30: xexec.h:8: error: expected specifier-qualifier-list before 'array_t' cmd-xexec.c: In function 'cmd_xexec': cmd-xexec.c:134: error: 'array_t' undeclared (first use in this function) cmd-xexec.c:134: error: (Each undeclared identifier is reported only once cmd-xexec.c:134: error: for each function it appears in.) cmd-xexec.c:134: error: expected ';' before 'union' I found, that in dovecot 1.1 has been changed some of functions of array init and so on. I'm not programmer :(, just a system admin., but first of all have to check it and trying to resolve by myself. According examples in ../../lib/array.h I removed array_t and this code is seems ok: xexec.h struct xexec { ARRAY_DEFINE(setups, struct xexec_setups *); }; and also here: cmd-xexec.c ARRAY_DEFINE(command, char *); After, errors cames with cmd-xexec.c: In function 'cmd_xexec': cmd-xexec.c:144: warning: passing argument 4 of 'client_read_args' from incompatible pointer type cmd-xexec.c:159: warning: assignment from incompatible pointer type cmd-xexec.c:180: warning: implicit declaration of function 'ARRAY_CREATE' cmd-xexec.c:180: error: expected expression before 'char' As I understand, it is because of (from changelog) Replaced ARRAY_CREATE() macro with [ipt]_array_init() macros. The macro has no side effects so it might as well be lowercased. I have look at the array.h, but can't find appropriate function in list of array_create,i_array_init,p_array_init,t_array_init. Should I just forget about it, until someone adapts code for dovecot 1.1, or maybe it no so complex, as looks? Thank you.
subscriber at viliar.net.ru schreef:> I'll test very interesting plugin xexec. It seems very nice and can be > used in many things. It's compiled perfect with dovecot 1.0, but certanly > not with dovecot 1.1. It's stopped with next error: >I did not write that module, but tonight I got a bit bored, so I gave it a quick try to port it to Dovecot 1.1. The attached patch provides a compile fix to make it compile without warnings for dovecot-1.1. I only tested whether the module is successfully loaded by Dovecot and not whether XEXEC still does what it is supposed to. It does not segfault on the xexec command, but that is all I tested. I got a backend command error and now it is bed time for me, but there is a good chance that this works if you bother to read the wiki page properly ;) So, consider this to be more like an 'It compiles! Ship it!' kind of fix. But, anyways, it should help you to get where you want. Just apply inside the xexec directory using the usual patch -p1. Let me know what you find out. Regards, Stephan. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: dovecot-xexec-1.1.patch URL: <http://dovecot.org/pipermail/dovecot/attachments/20080319/0869dcc0/attachment-0002.pl>
subscriber at viliar.net.ru schreef:> I'll test very interesting plugin xexec. It seems very nice and can beused in many things. It's compiled perfect with dovecot 1.0, but certanly> not with dovecot 1.1. It's stopped with next error: >I did not write that module, but tonight I got a bit bored, so I gave it a quick try to port it to Dovecot 1.1. The attached patch provides a compile fix to make it compile without warnings for dovecot-1.1. I only tested whether the module is successfully loaded by Dovecot and not whether XEXEC still does what it is supposed to. It does not segfault on the xexec command, but that is all I tested. I got a backend command error and now it is bed time for me, but there is a good chance that this works if you bother to read the wiki page properly ;) So, consider this to be more like an 'It compiles! Ship it!' kind of fix. But, anyways, it should help you to get where you want. Just apply inside the xexec directory using the usual patch -p1. Let me know what you find out. Regards, Stephan. Thank you, Stephan, for your help. Patch applies without any problem and compilation was successful. According maillog, Dovecot load it without problems too: Mar 19 09:06:37 mx3 dovecot: IMAP(alx at skymail.alx.in): Module loaded: /usr/lib/dovecot/imap/lib10_xexec_plugin.so I have activate it in config as for dovecot 1.0. But "sub commands" does not started: [root at mx3 rpms]# telnet 127.0.0.1 143 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. * OK Dovecot ready. 001 login alx at xxx xxxxxxx 001 OK Logged in. 002 noop 003 OK NOOP completed. 003 noop 003 OK NOOP completed. 004 xexec user 004 NO command failed same command exucuted ok with dovecot 1.0. from config: plugin { xexec2 = user:/usr/local/bin/user %u } According strace -vfF -p there is segfault :-( read(0, "004 xexec user\r\n", 4044) = 16 pipe([6, 7]) = 0 pipe([8, 9]) = 0 pipe([10, 11]) = 0 clone(Process 4093 attached child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7f17708) = 4093 [pid 4061] close(6) = 0 [pid 4061] close(9) = 0 [pid 4061] close(11) = 0 [pid 4061] _llseek(7, 0, 0xbfb8ca40, SEEK_CUR) = -1 ESPIPE (Illegal seek) [pid 4061] getsockname(7, 0xbfb8ca34, [28]) = -1 ENOTSOCK (Socket operation on non-socket) [pid 4061] fstat64(8, {st_dev=makedev(0, 5), st_ino=5022779, st_mode=S_IFIFO|0600, st_nlink=1, st_uid=2004, st_gid=12, st_blksize=4096, st_blocks=0, st_size=0, st_atime=2008/03/19-09:08:00, st_mtime=2008/03/19-09:08:00, st_ctime=2008/03/19-09:08:00}) = 0 [pid 4061] fstat64(10, {st_dev=makedev(0, 5), st_ino=5022780, st_mode=S_IFIFO|0600, st_nlink=1, st_uid=2004, st_gid=12, st_blksize=4096, st_blocks=0, st_size=0, st_atime=2008/03/19-09:08:00, st_mtime=2008/03/19-09:08:00, st_ctime=2008/03/19-09:08:00}) = 0 [pid 4061] gettimeofday({1205932080, 941409}, {4294967116, 0}) = 0 [pid 4061] select(11, [8 10], [], [8 10], {2147483, 0} <unfinished ...> [pid 4093] close(0) = 0 [pid 4093] close(1) = 0 [pid 4093] close(2) = 0 [pid 4093] close(7) = 0 [pid 4093] close(8) = 0 [pid 4093] close(10) = 0 [pid 4093] dup2(6, 0) = 0 [pid 4093] close(6) = 0 [pid 4093] dup2(9, 1) = 1 [pid 4093] close(9) = 0 [pid 4093] dup2(11, 2) = 2 [pid 4093] close(11) = 0 [pid 4093] --- SIGSEGV (Segmentation fault) @ 0 (0) --- Process 4093 detached <... select resumed> ) = 2 (in [8 10], left {2147482, 996000}) --- SIGCHLD (Child exited) @ 0 (0) --- gettimeofday({1205932080, 943134}, {4294967116, 0}) = 0 read(10, "", 1024) = 0 read(8, "", 1024) = 0 close(7) = 0 close(8) = 0 close(10) = 0 waitpid(4093, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGSEGV}], 0) = 4093 gettimeofday({1205932080, 943814}, NULL) = 0 setsockopt(1, SOL_TCP, TCP_CORK, [1], 4) = 0 write(1, "004 NO command failed\r\n", 23) = 23 setsockopt(1, SOL_TCP, TCP_CORK, [0], 4) = 0 I will try to use gdb to attach proccess and found something.
Stephan Bosch wrote:> subscriber at viliar.net.ru schreef: >> subscriber at viliar.net.ru schreef: >> Thank you, Stephan, for your help. Patch applies without any problem and >> compilation was successful. According maillog, Dovecot load it without >> problems too: >> >> Mar 19 09:06:37 mx3 dovecot: IMAP(alx at skymail.alx.in): Module loaded: >> /usr/lib/dovecot/imap/lib10_xexec_plugin.so >> I have activate it in config as for dovecot 1.0. But "sub commands" does >> not started: >> >> ... >> >> [pid 4093] --- SIGSEGV (Segmentation fault) @ 0 (0) --- >> Process 4093 detached >> <... select resumed> ) = 2 (in [8 10], left {2147482, >> 996000}) >> --- SIGCHLD (Child exited) @ 0 (0) -- > Found it, apparently dovecot-1.1 does not like a NULL parameter to the > array_get function anymore: > > - execvp(*(char **)array_idx(&command, 0), array_get(&command, > NULL)); > + execvp(*(char **)array_idx(&command, 0), array_idx(&command, > 0)); > > With this additional change, the attached full patch manages to update > the XEXEC plugin to dovecot-1.1. This was tested with the 'average' > example and that worked flawlessly. > > Regards, > > Stephan > >Thank you again, Stephan. Now all works perfectly :-) Probably at http://wiki.dovecot.org/Plugins/xexec it is good to have link on patch/new version of module, created by you. Or attach to page file. I can do it, if it's ok. What you think?
Patch and prepatched version of xexec module to dovecot v1.1 now available from http://wiki.dovecot.org/Plugins/xexec. Thanks for patch to Stephan Bosch.
Charles Marcus wrote:> On 3/27/2008, Marc Perkel (marc at perkel.com) wrote: >> After dovecot receives he outgoing message it will just do an SMTP >> connection to a server that is set up to receive it and relay it. > > The question I have is how would you configure the Client to do this? > I guess just point it to the same server address as the incoming server?Clients would have to be rewritten to support the new IMAP extensions. If the IMAP server supported outgoing email then the client would know it through CAPABILITIES. It would then not need to have any outgoing email settings. It would cut client configuration in half.