]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dict-client: Prefix relative socket paths with base_dir.
authorTimo Sirainen <tss@iki.fi>
Wed, 2 Sep 2015 15:42:01 +0000 (18:42 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 2 Sep 2015 15:42:01 +0000 (18:42 +0300)
src/lib-dict/dict-client.c

index 027937a9e04f4a0ef8d5fc54b0dbe4702bbc3906..4cfa86044f2c344e2328568c9ebcefac4bb3fc73 100644 (file)
@@ -502,12 +502,17 @@ client_dict_init(struct dict *driver, const char *uri,
 
        dict->fd = -1;
 
-       if (*uri != ':') {
-               /* path given */
-               dict->path = p_strdup_until(pool, uri, dest_uri);
-       } else {
+       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 {
+               /* 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;