[Dovecot] Dovecot waking every 50ms when doing nothing

2007-06-03 Thread Ross Burton
Hi,

My laptop runs a local IMAP server so that I'm immune from breaking my
mail client, and when playing around with powertop I discovered that
Dovecot (in particular imap-login) wakes up every 1000ms and then every
50ms even when no clients are connected.  A bit of stracing shows this:

gettimeofday({1180875699, 667917}, NULL) = 0 0.10
poll([{fd=7, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=10, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=3, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=1, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}], 5, 999) = 0 0.999595
gettimeofday({1180875700, 667627}, {4294967236, 0}) = 0 0.07
gettimeofday({1180875700, 667670}, NULL) = 0 0.07
poll([{fd=7, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=10, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=3, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=1, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}], 5, 0) = 0 0.06
gettimeofday({1180875700, 667762}, {4294967236, 0}) = 0 0.07
gettimeofday({1180875700, 667801}, NULL) = 0 0.06
poll([{fd=7, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=10, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=3, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=1, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}], 5, 999) = 0 0.999699
gettimeofday({1180875701, 667638}, {4294967236, 0}) = 0 0.10

Is there any reason why dovecot wakes up so frequently even when there
is apparently nothing to do?  If it is to perform some routine task, can
this timeout be extended?  There are many daemons on my machine
(lighttpd is another) that are waking up every second when nothing is
happening, and each of these is contributing to waking the CPU from
sleep.

Cheers,
Ross
-- 
Ross Burton mail: [EMAIL PROTECTED]
  jabber: [EMAIL PROTECTED]
 www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF





Re: [Dovecot] Dovecot waking every 50ms when doing nothing

2007-06-03 Thread Timo Sirainen
On Sun, 2007-06-03 at 14:06 +0100, Ross Burton wrote:
 Hi,
 
 My laptop runs a local IMAP server so that I'm immune from breaking my
 mail client, and when playing around with powertop I discovered that
 Dovecot (in particular imap-login) wakes up every 1000ms and then every
 50ms even when no clients are connected.  A bit of stracing shows this:

I did once try to reduce these unnecessary wakeups, but then I thought
it's probably not worth the trouble. No-one's going to run an IMAP
server in their laptop.. :)

This fixes it for imap/pop3-login:
http://hg.dovecot.org/dovecot/rev/0021765627f3

Fixing dovecot-auth and dovecot processes is a bit more difficult.
Patches welcome. :)



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Dovecot waking every 50ms when doing nothing

2007-06-03 Thread Timo Sirainen
On Sun, 2007-06-03 at 18:05 +0300, Timo Sirainen wrote:
  My laptop runs a local IMAP server so that I'm immune from breaking my
  mail client, and when playing around with powertop I discovered that
  Dovecot (in particular imap-login) wakes up every 1000ms and then every
  50ms even when no clients are connected.  A bit of stracing shows this:
 
 I did once try to reduce these unnecessary wakeups, but then I thought
 it's probably not worth the trouble. No-one's going to run an IMAP
 server in their laptop.. :)
 
 This fixes it for imap/pop3-login:
 http://hg.dovecot.org/dovecot/rev/0021765627f3
 
 Fixing dovecot-auth and dovecot processes is a bit more difficult.
 Patches welcome. :)

Maybe the optimal solution would be to create a new abstraction layer.
Most of the timeout handlers are just checking for idle timeouts.

struct idle_timeout *idle_timeout_new(unsigned int secs,
timeout_callback_t *callback, void *context);
void idle_timeout_free(struct idle_timeout *idle);
void idle_timeout_reset(struct idle_timeout *idle);

The code would internally keep just one timeout handler and whenever
it's called, calculate the new time when it should be called.


signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Dovecot waking every 50ms when doing nothing

2007-06-03 Thread Timo Sirainen
On Sun, 2007-06-03 at 18:13 +0300, Timo Sirainen wrote:
 Maybe the optimal solution would be to create a new abstraction layer.
 Most of the timeout handlers are just checking for idle timeouts.
 
 struct idle_timeout *idle_timeout_new(unsigned int secs,
 timeout_callback_t *callback, void *context);
 void idle_timeout_free(struct idle_timeout *idle);
 void idle_timeout_reset(struct idle_timeout *idle);
 
 The code would internally keep just one timeout handler and whenever
 it's called, calculate the new time when it should be called.

