[Dovecot] userdb namespace settings bug
Hi!
Since upgrading to 2.1.6, setting namespaces via environment variables using a imap-postlogin-script *sometimes* doesn't work.
Sometimes, the prefix of a namespace isn't set correctly, but is set to an empty string, which leads to the following error: namespace configuration error: Duplicate namespace prefix: ""
However, the environment is set correctly, the error seems to occur when parsing the environment.
See the attached log: The postlogin-script sets the environment variables attached as dovecot-postlogin-environment.txt. (dumped from postlogin script via env)
However, the variable "NAMESPACE/S-GSD/PREFIX=Shared/GSD/" gets parsed as: plugin/namespace/s-gsd/prefix=Shared/GSD/
See the error message: Unknown userdb setting: plugin/namespace/s-gsd/prefix=Shared/GSD/
After restarting dovecot, the same configuration sometimes works correctly.
I'd greatly appreciate your help! Unfortunately I have done the upgrade on a production system, so the issue is quite serious for me..
Will downgrading to 2.0 work? (Index-files, etc?)
Thanks, --leo
e-mail ::: Leo.Bergolth (at) wu.ac.at fax ::: +43-1-31336-906050 location ::: IT-Services | Vienna University of Economics | Austria
On 05/13/2012 11:40 PM, Alexander 'Leo' Bergolth wrote:
Since upgrading to 2.1.6, setting namespaces via environment variables using a imap-postlogin-script *sometimes* doesn't work.
Sometimes, the prefix of a namespace isn't set correctly, but is set to an empty string, which leads to the following error: namespace configuration error: Duplicate namespace prefix: ""
However, the environment is set correctly, the error seems to occur when parsing the environment.
See the attached log: The postlogin-script sets the environment variables attached as dovecot-postlogin-environment.txt. (dumped from postlogin script via env)
However, the variable "NAMESPACE/S-GSD/PREFIX=Shared/GSD/" gets parsed as: plugin/namespace/s-gsd/prefix=Shared/GSD/
See the error message: Unknown userdb setting: plugin/namespace/s-gsd/prefix=Shared/GSD/
The prefix "plugin/" is added in mail-storage-service.c:set_line():
-------------------- 8< -------------------- if (!settings_parse_is_valid_key(set_parser, key)) { /* assume it's a plugin setting */ key = t_strconcat("plugin/", key, NULL); -------------------- 8< --------------------
Looks like dovecot doesn't think that s-gsd isn't a valid namespace... Maybe the order of parsing the userdb settings is not well defined?
I think it should parse the list of allowed namespaces first (namespace=s-gsd s-kit s-rufhilfe s-sef s-homepage) and the namespace specific settings after that.
However, the debug output shows a different order:
-------------------- 8< -------------------- May 13 23:00:22 samba dovecot: imap: Debug: Unknown userdb setting: plugin/namespace/s-gsd/prefix=Shared/GSD/ May 13 23:00:22 samba dovecot: imap: Debug: Unknown userdb setting: plugin/namespace/s-rufhilfe/location=maildir:/var/spool/mail/Shared/Rufhilfe:INDEX=~/Maildir/index/Shared/Rufhilfe May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: namespace=s-gsd s-kit s-rufhilfe s-sef s-homepage May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: namespace/s-rufhilfe/separator=/ -------------------- 8< --------------------
The first two namespace settings are rejected because the allowed namespaces are not configured yet. The third line configures the namespaces and subsequent namespace-settings are working fine.
Does that sound reasonable?
Any hints on how to change the order of userdb settings?
Thanks, --leo
e-mail ::: Leo.Bergolth (at) wu.ac.at
fax ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria
On 05/14/2012 10:40 AM, Alexander 'Leo' Bergolth wrote:
On 05/13/2012 11:40 PM, Alexander 'Leo' Bergolth wrote:
Since upgrading to 2.1.6, setting namespaces via environment variables using a imap-postlogin-script *sometimes* doesn't work.
See the error message: Unknown userdb setting: plugin/namespace/s-gsd/prefix=Shared/GSD/
The prefix "plugin/" is added in mail-storage-service.c:set_line():
-------------------- 8< -------------------- if (!settings_parse_is_valid_key(set_parser, key)) { /* assume it's a plugin setting */ key = t_strconcat("plugin/", key, NULL); -------------------- 8< --------------------
Looks like dovecot doesn't think that s-gsd isn't a valid namespace... Maybe the order of parsing the userdb settings is not well defined?
I think it should parse the list of allowed namespaces first (namespace=s-gsd s-kit s-rufhilfe s-sef s-homepage) and the namespace specific settings after that.
However, the debug output shows a different order:
-------------------- 8< -------------------- May 13 23:00:22 samba dovecot: imap: Debug: Unknown userdb setting: plugin/namespace/s-gsd/prefix=Shared/GSD/ May 13 23:00:22 samba dovecot: imap: Debug: Unknown userdb setting: plugin/namespace/s-rufhilfe/location=maildir:/var/spool/mail/Shared/Rufhilfe:INDEX=~/Maildir/index/Shared/Rufhilfe May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: namespace=s-gsd s-kit s-rufhilfe s-sef s-homepage May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: namespace/s-rufhilfe/separator=/ -------------------- 8< --------------------
The first two namespace settings are rejected because the allowed namespaces are not configured yet. The third line configures the namespaces and subsequent namespace-settings are working fine.
Does that sound reasonable?
Any hints on how to change the order of userdb settings?
OK, got it.
userdb settings are parsed in the same order as set in USERDB_KEYS. The key NAMESPACES has to be defined before the namespace-specific keys.
My post-login script was setting this variable dynamically from a hash so the order was undefined. That's why it did actually work sometimes... :-)
Cheers, --leo
e-mail ::: Leo.Bergolth (at) wu.ac.at fax ::: +43-1-31336-906050 location ::: IT-Services | Vienna University of Economics | Austria
On Mon, 2012-05-14 at 11:48 +0200, Alexander 'Leo' Bergolth wrote:
Any hints on how to change the order of userdb settings?
OK, got it.
userdb settings are parsed in the same order as set in USERDB_KEYS. The key NAMESPACES has to be defined before the namespace-specific keys.
My post-login script was setting this variable dynamically from a hash so the order was undefined. That's why it did actually work sometimes... :-)
Could you try if the attached patch also fixes the ordering? If yes, I could add it to v2.2.
participants (2)
-
Alexander 'Leo' Bergolth
-
Timo Sirainen