summaryrefslogtreecommitdiff
path: root/main/tcptls.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2012-07-06 18:49:17 +0000
committerMark Michelson <mmichelson@digium.com>2012-07-06 18:49:17 +0000
commit8260fdfdd15856c1c319ab21ab065dac4096fb22 (patch)
treeac0ceb6a066dfc65bd7131dbc0bc537bd0802dd6 /main/tcptls.c
parent8e7ad68b1af6dd022f2d73ce8ecc6268a9e1b140 (diff)
Remove a superfluous and dangerous freeing of an SSL_CTX.
The problem here is that multiple server sessions share a SSL_CTX. When one session ended, the SSL_CTX would be freed and set NULL, leaving the other sessions unable to function. The code being removed is superfluous because the SSL_CTX structures for servers will be properly freed when ast_ssl_teardown is called. (closes issue ASTERISK-20074) Reported by Trevor Helmsley Patches: ASTERISK-20074.diff uploaded by Mark Michelson (license #5049) Testers: Trevor Helmsley ........ Merged revisions 369731 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 369732 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369733 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/tcptls.c')
-rw-r--r--main/tcptls.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/main/tcptls.c b/main/tcptls.c
index 7a3ce4c4f..81972651e 100644
--- a/main/tcptls.c
+++ b/main/tcptls.c
@@ -135,14 +135,6 @@ HOOK_T ast_tcptls_server_write(struct ast_tcptls_session_instance *tcptls_sessio
return write(tcptls_session->fd, buf, count);
}
-static void session_instance_destructor(void *obj)
-{
- struct ast_tcptls_session_instance *i = obj;
- if (i->parent && i->parent->tls_cfg) {
- ast_ssl_teardown(i->parent->tls_cfg);
- }
-}
-
/*! \brief
* creates a FILE * from the fd passed by the accept thread.
* This operation is potentially expensive (certificate verification),
@@ -291,7 +283,7 @@ void *ast_tcptls_server_root(void *data)
}
continue;
}
- tcptls_session = ao2_alloc(sizeof(*tcptls_session), session_instance_destructor);
+ tcptls_session = ao2_alloc(sizeof(*tcptls_session), NULL);
if (!tcptls_session) {
ast_log(LOG_WARNING, "No memory for new session: %s\n", strerror(errno));
if (close(fd)) {
@@ -505,7 +497,7 @@ struct ast_tcptls_session_instance *ast_tcptls_client_create(struct ast_tcptls_s
}
}
- if (!(tcptls_session = ao2_alloc(sizeof(*tcptls_session), session_instance_destructor))) {
+ if (!(tcptls_session = ao2_alloc(sizeof(*tcptls_session), NULL))) {
goto error;
}