dovecot-2.0: config: Avoid problems with trailing '/' in base_dir.
dovecot at dovecot.org
dovecot at dovecot.org
Thu Mar 25 17:33:43 EET 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/2fde82ea7cd9
changeset: 10979:2fde82ea7cd9
user: Timo Sirainen <tss at iki.fi>
date: Thu Mar 25 17:33:40 2010 +0200
description:
config: Avoid problems with trailing '/' in base_dir.
diffstat:
src/config/old-set-parser.c | 7 ++++++-
src/master/master-settings.c | 8 +++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diffs (39 lines):
diff -r 7d7540af8446 -r 2fde82ea7cd9 src/config/old-set-parser.c
--- a/src/config/old-set-parser.c Thu Mar 25 17:01:21 2010 +0200
+++ b/src/config/old-set-parser.c Thu Mar 25 17:33:40 2010 +0200
@@ -59,9 +59,14 @@
const char *key, const char *value)
{
const char *p;
+ unsigned int len;
- if (strcmp(key, "base_dir") == 0)
+ if (strcmp(key, "base_dir") == 0) {
+ len = strlen(value);
+ if (len > 0 && value[len-1] == '/')
+ value = t_strndup(value, len-1);
ctx->old->base_dir = p_strdup(ctx->pool, value);
+ }
if (strcmp(key, "protocols") == 0) {
char **protos, **s;
bool have_imap = FALSE, have_imaps = FALSE;
diff -r 7d7540af8446 -r 2fde82ea7cd9 src/master/master-settings.c
--- a/src/master/master-settings.c Thu Mar 25 17:01:21 2010 +0200
+++ b/src/master/master-settings.c Thu Mar 25 17:33:40 2010 +0200
@@ -348,9 +348,15 @@
struct service_settings *const *services;
const char *const *strings;
ARRAY_TYPE(const_string) all_listeners;
- unsigned int i, j, count, process_limit;
+ unsigned int i, j, count, len, process_limit;
unsigned int auth_client_limit, max_auth_client_processes;
+ len = strlen(set->base_dir);
+ if (len > 0 && set->base_dir[len-1] == '/') {
+ /* drop trailing '/' */
+ set->base_dir = p_strndup(pool, set->base_dir, len - 1);
+ }
+
if (set->last_valid_uid != 0 &&
set->first_valid_uid > set->last_valid_uid) {
*error_r = "first_valid_uid can't be larger than last_valid_uid";
More information about the dovecot-cvs
mailing list