summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anylike.org>2010-05-30 22:36:36 +0000
committerChristian Pointner <equinox@anylike.org>2010-05-30 22:36:36 +0000
commita112eee5e9591f270c3f5412dfd692b1e51754f2 (patch)
treee55b0140cdf8fc461afc6366bbcc8882818d910e
parentdebug shell is now able to execute lua code (diff)
start debug shell only when -U is supplied
added warning when starting debug shell
-rw-r--r--src/debug_shell.lua5
-rw-r--r--src/main_loop.lua6
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