[Dovecot] v2.2.2 (e5bd0a7c6a1e) Core Dump

2013-06-07 Thread Thomas Leuxner
(gdb) bt full

#0  mailbox_list_default_get_vname (list=0x21ceec0, storage_name=0x0) at 
mailbox-list.c:655
__s2_len = 
i = 
prefix_len = 
name_len = 
vname = 0x0
list_sep = 
ns_sep = 
ret = 
#1  0x7fecd7cf4585 in acl_backend_vfile_get_local_dir (name=0x0, 
name@entry=0x7fecd7cfada8 "", backend=) at acl-backend-vfile.c:147
ns = 0x21ca6d0
list = 0x21ceec0
storage = 
type = 
dir = 
inbox = 
vname = 
error = 0x221a100 "\320\"\035\002"
#2  0x7fecd7cf470e in acl_backend_vfile_object_init (_backend=0x21d22d0, 
name=0x7fecd7cfada8 "") at acl-backend-vfile.c:195
_data_stack_cur_id = 6
backend = 0x21d22d0
aclobj = 0x221a100
dir = 
vname = 
#3  0x7fecd7cf3c8e in acl_backend_get_default_object 
(backend=backend@entry=0x21d22d0) at acl-backend.c:177
user = 0x21caeb0
ns = 0x21ca6d0
default_name = 
#4  0x7fecd7cf3cce in acl_backend_get_default_rights (backend=0x21d22d0, 
mask_r=mask_r@entry=0x7fffc5835d78) at acl-backend.c:184
aclobj = 
#5  0x7fecd7cf9c51 in acl_mailbox_try_list_fast (ctx=0x221b4b0) at 
acl-mailbox-list.c:107
alist = 0x21cf1a8
nonowner_list_ctx = 
ret = 
backend = 
idxp = 0x21cf278
acl_mask = 0x0
ns = 0x21ca6d0
update_ctx = {iter_ctx = 0x1, tree_ctx = 0x7fecd90aa548, glob = 0x6, 
leaf_flags = 35726664, parent_flags = 0, update_only = 0, match_parents = 0}
name = 
#6  acl_mailbox_list_iter_init (list=0x21ceec0, patterns=0x21d92f8, 
flags=49152) at acl-mailbox-list.c:194
_data_stack_cur_id = 5
alist = 0x21cf1a8
ctx = 0x221b4b0
pool = 
p = 
i = 
inboxcase = 
#7  0x7fecd8c0c09d in mailbox_list_iter_init_multiple (list=0x21ceec0, 
patterns=, flags=49152) at mailbox-list-iter.c:173
ctx = 
ret = 0
#8  0x7fecd8c0d35b in mailbox_list_ns_iter_try_next (info_r=, _ctx=0x21d9020) at mailbox-list-iter.c:574
ctx = 0x21d9020
info = 
errstr = 
has_children = 
ns = 
error = 4294967295
#9  mailbox_list_ns_iter_next (_ctx=0x21d9020) at mailbox-list-iter.c:645
info = 
#10 0x7fecd8c0bd17 in mailbox_list_iter_next_call (ctx=ctx@entry=0x21d9020) 
at mailbox-list-iter.c:941
info = 
set = 
#11 0x7fecd8c0c9a8 in mailbox_list_iter_next (ctx=0x21d9020) at 
mailbox-list-iter.c:1012
_data_stack_cur_id = 4
info = 
#12 0x0040f209 in cmd_list_continue (cmd=cmd@entry=0x21ddf40) at 
cmd-list.c:229
ctx = 0x21de188
info = 
flags = 
str = 0x21af518
mutf7_name = 0x21af668
name = 
ret = 
#13 0x0040fa4f in cmd_list_full (cmd=0x21ddf40, lsub=) 
at cmd-list.c:463
client = 
args = 0x21bab18
list_args = 0x21ddf40
arg_count = 
ctx = 0x21de188
patterns = {arr = {buffer = 0x21de1c8, element_size = 8}, v = 
0x21de1c8, v_modifiable = 0x21de1c8}
ref = 0x21de1b8 ""
pattern = 0x21de1c0 "%"
patterns_strarr = 0x21de200
str = 
#14 0x0041675c in command_exec (cmd=cmd@entry=0x21ddf40) at 
imap-commands.c:156
hook = 0x21b8d90
ret = 
#15 0x004157c0 in client_command_input (cmd=0x21ddf40) at 
imap-client.c:775
client = 0x21dd360
command = 
__FUNCTION__ = "client_command_input"
#16 0x0041587a in client_command_input (cmd=0x21ddf40) at 
imap-client.c:836
client = 0x21dd360
command = 
__FUNCTION__ = "client_command_input"
#17 0x00415b35 in client_handle_next_command (remove_io_r=, client=0x21dd360) at imap-client.c:874
No locals.
#18 client_handle_input (client=client@entry=0x21dd360) at imap-client.c:886
_data_stack_cur_id = 3
ret = 32
remove_io = false
handled_commands = false
__FUNCTION__ = "client_handle_input"
#19 0x00415ee2 in client_input (client=0x21dd360) at imap-client.c:928
cmd = 
output = 0x21ddd78
bytes = 19
__FUNCTION__ = "client_input"
#20 0x7fecd8922d06 in io_loop_call_io (io=0x21dde40) at ioloop.c:387
ioloop = 0x21b7720
t_id = 2
#21 0x7fecd8923b77 in io_loop_handler_run (ioloop=ioloop@entry=0x21b7720) 
at ioloop-epoll.c:215
ctx = 0x21b7a90
events = 0x21ca6d0
event = 0x21b7b00
list = 0x21dde90
io = 
tv = {tv_sec = 3, tv_usec = 876580}
events_count = 
msecs = 
ret = 1
i = 
call = 
__FUNCTION__ = "io_loop_handler_run"
#22 0x7fecd8922848 in io_loop_run (ioloop=0x21b7720) at ioloop.c:406
No locals.
#23 0x7fecd88d8b53 in master_service_run (service=0x21b75b0, 
callback=callback@entry=0x41ed00 ) at master-service.c:560
No locals.
#24 0x0040baf