..Or maybe just fix the basic timeout_*() API. Add a new timeout_reset()
call == timeout_remove() + timeout_add(original values) and then make
the implementation be fast with hundreds of timeouts. The timeouts are
currently kept in linked list, so that could be changed to red-black
tree I guess (sorted by next execution time). Or is there a better data
structure for this?



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Dovecot waking every 50ms when doing nothing

2007-06-03 Thread Timo Sirainen
On Sun, 2007-06-03 at 18:27 +0300, Timo Sirainen wrote:
 ..Or maybe just fix the basic timeout_*() API. Add a new timeout_reset()
 call == timeout_remove() + timeout_add(original values) and then make
 the implementation be fast with hundreds of timeouts. The timeouts are
 currently kept in linked list, so that could be changed to red-black
 tree I guess (sorted by next execution time). Or is there a better data
 structure for this?

Continuing my monolog.. :)

There are only a few different idle timout values, so maybe the
idle_timeout_*() API is a good idea anyway. It allows the implementation
to be really fast and simple:

struct idle_timeout {
  struct idle_timeout *prev, *next;
  time_t next_run;
  void *context;
};

So a doubly linked list for each different timeout value. Adding a new
timeout or reseting existing one moves the struct to last in the list.
When timeout handler runs, it needs to check only the first ones in the
list and move them to last.



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Dovecot waking every 50ms when doing nothing

2007-06-03 Thread Richard Laager
On Sun, 2007-06-03 at 18:48 +0300, Timo Sirainen wrote:
 I've used GLib before. The biggest problem I see with it is that it
 doesn't support memory pools. That's why I duplicated most of its useful
 functionality originally instead of just using it directly. So I think
 it's much better to fix Dovecot's main loop code to work better instead
 of adding a dependency to GLib and using only a tiny part of it.

Are they against adding memory pools?

Richard


signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Dovecot waking every 50ms when doing nothing

2007-06-03 Thread Dave McGuire

On Jun 3, 2007, at 11:29 AM, Ross Burton wrote:

I presume porting Dovecot to use the glib main loop abstraction (which
is nice and lean, the object system is a separate library) is out  
of the

question?


  Please don't.  One reason Dovecot is so easy to get up and running  
quickly is that it has minimal dependencies.  For those of us who  
aren't running Linux on PCs that can become a headache very quickly,  
as the authors of many of the depended-upon libraries often get  
creative with nonportable GCCisms and other such nonsense.  And  
even when one *is* running Linux on a PC, sometimes we don't want to  
build fifteen packages in order to build one.


  That's not to say that simply adding one dependency on glib would  
cause a huge problem...but it indicates the adoption of a mindset,  
and it's a slippery slope.


 -Dave

--
Dave McGuire
Port Charlotte, FL




Re: [Dovecot] Dovecot waking every 50ms when doing nothing

2007-06-03 Thread Ross Burton
On Sun, 2007-06-03 at 11:54 -0500, Richard Laager wrote:
 On Sun, 2007-06-03 at 18:48 +0300, Timo Sirainen wrote:
  I've used GLib before. The biggest problem I see with it is that it
  doesn't support memory pools. That's why I duplicated most of its useful
  functionality originally instead of just using it directly. So I think
  it's much better to fix Dovecot's main loop code to work better instead
  of adding a dependency to GLib and using only a tiny part of it.
 
 Are they against adding memory pools?

By pool do you mean memory regions which can be split into children, and
freeing the parent region also frees the children?  That isn't in Glib.
It does have a slice allocator for rapid allocation of blocks though.

Ross
-- 
Ross Burton mail: [EMAIL PROTECTED]
  jabber: [EMAIL PROTECTED]
 www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF





[Dovecot] Dovecot Authentication Problem - Help pls!

2007-06-03 Thread Odhiambo WASHINGTON

Hello List,


