Re: [Dovecot] Problems with the fs-quota plugin on delivery stage

2010-05-13 Thread Kostik
Hi!

Kostik wrote:
 Just noticed a strange behavior of the FS quota plugin on delivery stage.

Is there anyone know? This log message...

 May 12 20:01:47 dovecot: deliver(x...@x.): quota-fs: gid=5751796,
 value=8409088, limit=10485760, active=1

shows value=8409088 before or after delivery?


I added debugging printf() into src/plugins/quota/quota.c and got strange
data. When I try to deliver 7088147 bytes msg into 10485760 bytes limit
mailbox with 1320941 bytes already used, then in:

static int quota_default_test_alloc(...) is:
---
if (ctx-count_left != 0  ctx-bytes_left = ctx-bytes_used + size)
   return 1;
---
I get:
---
ctx-bytes_left = 2076672
ctx-bytes_used = 0
msg size = 7088147
and current limits are: current(used)=8409088 limit=10485760
---

It's very odd, because the msg is not yet delivered, but the disk space is
already occupied. The INBOX file actually does not contain this message,
but quota-tool already shows the new used space as if already with the
received message.

Is this correct? Because the msg could not be delivered in a mailbox, but
does not exceed its limit.

=kositk


[Dovecot] Problems with the fs-quota plugin on delivery stage

2010-05-12 Thread Kostik
Hi All!

Just noticed a strange behavior of the FS quota plugin on delivery stage.
We use group FS quotas via NFS. And quota-tool says:
---
Disk quotas for group #5751796 (gid 5751796):
 Filesystemblocks   quota   limit   grace
 nfse:/export1276   10240   10240
---
I run:
---
cat ./test.eml | /usr/local/libexec/dovecot/deliver -e -n -d x...@x.
---
and get:
---
Quota exceeded (mailbox for user is full)
---
But ./test.eml is 7088147 bytes and it is not above the quota.


dovecot debug log is:
---
May 12 20:01:46 dovecot: deliver(x...@x.): fs quota block device =
nfse:/export
May 12 20:01:46 dovecot: deliver(x...@x.): fs quota mount point =
/mount/m5
May 12 20:01:47 dovecot: deliver(x...@x.): quota-fs: host=nfse,
path=/export, gid=5751796, bytes
May 12 20:01:47 dovecot: deliver(x...@x.): quota-fs: gid=5751796,
value=8409088, limit=10485760, active=1
May 12 20:01:47 dovecot: deliver(x...@x.): from=x...@x.,
msgid=4bea4744.1040...@@x.: save failed to INBOX: Quota
exceeded (mailbox for user is full)
---
It seems that value=8409088, limit=10485760 shows that the quota is no
problem, but save failed.

If I become that user, then no problems. I can copy ./test.eml without
problems. Now quota-tool says:
---
   Filesystemblocks   quota   limit   grace
   nfse:/export8212   10240   10240