Re: [Dovecot] v2.2.2 (e5bd0a7c6a1e) Core Dump

2013-06-07 Thread Thomas Leuxner
* Thomas Leuxner  2013.06.07 09:02:

> (gdb) bt full

Culprit in config being:

plugin {
  acl = vfile:/var/vmail/conf.d/%d/acls:cache_secs=300
}



signature.asc
Description: Digital signature


Re: [Dovecot] Dovecot and time (again)

2013-06-07 Thread Ben Morrow
At  9AM -0500 on  5/06/13 you (Rick Romero) wrote:
> I'm rehashing/reliving my issues from 2010:
> http://www.dovecot.org/list/dovecot/2010-October/053528.html
> 
> In short, when calling deliver from vdelivermail (or procmail), and
> delivering via NFS to Maildir, the timestamp on the file is GMT.  If
> procmail or vdelivermail completely handle the email, the timestamp is CST.
> The server is set to CST.

Um, the timestamp on a file doesn't have a timezone. It's a Unix time in
seconds since the epoch; any conversion to or from a human time with a
timestamp happens in the program reading or writing the timestamp. The
server being 'set to' CST doesn't actually mean anything very solid: it
just serves as a default timezone for processes that don't have TZ set.

> What's changed from the original issue? 
> Previously was running dovecot 1.x on FreeBSD, now 2.1.7 on Debian 7.   I
> know it's a few versions behind, but this is a deliver only server, and
> ChangeLog doesn't show too many fixes for lda.
> Of course, running the command from the command line works perfectly... So
> where could my problem reside?
> Two examples:
> 
> 1st via Calling from procmail:
> :0
> * ? test -f /usr/lib/dovecot/dovecot-lda
> {
> :0w
> |/usr/lib/dovecot/deliver -d $EXT@$HOST
> }
> 
> -rw---    1 vpopmail  vchkpw  87196 Jun  5 13:43
> 1370439849.M812P29560.smtp101,S=87196,W=88094

Well, that's certainly peculiar; the datestamp there resolves as 13.43
UTC or 8.44 CDT. Are you able to list the file's timestamp as a Unix
time, to compare with the timestamp in the filename? On my system I can
use 'ls -lD %s' but I don't know how portable that is. You might be able
to use stat(1).

How many machines are involved here? (Including the machine you ran that
'ls' from.) Are you running NTP, and do they all have their clocks
correct? AFAICT Dovecot only attempts to set the mtime for IMAP APPEND
and dsync; the LDA just opens the file and lets the OS set the
timestamp.

