diff --git a/INSTALL b/INSTALL index 558e3a32baf0c3dc85eab7919d7b3ffaa32740b6..2fe76b91a1d7bd5f182468b53d3b248d864f348c 100644 --- a/INSTALL +++ b/INSTALL @@ -126,11 +126,6 @@ The following options are defined for all location types: Multiple mail users can share a single script directory if the script location is the same and all users share the same system credentials (uid, gid). - - default=<script-name> - The name by which the default Sieve script (see `sieve_default=' setting - below) is visible to ManageSieve clients. Normally, it is not visible at - all. See "Visible Default Script" section below for more information. Sieve Interpreter - Basic Configuration --------------------------------------- @@ -171,9 +166,12 @@ plugin section of the config file (default values are shown if applicable): /var/lib/dovecot/default.sieve. This is usually a global script, so be sure to pre-compile this script manually using the sievec command line tool, as explained in the README file. This setting used to be called - `sieve_global_path', but that name is now deprecated. See the "Visible - Default Script" section below for information on how to make the default - script visible from ManageSieve. + `sieve_global_path', but that name is now deprecated. + + sieve_default_name = + The name by which the default Sieve script is visible to ManageSieve + clients. Normally, it is not visible at all. See "Visible Default Script" + section below for more information. sieve_global = Location for :global include scripts for the Sieve include extension. This @@ -401,8 +399,9 @@ Sieve Interpreter - Visible Default Script The `sieve_default=' setting specifies the location of a default script that is executed when the user has no active personal script. Normally, this default script is invisible to the user; i.e., it is not listed in ManageSieve. -To give the user the ability to base a custom personal script on the default -script, it is possible to make it visible under a specific configurable name. +To give the user the ability to see and read the default script, it is possible +to make it visible under a specific configurable name using the +`sieve_default_name' setting. ManageSieve will magically list the default script under that name, even though it does not actually exist in the user's normal script storage location. This @@ -420,19 +419,19 @@ edited script is saved through the ManageSieve client, it will will override the default script. If the user ever wants to revert to the default, the user only needs to delete the edited script and the default will reappear. -To enable this feature, the the `;default=<script-name>' option must be -specified for the `sieve=' setting. It configures the name by which the default -script will be known. Of course, the `sieve_default=' setting needs to point to -a valid script location as well for this to work. If the default script does not -exist at the indicated location, it is not shown. +The name by which the default script will be known is configured using the +`sieve_default_name' setting. Of course, the `sieve_default' setting needs to +point to a valid script location as well for this to work. If the default script +does not exist at the indicated location, it is not shown. For example: plugin { ... - sieve = file:~/sieve;active=~/.dovecot.sieve;default=roundcube + sieve = file:~/sieve;active=~/.dovecot.sieve sieve_default = /var/lib/dovecot/sieve/default.sieve + sieve_default_name = roundcube } Sieve Interpreter - Extension Configuration diff --git a/src/lib-sieve/sieve-storage.c b/src/lib-sieve/sieve-storage.c index a2e7dc68602255623860fd4a60197e7fd6655aa8..6f61c92d066ece464d83fa2541c70250cadce6d0 100644 --- a/src/lib-sieve/sieve-storage.c +++ b/src/lib-sieve/sieve-storage.c @@ -199,15 +199,6 @@ static int sieve_storage_data_parse if ( storage->script_name == NULL ) storage->script_name = p_strdup(storage->pool, option+5); - } else if ( strncasecmp(option, "default=", 8) == 0 ) { - if ( option[8] == '\0' ) { - /* skip if empty */ - continue; - } - - if ( storage->default_name == NULL ) - storage->default_name = p_strdup(storage->pool, option+8); - } else if ( strncasecmp(option, "bindir=", 7) == 0 ) { const char *bin_dir = option+7; @@ -479,7 +470,7 @@ struct sieve_storage *sieve_storage_create_main enum sieve_storage_flags flags, enum sieve_error *error_r) { struct sieve_storage *storage; - const char *set_sieve_default; + const char *set_default, *set_default_name; enum sieve_error error; if ( error_r != NULL ) @@ -488,21 +479,26 @@ struct sieve_storage *sieve_storage_create_main error_r = &error; /* Determine location for default script */ - set_sieve_default = + set_default = sieve_setting_get(svinst, "sieve_default"); - if ( set_sieve_default == NULL ) { + if ( set_default == NULL ) { /* For backwards compatibility */ - set_sieve_default = + set_default = sieve_setting_get(svinst, "sieve_global_path"); } + set_default_name = + sieve_setting_get(svinst, "sieve_default_name"); /* Attempt to locate user's main storage */ storage = sieve_storage_do_create_main(svinst, user, flags, error_r); + storage->default_name = + p_strdup_empty(storage->pool, set_default_name); + if ( storage != NULL ) { /* Success; record default script location for later use */ storage->default_location = - p_strdup_empty(storage->pool, set_sieve_default); + p_strdup_empty(storage->pool, set_default); if (storage->default_location != NULL && storage->default_name != NULL) { @@ -516,33 +512,33 @@ struct sieve_storage *sieve_storage_create_main /* Failed; try using default script location (not for temporary failures, read/write access, or dsync) */ - if ( set_sieve_default == NULL ) { + if ( set_default == NULL ) { sieve_sys_debug(svinst, "storage: " "No default script location configured"); } else { sieve_sys_debug(svinst, "storage: " "Trying default script location `%s'", - set_sieve_default); + set_default); storage = sieve_storage_create - (svinst, set_sieve_default, 0, error_r); + (svinst, set_default, 0, error_r); if ( storage == NULL ) { switch ( *error_r ) { case SIEVE_ERROR_NOT_FOUND: sieve_sys_debug(svinst, "storage: " "Default script location `%s' not found", - set_sieve_default); + set_default); break; case SIEVE_ERROR_TEMP_FAILURE: sieve_sys_error(svinst, "storage: " "Failed to access default script location `%s' " "(temporary failure)", - set_sieve_default); + set_default); break; default: sieve_sys_error(svinst, "storage: " "Failed to access default script location `%s'", - set_sieve_default); + set_default); break; } }