diff options
-rw-r--r-- | src/debug_shell.lua | 5 | ||||
-rw-r--r-- | src/main_loop.lua | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/debug_shell.lua b/src/debug_shell.lua index 58fb258..e470a8e 100644 --- a/src/debug_shell.lua +++ b/src/debug_shell.lua @@ -33,6 +33,8 @@ socket = require("socket") debug_shell = {} +debug_shell.socks = {}; + debug_shell.init = function(host, port) local ip, err = socket.dns.toip(host) if(ip == nil) then @@ -40,7 +42,6 @@ debug_shell.init = function(host, port) return nil end - debug_shell.socks = {}; debug_shell.socks[1], err = socket.tcp() if(debug_shell.socks[1] == nil) then log.printf(log.ERROR, "debug shell: can't create tcp socket") @@ -64,7 +65,7 @@ debug_shell.init = function(host, port) debug_shell.socks[1]:settimeout(0); debug_shell.buffer = ""; - log.printf(log.NOTICE, "debug shell: listening on %s:%s", ip, port); + log.printf(log.WARNING, "debug shell: listening on %s:%s (this is a huge security risk)", ip, port); return debug_shell.socks[1] end diff --git a/src/main_loop.lua b/src/main_loop.lua index cb74170..40f2e9a 100644 --- a/src/main_loop.lua +++ b/src/main_loop.lua @@ -35,8 +35,10 @@ function main_loop(opt) log.printf(log.NOTICE, "main_loop started") local sig = signal.init() - local ret = debug_shell.init("localhost", 9000) - if(ret == nil) then return -1 end + if(opt.debug) then + local ret = debug_shell.init("localhost", 9000) + if(ret == nil) then return -1 end + end local return_value = 0 while return_value == 0 do |