Are you able to temporarily change the procmail recipe to touch(1) a
file inside the maildir rather than making a proper delivery, just to
get some idea of where the problem might be?

> 2nd via Commandline:
> #sudo -u vpopmail cat /tmp/testmail.txt | /usr/lib/dovecot/deliver -d
> r...@havokmon.com
> 
> -rw---    1 vpopmail  vchkpw  27740 Jun  5 08:46
> 1370440001.M421646P29846.smtp101,S=27740,W=28243

I assume you ran that ls on the same machine and with the same
environment as the one above?

> I've thrown the TZ variable in the mix as well with no resolution
> |/usr/bin/env -i TZ=CST /usr/lib/dovecot/deliver -d $EXT@$HOST
> |/usr/bin/env -i TZ=America/Chicago /usr/lib/dovecot/deliver -d $EXT@$HOST

Given that LDA doesn't do any date parsing, it just handles dates as
Unix timestamps, I'd have been very surprised if that made any
difference.

Ben



Re: [Dovecot] Make install error

2013-06-07 Thread Ben Morrow
At  5PM +0800 on  4/06/13 you (kengheng) wrote:
> On 5/17/13 7:12 PM, Ben Morrow wrote:
> > At  5PM +0800 on 15/05/13 you (kengheng) wrote:
> >> On 4/24/13 11:50 PM, Ben Morrow wrote:
> >>>
> >>> These files should be installed under libexec; probably
> >>> /usr/local/dovecot/libexec/dovecot, though I'm not sure how autoconf
> >>> chooses the libexec directory when you're using an explicit prefix. What
> >>> do the following give you (in the top-level Dovecot source dir)?
> >>>
> >>>   grep ^libexecdir config.log
> >>>   grep ^exec_prefix config.log
> >>>   grep ^prefix config.log
> >> grep ^libexecdir config.log
> >> libexecdir='${exec_prefix}/lib'
> >>
> >> grep ^exec_prefix config.log
> >> exec_prefix='${prefix}'
> >>
> >> grep ^prefix config.log
> >> prefix='/usr/local/dovecot'
> > That's weird, and wrong. Also, I can't reproduce it; if I run
> >
> >  ./configure --prefix=/usr/local/dovecot
> >  grep ^libexec config.log
> >
> > in the 2.2.1 tarball I get
> >
> >  libexecdir='${exec_prefix}/libexec'
> >
> > as I would have expected. Are you sure you didn't pass a --libexecdir
> > argument to configure?
>
> Hi, yes, the configure without "--libexecdir" .
> 
> and i found this comment from config.log:
> | # If user did not specify libexecdir, set the correct target:
> | # Nor FHS nor openSUSE allow prefix/libexec. Let's default to prefix/lib.
> |
> | if test "$libexecdir" = '${exec_prefix}/libexec' ; then
> |   libexecdir='${exec_prefix}/lib'
> | fi

Since neither that comment nor that code appear anywhere in the Dovecot
2.2.1 tarball, I have to assume you're using a patched version from a
SRPM or something. It would have been helpful to mention that; also
helpful to try with the unpatched version before posting.

Whoever patched that code in either didn't understand that Dovecot needs
lib and libexec to be different, or had a workaround of some kind. I
would recommend using the real 2.2.1 sources from dovecot.org instead.

At  5PM +0800 on  4/06/13 you (kengheng) wrote:
> For your note, I'm installing dovecot on opensuse (32bits) 12.2 and 12.3 
> , both produced the same errors.

At  5PM +0800 on  4/06/13 you (kengheng) wrote:
> I've success installed it with a workaround:
> 
> 1) after error, create a folder /usr/local/dovecot/lib/dovecot/auth
> 2) make install again, and it will install the file auth at 
> /usr/local/dovecot/lib/dovecot/auth

That installation will not work, you've just tricked install(1) into
not giving you an error. Dovecot needs ${libexecdir}/dovecot/auth to be
an executable: it's one of the daemon processes, and if you've put a
directory there the exec will fail. Installing it to
${libexecdir}/dovecot/auth/auth instead won't help, since Dovecot won't
be looking for it there.

Ben



Re: [Dovecot] dovecot and time

