From: Timo Sirainen Date: Fri, 6 May 2016 09:59:38 +0000 (+0300) Subject: dict: Pass through dict_lookup() error from dict server to client X-Git-Tag: 2.3.0.rc1~3806 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6cfe560af03491c2ea118e9698a145d8a9ee26b2;p=thirdparty%2Fdovecot%2Fcore.git dict: Pass through dict_lookup() error from dict server to client --- diff --git a/src/dict/dict-commands.c b/src/dict/dict-commands.c index f38e1976bf..43e0d93102 100644 --- a/src/dict/dict-commands.c +++ b/src/dict/dict-commands.c @@ -90,7 +90,8 @@ cmd_lookup_callback(const struct dict_lookup_result *result, void *context) cmd->reply = i_strdup_printf("%c\n", DICT_PROTOCOL_REPLY_NOTFOUND); } else { i_error("%s", result->error); - cmd->reply = i_strdup_printf("%c\n", DICT_PROTOCOL_REPLY_FAIL); + cmd->reply = i_strdup_printf("%c%s\n", DICT_PROTOCOL_REPLY_FAIL, + str_tabescape(result->error)); } dict_connection_cmds_flush(cmd->conn); } diff --git a/src/lib-dict/dict-client.c b/src/lib-dict/dict-client.c index 157273e59a..7a384c15df 100644 --- a/src/lib-dict/dict-client.c +++ b/src/lib-dict/dict-client.c @@ -621,7 +621,9 @@ static int client_dict_lookup(struct dict *_dict, pool_t pool, const char *key, *value_r = NULL; return 0; case DICT_PROTOCOL_REPLY_FAIL: - *error_r = "dict-server returned failure"; + *error_r = line[1] == '\0' ? "dict-server returned failure" : + t_strdup_printf("dict-server returned failure: %s", + dict_client_unescape(line+1)); return -1; default: *error_r = t_strdup_printf(