Re: Bug in quota_get_status

2014-07-03 Thread Franz Knipp
Am 2014-07-02 19:40, schrieb Timo Sirainen:
 This should fix it properly:
 http://hg.dovecot.org/dovecot-2.2/rev/76d573ec5045 (Requires
 http://hg.dovecot.org/dovecot-2.2/rev/0d4de84a54f0)

Ok. Thanks.

When do you plan to release the next stable version (containing these
fixes)?

 The problem is that within the same transaction it's possible to
 add/remove multiple mails. The *_ceil and *_over are set only once at
 the beginning of the transaction.

Thanks for the explanation.

In the case of LMTP, this doesn't matter :-)

-- 
Franz Knipp, +43 664 3980169
qnipp GmbH, Hauptstraße 54, 7064 Oslip, Österreich
http://qnipp.com   http://qnipp.com/qnipp.vcf


Bug in quota_get_status

2014-06-26 Thread Franz Knipp
Hi,

  the configuration option

lmtp_rcpt_check_quota = yes

didn't work, so I traced down the problem:

quota_get_status (quota_storage.c:89) calls quota_test_alloc
(quota.c:1352) with size = 0 bytes, which leads always to a FALSE result
in quota_is_over (quota.c:1305).

I've fixed the function quota_is_over by considering ctx-bytes_over and
ctx-count_over. See the included patch.

Kind regards,

Franz