2013-06-07 Thread Ben Morrow
At 11AM -0500 on  5/06/13 you (Rick Romero) wrote:
> I found something interesting via strace.  lda is writing a timestamp  
> with utime before doign the fsync, but I'm really not a C guy, so I  
> have no idea why that's going on via procmail and not via commandline.  
>   I assume it's related to the choice of pread64 vs read.
> 
> when called from commandline (working):
> 
> read(0, "July 14-20, 2013\n10 courses. Bon"..., 4096) = 4096
[...]
> open("/usr/home/vpopmail/domains/havokmon.com/rick/Maildir/tmp/1370448645.M589211P14191.smtp101",
>  O_WRONLY|O_CREAT|O_EXCL|O_TRUNC|O_LARGEFILE, 0777) =  
> 11
[...]
> 
> when called from procmail (not working):
> 
> pread64(10, "00.vfemail.net,S=10941\n968 W2552"..., 4064, 52993) = 4064
[...]
> open("/usr/home/vpopmail/domains/havokmon.com/rick/Maildir/tmp/1370449940.M313792P17436.smtp101",
> O_WRONLY|O_CREAT|O_EXCL|O_TRUNC|O_LARGEFILE, 0777) =  
> 11
[...]
> utime("/usr/home/vpopmail/domains/havokmon.com/rick/Maildir/tmp/1370449940.M313792P17436.smtp101",
>  [2013/06/05-16:32:20, 2013/06/05-21:32:18]) =  
[...]

Eeenteresting. The pread64 vs read is presumably because procmail is
passing lda a regular file on stdin rather than a pipe; you can't use
pread on a pipe. I wondered if maybe lda might be copying the timestamp
across from its input file, which it isn't, but while checking that I
found this (in src/lda/main.c):

/* If input begins with a From-line, drop it */
ret = i_stream_read_data(input, &data, &size, 5);
if (ret > 0 && size >= 5 && memcmp(data, "From ", 5) == 0) {
/* ... */
(void)mbox_from_parse(data, i, mtime_r, &tz,
  &sender);
/* ... */
}

which says to me that if lda is passed a mail starting with an
mbox-format From_ line, it will use the datestamp from that line rather
than the current time. Procmail likes to give things From_ lines, so
it's likely this is what's happening.

Can you add something to the procmail recipe to write the mail out
somewhere unmodified, to see whether procmail is writing the date out
wrong or dovecot is parsing it wrong? Presumably the timezone
information is getting screwed up somewhere; is procmail leaving it out
altogether, or maybe writing a named timezone (which Dovecot will
ignore, apparently)?

You may be able to help matters by running the whole delivery process
(both procmail and lda) with TZ=UTC (and probably LC_ALL=C for good
measure), just to try and get things to use machine-readable rather than
human-readable timestamp formats. You could also try head -n +1 | lda,
or something a little less crude.

Ben



[Dovecot] Dovecot IMAP

2013-06-07 Thread Alex Dubinin
This is my first experience of the mail server.
Set up a mail server from Postfix + Dovecot with the MySQL authorization.
When you create a new user dovecot makes strange folder structure: the
'inbox' contains 'juncus', 'tash', 'sent' etc.
ie 'sent' and other folders are subdir to the 'inbox'.

My result:

04 LIST "" "*"
* LIST (\HasChildren) "." "INBOX"
* LIST (\HasNoChildren) "." "INBOX.Trash"

I want:

04 LIST "" "*"
* LIST (\HasNoChildren) "." "INBOX"
* LIST (\HasNoChildren) "." "Trash"

# dovecot --version
2.1.7

