aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/http.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-24 20:18:25 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-24 20:18:25 +0100
commitd0c6c56dab0c0632d59352493d276f52311d38de (patch)
treec0cc0c2d7df81001612f9fdc39f55711acbf92e6 /src/libutil/http.c
parentab6c598f278afa9d5afb1a93089adcfc91d8003b (diff)
downloadrspamd-d0c6c56dab0c0632d59352493d276f52311d38de.tar.gz
rspamd-d0c6c56dab0c0632d59352493d276f52311d38de.zip
[Minor] Add aux method to disable HTTP encryptipon
Diffstat (limited to 'src/libutil/http.c')
-rw-r--r--src/libutil/http.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/libutil/http.c b/src/libutil/http.c
index 315598871..974a2b592 100644
--- a/src/libutil/http.c
+++ b/src/libutil/http.c
@@ -850,7 +850,8 @@ rspamd_http_decrypt_message (struct rspamd_http_connection *conn,
if (!rspamd_cryptobox_decrypt_nm_inplace (m, dec_len, nonce,
nm, m - rspamd_cryptobox_mac_bytes (mode), mode)) {
- msg_err ("cannot verify encrypted message");
+ msg_err ("cannot verify encrypted message, first bytes of the input: %*xs",
+ (gint)MIN(msg->body_buf.len, 64), msg->body_buf.begin);
return -1;
}
@@ -3936,3 +3937,24 @@ rspamd_http_normalize_path_inplace (gchar *path, guint len, guint *nlen)
*nlen = (o - path);
}
}
+
+void
+rspamd_http_connection_disable_encryption (struct rspamd_http_connection *conn)
+{
+ struct rspamd_http_connection_private *priv;
+
+ priv = conn->priv;
+
+ if (priv) {
+ if (priv->local_key) {
+ rspamd_keypair_unref (priv->local_key);
+ }
+ if (priv->peer_key) {
+ rspamd_pubkey_unref (priv->peer_key);
+ }
+
+ priv->local_key = NULL;
+ priv->peer_key = NULL;
+ priv->flags &= ~RSPAMD_HTTP_CONN_FLAG_ENCRYPTED;
+ }
+} \ No newline at end of file