From ed4a03da6e04bed8565bc69b1f0c9637b0b4bc3e Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Thu, 2 Nov 2017 17:10:23 -0400 Subject: Avoid saving a session to SQL database with empty hostname This happens if the hostname is unknown or specified as an IP. --- src/lib/tls/sessions_sql/tls_session_manager_sql.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/lib/tls') diff --git a/src/lib/tls/sessions_sql/tls_session_manager_sql.cpp b/src/lib/tls/sessions_sql/tls_session_manager_sql.cpp index 4287172f4..45b3059f5 100644 --- a/src/lib/tls/sessions_sql/tls_session_manager_sql.cpp +++ b/src/lib/tls/sessions_sql/tls_session_manager_sql.cpp @@ -170,6 +170,9 @@ size_t Session_Manager_SQL::remove_all() void Session_Manager_SQL::save(const Session& session) { + if(session.server_info().hostname().empty()) + return; + auto stmt = m_db->new_statement("insert or replace into tls_sessions" " values(?1, ?2, ?3, ?4, ?5)"); -- cgit v1.2.3