This is dovecot 1.0.0 on FreeBSD 4.11-STABLE. I did not provide this 
information before:-)


I am back again and I think I am edging closer to getting a solution.
I have done some modifications and now dovecot gives me a different
error message than before

Here is what I have for the password_query and user_query 


password_query = SELECT popbox.cleartext AS password FROM popbox, domain \
WHERE popbox.local_part = 'eddie' AND popbox.domain_name = 'demo.wananchi.com' \
AND popbox.domain_name = domain.domain_name;
+--+
| password |
+--+
| boeing8  |
+--+

user_query = SELECT CONCAT(domain.path, '/', popbox.mbox_name) as home, \
69 as uid, 6 as gid  FROM popbox, domain WHERE popbox.local_part = 'eddie' \
AND  popbox.domain_name = 'demo.wananchi.com' AND \
popbox.domain_name = domain.domain_name;
++-+-+
| home   | uid | gid |
++-+-+
| /var/spool/virtual/demo.wananchi.com/eddie |  69 |   6 |
++-+-+

When I test to connect to the pop3 daemon, this is what happens now:

[EMAIL PROTECTED] 0 7173
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
+OK Welcome. Dovecot is Ready to serve your emails.
user [EMAIL PROTECTED]
+OK
pass boeing8
-ERR [IN-USE] Internal login failure. Refer to server log for more information.
Connection closed by foreign host.


...and this is what dovecot writes to the log:
[EMAIL PROTECTED] /var/log/dovecot.log
dovecot: May 30 12:00:04 Info: auth(default): client in: AUTH   1   PLAIN   
service=POP3secured lip=62.8.64.4   rip=62.8.64.4   
resp=AGVkZGllQGRlbW8ud2FuYW5jaGkuY29tAGJvZWluZzg=
dovecot: May 30 12:00:04 Info: auth-worker(default): mysql: Connected to 
localhost (virtualemail)
dovecot: May 30 12:00:04 Info: auth-worker(default): sql([EMAIL 
PROTECTED],62.8.64.4): query: SELECT popbox.cleartext AS password FROM popbox, 
domain WHERE popbox.local_part = 'eddie' AND popbox.domain_name = 
'demo.wananchi.com' AND popbox.domain_name = domain.domain_name
dovecot: May 30 12:00:04 Info: auth(default): client out: OK1   [EMAIL 
PROTECTED]
dovecot: May 30 12:00:04 Info: auth(default): master in: REQUEST2   
36772   1
dovecot: May 30 12:00:04 Info: auth-worker(default): sql([EMAIL 
PROTECTED],62.8.64.4): SELECT CONCAT(domain.path, '/', popbox.mbox_name) as 
home, 69 as uid, 6 as gid  FROM popbox, domain WHERE popbox.local_part = 
'eddie' AND popbox.domain_name = 'demo.wananchi.com' AND popbox.domain_name = 
domain.domain_name
dovecot: May 30 12:00:05 Error: child 39853 (auth-worker) killed with signal 11
dovecot: May 30 12:00:05 Info: auth(default): master out: FAIL  2
dovecot: May 30 12:00:05 Info: pop3-login: Internal login failure: user=[EMAIL 
PROTECTED], method=PLAIN, rip=62.8.64.4, lip=62.8.64.4, secured


User's mail is stored in /var/spool/virtual/$domain/$user/{new,cur,tmp}
The path /var/spool/virtual/ is owned by uid:gid 69:6, and is writeable
by that uid.


dovecot -n:

