subscriber@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.
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@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@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@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.