Hmm. Maybe something generic: Returning "foo" extra field overwrites "foo" setting, but returning "+foo" extra field appends the value to the "foo" setting? See if the attached patch works (untested).
On Mon, 2011-06-06 at 12:18 +0200, Antonio Perez-Aranda wrote: > Umm, it isn't running. > > If I put plugin imap_quota forced on user_attrs, then IMAP and Dovedm > doesn't run correctly. They can load this plugin. > > Maybe we can do a patch for ldap/config to avoid overwrite "all > plugins" enabled and support to append to enabled? > > > > 2011/6/3 Antonio Perez-Aranda <aperezara...@yaco.es>: > > OK thanks. It isn't pretty but is running. > > > > 2011/6/3 Timo Sirainen <t...@iki.fi>: > >> On Fri, 2011-06-03 at 12:30 +0200, Antonio Perez-Aranda wrote: > >> > >>> And in passwd-ldap.conf I have some like this to add extra plugins: > >>> > >>> user_attrs = > >>> homeDirectory=home,uid=user,mailQuota=quota_rule=*:bytes=%$,mailPlugins=mail_plugins > >> > >> This completely overrides mail_plugins setting.. > >> > >>> With this. I can see that dovecot load all plugins from settings, but > >>> in the user session, I can get only the plugins that I have selected > >>> in mailPlugins field > >>> > >>> If i check some like this: > >>> mailPlugins=mail_plugins=$mail_plugins %$, > >> > >> $mail_plugins variable works only inside dovecot.conf while the settings > >> are being parsed. > >> > >>> The imap session user is aborted after login. > >>> > >>> > >>> How can I add extra plugins by ldap without put on ldap all user plugins? > >> > >> The best you can do now is: > >> > >> mailPlugins=mail_plugins=plugin1,plugin2,plugin3,%$ > >> > >> i.e. list the global plugins in here as well as in the global > >> mail_plugins setting. > >> > >> > > > > > > > > -- > > Antonio Pérez-Aranda Alcaide > > aperezara...@yaco.es > > > > Yaco Sistemas S.L. > > http://www.yaco.es/ > > C/ Rioja 5, 41001 Sevilla > > Teléfono +34 954 50 00 57 > > Fax +34 954 50 09 29 > > > > >
diff -r ed05316ed441 src/lib-storage/mail-storage-service.c --- a/src/lib-storage/mail-storage-service.c Tue Jun 07 16:12:13 2011 +0300 +++ b/src/lib-storage/mail-storage-service.c Tue Jun 07 16:44:43 2011 +0300 @@ -107,14 +107,20 @@ { struct setting_parser_context *set_parser = user->set_parser; bool mail_debug; - const char *key; + const char *key, *orig_key; + bool append = FALSE; int ret; mail_debug = mail_user_set_get_mail_debug(user->user_info, user->user_set); if (strchr(line, '=') == NULL) line = t_strconcat(line, "=yes", NULL); - key = t_strcut(line, '='); + orig_key = key = t_strcut(line, '='); + + if (*key == '+') { + key++; + append = TRUE; + } if (!settings_parse_is_valid_key(set_parser, key)) { /* assume it's a plugin setting */ @@ -131,6 +137,19 @@ return 1; } + if (append) { + const void *value; + enum setting_type type; + + value = settings_parse_get_value(set_parser, key, &type); + if (type == SET_STR) + line = t_strconcat(line, value, NULL); + else { + i_error("Ignoring %s userdb setting. " + "'+' can only be used for strings.", orig_key); + } + } + ret = settings_parse_line(set_parser, line); if (mail_debug && ret >= 0) { i_debug(ret == 0 ?