# /usr/local/etc/dovecot.conf
base_dir: /var/run/dovecot/
log_path: /var/log/dovecot.log
protocols: imap pop3
listen(default): *:7143
listen(imap): *:7143
listen(pop3): *:7110
ssl_disable: yes
disable_plaintext_auth: no
shutdown_clients: no
login_dir: /var/run/dovecot/login
login_executable(default): /usr/local/libexec/dovecot/imap-login
login_executable(imap): /usr/local/libexec/dovecot/imap-login
login_executable(pop3): /usr/local/libexec/dovecot/pop3-login
login_user: exim
login_greeting: Welcome. Dovecot is Ready to serve your emails.
login_process_size: 64
login_max_processes_count: 200
verbose_proctitle: yes
first_valid_uid: 69
first_valid_gid: 0
mail_extra_groups: dovecot:mail
mail_location: maildir:/var/spool/virtual/%d/%n
mail_executable(default): /usr/local/libexec/dovecot/imap
mail_executable(imap): /usr/local/libexec/dovecot/imap
mail_executable(pop3): /usr/local/libexec/dovecot/pop3
mail_plugin_dir(default): /usr/local/lib/dovecot/imap
mail_plugin_dir(imap): /usr/local/lib/dovecot/imap
mail_plugin_dir(pop3): /usr/local/lib/dovecot/pop3
imap_client_workarounds(default): delay-newmail outlook-idle netscape-eoh 
tb-extra-mailbox-sep
imap_client_workarounds(imap): delay-newmail outlook-idle netscape-eoh 
tb-extra-mailbox-sep
imap_client_workarounds(pop3): outlook-idle
pop3_uidl_format(default): 
pop3_uidl_format(imap): 
pop3_uidl_format(pop3): %08Xu%08Xv
pop3_client_workarounds(default): 
pop3_client_workarounds(imap): 
pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh
auth default:
  mechanisms: plain login digest-md5 cram-md5
  verbose: yes
  debug_passwords: yes
  passdb:
driver: sql
args: /usr/local/etc/dovecot-sql.conf
  userdb:
driver: sql
args: /usr/local/etc/dovecot-sql.conf
  socket:
type: listen
client:
  path: /var/run/dovecot/auth-client
  mode: 432
master:
  path: 

Re: [Dovecot] Dovecot waking every 50ms when doing nothing

2007-06-03 Thread Richard Laager
On Sun, 2007-06-03 at 13:48 -0400, Dave McGuire wrote:
That's not to say that simply adding one dependency on glib would  
 cause a huge problem...but it indicates the adoption of a mindset,  
 and it's a slippery slope.

The same applies to duplicating code in the interest of avoiding
dependencies.

Richard


signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Dovecot waking every 50ms when doing nothing

2007-06-03 Thread Timo Sirainen
On Sun, 2007-06-03 at 11:54 -0500, Richard Laager wrote:
 On Sun, 2007-06-03 at 18:48 +0300, Timo Sirainen wrote:
  I've used GLib before. The biggest problem I see with it is that it
  doesn't support memory pools. That's why I duplicated most of its useful
  functionality originally instead of just using it directly. So I think
  it's much better to fix Dovecot's main loop code to work better instead
  of adding a dependency to GLib and using only a tiny part of it.
 
 Are they against adding memory pools?

I haven't asked, but adding support for them would require changing a
lot of code and duplicating a lot of functions to create mempool
supported versions of them. And all of this would just make the code
slower if the mempools weren't actually used much. I doubt GLib people
would be that interested in adding support for them.

Anyway, I don't really care that much about GLib. I'm pretty happy with
my own liblib, although it would be nice to be able to use GLib's
unicode functions already. One other reason why I wouldn't want to use
GLib is because I want dovecot-auth to be MIT licensed to get it more
widely used. There's just one piece of LGPLed code preventing it: GLib's
printf_string_upper_bound(). Plus of course that I haven't bothered to
really separate dovecot-auth into its own package yet, maybe for v2.0..




signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Is there a connect acl ?

2007-06-03 Thread Timo Sirainen
On Sat, 2007-06-02 at 10:47 -0400, Oliver Schulze L. wrote:
 Hi,
 I have been reading the acl documentation and it seems that a connect acl
 is not available.
 
 I need to limit the users that can login in an IP number, is that 
 posible with
 dovecot 1.0? (i.e. only these users can login from the Internet)

Do you mean something like
http://wiki.dovecot.org/PasswordDatabase/ExtraFields/AllowNets (and
http://wiki.dovecot.org/PasswordDatabase/ExtraFields)?

 Or a new plugin should be written? It is complicated to do that?

