]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Do not try to set keys for unencrypted requests in proxy
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 1 Mar 2017 08:46:04 +0000 (08:46 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 1 Mar 2017 08:46:41 +0000 (08:46 +0000)
src/rspamd_proxy.c

index 33ac428af838b145fe43f0397c14ba159ff3dd5e..ea8964d85e694344bd044e97b43f053e2c72226c 100644 (file)
@@ -1067,9 +1067,11 @@ proxy_open_mirror_connections (struct rspamd_proxy_session *session)
                                session->ctx->keys_cache,
                                NULL);
 
-               rspamd_http_connection_set_key (bk_conn->backend_conn,
-                               session->ctx->local_key);
-               msg->peer_key = rspamd_pubkey_ref (m->key);
+               if (m->key) {
+                       rspamd_http_connection_set_key (bk_conn->backend_conn,
+                                       session->ctx->local_key);
+                       msg->peer_key = rspamd_pubkey_ref (m->key);
+               }
 
                if (m->local ||
                                rspamd_inet_address_is_local (rspamd_upstream_addr (bk_conn->up))) {
@@ -1267,9 +1269,12 @@ retry:
                session->master_conn->parser_to_ref = backend->parser_to_ref;
 
                msg = rspamd_http_connection_copy_msg (session->client_message);
-               rspamd_http_connection_set_key (session->master_conn->backend_conn,
-                               session->ctx->local_key);
-               msg->peer_key = rspamd_pubkey_ref (backend->key);
+
+               if (backend->key) {
+                       msg->peer_key = rspamd_pubkey_ref (backend->key);
+                       rspamd_http_connection_set_key (session->master_conn->backend_conn,
+                                       session->ctx->local_key);
+               }
 
                if (backend->local ||
                                rspamd_inet_address_is_local (