Skip to content

Commit

Permalink
doveadm-server: http: Fixed temp_path_prefix for iostream-temp.
Browse files Browse the repository at this point in the history
The temp_path_prefix was "/tmp", which is extended to "/tmp<hostname>.<pid>.<random>" by safe_mkstemp.

Obviously, mortal users cannot create a file like that, causing this error:
doveadm: Error: safe_mkstemp(/tmp) failed: Permission denied

The temp_path_prefix should have been "/tmp/doveadm.", as it is elsewhere as well.
  • Loading branch information
stephanbosch authored and sirainen committed Dec 13, 2016
1 parent 1f6c70b commit 41d538d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/doveadm/client-connection-http.c
Expand Up @@ -732,11 +732,13 @@ doveadm_http_server_handle_request(void *context, struct http_server_request *re
i_stream_set_name(conn->client.input, net_ip2addr(&conn->client.remote_ip));
i_stream_ref(conn->client.input);
conn->client.io = io_add_istream(conn->client.input, *ep->handler, conn);
conn->client.output = iostream_temp_create_named("/tmp", 0, net_ip2addr(&conn->client.remote_ip));
conn->client.output = iostream_temp_create_named
("/tmp/doveadm.", 0, net_ip2addr(&conn->client.remote_ip));
p_array_init(&conn->pargv, conn->client.pool, 5);
ep->handler(conn);
} else {
conn->client.output = iostream_temp_create_named("/tmp", 0, net_ip2addr(&conn->client.remote_ip));
conn->client.output = iostream_temp_create_named
("/tmp/doveadm.", 0, net_ip2addr(&conn->client.remote_ip));
ep->handler(conn);
}
}
Expand Down

0 comments on commit 41d538d

Please sign in to comment.