dovecot-auth doesn't really support such plugins. You could let the user
log in normally and then check the IP and disconnect if it's wrong
(http://wiki.dovecot.org/PostLoginScripting) but that of course tells
the user that the user/pass was correct and the IP was just wrong.



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Dovecot Authentication Problem - Help pls!

2007-06-03 Thread Timo Sirainen
On Sun, 2007-06-03 at 21:20 +0300, Odhiambo WASHINGTON wrote:
 Here is a backtrace of the dovecot-auth crash:

Two problems with it:

 #0  0x805dc00 in userdb_blocking_lookup ()

Debugging symbols were stripped. Could you try building it without
removing them, at least from dovecot-auth binary? I guess make install
does the stripping, so maybe copying the file manually would preserve
it. You can anyway check this with file dovecot-auth to see if it says
stripped or not stripped.

 (gdb) bt
 #0  0x805dc00 in userdb_blocking_lookup ()
 #1  0x805dd50 in userdb_blocking_lookup ()
 #2  0x806175a in sql_drivers_register_all ()
 #3  0x8060d1c in sql_query ()
 #4  0x805de62 in userdb_blocking_lookup ()
 #5  0x8055724 in auth_stream_is_empty ()
 #6  0x80557f4 in auth_stream_is_empty ()
 #7  0x8055894 in auth_stream_is_empty ()
 #8  0x80668ac in io_loop_handler_run ()
 #9  0x80662a1 in io_loop_run ()
 #10 0x805770f in main ()
 #11 0x804fd52 in _start ()

Also this backtrace is corrupted for some reason. One (pretty) sure way
to get a non-corrupted backtrace is to attach gdb to dovecot-auth while
it's still running:

gdb attach pid of dovecot-auth -w process
cont
wait for crash
bt full



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Sharing nested folders / maildir variations?

2007-06-03 Thread Timo Sirainen
On Thu, 2007-05-31 at 22:43 -0700, SeattleServer.com wrote:
 We'd have:
 
 .Folder/{cur,new,tmp}
 .Folder/.SubFolder1/{cur,new,tmp}
 .Folder/.SubFolder1/{cur,new,tmp}
 .Folder/.SubFolder1/.foo/{cur,new,tmp}
 .Folder/.SubFolder1/.bar/{cur,new,tmp}
 .Folder/.SubFolder2/{cur,new,tmp}
 
 That would both solve my issue and be a lot more convenient when  
 browsing/scripting around maildirs (i.e. cd ../.foo vs  
 cd ../.Folder.Subfolder1.foo).
 
 It seems to me that this would be a really easy thing to add support  
 for via the config option used to choose between maildir/mbox/dbox.  
 Call it rmaildir or somesuch...

Should be already possible with the development version (wonder what I
should call it now that I can't call it CVS HEAD anymore ..
development, 1.1.UNSTABLE, hg, ..?):

mail_location = maildir:~/Maildir:LAYOUT=FS

It doesn't use dots anymore then either.


signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] TLS errors when vodafone connecting to dovecot server.

2007-06-03 Thread Timo Sirainen
On Thu, 2007-05-31 at 16:58 +0100, Andrew Pounce wrote:
 Hi,
 
 I've been trying to setup the vodafone email sync ( provided by visto
 apparently ) and have not been able to do so - I'm getting an error
 message in my mail logs which looks as if there is a problem with
 certificates somewhere. 
 
 May 31 16:49:39 imap dovecot: imap-login: SSL_accept() failed:
 error:14094416:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate
 unknown [206.124.112.22]

I guess it means that the client couldn't verify the Certificate
Authority and didn't bother to ask you if you wanted to trust it anyway
(which most clients do nowadays). So you'll probably need to figure out
a way to import your CA cert (or self-signed cert) to the vodafone.

See http://wiki.dovecot.org/SSL/CertificateCreation for more information
about CA certs and self-signed certs and their problems.



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Possible Caching Bug showing up as a MIME Boundary Issue

2007-06-03 Thread Timo Sirainen
On Thu, 2007-05-31 at 11:48 -0400, Kevin A. McGrail wrote:
 I'm using Dovecot version 1.0.0. I was using Dovecot version 1.0.0
 beta3 or alpha4.  I upgraded to Dovecot 1.0.0 to make sure that was
 not the issue. 

