aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-11-26 22:21:12 +0000
committerMatthew Wild <mwild1@gmail.com>2009-11-26 22:21:12 +0000
commit944ab8a84e38a7d10257fab36578e37cb571d8cf (patch)
treefad4a02918130b6cc96a6719d3deaba7d42f8d2c
parente6d079f88724611385a25a1c2554b13bde9bc44a (diff)
downloadprosody-944ab8a84e38a7d10257fab36578e37cb571d8cf.tar.gz
prosody-944ab8a84e38a7d10257fab36578e37cb571d8cf.zip
net.server_event: Hide starttls function when the connection is not SSL-enabled
-rw-r--r--net/server_event.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/server_event.lua b/net/server_event.lua
index 8187a7d0..79b2f388 100644
--- a/net/server_event.lua
+++ b/net/server_event.lua
@@ -374,6 +374,12 @@ do
function interface_mt:set_sslctx(sslctx)
self._sslctx = sslctx;
+ if sslctx then
+ self.starttls = nil; -- use starttls() of interface_mt
+ else
+ self.starttls = false; -- prevent starttls()
+ end
+ end
end
function interface_mt:starttls()
@@ -458,6 +464,9 @@ do
_sslctx = sslctx; -- parameters
_usingssl = false; -- client is using ssl;
}
+ if not sslctx then
+ interface.starttls = false -- don't allow TLS
+ end
interface.id = tostring(interface):match("%x+$");
interface.writecallback = function( event ) -- called on write events
--vdebug( "new client write event, id/ip/port:", interface, ip, port )