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: acl and lazy_expunge plugins are incompatible?

2015-04-24 Thread Paolo Cravero
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): Debug: acl: acl
> username = paolo.crav...@csi.it
> Mar 3 15:59:02 tst-msg03 dovecot: imap(doveco...@csi.it): Debug: acl:
> owner
> = 1
> Mar 3 15:59:02 tst-msg03 dovecot: imap(doveco...@csi.it): Debug: acl
> vfile:
> Global ACLs disabled
> Mar 3 15:59:02 tst-msg03 dovecot: imap(doveco...@csi.it): Fatal:
> lazy_expunge: Unknown namespace: '.EXPUNGED/'
> 
> 
> Removing the lazy_expunge, ACLs do work as expected and I can
> add/remove/use
> them.
> 
> 
> Is there a known compatibility issue? Or there's something wrong in my
> config and someone else is running with both plugins enabled?
> 
> Thanks,
> Paolo
> 
> PS: output of dovecot -n:
> 
> # 2.2.15: /etc/dovecot/dovecot.conf
> # OS: Linux 2.6.32-431.el6.x86_64 x86_64 Red Hat Enterprise Linux Server
> release 6.5 (Santiago) ext3
> auth_mechanisms = plain login
> disable_plaintext_auth = no
> imap_client_workarounds = tb-extra-mailbox-sep
> lmtp_save_to_detail_mailbox = yes
> mail_attachment_dir = /maildata1/attachments
> mail_attachment_hash = %{sha256}
> mail_debug = yes
> mail_gid = 500
> mail_location =
> mdbox:/maildata1/main/%d/%1n/%n:ALT=/maildata1/altstorage/%d/%1n/%n:INDEX=/maildata1/indexes/%d/%1n/%n
> mail_plugins = quota mail_log notify lazy_expunge acl
> mail_uid = 500
> 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
> mbox_write_locks = fcntl
> mdbox_rotate_size = 50 M
> namespace {
>  hidden = no
>  list = yes
>  location =
> mdbox:/maildata1/main/%d/%1n/%n:INDEX=/maildata1/indexes/%d/%1n/%n:MAILBOXDIR=expunged
>  prefix = .EXPUNGED/
>  subscriptions = no
> }
> namespace {
>  list = children
>  location =
> mdbox:/maildata1/main/%%d/%%1n/%%n:ALT=/maildata1/altstorage/%%d/%%1n/%%n:INDEX=/maildata1/indexes/%%d/%%1n/%%n
>  prefix = user/%%u/
>  separator = /
>  type = shared
> }
> namespace inbox {
>  inbox = yes
>  location =
>  mailbox Drafts {
>  auto = subscribe
>  special_use = \Drafts
>  }
>  mailbox Junk {
>  auto = subscribe
>  special_use = \Junk
>  }
>  mailbox Sent {
>  auto = subscribe
>  special_use = \Sent
>  }
>  mailbox "Sent Messages" {
>  special_use = \Sent
>  }
>  mailbox Trash {
>  auto = subscribe
>  special_use = \Trash
>  }
>  prefix =
>  type = private
> }
> passdb {
>  args = /etc/dovecot/dovecot-ldap.conf.ext
>  driver = ldap
> }
> plugin {
>  acl = vfile
>  acl_shared_dict = file:/maildata1/db/shared-mailboxes.db
>  lazy_expunge = .EXPUNGED/
>  mail_log_events = delete undelete expunge copy mailbox_delete
> mailbox_rename flag_change append
>  mail_log_fields = uid box msgid size flags vsize
>  quota = dict:User quota::file:%h/dovecot-quota
>  quota_grace = 10%%
>  quota_rule = *:storage=10G
>  quota_rule2 = Trash:storage=+100M
>  quota_warning = storage=95%% quota-warning 95 %u
>  quota_warning2 = storage=80%% quota-warning 80 %u
> }
> protocols = imap pop3 lmtp sieve
> service auth {
>  unix_listener auth-userdb {
>  group = vmail
>  user = vmail
>  }
> }
> service lmtp {
>  inet_listener lmtp {
>  address = 10.102.42.114
>  port = 24
>  }
>  process_min_avail = 2
>  user = vmail
> }
> ssl_cert =  ssl_key =  userdb {
>  args = /etc/dovecot/dovecot-ldap.conf.ext
>  driver = ldap
> }
> protocol lmtp {
>  mail_plugins = quota mail_log notify lazy_expunge acl sieve
> }
> protocol lda {
>  mail_plugins = quota mail_log notify lazy_expunge acl sieve
> }
>