And after upgrade and deleting .imap/ directory this has still happened
to new mails?

 mail_location: mbox:~/:INBOX=/var/spool/mail/%u

I guess this might have something to do with mbox format as well,
although I haven't heard other people having this problem for a long
time.

When it happens, is it possible that you could send me the mbox file
(through http://dovecot.org/tools/mbox-anonymize.pl is fine) and the
mailbox's dovecot.index* files? The only problematic file (and the most
important one in fixing this) is dovecot.index.cache which could contain
email addresses, subjects and other headers.



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Namespace Problems

2007-06-03 Thread Timo Sirainen
On Wed, 2007-05-30 at 10:54 +0200, Rainer Sigl wrote:
 Many thanks,
 its working fine with your suggestion.
 But only with outlook I still have problems. Today morning I found out 
 that outlook does work only I keep the separator line empty
 with
 
 namespace private {
 #   separator = .
prefix = INBOX.
inbox = yes
hidden = no
 }

Umm. The default is '.' with maildir, so it should make no difference
between setting it to '.' and leaving it as default.

You can check yourself what the mailbox listing looks like:

telnet localhost 143
x login username password
1 namespace
2 list  *



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] dovecot-sieve-1.0 (hg) does not build

2007-06-03 Thread Timo Sirainen
On Tue, 2007-05-29 at 13:23 +0200, Bernhard Schmidt wrote:
 Hi,
 
 the dovecot-sieve plugin from the hg repository
 (http://hg.dovecot.org/dovecot-sieve-1.0/) does not build against
 current dovecot-1.0 repository. 
..
 /.libs/libsieve.a(script.o): In function `sieve_script_parse':
 /usr/src/dovecot-sieve-1.0/src/libsieve/script.c:140: undefined
 reference to `yylineno'

It builds with me, so I guess the problem has something to do with the
software you're using to build it. Perhaps you're using some other lex
than flex?

 dovecot-sieve-1.0.1.tar.gz builds fine.

That's because it contains generated .c files for yacc/lex files so you
don't need to build them yourself.



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Overriding IMAP commands

2007-06-03 Thread Timo Sirainen
On Tue, 2007-05-29 at 11:56 +0800, Tony Tsang wrote:
 Hi all,
 
 I am writing a plugin to override some built-in imap commands. But
 when client logs out, imap segfaults during unregistering commands.
 What is the correct procedure for overriding imap commands in dovecot?

I don't think anyone has tried that before. Where does it crash? Did you
try command_unregister() for the original command before overriding it
with yours?



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Client certificate verification/authentication

2007-06-03 Thread Timo Sirainen
On Tue, 2007-05-29 at 12:06 +0200, eizert wrote:
 Not in Dovecot...
 In my log, i've simply :
 dovecot: auth(default):  Client didn't present valid SSL certificate

Set verbose_ssl=yes and it should log more. It should then log either
Invalid certificate or Valid certificate. If it logged neither, then
your client didn't send a certificate at all.



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] UW-IMAP style mbox snarfing from /var/mail/ to ~/mbox

2007-06-03 Thread Timo Sirainen
On Tue, 2007-05-29 at 16:20 +0200, Bernd Kuhls wrote:
 Timo Sirainen wrote:
  http://dovecot.org/patches/mbox-snarf-plugin.c
 
 Hi,
 
 I just tried to setup this plugin on a Debian Etch machine but it 
 crashes the Dovecot daemons.
 
 Debian Etch uses the sourcecode of Dovecot 1.0rc15 + some patches.

It's entirely possible that it requires a newer version. I only tried it
with v1.0.

 gcc -fPIC -shared -Wall -I$DOVECOT -I$DOVECOT/src/lib
 -I$DOVECOT/src/lib-storage -I$DOVECOT/src/lib-mail
 -I$DOVECOT/src/lib-imap -DHAVE_CONFIG_H  mbox-snarf-plugin.c -o
 mbox_snarf_plugin.so

