aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-04-01 17:17:58 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-04-01 17:17:58 +0100
commit27b2a5bc41971072318e6b8f588c5d3e99d9e7d7 (patch)
tree77bf19e6548b65cacd836d57bb692f345241148f /src/libutil
parent067c344312a89b888040aece1b69eaa66b37ea31 (diff)
downloadrspamd-27b2a5bc41971072318e6b8f588c5d3e99d9e7d7.tar.gz
rspamd-27b2a5bc41971072318e6b8f588c5d3e99d9e7d7.zip
Fix memory leak in keys management.
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/http.c15
-rw-r--r--src/libutil/http.h7
2 files changed, 22 insertions, 0 deletions
diff --git a/src/libutil/http.c b/src/libutil/http.c
index 1a5bc7840..9e95462b4 100644
--- a/src/libutil/http.c
+++ b/src/libutil/http.c
@@ -1830,6 +1830,21 @@ rspamd_http_connection_set_key (struct rspamd_http_connection *conn,
priv->local_key = kp;
}
+gboolean
+rspamd_http_connection_is_encrypted (struct rspamd_http_connection *conn)
+{
+ struct rspamd_http_connection_private *priv = conn->priv;
+
+ if (priv->peer_key != NULL) {
+ return TRUE;
+ }
+ else if (priv->msg) {
+ return priv->msg->peer_key != NULL;
+ }
+
+ return FALSE;
+}
+
void
rspamd_http_connection_key_unref (gpointer key)
{
diff --git a/src/libutil/http.h b/src/libutil/http.h
index eef963f9d..3ecfc1c99 100644
--- a/src/libutil/http.h
+++ b/src/libutil/http.h
@@ -182,6 +182,13 @@ gpointer rspamd_http_connection_gen_key (void);
void rspamd_http_connection_set_key (struct rspamd_http_connection *conn,
gpointer key);
+/**
+ * Returns TRUE if a connection is encrypted
+ * @param conn
+ * @return
+ */
+gboolean rspamd_http_connection_is_encrypted (struct rspamd_http_connection *conn);
+
/** Print pubkey */
#define RSPAMD_KEYPAIR_PUBKEY 0x1
/** Print secret key */