]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm-server: http: Fixed temp_path_prefix for iostream-temp.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Fri, 9 Dec 2016 08:57:57 +0000 (09:57 +0100)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Fri, 9 Dec 2016 09:01:36 +0000 (10:01 +0100)
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.

src/doveadm/client-connection-http.c

index 5c8282b80fed4897c502ef715949d10e6f3c0b72..197efedefc60b73a94fca2993bd84cb7dfcede53 100644 (file)
@@ -726,11 +726,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);
        }
 }