Looks ok.

  May 29 16:01:24 bach dovecot: child 28786 (imap) killed with signal 11

Getting backtrace of the crash could also show where the problem is.
http://dovecot.org/bugreport.html



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] IMAP traffic logging

2007-06-03 Thread Timo Sirainen
On Mon, 2007-06-04 at 03:35 +0300, Timo Sirainen wrote:
 On Wed, 2007-05-30 at 15:59 +0200, Chris Laif wrote:
  Hi.
  
  I wonder if it is possible to log the number of bytes send in response
  to IMAP commands. Unfortunately there seems to be no config option
  similar to pop3_logout_format.
 
 There's a patch for it. Someone already gave a link to it within last
 few weeks. I think it was originally posted some months ago. If you
 can't find it I can try to look for it.
 
 I guess it could be put to http://dovecot.org/patches/ since it's
 somewhat commonly requested..

Added: http://dovecot.org/patches/imap-bytes.diff



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Dovecot and Seamonkey/Mozilla delete attachment

2007-06-03 Thread Timo Sirainen
On Wed, 2007-05-23 at 22:19 -0700, Bryce Nesbitt wrote:
 I'm having persistent trouble deleting larger attachments from messages
 in Mozilla/Seamonkey mail, and I'm thinking it may be related to
 Dovecot.  A bug report is over at
 https://bugzilla.mozilla.org/show_bug.cgi?id=381759

126 append BasiliX/Testing (\Seen) {995863+}
127 uid store 4 +Flags (\Seen \Deleted)

To me it looks like it appends the message without actually removing the
attachment and then marks the original message as deleted. If the
message size after removing attachment was supposed to make it smaller
than 995863 bytes, then I'd say this is clearly a Mozilla bug that has
nothing to do with Dovecot.

 I do not have the version number of Dovecot available, unless you know
 how to get it from the IMAP prompt:

So I guess you're not the server admin? dovecot --version would be the
easiest way.

  telnet idiom.com 143

It's v1.0.rc1 or newer because it advertises SASL-IR. There's no way to
know beyond that though.




signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Simple questions about Quota

2007-06-03 Thread Timo Sirainen
On Thu, 2007-05-24 at 09:31 -0300, Venilton Junior wrote:
 Here follows my configuration:

dovecot -n is preferrable to copypasteing dovecot.conf.

 user_attrs = mail,homeDirectoryquota=quota=maildir:storage

This is a mix of old and new style user_attrs format. That might be
causing the problem. Use instead:

user_attrs = homeDirectory=home,quota=quota=maildir:storage

 If I'm using quota information in my ldap server, do I have to use this
 option in my dovecot.conf file?
 
  
 
 plugin {
 
 quota = maildir
 
 }

It doesn't matter, because it's overridden by the quota setting returned
by userdb.

If you can't seem to get it work, set auth_debug=yes and look at what
you see in the logs. You should see something like:

auth(default): master out: USER  1   tssuid=1000 gid=1000 
home=/home/tss   quota=maildir:storage=102400

Make sure the quota setting looks correct in there.



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] AIX mail quota plugin problems

2007-06-03 Thread Timo Sirainen
On Wed, 2007-05-30 at 12:46 -0400, Stewart Dean wrote:
  4272 [EMAIL PROTECTED]:/usr/local/lib/dovecot/imap ## dovecot
  ILoading modules from directory: /usr/local/lib/dovecot/imap
  IModule loaded: /usr/local/lib/dovecot/imap/lib10_quota_plugin.so
  FPlugin imap_quota not found from directory /usr/local/lib/dovecot/imap
  Error: imap dump-capability process returned 89

quota is loaded OK, imap_quota isn't.

 [EMAIL PROTECTED]:/usr/local/lib/dovecot/imap ## ls -al
..
 -rwxr-xr-x   1 root system28645 May 22 15:12 
 052207-1455-64bit-ssl.lib11_imap_quota_plugin.so*

So it should be loading this.

 lrwxrwxrwx   1 root system   76 May 24 12:36 
 lib11_imap_quota_plugins.so@ - /usr/local/lib/dovecot/i

