aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-11-02 17:10:23 -0400
committerJack Lloyd <[email protected]>2017-11-02 17:10:23 -0400
commited4a03da6e04bed8565bc69b1f0c9637b0b4bc3e (patch)
treeab3e46c74fdff7dd279c468c086b85e43faa4a74 /src/lib
parentd9a456e0b0fe2c3a3f8197f2a3daf7325495010f (diff)
Avoid saving a session to SQL database with empty hostname
This happens if the hostname is unknown or specified as an IP.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/tls/sessions_sql/tls_session_manager_sql.cpp3
1 files changed, 3 insertions, 0 deletions
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)");