[Dovecot] Forcing NOSELECT for a Maildir folder?

Nils himself at n-art.de
Sat Apr 3 23:58:42 EEST 2010


Hello,

is it at all possible, possibly without modifying the source code of 
Dovecot, to enforce that a mailbox gets the NOSELECT attribute?

I have a namespace set up like this:

namespace private {
     separator = /
     prefix = Local Folders/
     location = maildir:/xyz/core/store/maildir/%u/
     inbox = yes
     hidden = no
     list = yes
     subscriptions = yes
}

And the folder hierarchy my client builds based on the LIST response 
from Dovecot comes out as:

INBOX
Local Folders <--- (standard flags, but no NOSELECT)
- Folder 1
-- Folder 1.1
- Folder 2
- Sent
- Trash
Public Folders <--- NOSELECT
- Announcements

That's how I expect it, except that I don't want "Local Folders" to be 
selectable. When I select it and list the contents, I get the contents 
of INBOX. I have no clue why that happens. :-/

For the public namespace, everything works as expected, so I'm lost.

Basically: I want "Local Folders" to be like "Public Folders" and have 
\NOSELECT.

In maildir_storage.c I can find places where a MAILBOX_NOSELECT flag is 
set, but from what I understand that's only done if the path is not a 
directory or if the permissions are insufficient.

Random taking away of permissions on folders didn't yield the result I 
wanted. Either it resulted in no change, or in Dovecot complaining that 
the permissions were now too restrictive.

Forgive me if I missed something obvious. I only studied the source 
using grep and nano for 10 minutes before adding an ugly hack in my 
client to fake that Dovecot gave the "Local Folders" mailbox the 
NOSELECT attribute (my client is the only one that will ever talk to my 
installation of Dovecot, so I can do that). The wiki also didn't mention 
anything on NOSELECT. Google searches didn't help either.

I'd much rather have Dovecot give the response I want, rather than 
bending its responses around in my client.

Any ideas how I can achieve that?


- Nils

---------------

[q at lala dovecot]# dovecot --version
1.2.11

---------------

[q at lala dovecot]# telnet 127.0.0.1 144
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE 
AUTH=PLAIN AUTH=LOGIN AUTH=CRAM-MD5] Private Messages Server
0 LOGIN abc def
OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT 
SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE 
CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC 
ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS QUOTA] Logged in
1 LIST "" "*"
* LIST (\HasChildren) "/" "Local Folders"
* LIST (\HasNoChildren) "/" "Local Folders/Trash"
* LIST (\HasNoChildren) "/" "Local Folders/Sent"
* LIST (\HasNoChildren) "/" "INBOX"
* LIST (\Noselect \HasChildren) "/" "Public Folders"
* LIST (\HasNoChildren) "/" "Public Folders/Announcements"
1 OK List completed.
2 STATUS INBOX (messages)
* STATUS "INBOX" (MESSAGES 4)
2 OK Status completed.
3 STATUS "Local Folders" (messages)
* STATUS "Local Folders" (MESSAGES 4)
3 OK Status completed.
4 LOGOUT
* BYE Logging out
4 OK Logout completed.

---------------

[q at lala dovecot]# dovecot -n -c /etc/dovecot/dovecot-pm.conf
# 1.2.11: /etc/dovecot/dovecot-pm.conf
# OS: Linux 2.6.32-ARCH i686
base_dir: /var/run/dovecot-pm/
listen: 127.0.0.1:144
ssl: no
disable_plaintext_auth: no
login_dir: /var/run/dovecot-pm//login
login_executable: /usr/lib/dovecot/imap-login
login_greeting: Private Messages Server
mail_max_userip_connections: 5
mail_debug: yes
mail_plugins: quota imap_quota trash acl
namespace:
   type: private
   separator: /
   prefix: Local Folders/
   location: maildir:/xyz/core/store/maildir/%u/
   inbox: yes
   list: yes
   subscriptions: yes
namespace:
   type: public
   separator: /
   prefix: Public Folders/
   location: maildir:/xyz/core/store/publicmaildir/:INDEX=~/public/
   list: yes
auth default:
   mechanisms: plain login cram-md5
   user: xyz
   passdb:
     driver: sql
     args: /etc/dovecot/dovecot-pm-sql.conf
   userdb:
     driver: static
     args: uid=xyz gid=xyz home=/xyz/core/store/maildir/%n
plugin:
   quota: maildir:User Quota
   quota_rule: *:backend=1000C,26214400S
   quota_rule2: Trash:storage=25M
   quota_warning: storage=80%% /xyz/cronobs/QuotaWarning.php
   quota_warning2: messages=9500 /xyz/cronobs/QuotaWarning.php
   trash: /etc/dovecot/dovecot-pm-trash.conf
   acl_anyone: allow
   acl: vfile:/etc/dovecot/pm-acls

---------------

[q at lala dovecot]# cat /etc/dovecot/dovecot-pm-sql.conf
driver = pgsql
connect = host=127.0.0.1 dbname=xyz user=abc password=def
default_pass_scheme = PLAIN

password_query = \
   SELECT "Username" AS "username", "Password" as "password"  \
   FROM "users" WHERE "Username" = '%n';

---------------

[q at lala dovecot]# cat /etc/dovecot/dovecot-pm-trash.conf
1 Local Folders/Trash

---------------

[q at lala dovecot]# cat /etc/dovecot/pm-acls/Announcements
authenticated lrs



More information about the dovecot mailing list