# dovecot -n
# 2.1.7: /etc/dovecot/dovecot.conf
# OS: Linux 3.2.0-4-amd64 x86_64 Debian 7.0 ext4
auth_debug = yes
auth_debug_passwords = yes
auth_verbose = yes
auth_verbose_passwords = plain
base_dir = /run/dovecot/
debug_log_path = /var/vmail/dovecot.log
disable_plaintext_auth = no
info_log_path = /var/vmail/dovecot.log
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
listen = MY_IP
log_path = /var/vmail/dovecot.log
log_timestamp = "%Y-%m-%d %H:%M:%S "
login_greeting = MAIL_DOMAIN_NAME IMAP server ready.
mail_debug = yes
mail_location = maildir:/var/vmail/%d/%n/Maildir
mail_plugins = " quota"
namespace inbox {
hidden = no
inbox = yes
list = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Trash {
special_use = \Trash
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
prefix = INBOX.
separator = .
type = private
}
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
plugin {
quota = maildir:User quota
quota_rule = *:storage=1G
quota_rule2 = Trash:storage=+10%%
quota_rule3 = Junk:storage=+10%%
quota_rule4 = Drafts:storage=+10%%
quota_warning = storage=95%% quota-warning 95 %u
}
postmaster_address = admin@ MAIL_DOMAIN_NAME
protocols = " imap pop3"
service auth-worker {
executable = auth -w
unix_listener auth-worker {
group =
mode = 0600
}
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0660
user = postfix
}
unix_listener auth-master {
group = vmail
mode = 0600
user = vmail
}
unix_listener auth-userdb {
group =
mode = 0600
user =
}
user = root
}
service dict {
unix_listener dict {
group =
mode = 0600
user =
}
}
service imap-login {
inet_listener imap {
port = 0
}
inet_listener imaps {
port = 993
ssl = yes
}
process_min_avail = 0
service_count = 1
}
service imap {
unix_listener login/imap {
group =
mode = 0666
user =
}
}
service lmtp {
unix_listener lmtp {
group =
mode = 0666
user =
}
}
service pop3-login {
inet_listener pop3 {
port = 0
}
inet_listener pop3s {
port = 0
ssl = yes
}
}
service pop3 {
unix_listener login/pop3 {
group =
mode = 0666
user =
}
}
ssl = required
ssl_ca = 

signature.asc
Description: OpenPGP digital signature


Re: [Dovecot] Dovecot IMAP

2013-06-07 Thread Luca Fornasari
On Fri, Jun 7, 2013 at 9:23 AM, Alex Dubinin wrote:

> This is my first experience of the mail server.
> Set up a mail server from Postfix + Dovecot with the MySQL authorization.
> When you create a new user dovecot makes strange folder structure: the
> 'inbox' contains 'juncus', 'tash', 'sent' etc.
> ie 'sent' and other folders are subdir to the 'inbox'.
>
> My result:
>
> 04 LIST "" "*"
> * LIST (\HasChildren) "." "INBOX"
> * LIST (\HasNoChildren) "." "INBOX.Trash"
>
> I want:
>
> 04 LIST "" "*"
> * LIST (\HasNoChildren) "." "INBOX"
> * LIST (\HasNoChildren) "." "Trash"
>
> namespace inbox {
> hidden = no
> inbox = yes
> list = yes
> location =
> mailbox Drafts {
> special_use = \Drafts
> }
> mailbox Trash {
> special_use = \Trash
> }
> mailbox Junk {
> special_use = \Junk
> }
> mailbox Sent {
> special_use = \Sent
> }
>  prefix = INBOX.
> separator = .
> type = private
> }
>

You explicitly told Dovecot to ...
Luca


Re: [Dovecot] Dovecot IMAP

2013-06-07 Thread A.L.E.C
On 06/07/2013 09:23 AM, Alex Dubinin wrote:
> How to make the imap folders 'sent', 'trash' and others were not affiliated?

Remove this:

prefix = INBOX.

-- 
Aleksander 'A.L.E.C' Machniak
LAN Management System Developer [http://lms.org.pl]
Roundcube Webmail Developer  [http://roundcube.net]
---
PGP: 19359DC1 @@ GG: 2275252 @@ WWW: http://alec.pl


[Dovecot] per user quota in mysql

2013-06-07 Thread John Doe
Hello everybody,

I have set up dovecot to use ldap authentication and it works great.
I wonder if it is possible to use mysql for user quota and still keep my
ldap authentication.

Thank you!


[Dovecot] Question on Director setup

2013-06-07 Thread Joe Wong
Hello,

 I am following the wiki page to setup 2 IMAP servers Director. in each
server, I have created 2 sets of dovecot config file where

the first set is for imap proxy with director
the second set is for the imap backend

after this, I attempt to login IMAP through the imap-proxy on any machine
with several users. from the log, all users always go to the same IMAP
backend in Server 2, I don't see any user go to the IMAP backend in Server
1 at all. What could be the problem I have ?

- Joe