Re: acl and lazy_expunge plugins are incompatible?

2015-04-24 Thread Giedrius Liubavičius
Hello,
as i've already sent it few times: it works... but with minor
patching (dirty patch bellow)

Keep in mind, that for using this patch to work, you should add
*lazy_expunge_ignore_namespace_not_found* parameter to your configuration.
My own configuration below:
> plugin {
> lazy_expunge = .EXPUNGED/
> lazy_expunge_ignore_namespace_not_found = TRUE
> }


 Patch:
> diff -C3 -d -p -r -xMakefile -x.deps -x.libs -x.lo -x.o
> ../dovecot/src/plugins/lazy-expunge/lazy-expunge-plugin.c
> ./src/plugins/lazy-expunge/lazy-expunge-plugin.c
> *** ../dovecot/src/plugins/lazy-expunge/lazy-expunge-plugin.c   
> 2014-04-15 18:11:56.0 +0300
> --- ./src/plugins/lazy-expunge/lazy-expunge-plugin.c2014-06-28
> 19:05:59.269530965 +0300
> *** struct lazy_expunge_mail_user {
> *** 34,39 
> --- 34,40 
> struct mail_namespace *lazy_ns;
> const char *env;
> bool copy_only_last_instance;
> +   bool ignore_namespace_notfound;
>   };
>  
>   struct lazy_expunge_mailbox_list {
> *** lazy_expunge_mail_namespaces_created(str
> *** 420,428 
> if (luser == NULL)
> return;
>  
> luser->lazy_ns = mail_namespace_find_prefix(namespaces,
> luser->env);
> !   if (luser->lazy_ns == NULL)
> !   i_fatal("lazy_expunge: Unknown namespace: '%s'",
> luser->env);
> mail_namespace_ref(luser->lazy_ns);
>  
> /* we don't want to override this namespace's expunge
> operation. */
> --- 421,447 
> if (luser == NULL)
> return;
>  
> +   if (namespaces->user && namespaces->user->mail_debug){
> +   struct mail_namespace *ns;
> +   int envl = strlen(luser->env);
> +   for(ns = namespaces; ns != NULL; ns=ns->next){
> +   i_warning("LAZY_EXPUNGE[%u|%s]: p%u|%s[%u], u(%s;%s)
> o(%s;%s)",
> +   envl, luser->env,
> +   ns->prefix_len, ns->prefix, ns->type,
> +   ns->user->username,  ns->user->_home,
> +   ns->owner?ns->owner->username:NULL,
> ns->owner?ns->owner->_home:NULL
> +   );
> +   }
> +   i_warning("LAZY_EXPUNGE[%u|%s]: _
> LIST ENDS __", envl, luser->env);
> +   }
> luser->lazy_ns = mail_namespace_find_prefix(namespaces,
> luser->env);
> !   if (luser->lazy_ns == NULL){
> !   if (luser->ignore_namespace_notfound){
> !   i_warning("lazy_expunge: Unknown namespace: '%s'",
> luser->env);
> !   return;
> !   }else
> !   i_fatal("lazy_expunge: Unknown namespace: '%s'",
> luser->env);
> !   }
> mail_namespace_ref(luser->lazy_ns);
>  
> /* we don't want to override this namespace's expunge
> operation. */
> *** static void lazy_expunge_mail_user_creat
> *** 455,460 
> --- 474,481 
> luser->env = env;
> luser->copy_only_last_instance =
> mail_user_plugin_getenv(user,
> "lazy_expunge_only_last_instance") != NULL;
> +   luser->ignore_namespace_notfound =
> +   mail_user_plugin_getenv(user,
> "lazy_expunge_ignore_namespace_not_found") != NULL;
>  
> MODULE_CONTEXT_SET(user,
> lazy_expunge_mail_user_module, luser);
> } else if (user->mail_debug) {


2015.04.24 10:59, Paolo Cravero rašė:
> Hello.
>
> Before going into deep testing of 2.2.16 (clean install tbd), I would like
> to know if someone is using succesfully both ACL and Lazy_expunge plugins.
> Perhaps I had a config error?
>
> Thanks,
> Paolo
>
>> Il 3 marzo 2015 alle 16.36 Paolo Cravero  ha
>> scritto:
>>
>>
>> Hello list.
>> Following two previous unanswered requests
>> (http://www.dovecot.org/list/dovecot/2014-August/097449.html and
>> http://www.dovecot.org/list/dovecot/2014-May/096261.html), I fell into the
>> same problem: ACL and lazy_expunge plugins do not work together.
>>
>> I had lazy_expunge enabled working OK. Then I activated ACL plugin, and
>> gave
>> dovecot.2 visibily over paolo.cravero's Inbox: the IMAP connection fails
>> on
>> server-side. Relevant debug log is:
>>
>> Mar 3 15:59:02 tst-msg03 dovecot: imap(doveco...@csi.it): Debug: Quota
>> grace: root=User quota bytes=576716800 (10%)
>> Mar 3 15:59:02 tst-msg03 dovecot: imap(doveco...@csi.it): Debug: dict
>> quota: user=paolo.crav...@csi.it,
>> uri=file:/maildata1/home/csi.it/p/paolo.cravero/dovecot-quota,
>> noenforcing=0
>> Mar 3 15:59:02 tst-msg03 dovecot: imap(doveco...@csi.it): Debug: fs:
>> root=/maildata1/main/csi.it/p/paolo.cravero,
>> index=/maildata1/indexes/csi.it/p/paolo.cravero, indexpvt=, control=,
>> inbox=, alt=/maildata1/altstorage/csi.it/p/paolo.cravero
>> Mar 3 15:59:02 tst-msg03 dovecot: imap(doveco...@csi.it): Debug: acl:
>> initializing backend with data: vfile
>> Mar 3 15:59:02 tst-msg03 dovecot: imap(doveco...@csi.it)

Re: Shared folders not listed by IMAP

2014-07-02 Thread Giedrius Liubavičius
OK,
This is the problem why your configuration is not working. My shared
folder did not work up until I fixed auth-userdb permissions in a way
 so that user my A (not dovecot user) [t...@mydomain.pl in your
case] could connect to it and get info about user B [te...@mydomain.pl
in your case]

Just change the auth-userdb file location (and probably permissions)
or duplicate it to real root location.
either from within configuration files or just as a plain symlink
(maybe pre-login script ?)
   
2014.07.02 19:03, Bambero rašė:
> But the problem is that I can't see shared folders to subscribe (shared by
> other users) while connecting via IMAP.
>
> There is also an error:
> Error: userdb lookup: connect(/var/dovecot/auth-userdb) failed: No such
> file or directory
>
> Probably becouse of chroot (/var/mail).
>
>
> On Wed, Jul 2, 2014 at 1:29 PM, Giedrius Liubavičius  wrote:
>
>> Hi,
>> doveadm mailbox subscribe -u t...@mydomain.pl Shared/te...@mydomain.pl
>> doveadm mailbox subscribe -u t...@mydomain.pl
>> Shared/te...@mydomain.pl/Sent
>>
>> 2014.07.02 14:04, Bambero rašė:
>>> Hello
>>>
>>> I just upgraded my system and there is a problem with shared mailboxes.
>>>
>>> When I use the doveadm command I can see shared folders:
>>>
>>> doveadm mailbox list -u 't...@mydomain.pl'
>>> Drafts
>>> Sent
>>> Spam
>>> Trash
>>> Shared
>>> Virtuals
>>> Virtuals/all
>>> Shared/te...@mydomain.pl
>>> Shared/te...@mydomain.pl/Sent
>>> INBOX
>>>
>>> But I can't see them over IMAP protocol.
>>>
>>> Some config opts:
>>>
>>> valid_chroot_dirs = /var/mail
>>> mail_chroot = /var/mail
>>>
>>> namespace {
>>>   type = shared
>>>   separator = /
>>>   prefix = Shared/%%u/
>>>   location = maildir:/%%u/Maildir:INDEX=~/Maildir/Shared/%%u
>>>   subscriptions = yes
>>>   list = yes
>>> }
>>>
>>> plugin {
>>>   acl = vfile:cache_secs=5
>>> }
>>>
>>> plugin {
>>>   acl_shared_dict = file:/var/mail/%i.db
>>> }
>>>
>>> protocol imap {
>>>   mail_plugins = $mail_plugins imap_quota imap_acl imap_zlib
>>> }
>>>
>>>
>>> My version of dovecot is 2.2.10.
>>>
>>> Regards
>>> Bambero
>>>
>>
>>


<>

Re: [Dovecot] lazy_expunge and shared folders

2014-07-02 Thread Giedrius Liubavičius
Hi,
i've had the save problem.
This is /quick/ and /dirty/ fix for this problem [gzipped patch file
attached]

After patching source, recompile lazy_expunge plugin (make -C
src/plugins/lazy_expunge all install)
AND add this to the configuration:
> plugin {
> lazy_expunge_ignore_namespace_not_found = yes
> }

2014.05.26 17:12, Florian Tischler rašė:
> Am Dienstag, 20. Mai 2014, 14:00:11 schrieben Sie:
>> Hi,
>>
>> since migration to Dovecot 2.2 I have troubles with lazy_expunge as soon
>> as a user shares a folder. The user the folder is shared to cannot login
>> anymore, dovecot logs Fatal: lazy_expunge: Unknown namespace:
>> '.EXPUNGED/'
>>
>> - When no folder is shared lazy_expunge is working fine, deleted mails are
>> moved to the expunged namespace and can be recovered without any
>> problems. - Sharing folders works as long as I disable lazy_expunge.
>>
>> I have used the config (with minor changes) with dovecot 2.0 for years
>> without any problem. Switching to dovecot 2.2.10 (atrps repository) or
>> 2.2.12 (dovecot enterprise repo) lazy_expunge and acl do not work together
>> anymore.
> Hi,
>
> unfortunately I got no response to the acl breaks lazy_expunge problem.
>
> Maybe the developers can give me some feedback?
> Is it supposed (not) to work? Will it be fixed?
>
> Currently it prevents me from sucessfully migration from 2.0 to 2.2 without 
> losing features.
>
> Thanks,
> Florian
>
>> Is it a bug, a known limitation or is something wrong with my config?
>> Any hints are welcome.
>>
>> Thanks in advance,
>> Florian
>>
>> dovecot -n
>>
>> # 2.2.12.12 (03196f188677): /etc/dovecot/dovecot.conf
>> # OS: Linux 2.6.32-042stab085.20 x86_64 CentOS release 6.5 (Final)
>> auth_cache_negative_ttl = 10 mins
>> auth_cache_size = 10 M
>> auth_cache_ttl = 2 hours
>> auth_failure_delay = 10 secs
>> auth_mechanisms = plain login
>> auth_socket_path = /var/run/dovecot/auth-userdb
>> base_dir = /var/run/dovecot/
>> disable_plaintext_auth = no
>> first_valid_gid = 105
>> first_valid_uid = 105
>> hostname = ...
>> imap_client_workarounds = delay-newmail tb-extra-mailbox-sep tb-lsub-flags
>> imap_idle_notify_interval = 10 mins
>> last_valid_uid = 105
>> listen = ...
>> lmtp_save_to_detail_mailbox = yes
>> login_log_format_elements = user=<%u> method=%m rip=%r lip=%l mpid=%e %c
>> mail_gid = vimap
>> mail_home = /var/imap/spool/%1n/%n
>> mail_location = mdbox:~/mdbox
>> mail_plugins = " fts fts_lucene acl"
>> mail_temp_dir = /var/imap/tmp
>> mail_uid = vimap
>> 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
>> mbox_write_locks = fcntl
>> mdbox_rotate_interval = 1 days
>> namespace {
>>   list = children
>>   location =
>> mdbox:/var/imap/spool/%%1n/%%n/mdbox:INDEXPVT=/var/imap/spool/%1n/%n/mdbox
>> /shared/%%u prefix = User/%%u/
>>   separator = /
>>   subscriptions = no
>>   type = shared
>> }
>> namespace expunged {
>>   hidden = yes
>>   list = no
>>   location = mdbox:/var/imap/spool/%1n/%n/mdbox:MAILBOXDIR=expunged
>>   prefix = .EXPUNGED/
>>   separator = /
>>   subscriptions = no
>>   type = private
>> }
>> namespace inbox {
>>   inbox = yes
>>   location = mdbox:/var/imap/spool/%1n/%n/mdbox
>>   mailbox Drafts {
>> auto = subscribe
>> special_use = \Drafts
>>   }
>>   mailbox Learn {
>> auto = subscribe
>>   }
>>   mailbox Learn/Ham {
>> auto = subscribe
>>   }
>>   mailbox Learn/Spam {
>> auto = subscribe
>>   }
>>   mailbox Sent {
>> auto = subscribe
>> special_use = \Sent
>>   }
>>   mailbox Spam {
>> auto = subscribe
>> special_use = \Junk
>>   }
>>   mailbox Trash {
>> auto = subscribe
>> special_use = \Trash
>>   }
>>   mailbox virtual/All {
>> special_use = \All
>>   }
>>   mailbox virtual/Flagged {
>> special_use = \Flagged
>>   }
>>   prefix =
>>   separator = /
>>   type = private
>> }
>> passdb {
>>   args = /etc/dovecot/master-users
>>   driver = passwd-file
>>   master = yes
>> }
>> passdb {
>>   args = /etc/dovecot/dovecot-ldap.conf.ext
>>   driver = ldap
>> }
>> passdb {
>>   args = /etc/dovecot/extra-users
>>   driver = passwd-file
>> }
>> plugin {
>>   acl = vfile:/var/imap/global-acls:cache_secs=300
>>   acl_shared_dict = file:/var/imap/shared-mailboxes/shared-mailboxes
>>   fts = lucene
>>   fts_autoindex = yes
>>   fts_lucene = whitespace_chars=@.
>>   lazy_expunge = .EXPUNGED/
>>   lazy_expunge_only_last_instance = yes
>>   recipient_delimiter = +
>>   sieve = ~/.dovecot.sieve
>>   sieve_dir = ~/sieve
>>   sieve_max_actions = 32
>>   sieve_max_redirects = 4
>>   sieve_max_script_size = 1M
>> }
>> pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
>> postmaster_address = postmaster@...
>> protocols = imap pop3 lmtp sieve
>> service auth {
>>   unix_listener /var/spool/postfix/private/auth {
>> 

Re: Shared folders not listed by IMAP

2014-07-02 Thread Giedrius Liubavičius
Hi,
doveadm mailbox subscribe -u t...@mydomain.pl Shared/te...@mydomain.pl
doveadm mailbox subscribe -u t...@mydomain.pl
Shared/te...@mydomain.pl/Sent

2014.07.02 14:04, Bambero rašė:
> Hello
>
> I just upgraded my system and there is a problem with shared mailboxes.
>
> When I use the doveadm command I can see shared folders:
>
> doveadm mailbox list -u 't...@mydomain.pl'
> Drafts
> Sent
> Spam
> Trash
> Shared
> Virtuals
> Virtuals/all
> Shared/te...@mydomain.pl
> Shared/te...@mydomain.pl/Sent
> INBOX
>
> But I can't see them over IMAP protocol.
>
> Some config opts:
>
> valid_chroot_dirs = /var/mail
> mail_chroot = /var/mail
>
> namespace {
>   type = shared
>   separator = /
>   prefix = Shared/%%u/
>   location = maildir:/%%u/Maildir:INDEX=~/Maildir/Shared/%%u
>   subscriptions = yes
>   list = yes
> }
>
> plugin {
>   acl = vfile:cache_secs=5
> }
>
> plugin {
>   acl_shared_dict = file:/var/mail/%i.db
> }
>
> protocol imap {
>   mail_plugins = $mail_plugins imap_quota imap_acl imap_zlib
> }
>
>
> My version of dovecot is 2.2.10.
>
> Regards
> Bambero
>


<>