+
+--- Check whether Session environment is sane.
+-- @return Boolean status
+function sane(file)
+ return luci.sys.process.info("uid")
+ == luci.fs.stat(file or sessionpath, "uid")
+ and luci.fs.stat(file or sessionpath, "modestr")
+ == (file and "rw-------" or "rwx------")
+end
+
+
+--- Write session data to a session file.
+-- @param id Session identifier
+-- @param data Session data