summaryrefslogtreecommitdiffstats
path: root/privsep.lua
diff options
context:
space:
mode:
Diffstat (limited to 'privsep.lua')
-rw-r--r--privsep.lua40
1 files changed, 0 insertions, 40 deletions
diff --git a/privsep.lua b/privsep.lua
deleted file mode 100644
index b6e8f95..0000000
--- a/privsep.lua
+++ /dev/null
@@ -1,40 +0,0 @@
-
-ipcmsg = require("cmsgpack")
-ipcmsg.encode = ipcmsg.pack
-ipcmsg.decode = ipcmsg.unpack
-
-socket = require("socket")
-socket.unix = require("socket.unix")
-
-
-local modules_path = "./modules"
-
-local privsep = {}
-
-function privsep.call_privileged(mod, func, sectoken, args)
- local c = assert(socket.unix())
- assert(c:connect("/var/run/privsep/root.sock"))
-
- local req = { mod = mod, func = func, args = args, sectoken = sectoken }
- c:send(ipcmsg.encode(req))
- local retmsg, errmsg = c:receive("*a")
- if retmsg then
- local data = ipcmsg.decode(retmsg)
- return unpack(data.result or {})
- end
- return nil
-end
-
-function privsep.wrap(modname, sessionid)
- local mod = dofile(modules_path.."/"..modname..".lua")
- local f = {}
- for k,v in pairs(mod) do
- f[k] = function(...)
- return privsep.call_privileged(modname, k, sessionid, {...})
- end
- end
- return f
-end
-
-return privsep
-