Commit 08e83618 authored by Leo Iannacone's avatar Leo Iannacone

moved required libs back on top - moved setuid after setgid (if you set uid...

moved required libs back on top - moved setuid after setgid (if you set uid before, you will not be able to switch group after just because you have lost permissions)
parent b09999de
......@@ -7,9 +7,14 @@ var express = require('express')
, routes = require('./routes')
, config = require('./lib/config.js')
, utils = require('./lib/utils.js')
, Client = require('./lib/client.js')
, Broadcaster = require('./lib/broadcaster.js')
var app = module.exports = express.createServer();
//var io = require('socket.io').listen(app, { log: false }); // disable-log
var io = require('socket.io').listen(app);
// Configuration
app.configure(function(){
app.set('views', __dirname + '/views');
......@@ -41,8 +46,8 @@ var server = app.listen(config.port, config.host, null, function(){
// set uid e gid - drop root privileges
try {
process.setuid(config.user);
process.setgid(config.user);
process.setuid(config.user);
} catch (err) {
if (err.code == 'EPERM') {
console.error('Changing user id %s: permission denied. Running as %s.', config.user, process.getuid());
......@@ -53,13 +58,6 @@ var server = app.listen(config.port, config.host, null, function(){
}
}
var Client = require('./lib/client.js')
var Broadcaster = require('./lib/broadcaster.js')
// no log
//var io = require('socket.io').listen(app, { log: false });
var io = require('socket.io').listen(app);
// statuses
var status = {}
status.packages = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment