Re: Quota reporting

2014-10-30 Thread Steffen Kaiser

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wed, 29 Oct 2014, Hanns Mattes wrote:


AFAICS there's one issue left: Thunderbird and Kmail don't show the
quota status. Using doveadm quota the information is shown correctly,
even the user-specific values (coming from openldap) are set correctly.

I think, I miss something obvious ... (and besides quota - any
configuration hint is very welcome)

linux:/etc/dovecot # doveconf -n



protocol imap {
 mail_plugins =  quota zlib fts fts_lucene trash quota imap_quota
imap_zlib
}



Any ideas?


Looks like imap_quota is present. However:

a) did you reloaded Dovecot after config change?
b) in which conf-file did you've configured imap_quota and why quota is 
mentioned twice?


manual test:

telnet server 143
*1 login user pwd
*2 GETQUOTAROOT INBOX
*3 logout

Command 1 should include QUOTA in capability string, cmd #2 should 
return success. If this test succeeds, you have a MUA problem.


- -- 
Steffen Kaiser

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iQEVAwUBVFHnsHz1H7kL/d9rAQLxiAf/YtZIqMi2y7S7286r/sRUPxmi1af0rL6P
HrmXZDl5qayi9Pp0eFIVVkf1srSMflEya2sVUiKQKOxcHXiIa4xjLvky3TV59sP1
g4Kxw1FpaJ2pzFRpZxCjtmqr1+TTNazlG+Aj4pCptHljMlL7H2Jk9b57Gs8ysiTN
9HLFLWMQ/ETO7184Fe4evODirbPFfxxrSp599B3pC0dlE3/Ilce9jgLEGkh3XMWX
jNVxtg0DOEmhFh2einvJjEOniJjiAV522uPPsPGgCkMyYZUj/v6Y4PWc0ayEA97Q
bF8brGiFDpncQf77Z6kNDYFnfiv4aAhoC/II5DopEV+VthUZAilUiQ==
=h43a
-END PGP SIGNATURE-


Re: Quota reporting

2014-10-30 Thread Hanns Mattes
Hi

Am 30.10.2014 um 08:24 schrieb Steffen Kaiser:
 [quota not working]
 Looks like imap_quota is present. However:
 
 a) did you reloaded Dovecot after config change?

Yes

 b) in which conf-file did you've configured imap_quota 

The Plugin is listed in 20-imap.conf.

 and why quota is mentioned twice?

Accidentially added in 20-imap.conf after $mail_plugins

 
 manual test:
 
 telnet server 143
 *1 login user pwd

Quota is present

 *2 GETQUOTAROOT INBOX

OK No quota.

So it seems to be a problem with my configuration, not the MUA.

Any ideas?

Thanks in advance

Hanns


Re: Quota reporting

2014-10-30 Thread Hanns Mattes
Am 30.10.2014 um 09:39 schrieb Hanns Mattes:
 Hi
 
 Am 30.10.2014 um 08:24 schrieb Steffen Kaiser:
 [quota not working]

I've used prefetching with ldap. Turning it off, the quotas are
presented correctly. So the problem is somewhere in the prefetch-part of
my configuration.

Regards Hanns


Re: Quota reporting

2014-10-30 Thread Hanns Mattes
Hi,

answering myself...

Am 30.10.2014 um 10:21 schrieb Hanns Mattes:
 Am 30.10.2014 um 09:39 schrieb Hanns Mattes:
 Hi

 Am 30.10.2014 um 08:24 schrieb Steffen Kaiser:
 [quota not working]
 
 I've used prefetching with ldap. Turning it off, the quotas are
 presented correctly. So the problem is somewhere in the prefetch-part of
 my configuration.

Solved. I've missed a $ in the pass_attrs. Simple Typo...


Thanks to everyone

Hanns


Quota reporting

2014-10-29 Thread Hanns Mattes
Hi,

my main server will be upgraded from Dovecot 1.2something to 2.2. For
testing I've installed a setup with postfix, handing malis as a relay
via lmtp. So far it's up and running - really nice.

AFAICS there's one issue left: Thunderbird and Kmail don't show the
quota status. Using doveadm quota the information is shown correctly,
even the user-specific values (coming from openldap) are set correctly.

I think, I miss something obvious ... (and besides quota - any
configuration hint is very welcome)

linux:/etc/dovecot # doveconf -n
# 2.2.15: /etc/dovecot/dovecot.conf
# OS: Linux 3.7.10-1.40-desktop x86_64 openSUSE 12.3 (x86_64)
auth_master_user_separator = *
auth_mechanisms = plain login digest-md5 cram-md5 apop
auth_verbose = yes
mail_debug = yes
mail_location = maildir:~/Maildir
mail_plugins =  quota zlib fts fts_lucene trash
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope
encoded-character vacation subaddress comparator-i;ascii-numeric
relational regex imap4flags copy include variables body enotify
environment mailbox date ihave duplicate
namespace inbox {
  inbox = yes
  location =
  mailbox Drafts {
auto = subscribe
special_use = \Drafts
  }
  mailbox Sent {
auto = subscribe
special_use = \Sent
  }
  mailbox Sent Messages {
special_use = \Sent
  }
  mailbox Trash {
auto = subscribe
special_use = \Trash
  }
  prefix =
}
passdb {
  args = /etc/dovecot/master-users
  driver = passwd-file
  master = yes
  pass = yes
}
passdb {
  args = /etc/dovecot/dovecot-ldap.conf.ext
  driver = ldap
}
plugin {
  fts_autoindex = yes
  fts_lucene = whitespace_chars=@.
  quota = maildir:User quota
  quota_exceeded_message = Storage quota for this account has been
exceeded, please try again later.
  quota_grace = 100M
  quota_rule = *:storage=1000M
  quota_rule2 = Trash:storage=+10%%
  quota_warning = storage=95%% quota-warning 95 %u
  quota_warning2 = storage=80%% quota-warning 80 %u
  quota_warning3 = storage=75%% quota-warning 75 %u
  sieve = ~/.dovecot.sieve
  sieve_dir = ~/sieve
  sieve_max_redirects = 32
  trash = /etc/dovecot/dovecot-trash.conf.ext
  zlib_save = gz
  zlib_save_level = 6
}
postmaster_address = ad...@93er.net
protocols = imap pop3 lmtp sieve
service auth {
  unix_listener /var/spool/postfix/private/auth {
mode = 0666
  }
}
service imap-login {
  inet_listener imap {
port = 143
  }
  inet_listener imaps {
port = 993
ssl = yes
  }
}
service lmtp {
  inet_listener lmtp {
address = 127.0.0.1
port = 24
  }
  user = vmail
}
service managesieve-login {
  inet_listener sieve {
port = 4190
  }
  inet_listener sieve_deprecated {
port = 2000
  }
}
service pop3-login {
  inet_listener pop3 {
port = 110
  }
  inet_listener pop3s {
port = 995
ssl = yes
  }
}
service quota-warning {
  executable = script /usr/local/bin/quota-warning.sh
  user = vmail
}
ssl_cert = /etc/dovecot/brueckokomplett2014.crt
ssl_key = /etc/dovecot/brueckofrei2014.key
userdb {
  driver = prefetch
}
userdb {
  args = /etc/dovecot/dovecot-ldap.conf.ext
  driver = ldap
}
verbose_proctitle = yes
protocol lmtp {
  mail_plugins =  quota zlib fts fts_lucene trash quota sieve
}
protocol lda {
  mail_plugins =  quota zlib fts fts_lucene trash
}
protocol imap {
  mail_plugins =  quota zlib fts fts_lucene trash quota imap_quota
imap_zlib
}


here is dovecot-ldap.conf.ext:

hosts = 127.0.0.1 192.168.0.1
dn = cn=Manager,dc=dies,dc=jenes
dnpass = ganzgeheim
auth_bind = no
base = ou=virtualmail,dc=dies,dc=jenes
scope = subtree
user_attrs =
homeDirectory=home,uidNumber=uid,gidNumber=gid,quota=quota_rule=*:\
storage=%$M
user_filter = ((objectClass=CourierMailAccount)(uid=%u))
pass_attrs =
uid=user,userPassword=password,homeDirectory=userdb_home,uidNumber\
=userdb_uid,gidNumber=userdb_gid,quota=userdb_quota_rule=*:storage=%M
pass_filter = ((disableimap=FALSE)(objectClass=CourierMailAccount)(uid=%u))
iterate_attrs = uid=user
iterate_filter = (objectClass=CourierMailAccount)
default_pass_scheme = PLAIN

Any ideas?

Thanks in advance

regards

Hanns


Re: [Dovecot] question about rpc quota reporting 1.2.11

2010-06-11 Thread Timo Sirainen
On ke, 2010-06-09 at 18:10 -0700, Tom Lieuallen wrote:
 Jun 09 17:47:11 IMAP(toml): Error: open(/nfs/farm/u3/quotas) failed: 
 Permission denied

This should help: http://hg.dovecot.org/dovecot-1.2/rev/edc7da213d4c




Re: [Dovecot] question about rpc quota reporting 1.2.11

2010-06-11 Thread Tom Lieuallen

yes, that seems to have done the trick.

thank you

Tom Lieuallen

On 6/11/10 7:57 AM, Timo Sirainen wrote:

On ke, 2010-06-09 at 18:10 -0700, Tom Lieuallen wrote:

Jun 09 17:47:11 IMAP(toml): Error: open(/nfs/farm/u3/quotas) failed:
Permission denied


This should help: http://hg.dovecot.org/dovecot-1.2/rev/edc7da213d4c



Re: [Dovecot] question about rpc quota reporting 1.2.11

2010-06-09 Thread Tom Lieuallen



On 5/28/10 8:53 AM, Timo Sirainen wrote:

On Thu, 2010-05-27 at 09:10 -0700, Tom Lieuallen wrote:

I'm getting the same type of error with the quota2 line now:
open(/nfs/rack/u4/quotas) failed: Permission denied

Since the home directory quota worked without the plugin configuration,
my guess is that the plugin config is not using rpc.  I can't find any
way to force it to use rpc.  Again, if I make that 'quotas' file world
readable (which I believe isn't good practice), dovecot stops complaining.


Dovecot first finds the mountpoint and then gets its filesystem. If it's
nfs, it uses rquota, otherwise local quota. You could enable
mail_debug=yes and see what mountpoints Dovecot finds and then see if
their type is nfs or something else. Also this would make checking the
type (correctly) even easier:
http://hg.dovecot.org/dovecot-1.2/rev/eaba4cfeaa44



again, my quota config is this:

  quota = fs:INBOX:mount=/a1
  quota2 = fs:Home quota:mount=%h

When I modified the quota-fs.c file, recompiled, and ran in mail_debug 
mode, I get messages like this:


Jun 09 17:47:11 IMAP(toml): Info: Effective uid=5113, gid=5094, 
home=/nfs/farm/u3/t/toml
Jun 09 17:47:11 IMAP(toml): Info: Quota root: name=INBOX backend=fs 
args=mount=/a1
Jun 09 17:47:11 IMAP(toml): Info: Quota root: name=Home quota backend=fs 
args=mount=/nfs/farm/u3/t/toml
Jun 09 17:47:11 IMAP(toml): Info: Namespace: type=private, prefix=, 
sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes
Jun 09 17:47:11 IMAP(toml): Info: mbox: 
data=~/mail:INBOX=/var/mail/toml:INDEX=/a2/imap-index/toml
Jun 09 17:47:11 IMAP(toml): Info: fs: root=/nfs/farm/u3/t/toml/mail, 
index=/a2/imap-index/toml, control=, inbox=/var/mail/toml
Jun 09 17:47:11 IMAP(toml): Info: fs quota add storage dir = 
/nfs/farm/u3/t/toml/mail
Jun 09 17:47:11 IMAP(toml): Info: fs quota block device = 
stak.engr.oregonstate.edu:/farm-u3

Jun 09 17:47:11 IMAP(toml): Info: fs quota mount point = /nfs/farm/u3
Jun 09 17:47:11 IMAP(toml): Info: fs quota mount type = nfs
Jun 09 17:47:11 IMAP(toml): Error: open(/nfs/farm/u3/quotas) failed: 
Permission denied


(after checking quota on a folder in my home directory from thunderbird...)

Jun 09 17:47:11 IMAP(toml): Info: quota-fs: 
host=stak.engr.oregonstate.edu, path=/farm-u3, uid=5113, bytes
Jun 09 17:47:12 IMAP(toml): Info: quota-fs: uid=5113, value=3105161216, 
limit=409600, active=1



That is the correct quota for my home dir, so it did query via rquota 
eventually.  There just seems to be something happening at login (at 
least) where it is trying via the file system first, even though it 
shouldn't.


thank you

Tom Lieuallen


Re: [Dovecot] question about rpc quota reporting 1.2.11

2010-05-28 Thread Timo Sirainen
On Thu, 2010-05-27 at 09:10 -0700, Tom Lieuallen wrote:
 I'm getting the same type of error with the quota2 line now:
open(/nfs/rack/u4/quotas) failed: Permission denied
 
 Since the home directory quota worked without the plugin configuration, 
 my guess is that the plugin config is not using rpc.  I can't find any 
 way to force it to use rpc.  Again, if I make that 'quotas' file world 
 readable (which I believe isn't good practice), dovecot stops complaining.

Dovecot first finds the mountpoint and then gets its filesystem. If it's
nfs, it uses rquota, otherwise local quota. You could enable
mail_debug=yes and see what mountpoints Dovecot finds and then see if
their type is nfs or something else. Also this would make checking the
type (correctly) even easier: 
http://hg.dovecot.org/dovecot-1.2/rev/eaba4cfeaa44




[Dovecot] question about rpc quota reporting 1.2.11

2010-05-27 Thread Tom Lieuallen

Timo, thank you for the reply to my question about shared folders yesterday.

I'm now trying to get quota reporting working consistently.  This is 
with dovecot 1.2.11 in solaris 10 sparc.  We have local quotas for the 
mail spool (/a1) and quotas for home directories.  All are UFS and have 
rpc (rquota) working fine.


With just this:

protocol imap {
  mail_plugins = quota imap_quota
}

My mail client (thunderbird 3.0.4) reported the home directory quota.

So then I added this:

plugin {
  quota = fs:INBOX:mount=/a1
  quota2 = fs:Home:mount=%h
}

First, I had to make /a1/quotas world readable, otherwise I'd get this 
error:


  open(/a1/quotas) failed: Permission denied

I'm getting the same type of error with the quota2 line now:
  open(/nfs/rack/u4/quotas) failed: Permission denied

Since the home directory quota worked without the plugin configuration, 
my guess is that the plugin config is not using rpc.  I can't find any 
way to force it to use rpc.  Again, if I make that 'quotas' file world 
readable (which I believe isn't good practice), dovecot stops complaining.


Also, what should I expect to see on the client?  Will dovecot report 
only one quota (the one that's closer to the limit), or will it report 
both?  I've only seen the first quota in thunderbird, but that could 
easily be a client issue.


thank you

Tom Lieuallen
Oregon State University


Re: [Dovecot] Maildir quota reporting

2009-09-21 Thread David Kmoch
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thanks for a kick in the right direction ;)

command

echo 1 getquotaroot inbox | USER=foo dovecot --exec-mail imap

doesn't work as expected

( HOME=/home/foo; USER=foo; echo 1 getquotaroot inbox | dovecot
- --exec-mail imap )

works much better

Now, with
  quota_rule = ?:storage=0

and a test user with maildirsize content
  102400S:

the above command shows

* PREAUTH [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOG reportsIN-REFERRALS
ID ENABLE SORT THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE
CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC
ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH QUOTA] Logged in as foo
* QUOTAROOT inbox User quota
* QUOTA User quota (STORAGE 0 100)
1 OK Getquotaroot completed.

result of that command in dovecot log with mail_debug = yes

ubik IMAP(foo): : Loading modules from directory: /usr/lib/dovecot/imap
ubik IMAP(foo): : Module loaded: /usr/lib/dovecot/imap/lib10_quota_plugin.so
ubik IMAP(foo): : Module loaded:
/usr/lib/dovecot/imap/lib11_imap_quota_plugin.so
ubik IMAP(foo): : Effective uid=0, gid=0, home=/home/foo
ubik IMAP(foo): : Quota root: name=User quota backend=maildir args=
ubik IMAP(foo): : Quota rule: root=User quota mailbox=? bytes=0 messages=0
ubik IMAP(foo): : maildir: data=/home/foo/Maildir
ubik IMAP(foo): : maildir++: root=/home/foo/Maildir, index=, control=,
inbox=/home/foo/Maildir
ubik IMAP(foo): : Namespace : Using permissions from /home/foo/Maildir:
mode=0700 gid=-1
ubik IMAP(foo): : Connection closed bytes=21/383

Is it OK, that bytes=0 is reported?


Timo Sirainen napsal(a):
 On Thu, 2009-09-03 at 10:57 +0200, David Kmoch wrote:
 and start dovecot again. The same result - TB still reports 20GB quota
 for user foo, the above echo command still reports 20971520, but(!),
 quota is actually unlimited for anyone. When I set some limit in
 ~foo/Maildir/maildirsize now, same values 20971520) are reported,
 although the limit works!
 
 Something weird is going on. What does it log about quota with
 mail_debug=yes?
 
 Finally, the question ;-) Where does that value (20971520) come from? Is
 it a feature or a bug?
 
 It's not a hard coded value for sure. Maybe it's reading a different
 maildirsize file. Maybe you have quota_rule=*:storage=20G coming from
 somewhere else.
 

- --

David Kmoch
Technical University of Liberec
Department of Applied Informatics
Halkova 6, 461 17 Liberec

tel: +420 485 353 633
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkq3SPoACgkQsUUM+N2AWobH6QCcCj/nvlWidqmf6h+tyYNo90cN
EigAnjLMK82jF8ysCyQ0tlblVpRPH1DQ
=s1V3
-END PGP SIGNATURE-


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [Dovecot] Maildir quota reporting

2009-09-21 Thread Timo Sirainen

On Sep 21, 2009, at 12:35 PM, David Kmoch wrote:

ubik IMAP(foo): : Quota rule: root=User quota mailbox=? bytes=0  
messages=0

..

Is it OK, that bytes=0 is reported?


Yes, because it hasn't yet read maildirsize at that point.


[Dovecot] Odd/Incorrect Quota Reporting on Dovecot 1.2.4 FreeBSD4

2009-09-09 Thread Siraj 'Sid' Rakhada
Hi,

Am seeing an odd problem on an old FreeBSD 4.11 box that I'm trying to
get courier off, and dovecot on. At the same time, I'm trying to put
some fairly simple quota support on, but getting very odd results.

I think it might be better described with the log below, but, the gist
of it is this:

I have set a 1GB quota, and I was getting intermittent reports on the
quota usage - sometimes at the correct usage (300MB or so), and then
at some crazy amount over the quota usage. I can get it to be
consistently incorrect though, as displayed with the below log.

The maildirsize is correct, and matches closely to 'du' output, it's
simply coming through incorrect on IMAP. It also only seems to happen
if the maildirsize is not created before the first 'getquota[root]'
command occurs.

I think it's something to do with dovecot + FreeBSD (at least, this
version)! I've done a quick test on a Debian box, and I don't have the
same problem.

Anyone else have any ideas what could be going wrong on this FreeBSD
box? Is it worth me giving the dovecot -n output at this stage?
It happens on different mailboxes too, this is just a sample.

Thanks!

- information  log follow

# /usr/local/dovecot/sbin/dovecot --version
1.2.4

# uname -a
FreeBSD server1.domain 4.11-RELEASE-p13 FreeBSD 4.11-RELEASE-p13 #5:
Wed Oct 12 18:02:46 BST 2005
r...@server1.domain:/usr/obj/build/src/sys/FBSD410RELENG  i386

# cat maildirsize
1073741824S
304806180 16002

Attempt 1:
. OK Capability completed.
a login s...@domain test
a OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE
SORT THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN
NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH
ESORT SEARCHRES WITHIN CONTEXT=SEARCH QUOTA] Logged in
a getquotaroot inbox
* QUOTAROOT inbox User Quota
* QUOTA User Quota (STORAGE 117738174 1048576)
a OK Getquotaroot completed.
a logout
* BYE Logging out
a OK Logout completed.
closed

Attempt 2:
(on server do 'rm maildirsize')

. OK Capability completed.
a login s...@domain test
a OK [snip] Logged in
a getquotaroot inbox
* QUOTAROOT inbox User Quota
* QUOTA User Quota (STORAGE 117738174 1048576)
a OK Getquotaroot completed.

(on server, do 'rm maildirsize' again, while still connected, the
first 'getquotaroot' is incorrect, as it seems dovecot regenerates the
maildirsize file on login, hence the 'rm')

a getquotaroot inbox
* QUOTAROOT inbox User Quota
* QUOTA User Quota (STORAGE 297662 1048576)
a OK Getquotaroot completed.
a getquotaroot inbox
* QUOTAROOT inbox User Quota


Re: [Dovecot] Odd/Incorrect Quota Reporting on Dovecot 1.2.4 FreeBSD4

2009-09-09 Thread Siraj 'Sid' Rakhada
Ack! The bottom of my log was truncated - but not by much, here is all
that was skipped:

(on server, do 'rm maildirsize' again, while still connected, the
first 'getquotaroot' is incorrect, as it seems dovecot regenerates the
maildirsize file on login, hence the 'rm')

a getquotaroot inbox
* QUOTAROOT inbox User Quota
* QUOTA User Quota (STORAGE 297662 1048576)
a OK Getquotaroot completed.
a getquotaroot inbox
* QUOTAROOT inbox User Quota
* QUOTA User Quota (STORAGE 297662 1048576)
a OK Getquotaroot completed.
a logout
* BYE Logging out
a OK Logout completed.
closed

If reconnecting, the same error occurs as Attempt 1 above.


Re: [Dovecot] Maildir quota reporting

2009-09-09 Thread Timo Sirainen
On Thu, 2009-09-03 at 10:57 +0200, David Kmoch wrote:
 and start dovecot again. The same result - TB still reports 20GB quota
 for user foo, the above echo command still reports 20971520, but(!),
 quota is actually unlimited for anyone. When I set some limit in
 ~foo/Maildir/maildirsize now, same values 20971520) are reported,
 although the limit works!

Something weird is going on. What does it log about quota with
mail_debug=yes?

 Finally, the question ;-) Where does that value (20971520) come from? Is
 it a feature or a bug?

It's not a hard coded value for sure. Maybe it's reading a different
maildirsize file. Maybe you have quota_rule=*:storage=20G coming from
somewhere else.



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


Re: [Dovecot] Odd/Incorrect Quota Reporting on Dovecot 1.2.4 FreeBSD4