Why is it plugins? It should be plugin.



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] testink

2007-06-03 Thread Timo Sirainen
On Thu, 2007-05-31 at 10:31 +0200, Steffen Kaiser wrote:
 I suggest, that you shouldn't try to do that.
 
  - Message contains In-Reply-To: header
  - Subject doesn't contain Re:
..
  - Body doesn't contain any quotes
..
  - User's first message to list
 
 Hmm, I find this test a bit strange. One need to ask a question first, 
 before one can answer others questions.

I'm not sure if you understood that those were all AND conditions. Only
if all of them matched, the message would be rejected. The Re: and quote
checks aren't perfect on their own, but I find it highly unlikely that
the user's first message to a list would be a valid reply to someone
else's mail without Re: and without quotes.

But I'm not planning on doing this anytime soon. Too much trouble.



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] frequent index rebuilds versus disabled indexes

2007-06-03 Thread Timo Sirainen
On Wed, 2007-05-30 at 09:38 -0400, Justin McAleer wrote:
 Ok, here's the short and sweet version of my dilemma. I have a group of 
 servers mounting a shared NFS device to hold mail data for many 
 different domains. Is it worth the load balancing management nightmare 
 of setting up dedicating smtp, pop, and imap to one server (failing over 
 to another in the group if the server goes down) to keep indexes on 
 local disk? It's very tempting to just disable indexes and not worry 
 about which server a user hits, and considering the vast majority of our 
 170,000 accounts only have about a 20MB quota, I'm not sure indexes will 
 help that many users. Although, I guess I would need to work out 
 something for the few huge accounts we do have.

It would be possible to keep indexes in local disks even if the user was
redirected randomly, although it would be less useful then.

But even without indexes I think there could be some problems with
dovecot-uidlist file if multiple servers tried to access the mailbox at
the same time and attribute caching is enabled.

I'll try to get v1.1 to work nicely with NFS and attribute caching, but
for v1.0 I can't really recommend trying it.


signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Public Namespace and ACLs with pure virtual users

2007-06-03 Thread Timo Sirainen
On Sun, 2007-06-03 at 22:26 -0400, Adam McDougall wrote:
 On Mon, Jun 04, 2007 at 04:28:56AM +0300, Timo Sirainen wrote:
 
   ACL plugin shouldn't have anything to do with that decision. The \Seen
   flag is stored privately if you have created dovecot-shared file to the
   maildir. 
 
 Is it possible to have dovecot enforce the file mode and group owner of
 inserted mails without causing flags to be stored privately?  Its looking
 like I will have to use a cron job to fix file permissions on mails added
 to shared mail folders by imap clients.  I'd be willing to implement a 
 local permanent patch but I haven't looked into how easy it would be yet
 because I did not (until now) realize that this behavior was intended.

src/lib-storage/index/maildir/maildir-storage.c around line 539:

mbox-private_flags_mask = MAIL_SEEN;

Set that to 0.



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] dovecot-shared tries to fchown index+control files but fails

2007-06-03 Thread Timo Sirainen
On Thu, 2007-05-24 at 18:59 -0400, Adam McDougall wrote:
 May 24 18:45:35 hostname dovecot: IMAP(username): 
 fchown(/home/username/Maildir/dovecot/public/control/org/.mailfolder/dovecot-uidlist)
  failed: 
 Operation not permitted

I'm not sure if you already figured this out, but these calls are used
to change the file's group, not its owner.



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] dovecot-shared tries to fchown index+control files but fails

2007-06-03 Thread Adam McDougall
On Mon, Jun 04, 2007 at 05:57:49AM +0300, Timo Sirainen wrote:

  On Thu, 2007-05-24 at 18:59 -0400, Adam McDougall wrote:
   May 24 18:45:35 hostname dovecot: IMAP(username): 
   
fchown(/home/username/Maildir/dovecot/public/control/org/.mailfolder/dovecot-uidlist)
 failed: 
   Operation not permitted
  
  I'm not sure if you already figured this out, but these calls are used
  to change the file's group, not its owner.
  
Why would dovecot-shared affect files outside of the shared directory though?