dovecot-2.2: dict-client: Prefix relative socket paths with base...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 2 15:43:02 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/54c4e1ed387a
changeset: 19068:54c4e1ed387a
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 02 18:42:01 2015 +0300
description:
dict-client: Prefix relative socket paths with base_dir.

diffstat:

 src/lib-dict/dict-client.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (25 lines):

diff -r 7378ab8e3b4d -r 54c4e1ed387a src/lib-dict/dict-client.c
--- a/src/lib-dict/dict-client.c	Wed Sep 02 17:51:23 2015 +0300
+++ b/src/lib-dict/dict-client.c	Wed Sep 02 18:42:01 2015 +0300
@@ -502,12 +502,17 @@
 
 	dict->fd = -1;
 
-	if (*uri != ':') {
-		/* path given */
+	if (uri[0] == ':') {
+		/* default path */
+		dict->path = p_strconcat(pool, set->base_dir,
+				"/"DEFAULT_DICT_SERVER_SOCKET_FNAME, NULL);
+	} else if (uri[0] == '/') {
+		/* absolute path */
 		dict->path = p_strdup_until(pool, uri, dest_uri);
 	} else {
-		dict->path = p_strconcat(pool, set->base_dir,
-				"/"DEFAULT_DICT_SERVER_SOCKET_FNAME, NULL);
+		/* relative path to base_dir */
+		dict->path = p_strconcat(pool, set->base_dir, "/",
+				p_strdup_until(pool, uri, dest_uri), NULL);
 	}
 	dict->uri = p_strdup(pool, dest_uri + 1);
 	*dict_r = &dict->dict;


More information about the dovecot-cvs mailing list