2009-09-09 Thread Timo Sirainen
On Wed, 2009-09-09 at 15:07 +0100, Siraj 'Sid' Rakhada wrote:
 Am seeing an odd problem on an old FreeBSD 4.11 box that I'm trying to
 get courier off, and dovecot on. At the same time, I'm trying to put
 some fairly simple quota support on, but getting very odd results.

My guess is that this code doesn't work correctly in
src/plugins/quota/quota-maildir.c:

if (sscanf(*lines, %lld %d, bytes_diff, count_diff) != 2)
return -1;

You could try if the attached patch fixes it for you.

diff -r b359aac78f92 src/plugins/quota/quota-maildir.c
--- a/src/plugins/quota/quota-maildir.c	Wed Sep 09 00:50:16 2009 -0400
+++ b/src/plugins/quota/quota-maildir.c	Wed Sep 09 17:06:20 2009 -0400
@@ -441,7 +441,7 @@
 {
 	struct quota_root *_root = root-root;
 	uint64_t message_bytes_limit, message_count_limit;
-	long long bytes_diff, total_bytes;
+	long bytes_diff, total_bytes;
 	int count_diff, total_count;
 	unsigned int line_count = 0;
 
@@ -480,7 +480,7 @@
 	/* rest of the lines contains bytes count diffs */
 	total_bytes = 0; total_count = 0;
 	for (lines++; *lines != NULL; lines++, line_count++) {
-		if (sscanf(*lines, %lld %d, bytes_diff, count_diff) != 2)
+		if (sscanf(*lines, %ld %d, bytes_diff, count_diff) != 2)
 			return -1;
 
 		total_bytes += bytes_diff;


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


[Dovecot] Maildir quota reporting

2009-09-03 Thread David Kmoch
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I'm little confused with the way dovecot (1.2.4) is reporting quota.

with this config

protocols: imaps
ssl: required
ssl_ca_file: /root/cert/CA_Bundle_Trans.crt
ssl_cert_file: /root/cert/mails.crt
ssl_key_file: /root/cert/mails-key.pem.rsa
disable_plaintext_auth: yes
login_dir: /var/run/dovecot/login
login_executable: /usr/libexec/dovecot/imap-login
mail_location: maildir:%h/Maildir
mail_debug: yes
mail_plugins: quota imap_quota
lda:
  postmaster_address: postmas...@example.com
  mail_plugins: quota cmusieve
  mail_plugin_dir: /usr/lib/dovecot/lda
auth default:
  mechanisms: plain login
  passdb:
driver: pam
  userdb:
driver: passwd
plugin:
  quota: maildir:User quota
  quota_rule: ?:storage=20G
  sieve: ~/.dovecot.sieve

everything works fine. TB says, there 20G quota. Command

  echo 1 GETQUOTAROOT INBOX | USER=foo dovecot --exec-mail imap

reports

  * QUOTAROOT INBOX User quota
  * QUOTA User quota (STORAGE 0 20971520)
  1 OK Getquotaroot completed.

Now I change the first line in foo's maildirsize file to 0S to allow
unlimited quota. Then I boost it's size to force recalculation (just to
be sure)

dd if=/dev/zero bs=1k count=6  ~foo/Maildir/maildirsize

- From now, TB still reports 20GB quota for user foo, the above echo
command still reports 20971520, but(!), quota is actually unlimited for
user foo.

OK, now I stop dovecot, delete maildirsize, change line in dovecot.conf

  quota_rule = ?:storage=0

and start dovecot again. The same result - TB still reports 20GB quota
for user foo, the above echo command still reports 20971520, but(!),
quota is actually unlimited for anyone. When I set some limit in
~foo/Maildir/maildirsize now, same values 20971520) are reported,
although the limit works!

Looks like LDA (deliver) works fine, but imap_quota plugin is doing
something weird.

Finally, the question ;-) Where does that value (20971520) come from? Is
it a feature or a bug?

- --

David Kmoch
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqfhQoACgkQsUUM+N2AWobj7ACgh3yCU9LVfe1Pp2lO0nBG9iKf
zbgAn15UvkVM0AeCxaUlDeYgFu++8TOn
=CAoG
-END PGP SIGNATURE-


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [Dovecot] quota reporting and mail.app