-- 
Franz Knipp, +43 664 3980169
qnipp GmbH, Hauptstraße 54, 7064 Oslip, Österreich
http://qnipp.com   http://qnipp.com/qnipp.vcf
--- dovecot-2.2.13/src/plugins/quota/quota.c-quota_is_over	2014-02-04 22:28:38.0 +0100
+++ dovecot-2.2.13/src/plugins/quota/quota.c	2014-06-26 10:08:11.364167424 +0200
@@ -1306,8 +1306,10 @@
 
 static bool quota_is_over(struct quota_transaction_context *ctx, uoff_t size)
 {
-	if ((ctx-count_used  0 ||
+	if ((ctx-count_over == 0) 
+	(ctx-count_used  0 ||
 	 (uint64_t)ctx-count_used + 1 = ctx-count_ceil) 
+(ctx-bytes_over == 0) 
 	((ctx-bytes_used  0  size = ctx-bytes_ceil) ||
 	 (uint64_t)ctx-bytes_used + size = ctx-bytes_ceil))
 		return FALSE;


IMAP sessions quit when calling MYRIGHTS on shared namespace

2014-06-25 Thread Franz Knipp
Hi,

  the IMAP connection is dropped, when I call MYRIGHTS on the root of my
shared folders.

Using the configuration below, the shared folders are located in shared/%%U/

# telnet localhost imap
Trying ::1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE
IDLE STARTTLS AUTH=PLAIN] Dovecot ready.
. LOGIN XXX 
. OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE
IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS
THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN
NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH
ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY
MOVE QUOTA ACL RIGHTS=texk] Logged in
. MYRIGHTS shared
Connection closed by foreign host.

I'd expect some kind of error message instead of dropping the connection.

Kind regards,

Franz


# 2.2.13: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.32-358.18.1.el6.x86_64 x86_64 CentOS release 6.4 (Final)
auth_master_user_separator = *
auth_verbose = yes
debug_log_path = /var/log/dovecot_debug.log
default_client_limit = 3500
disable_plaintext_auth = no
import_environment = TZ DOVECOT_HOSTNAME
lmtp_rcpt_check_quota = yes
mail_gid = vmail
mail_location = mdbox:~/mail
mail_plugins = acl quota zlib mail_log notify
mail_uid = vmail
managesieve_sieve_capability = fileinto reject envelope
encoded-character vacation subaddress comparator-i;ascii-numeric
relational regex imap4flags copy include variables body environment
mailbox date ihave duplicate vacation-seconds imapflags notify
mbox_write_locks = fcntl
namespace {
  list = children
  location = mdbox:%%h/mail
  prefix = shared/%%u/
  separator = /
  subscriptions = no
  type = shared
}
namespace {
  hidden = yes
  list = no
  location = pop3c:
  prefix = POP3-MIGRATION-NS/
}
namespace inbox {
  inbox = yes
  location =
  mailbox Drafts {
auto = no
special_use = \Drafts
  }
  mailbox Sent {
auto = no
special_use = \Sent
  }
  mailbox Spam {
auto = subscribe
special_use = \Junk
  }
  mailbox Trash {
auto = no
special_use = \Trash
  }
  prefix = INBOX/
  separator = /
  subscriptions = yes
}
namespace parent {
  hidden = yes
  list = no
  location =
  prefix =
  separator = /
  subscriptions = yes
}
passdb {
  args = /etc/dovecot/passwd.masterusers
  driver = passwd-file
  master = yes
}
passdb {
  args = /etc/dovecot/dovecot-ldap.conf.ext
  driver = ldap
}
plugin {
  acl = vfile
  acl_shared_dict = file:/var/spool/imap/dovecot-shared-mailboxes
  mail_log_events = delete undelete expunge copy save mailbox_create
mailbox_delete mailbox_rename
  pop3_migration_mailbox = POP3-MIGRATION-NS/INBOX
  quota = dict:user::file:%h/mail/dovecot-quota
  quota_exceeded_message = Empfaenger Postfach ist voll (Mailbox Quota
Exceeded)
  quota_grace = 50M
  quota_warning = storage=95%% quota-warning 95 %u
  quota_warning2 = storage=80%% quota-warning 80 %u
  sieve = ~/sieve/active
  sieve_before = /etc/dovecot/sieve_before/movespamfolder.sieve
  sieve_dir = ~/sieve
  sieve_extensions = +notify -enotify +imapflags +vacation-seconds
  sieve_max_actions = 1000
  sieve_max_redirects = 1000
  sieve_vacation_max_period = 0
  sieve_vacation_min_period = 0
  zlib_save = gz
  zlib_save_level = 6
}
pop3_no_flag_updates = yes
pop3_uidl_format = %v.%u
pop3c_host = pop3.example.com
pop3c_master_user = master
pop3c_password = secret
protocols = imap pop3 lmtp sieve
service anvil {
  unix_listener anvil-auth-penalty {
mode = 00
  }
}
service auth {
  unix_listener auth-userdb {
mode = 0777
  }
}
service imap-login {
  process_limit = 3000
  process_min_avail = 16
  service_count = 0
}
service imap {
  process_limit = 10240
}
service lmtp {
  inet_listener lmtp {
port = 26
  }
}
service managesieve-login {
  inet_listener sieve_deprecated {
port = 2000
  }
}
service pop3-login {
  service_count = 0
}
service pop3 {
  process_limit = 10240
}
service quota-warning {
  executable = script /usr/local/bin/quota-warning.sh
  unix_listener quota-warning {
user = vmail
  }
}
ssl_cert = /etc/pki/dovecot/certs/dovecot.pem
ssl_key = /etc/pki/dovecot/private/dovecot.pem
syslog_facility = local0
userdb {
  driver = prefetch
}
userdb {
  args = /etc/dovecot/dovecot-ldap.conf.ext
  driver = ldap
}
protocol lmtp {
  mail_plugins = acl quota zlib mail_log notify sieve
}
protocol doveadm {
  mail_plugins = acl quota zlib mail_log notify pop3_migration
}
protocol lda {
  mail_plugins = acl quota zlib mail_log notify sieve
}
protocol imap {
  mail_max_userip_connections = 3789
  mail_plugins = acl quota zlib mail_log notify imap_acl imap_quota
}

-- 
Franz Knipp, +43 664 3980169
qnipp GmbH, Hauptstraße 54, 7064 Oslip, Österreich
http://qnipp.com   http://qnipp.com/qnipp.vcf


Re: IMAP sessions quit when calling MYRIGHTS on shared namespace

2014-06-25 Thread Franz Knipp
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Am 2014-06-25 09:21, schrieb Steffen Kaiser:
 the IMAP connection is dropped, when I call MYRIGHTS on the root
 of my shared folders.
 Did you've looked in your server log? You most likely got an abort
 or something like that.

You're right. So I enabled core dumps, this is the backtrace:

#0  0x7f6857da81c2 in acl_mailbox_get_aclobj (box=value optimized
out) at acl-mailbox.c:29
#1  0x7f6857b97f33 in cmd_myrights (cmd=0x13ca1f0) at
imap-acl-plugin.c:331
#2  0x0041709d in command_exec (cmd=0x13ca1f0) at
imap-commands.c:158
#3  0x00416150 in client_command_input (cmd=0x13ca1f0) at
imap-client.c:778
#4  0x0041624a in client_command_input (cmd=0x13ca1f0) at
imap-client.c:839
#5  0x004164bd in client_handle_next_command
(client=0x13c97d0) at imap-client.c:877
#6  client_handle_input (client=0x13c97d0) at imap-client.c:889
#7  0x0041682f in client_input (client=0x13c97d0) at
imap-client.c:931
#8  0x7f68589e62ee in io_loop_call_io (io=0x13ca100) at ioloop.c:441
#9  0x7f68589e7497 in io_loop_handler_run_internal (ioloop=value
optimized out) at ioloop-epoll.c:220
#10 0x7f68589e6379 in io_loop_handler_run (ioloop=0x13a4730) at
ioloop.c:488
#11 0x7f68589e63f8 in io_loop_run (ioloop=0x13a4730) at ioloop.c:465
#12 0x7f68589935d3 in master_service_run (service=0x13a45c0,
callback=value optimized out) at master-service.c:566
#13 0x00420088 in main (argc=1, argv=0x13a4390) at main.c:400

Hope this helps.

- -- 
Franz Knipp, +43 664 3980169
qnipp GmbH, Hauptstraße 54, 7064 Oslip, Österreich
http://qnipp.com   http://qnipp.com/qnipp.vcf
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlOqlN8ACgkQGRK+JW9GubbFiQCeMG711IR+4RayIpWq3KTpLCgk
W7EAoIu1hcYA5TG9I/y3VvYqOQHQX1TH
=jq3j
-END PGP SIGNATURE-