# HG changeset patch # User Timo Sirainen # Date 1475756391 -10800 # Node ID 11f6f45baf3ee686b4f28255d435540dbfbbab29 # Parent 90fad61ff8aea509096e284cb7903e3961191931 doveadm director kick: Escape username properly. This only mattered if the username contained \001, TAB or LF characters, which isn't normal. diff -r 90fad61ff8ae -r 11f6f45baf3e src/doveadm/doveadm-director.c --- a/src/doveadm/doveadm-director.c Thu Oct 06 15:13:30 2016 +0300 +++ b/src/doveadm/doveadm-director.c Thu Oct 06 15:19:51 2016 +0300 @@ -4,6 +4,7 @@ #include "md5.h" #include "hash.h" #include "str.h" +#include "strescape.h" #include "net.h" #include "istream.h" #include "write-full.h" @@ -586,6 +587,7 @@ { struct director_context *ctx; const char *line; + string_t *cmd = t_str_new(64); ctx = cmd_director_init(cctx); if (ctx->user == NULL) { @@ -593,7 +595,11 @@ return; } - director_send(ctx, t_strdup_printf("USER-KICK\t%s\n", ctx->user)); + str_append(cmd, "USER-KICK\t"); + str_append_tabescaped(cmd, ctx->user); + str_append_c(cmd, '\n'); + + director_send(ctx, str_c(cmd)); line = i_stream_read_next_line(ctx->input); if (line == NULL) { i_error("failed");