2007-09-20 Thread Mike Horwath
On Wed, Sep 19, 2007 at 06:54:39PM -0400, Benjamin R. Haskell wrote:
 As Rich mentioned, it appears to be a Mail.app issue with the empty-string 
 QUOTAROOT name.
 
 There's a FIXME in the dovecot source regarding this:
 
 root = quota_root_init(setups[0], ); /* FIXME: name? */
 
 See attached patch (against 1.0.3, but from hg.dovecot.org, seems to still 
 be valid) for a workaround. It causes dovecot to use a default QUOTAROOT 
 name of DEFAULT. [ I left the /*FIXME*/, since I'm not Timo. :-) ]

Interesting, thanks!

-- 
Mike Horwath[EMAIL PROTECTED]
 ipHouse - Welcome home!


Re: [Dovecot] quota reporting and mail.app

2007-09-20 Thread Mike Horwath
On Thu, Sep 20, 2007 at 05:10:18PM +0300, Timo Sirainen wrote:
 On Wed, 2007-09-19 at 18:54 -0400, Benjamin R. Haskell wrote:
  There's a FIXME in the dovecot source regarding this:
  
  root = quota_root_init(setups[0], ); /* FIXME: name? */
 
 I used an empty name because some other server did the same thing.
 Anyway quota-rewrite patch and v1.1 support naming quota roots in config
 file.

Cool!

This is production stuff so I will hold off on 1.1 anything until later.

-- 
Mike Horwath[EMAIL PROTECTED]
 ipHouse - Welcome home!


Re: [Dovecot] quota reporting and mail.app

2007-09-19 Thread Benjamin R. Haskell

On Wed, 19 Sep 2007, Mike Horwath wrote:


On Wed, Sep 19, 2007 at 02:59:18PM -0700, Rich at Whidbey Telecom wrote:

If I remember right, this is a known issue, where Mail.app won't
report the quota when QUOTAROOT is .  We've found no fix for it
here as it seems to be a Mail.app issue.


That's my guess as well, but after checking another IMAP server
(Communigate Pro), it returns a filled in string as well (#Account).

I don't have any UW-imap servers to touch, though :(

So, Courier-IMAP and Communigate Pro both return a filled in string
(though values are different), and Dovecot does not.

back to RFC hunting


What's to hunt?

http://tools.ietf.org/html/rfc2087#section-4.3

RFC 2087 is the IMAP4 QUOTA extension. Section 4.3 has a pretty clear 
example of a GETQUOTAROOT command and its response. Dovecot's response is 
nearly verbatim.


As Rich mentioned, it appears to be a Mail.app issue with the empty-string 
QUOTAROOT name.


There's a FIXME in the dovecot source regarding this:

root = quota_root_init(setups[0], ); /* FIXME: name? */

See attached patch (against 1.0.3, but from hg.dovecot.org, seems to still 
be valid) for a workaround. It causes dovecot to use a default QUOTAROOT 
name of DEFAULT. [ I left the /*FIXME*/, since I'm not Timo. :-) ]


Best,
Bendiff -ur dovecot-1.0.3-orig/src/plugins/quota/quota.c 
dovecot-1.0.3-patched/src/plugins/quota/quota.c
--- dovecot-1.0.3-orig/src/plugins/quota/quota.c2007-07-30 
02:14:41.0 -0400
+++ dovecot-1.0.3-patched/src/plugins/quota/quota.c 2007-09-19 
18:42:38.0 -0400
@@ -180,7 +180,7 @@
/* create a new quota root for the storage */
struct quota_root *root;
 
-   root = quota_root_init(setups[0], ); /* FIXME: name? */
+   root = quota_root_init(setups[0], DEFAULT); /* FIXME: name? */
found = quota_mail_storage_add_root(storage, root);
i_assert(found);
}