---
If I try to copy again(over quota), then honestly get:
---
cp: closing `./test2.msg': Disk quota exceeded
---

If I switch off quota plugin on dovecot.conf (LDA specific settings), then:
- 1. The first delivery is without error, but the INBOX is corrupted(last
msg is clipped) but quota-tool show only 3300 blocks used (quota is 10240
blocks).
- 2. Following delivery big msgs (over quoted) ends with an error: Not
enough disk space (this is correct, because the quota is really ended)
- 3. Following delivery small msgs (above quoted) ends well, msgs are
delivered (used 3304 blocks and etc.)

Our setup:
-- slackware 11.0, x86_32
-- linux 2.6.31.6
-- dovecot 1.2.11
-- mailbox(not maildir) via NFS storage.


Please, tell me where to start looking for the problem?


=kostik


Re: [Dovecot] Problems with the fs-quota plugin on delivery stage

2010-05-12 Thread Kostik
Kostik wrote:
 Just noticed a strange behavior of the FS quota plugin on delivery stage.

My /usr/local/sbin/dovecot -n is:
---
# 1.2.11: /usr/local/etc/dovecot.conf
# OS: Linux 2.6.32.12 i686 Slackware 11.0.0
base_dir: /var/run/dovecot/
protocols: imap pop3
listen(default): *:143
listen(imap): *:143
listen(pop3): *:110
disable_plaintext_auth: 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
mail_debug: yes
mmap_disable: yes
mail_nfs_storage: yes
mail_nfs_index: yes
lock_method: dotlock
mbox_read_locks: dotlock_try
mbox_write_locks: dotlock_try
mbox_lock_timeout: 150
mbox_dotlock_change_timeout: 60
mbox_very_dirty_syncs: yes
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_plugins(default): quota imap_quota mail_log
mail_plugins(imap): quota imap_quota mail_log
mail_plugins(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
pop3_no_flag_updates(default): no
pop3_no_flag_updates(imap): no
pop3_no_flag_updates(pop3): yes
pop3_client_workarounds(default):
pop3_client_workarounds(imap):
pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh
lda:
  postmaster_address: mailer-dae...@x.
  quota_full_tempfail: no
  deliver_log_format: from=%f, msgid=%m: %$
  sendmail_path: /usr/lib/sendmail
  rejection_subject: Rejected: %s
  rejection_reason: Your message to %t was automatically rejected:%n%r
  auth_socket_path: /var/run/dovecot/auth-master
auth default:
  mechanisms: plain login
  debug: yes
  passdb:
driver: sql
  userdb:
driver: prefetch
  socket:
type: listen
master:
  path: /var/run/dovecot/auth-master
  mode: 384
plugin:
  quota: fs:Quota:user
  mail_log_events: delete undelete expunge copy mailbox_delete mailbox_rename
  mail_log_fields: box from subject size

=kostik


Re: [Dovecot] Possible CPU Denial-Of-Service attack to dovecot IMAP.

2010-03-03 Thread Kostik
Hi!

Timo Sirainen wrote:
 Hmm. Since it's causing also real problems, I suppose I should fix it
 for v1.2 too.. The problem anyway is only with v1.2 + mbox combination,
 nothing else.
 
 Here's a workaround for v1.2:
 http://hg.dovecot.org/dovecot-1.2/rev/6c9f2ed821df

Yes, Timo, v1.2 works fine now.

BTW, my Thunderbird 2.0.0.23 hung at the opening of this massage. But now
that is not dovecot problem. :)

=koc




[Dovecot] Possible CPU Denial-Of-Service attack to dovecot IMAP.

2010-02-28 Thread Kostik

Hello!


5. I can provide download link to this buggy mailbox file if needed.

Yes, that would be helpful. I couldn't reproduce it.


I hope this will help:
http://user.rol.ru/~koc/buggymbox

=koc
---
Ванкувер 2010. Новости Олимпиады. http://olympic.aport.ru


[Dovecot] Possible CPU Denial-Of-Service attack to dovecot IMAP.

2010-02-27 Thread Kostik
Hi All!

Some time ago, we received e-mail message, which makes our server CPU
exhaustion attack.
---
PID   USER  PR  NI  VIRT  RES  SHR S %CPU %MEM  TIME+COMMAND
26319 5751796   20   0  2868 1868 1484 R 99.2  0.1  22:04.77 imap
---
It happens when I try open mail folder with this buggy message.

Our setup:
-- slackware 11.0, x86_32
-- linux 2.6.31.6
-- dovecot 1.2.10
-- mailbox(not maildir) via NFS storage.

Details:
1. Buggy message 1219733 byte size. And most of this size is mail header.

2. Mail header mostly consists of a repeating block:
---
[...]

MIME-Version: 1.0
Content-type: text/plain; charset=windows-1251
Content-transfer-encoding: 8bit
Date:   Thu, 25 Feb 2010 11:13:03 +0300
X-Priority: 0
X-MSMail-Priority: Normal
X-Mailer: Microsoft Office Outlook, Build 11.0.5510
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
X-Sender: torre...@rutracker.org
Reply-to: torre...@rutracker.org
From:   torre...@rutracker.org
Message-ID: 4052c9f301d0956f3fa1e855cca02...@rutracker.org

[...]

MIME-Version: 1.0
Content-type: text/plain; charset=windows-1251
Content-transfer-encoding: 8bit
Date:   Thu, 25 Feb 2010 11:13:02 +0300
X-Priority: 0
X-MSMail-Priority: Normal
X-Mailer: Microsoft Office Outlook, Build 11.0.5510
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
X-Sender: torre...@rutracker.org
Reply-to: torre...@rutracker.org
From:   torre...@rutracker.org
Message-ID: 6162ed30245a86b8cb26e4a0bf4de...@rutracker.org

[...]
---

3.strace show, that dovecot many-many time do:
---
pread64(6, -Sender: torre...@rutracker.org\n..., 4038, 814845) = 4038
pread64(6, s...@rutracker.org\nmessage-id: 461..., 4083, 818883) = 4083
pread64(6, arset=windows-1251\nContent-trans..., 4068, 822966) = 4068
pread64(6, ail-Priority: Normal\nX-Mailer: M..., 4091, 827034) = 4091
---

4. and gdb in that time:
---
(gdb) where
#0  0xb7604060 in memset () from /lib/tls/libc.so.6
#1  0x080d7483 in buffer_write (_buf=0x8131db0, pos=135470571,
data=0x8132d52, data_size=2) at buffer.c:54
#2  0x080d74fb in buffer_append (buf=0x0, data=0x8132d52, data_size=2) at
buffer.c:168
#3  0x080cebfe in read_header (mstream=0x8131be8) at
istream-header-filter.c:214
#4  0x080cef07 in i_stream_header_filter_read (stream=0x8131be8) at
istream-header-filter.c:301
#5  0x080cef79 in parse_header (mstream=0x8131be8) at
istream-header-filter.c:323
#6  0x080cefce in i_stream_header_filter_seek (stream=0x8131be8,
v_offset=128810, mark=false) at istream-header-filter.c:337
#7  0x080ddfdb in i_stream_seek (stream=0x8131c10, v_offset=128810) at
istream.c:198
#8  0x0809c99c in i_stream_mail_stats_read_mail_stats (stream=0x812c460) at
istream-mail-stats.c:43
#9  0x080ddbfc in i_stream_read (stream=0x812c488) at istream.c:85
#10 0x080de389 in i_stream_read_data (stream=0x812c488, data_r=0xbf9d82e4,
size_r=0xbf9d82e8, threshold=2) at istream.c:366
#11 0x080d400b in message_get_header_size (input=0x812c488, hdr=0x81298fc,
has_nuls=0x0) at message-size.c:56
#12 0x0808f976 in index_mail_init_stream (mail=0x81297d0,
hdr_size=0xbf9d83b0, body_size=0xbf9d8390, stream_r=0x0) at index-mail.c:852
#13 0x080838a1 in mbox_mail_get_stream (_mail=0x81297d0,
hdr_size=0xbf9d83b0, body_size=0xbf9d8390, stream_r=0xbf9d838c) at
mbox-mail.c:322
#14 0x0808e9ac in index_mail_get_virtual_size (_mail=0x81297d0,
size_r=0xbf9d8400) at index-mail.c:397
#15 0x080685a3 in fetch_rfc822_size (ctx=0x0, mail=0x81297d0, context=0x0)
at imap-fetch-body.c:894
#16 0x0806607c in imap_fetch_more (ctx=0x811e030) at imap-fetch.c:472
#17 0x0805e370 in cmd_fetch (cmd=0x811dec8) at cmd-fetch.c:228
#18 0x0806292b in cmd_uid (cmd=0x811dec8) at cmd-uid.c:27
#19 0x08063726 in client_command_input (cmd=0x811dec8) at client.c:612
#20 0x080636d1 in client_command_input (cmd=0x811dec8) at client.c:661
#21 0x080638b3 in client_handle_input (client=0x811cc08) at client.c:701
#22 0x080642d6 in client_input (client=0x811cc08) at client.c:753
#23 0x080e1bf1 in io_loop_handler_run (ioloop=0x0) at ioloop-epoll.c:208
#24 0x080e0f79 in io_loop_run (ioloop=0x8119ab0) at ioloop.c:335
#25 0x0806c21a in main (argc=3, argv=0xbf9d86b4, envp=0xbf9d86c4) at main.c:327
---

5. I can provide download link to this buggy mailbox file if needed.


=koc


Re: [Dovecot] FS Quota broken for delivering BIG message

2009-10-16 Thread Kostik
Timo Sirainen wrote:
 I guess the only nice way to handle this is to just let it use memory as
 much as it needs in this situation:
 
 http://hg.dovecot.org/dovecot-1.2/rev/a8254e6d5ada

Yes, problem resolved. Timo, thanx a lot!

=kostik



Re: [Dovecot] multiple quota roots complains

2009-10-16 Thread Kostik
Timo Sirainen wrote:
 Introduction:
 If dovecot LDA save failed to mbox (not enough disk space, for example),
 it does not do rollback. Then my mailbox was corrupted. Last message is
 dropped in the middle of headers(body, attachments, etc).
 
 That shouldn't be happening, even if you're not using quota plugin at
 all. What does Dovecot log in that situation?

I'm sorry, but this happens if I do not use quota plugin for LDA. :(

My environment is:
-- OS: Linux 2.6.30 i686 Slackware 11.0.0
-- dovecot 1.2.6 (with 2 patchs: stat((null)) + istream-seekable)
-- user inbox(mbox) and homedir(with mbox) locate at NFS (OS: Linux
2.6.18.7 i686 Slackware 11.0.0)
-- NFS has file system group quota

Test user is over quoted:
---
Disk quotas for group #5751796 (gid 5751796):
Filesystemblocks   quota   limit
nfse:/export   23768*  10240   10240
---

dovecot -n
---
# 1.2.6: /usr/local/etc/dovecot.conf
# OS: Linux 2.6.30 i686 Slackware 11.0.0
base_dir: /var/run/dovecot/

[ skip listen and ssl_* conf params ]

mmap_disable: yes
mail_nfs_storage: yes
mail_nfs_index: yes
mbox_write_locks: dotlock_try fcntl

mail_plugins(default): quota imap_quota
mail_plugins(imap): quota imap_quota
mail_plugins(pop3): quota

lda:
  mail_plugins: quota
  quota_full_tempfail: no
  sendmail_path: /usr/lib/sendmail
  rejection_subject: Rejected: %s
  rejection_reason: Your message to %t was automatically rejected:%n%r
  auth_socket_path: /var/run/dovecot/auth-master
auth default:
  mechanisms: plain login
  passdb:
driver: sql
  userdb:
driver: prefetch
  userdb:
driver: sql
  socket:
type: listen
master:
  path: /var/run/dovecot/auth-master
  mode: 384
plugin:
  quota: dirsize:Quota
  quota2: fs:Quota:group
---

If I change only one string (disable LDA quota): lda: mail_plugins:
quota, my inbox starts corrupt.

1. LDA with quota plugin log:

$ echo 123123123 |  /usr/local/libexec/dovecot/deliver -d koc
---
Quota root: name=Quota backend=dirsize args=
Quota rule: root=Quota mailbox=* bytes=10383360 messages=0
Quota root: name=Quota backend=fs args=group
Quota rule: root=Quota mailbox=* bytes=10383360 messages=0
mbox: data=~/:INBOX=/var/virtual/mail/I/I/koc:INDEX=MEMORY
fs: root=/var/virtual/home/I/I/koc, index=, control=,
inbox=/var/virtual/mail/I/I/koc
fs quota add storage dir = /var/virtual/home/I/I/koc
fs quota block device = nfse:/export
fs quota mount point = /mount/m5
quota-fs: host=nfse, path=/export, gid=5751796, bytes
quota-fs: gid=5751796, value=24338432, limit=10485760, active=1
from=, msgid=: save failed to INBOX: Quota exceeded (mailbox for user is
full)
from=, msgid=: rejected: Quota exceeded (mailbox for user is full)
msgid=: Return-Path missing, rejection reason: Quota exceeded (mailbox for
user is full)
---

2. LDA without quota plugin:

$ echo 123123123 |  /usr/local/libexec/dovecot/deliver -d koc
---
mbox: data=~/:INBOX=/var/virtual/mail/I/I/koc:INDEX=MEMORY
fs: root=/var/virtual/home/I/I/koc, index=, control=,
inbox=/var/virtual/mail/I/I/koc
close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded
from=, msgid=: saved mail to INBOX
---

My INBOX before delivery:
-rw--- 1 5751796 5751796 4087 2009-10-16 17:24 koc
after:
-rw--- 1 5751796 5751796 4096 2009-10-16 17:25 koc
(look at size, now it 8*512k blocks)

If INBOX is zero size, than deliver say same: lock failed, saved mail to
INBOX, but INBOX size still zero. If INBOX is 1 byte size, than deliver
say same, but message writes to INBOX to full 512k block.

 Or what does your MTA log? Does it say deliver crashed? Because that's
 the only reason I can think of that it would leave the mbox corrupted.
 Post your dovecot -n output also?

MTA log is: stat=ok3: saved mail to INBOX. Deliver not crash. I can make
strace if it helps.

 The stat((null)) should be fixed by this:
 http://hg.dovecot.org/dovecot-2.0/rev/14eeed133d57

I backport it to dovecot-1.2 and stat((null)) fixed now! Thanx again, Timo!


=kostik


Re: [Dovecot] multiple quota roots complains

2009-10-16 Thread Kostik
Hi!

TS On Fri, 2009-10-16 at 18:06 +0400, Kostik wrote:
 close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded

TS Oh, it fails too late. Does this help?
TS http://hg.dovecot.org/dovecot-1.2/rev/ebb44fb7d9de

It helped, but only half:
---
close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded
from=, msgid=: save failed to INBOX: Not enough disk space
from=, msgid=: rejected: Not enough disk space
msgid=: Return-Path missing, rejection reason: Not enough disk space
---

LDA return delivery error now, but inbox does not rolled back anyway.


=kostik



Re: [Dovecot] multiple quota roots complains

2009-10-16 Thread Kostik

TS On Fri, 2009-10-16 at 22:16 +0400, Kostik wrote:
 TS Oh, it fails too late. Does this help?
 TS http://hg.dovecot.org/dovecot-1.2/rev/ebb44fb7d9de
 
 It helped, but only half:
 ---
 close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded

TS This was again the only error? It's still failing too late. It should be
TS failing in fdatasync() earlier. What does it log with attached patch?

Yes, this is full debug log. Log after patch:
---
close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded
fdatasync() succeeded
from=, msgid=: saved mail to INBOX
---



Re: [Dovecot] multiple quota roots complains

2009-10-16 Thread Kostik

TS On Fri, 2009-10-16 at 22:41 +0400, Kostik wrote:
 close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded

TS Oh, I didn't read carefully enough. Closing .lock failed, not mbox. Does
TS the attached patch help?

No. Error on closing .lock disappeared, but mbox does not rollback.
And LDA now return saved instead rejected.
---
Oct 16 23:03:49 dovecot: deliver(koc): from=, msgid=: saved mail to INBOX
---

Strace:
---
open(/var/virtual/mail/I/I/koc.lock, O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0666) 
= 7
write(7, 13772:pigeon01, 14)  = 14
fdatasync(7)= -1 EDQUOT (Disk quota exceeded)
ftruncate64(7, 0)   = 0
fstat64(7, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
close(7)= 0
lstat64(/var/virtual/mail/I/I/koc.lock, {st_mode=S_IFREG|0600, st_size=0, 
...}) = 0
open(/var/virtual/mail/I/I/koc, O_RDWR|O_LARGEFILE) = 7
fstat64(7, {st_mode=S_IFREG|0600, st_size=4087, ...}) = 0
time(NULL)  = 1255719829
alarm(5)= 0
fcntl64(7, F_SETLKW64, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}, 
0xbfd78390) = 0
alarm(0)= 5
stat64(/var/virtual/mail/I/I/koc, {st_mode=S_IFREG|0600, st_size=4087, ...}) 
= 0
fstat64(7, {st_mode=S_IFREG|0600, st_size=4087, ...}) = 0
_llseek(7, 4086, [4086], SEEK_SET)  = 0
read(7, \n, 1)= 1
fstat64(7, {st_mode=S_IFREG|0600, st_size=4087, ...}) = 0
brk(0x8151000)  = 0x8151000
write(7, From MAILER-DAEMON  Fri Oct 16 2..., 168) = 168
pwrite64(7, \nContent-Length: 0, 18, 4235) = 18
fstat64(7, {st_mode=S_IFREG|0600, st_size=4255, ...}) = 0
fdatasync(7)= 0
write(7, \n, 1)   = 1
brk(0x8149000)  = 0x8149000
lstat64(/var/virtual/mail/I/I/koc.lock, {st_mode=S_IFREG|0600, st_size=0, 
...}) = 0
unlink(/var/virtual/mail/I/I/koc.lock) = 0
fcntl64(7, F_SETLK64, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}, 
0xbfd784c0) = 0
alarm(0)= 0
time([1255719829])  = 1255719829
stat64(/etc/localtime, {st_mode=S_IFREG|0644, st_size=2194, ...}) = 0
stat64(/etc/localtime, {st_mode=S_IFREG|0644, st_size=2194, ...}) = 0
stat64(/etc/localtime, {st_mode=S_IFREG|0644, st_size=2194, ...}) = 0
send(6, 22Oct 16 23:03:49 dovecot: del..., 88, MSG_NOSIGNAL) = 88
close(7)= -1 EDQUOT (Disk quota exceeded)
---

=kostik



Re: [Dovecot] multiple quota roots complains

2009-10-16 Thread Kostik

TS OK, so two problems:
 write(7, From MAILER-DAEMON  Fri Oct 16 2..., 168) = 168
 pwrite64(7, \nContent-Length: 0, 18, 4235) = 18

TS It's writing a zero byte mail. Was the incoming mail really zero bytes,
TS or is there something that truncates it?

No, it's not a problem. This is a really zero bytes message:
$ echo 123123123 |  strace /usr/local/libexec/dovecot/deliver -d koc

 fstat64(7, {st_mode=S_IFREG|0600, st_size=4255, ...}) = 0
 fdatasync(7)= 0
 write(7, \n, 1)   = 1

TS write() happened after fdatasync(), that causes this to fail:

 close(7)= -1 EDQUOT (Disk quota exceeded)

TS So this later problem should be fixed by:
TS http://hg.dovecot.org/dovecot-1.2/rev/b5e6de777e52

Yabba-Dabba Do! :)
Yes, this patch solves the problem: rejected: Not enough disk space.
And inbox is rollbacked now.

Timo, many thanks for all your help!

=kostik



[Dovecot] FS Quota broken for delivering BIG message

2009-10-15 Thread Kostik
Hi everybody.

I have Linux file system quota for users and enabled fs quota and quota
plugin for LDA. My test user is already deep over quoted:
---
Filesystemblocks   quota   limit
nfse:/export   23768*  10240   10240
---

1. If I tries to deliver _short_ message to user mbox - quota works:

$ echo 123123123123 | /usr/local/libexec/dovecot/deliver -d koc
---
Quota root: name=Quota backend=fs args=group:mount=/var/virtual/home/I/I/koc
Quota rule: root=Quota mailbox=* bytes=10383360 messages=0
mbox: data=~/:INBOX=/var/virtual/mail/I/I/koc:INDEX=MEMORY
fs: root=/var/virtual/home/I/I/koc, index=, control=,
inbox=/var/virtual/mail/I/I/koc
fs quota add storage dir = /var/virtual/home/I/I/koc
fs quota block device = nfse:/export
fs quota mount point = /mount/m5
quota-fs: host=nfse, path=/export, gid=5751796, bytes
quota-fs: gid=5751796, value=24338432, limit=10485760, active=1

from=, msgid=: save failed to INBOX: Quota exceeded (mailbox for user is
full)
from=, msgid=: rejected: Quota exceeded (mailbox for user is full)
msgid=: Return-Path missing, rejection reason: Quota exceeded (mailbox for
user is full)
---

2. But if I tries to deliver _BIG_ message to user mbox - quota broken:

$ cat big.msg | /usr/local/libexec/dovecot/deliver -d koc
---
Quota root: name=Quota backend=fs args=group:mount=/var/virtual/home/I/I/koc
Quota rule: root=Quota mailbox=* bytes=10383360 messages=0
mbox: data=~/:INBOX=/var/virtual/mail/I/I/koc:INDEX=MEMORY
fs: root=/var/virtual/home/I/I/koc, index=, control=,
inbox=/var/virtual/mail/I/I/koc
fs quota add storage dir = /var/virtual/home/I/I/koc
fs quota block device = nfse:/export
fs quota mount point = /mount/m5
quota-fs: host=nfse, path=/export, gid=5751796, bytes
quota-fs: gid=5751796, value=24338432, limit=10485760, active=1

write_full(/var/virtual/home/I/I/koc/.temp.pigeon01.8822.64dfacc7e57d71b4)
failed: Disk quota exceeded
stat(/tmp/Dovecot Delivery Mail) failed: Disk quota exceeded
from=, msgid=: save failed to INBOX: BUG: Unknown internal error
---


This write_full() failed from: src/lib/istream-seekable.c
---
static ssize_t i_stream_seekable_read(struct istream_private *stream)
{
...
/* save to our file */
data = i_stream_get_data(sstream-cur_input, size);
if (write_full(sstream-fd, data, size)  0) {
i_assert(errno != 0);
stream-istream.stream_errno = errno;
i_error(write_full(%s) failed: %m,
sstream-temp_path);
i_stream_close(stream-istream);
return -1;
}
...
}
---


=kostik


Re: [Dovecot] multiple quota roots complains

2009-10-15 Thread Kostik
Hello.

I fix this issue by manually set mount option to user home:
---
quota2 = fs:fs quota:group:mount=%h
---

From here:
http://wiki.dovecot.org/Quota/FS
---
mount=path: Report quota from given path. Default is to use the path for
the mail root directory.
---
But by default it is NULL.


=kostik

Kostik wrote:
 Hi to everyone.
 
 Timo,
 
 With dovecot-1.2.6 multiple quota roots complains:
 stat((null)) failed: Bad address to log file.
 
 My setup is:
 ---
 plugin {
   quota = dirsize:dirsize quota
   quota2 = fs:fs quota:group
 }
 ---
 
 Complains from (plugins/quota/quota-fs.c):
 ---
 if (stat(root-storage_mount_path, rst)  0) {
if (_root-quota-set-debug) {
  i_error(stat(%s) failed: %m,
  root-storage_mount_path);
}
return FALSE;
 }
 ---
 root-storage_mount_path is NULL here.


Re: [Dovecot] multiple quota roots complains

2009-10-13 Thread Kostik
Hello.

Actually it is a problem for me.

Introduction:
If dovecot LDA save failed to mbox (not enough disk space, for example),
it does not do rollback. Then my mailbox was corrupted. Last message is
dropped in the middle of headers(body, attachments, etc).

Same if I use file system quota, but does not set quota plugin
for LDA. If user receives message which is over quota:
save failed, no rollback, mbox corrupted. But if I set
quota plugin for LDA, then LDA works fine.

In my case, this problem occurs when:
-- use file system quota
-- and set quota plugin for LDA
-- and set multiple quota roots: dirsize + fs
-- and mail dir size less than all user files
(if user have mail and some other files on it home dir).

If user receives message which is over FS quota but under dirsize
quota, then dirsize quota plugin say: OK. But fs quota plugin
say: stat((null)) failed: Bad address. And LDA tries to deliver
message to mbox: save failed, no rollback, mbox corrupted.

Timo or anybody! Please! Help me! :)

=kostik

 With dovecot-1.2.6 multiple quota roots complains:
 stat((null)) failed: Bad address to log file.

 My setup is:
 ---
 plugin {
   quota = dirsize:dirsize quota
   quota2 = fs:fs quota:group
 }
 ---

 Complains from (plugins/quota/quota-fs.c):
 ---
 if (stat(root-storage_mount_path, rst)  0) {
if (_root-quota-set-debug) {
  i_error(stat(%s) failed: %m,
  root-storage_mount_path);
}
return FALSE;
 }
 ---
 root-storage_mount_path is NULL here.

 But single quota setup (dirsize or fs) works fine.


 Full log (multiple quota):
 ---
 Quota root: name=dirsize quota backend=dirsize args=
 Quota rule: root=dirsize quota mailbox=* bytes=48234496 messages=0
 Quota root: name=fs quota backend=fs args=group
 mbox: data=~/:INBOX=/var/virtual/mail/I/I/koc:INDEX=MEMORY
 fs: root=/var/virtual/home/I/I/koc, index=, control=,
 inbox=/var/virtual/mail/I/I/koc
 fs quota add storage dir = /var/virtual/home/I/I/koc
 fs quota block device = nfsf:/export
 fs quota mount point = /mount/m6
 stat((null)) failed: Bad address
 stat((null)) failed: Bad address
 stat((null)) failed: Bad address
 ...
 ---

 Full log (single fs quota):
 ---
 Quota root: name=fs quota backend=fs args=group
 Quota rule: root=fs quota mailbox=* bytes=48234496 messages=0
 mbox: data=~/:INBOX=/var/virtual/mail/I/I/koc:INDEX=MEMORY
 fs: root=/var/virtual/home/I/I/koc, index=, control=,
 inbox=/var/virtual/mail/I/I/koc
 fs quota add storage dir = /var/virtual/home/I/I/koc
 fs quota block device = nfsf:/export
 fs quota mount point = /mount/m6
 quota-fs: host=nfsf, path=/export, gid=52304385, bytes
 quota-fs: gid=52304385, value=48660480, limit=52428800, active=1
 ---



Re: [Dovecot] how to hide mailbox from the IMAP clients

2009-10-07 Thread Kostik

Timo Sirainen wrote:
 On Tue, 2009-10-06 at 18:58 +0400, Kostik wrote:
 How about redesign for the Sieve script location? You could use for
 example:
 
 sieve_dir = /var/sieve/%u/scripts/
 sieve = /var/sieve/%u/active
 
 or something. Anyway, are you using mbox or maildir? With maildir you
 could also do something else, but with mbox there's really no way to
 hide files.

Changing sieve script location is not convenient in my environment. We are
using mbox, most of all. I'll start to think about changing mail location.

Thank you!

=kostik


[Dovecot] multiple quota roots complains

2009-10-07 Thread Kostik
Hi to everyone.

Timo,

With dovecot-1.2.6 multiple quota roots complains:
stat((null)) failed: Bad address to log file.

My setup is:
---
plugin {
  quota = dirsize:dirsize quota
  quota2 = fs:fs quota:group
}
---

Complains from (plugins/quota/quota-fs.c):
---
if (stat(root-storage_mount_path, rst)  0) {
   if (_root-quota-set-debug) {
 i_error(stat(%s) failed: %m,
 root-storage_mount_path);
   }
   return FALSE;
}
---
root-storage_mount_path is NULL here.

But single quota setup (dirsize or fs) works fine.



Full log (multiple quota):
---
Quota root: name=dirsize quota backend=dirsize args=
Quota rule: root=dirsize quota mailbox=* bytes=48234496 messages=0
Quota root: name=fs quota backend=fs args=group
mbox: data=~/:INBOX=/var/virtual/mail/I/I/koc:INDEX=MEMORY
fs: root=/var/virtual/home/I/I/koc, index=, control=,
inbox=/var/virtual/mail/I/I/koc
fs quota add storage dir = /var/virtual/home/I/I/koc
fs quota block device = nfsf:/export
fs quota mount point = /mount/m6
stat((null)) failed: Bad address
stat((null)) failed: Bad address
stat((null)) failed: Bad address
...
---

Full log (single fs quota):
---
Quota root: name=fs quota backend=fs args=group
Quota rule: root=fs quota mailbox=* bytes=48234496 messages=0
mbox: data=~/:INBOX=/var/virtual/mail/I/I/koc:INDEX=MEMORY
fs: root=/var/virtual/home/I/I/koc, index=, control=,
inbox=/var/virtual/mail/I/I/koc
fs quota add storage dir = /var/virtual/home/I/I/koc
fs quota block device = nfsf:/export
fs quota mount point = /mount/m6
quota-fs: host=nfsf, path=/export, gid=52304385, bytes
quota-fs: gid=52304385, value=48660480, limit=52428800, active=1
---


=kostik


[Dovecot] how to hide mailbox from the IMAP clients

2009-10-06 Thread Kostik
Hello, everyone!

Is it possible to hide mailbox from the IMAP clients, so as to prevent
any user from subscribing to the some folders?

My storages are mbox maildir.

For example, to hide the directory where the personal Sieve scripts are
stored or etc.

=kostik


Re: [Dovecot] how to hide mailbox from the IMAP clients

2009-10-06 Thread Kostik
Eduardo M KALINOWSKI wrote:
 On Ter, 06 Out 2009, Kostik wrote:
 Hello, everyone!

 Is it possible to hide mailbox from the IMAP clients, so as to prevent
 any user from subscribing to the some folders?

 My storages are mbox maildir.

 For example, to hide the directory where the personal Sieve scripts are
 stored or etc.
 
 I think you're approaching the problem from a wrong perspective. You
 should not hide non-mail folders from clients, but you should hide
 them from the server. If it's not a mail folder, Dovecot should not
 treat it as one.
 
 How to do that depends on your settings, but basically you should not
 include the folder with scripts inside the folder with the mailboxes,
 but instead store it elsewhere.

Yes, you're right! For legacy reasons, my clients have their mailboxes
directly in their homedir. That not problem, because they have only imap
access to that server. But I am interested to hide some non-mail folders.

mailbox_location re-design is not possible right now. :(

=kostik


[Dovecot] Panic: file mbox-sync-rewrite.c: line 590

2009-08-03 Thread Kostik
Hello!

We start migrate to dovecot (v1.2.2).

# 1.2.2: /usr/local/etc/dovecot.conf
# OS: Linux 2.6.30 i686 Slackware 11.0.0

We have FS user quota and NFS mailboxs(mbox only). While user not
overquota, all works fine. But if is, we get error at log:

---
Aug  3 16:45:17 chest004 dovecot: pop3-login: Login:
user=bogg...@.xx, method=PLAIN
Aug  3 16:45:17 chest004 dovecot: POP3(bogg...@.xx):
close(/var/virtual/mail/boggart.lock) failed: Disk quota exceeded
Aug  3 16:46:28 chest004 dovecot: POP3(bogg...@.xx):
close(/var/virtual/mail/boggart.lock) failed: Disk quota exceeded
Aug  3 16:46:28 chest004 dovecot: POP3(bogg...@.xx): Panic: file
mbox-sync-rewrite.c: line 590 (mbox_sync_rewrite): assertion failed:
(mails[idx].from_offset == start_offset)
Aug  3 16:46:28 chest004 dovecot: POP3(bogg...@.xx): Raw backtrace:
pop3 [0x80c949c] - pop3 [0x80c9c3e] - pop3 [0x80c9638] -
pop3(mbox_sync_rewrite+0x6ff) [0x807c9af] - pop3 [0x8078038] - pop3
[0x807a30a] - pop3(mbox_sync+0x399) [0x807b279] -
pop3(mbox_storage_sync_init+0x53) [0x807b773] - pop3(mailbox_sync+0x2d)
[0x809331d] - pop3(client_command_execute+0x2e6) [0x805d066] -
pop3(client_handle_input+0x75) [0x805be35] -
pop3(io_loop_handler_run+0x101) [0x80d2221] - pop3(io_loop_run+0x29)
[0x80d15a9] - pop3(main+0x779) [0x805dd49] -
/lib/tls/libc.so.6(__libc_start_main+0xd4) [0xb7e46e14] - pop3 [0x805b161]
---

What does that mean?



/usr/local/sbin/dovecot -n
---
# 1.2.2: /usr/local/etc/dovecot.conf
# OS: Linux 2.6.30 i686 Slackware 11.0.0
base_dir: /var/run/dovecot/
protocols: imap pop3
listen(default): *:143
listen(imap): *:143
listen(pop3): *:110
disable_plaintext_auth: 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
mmap_disable: yes
mail_nfs_storage: yes
mail_nfs_index: yes
mbox_write_locks: dotlock_try fcntl
mbox_lock_timeout: 150
mbox_dotlock_change_timeout: 60
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_plugins(default): quota imap_quota mail_log
mail_plugins(imap): quota imap_quota mail_log
mail_plugins(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
pop3_no_flag_updates(default): no
pop3_no_flag_updates(imap): no
pop3_no_flag_updates(pop3): yes
pop3_client_workarounds(default):
pop3_client_workarounds(imap):
pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh
auth default:
  mechanisms: plain login
  passdb:
driver: sql
  userdb:
driver: prefetch
plugin:
  quota: fs:Quota:user

=koc


[Dovecot] NFS group RQUOTA

2009-01-20 Thread Kostik
Hi All.

Linux have EXT_RQUOTAPROG (Extended (LINUX) RPC quota program). Does
anybody know how to implement dovecot GROUP NFS quota-fs?

=kostik