Skip to content

Commit

Permalink
Fixes #3.
Browse files Browse the repository at this point in the history
  • Loading branch information
diosney committed Jul 3, 2014
1 parent 0f3c823 commit 557204e
Show file tree
Hide file tree
Showing 20 changed files with 97 additions and 97 deletions.
10 changes: 5 additions & 5 deletions lib/ipset/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ module.exports = function (options, cb) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/ipset/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ module.exports = function (options, cb) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/ipset/del.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ module.exports = function (options, cb) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/ipset/destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ module.exports = function (/* options?, cb */) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/ipset/flush.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ module.exports = function (/* options?, cb */) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/ipset/rename.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ module.exports = function (options, cb) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/ipset/swap.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ module.exports = function (options, cb) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
12 changes: 6 additions & 6 deletions lib/ipset/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = function (options, cb) {
var ipset_cmd = (options.sudo)
? 'sudo'
: '';

/*
* Build cmd to execute.
*/
Expand Down Expand Up @@ -48,11 +48,11 @@ module.exports = function (options, cb) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
}, error.code);
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err, error.code);
}
else if (cb) {
cb(null, 0);
Expand Down
10 changes: 5 additions & 5 deletions lib/ipset/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ module.exports = function (cb) {
*/
exec(cmd.join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null, stdout.split('\n')[0]);
Expand Down
10 changes: 5 additions & 5 deletions lib/iptables/append.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ module.exports = function (options, cb) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/iptables/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ module.exports = function (options, cb) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/iptables/delete_chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ module.exports = function (/* options?, cb */) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/iptables/flush.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ module.exports = function (/* options?, cb */) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/iptables/insert.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ module.exports = function (options, cb) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/iptables/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ module.exports = function (options, cb) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/iptables/policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ module.exports = function (options, cb) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/iptables/rename.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ module.exports = function (options, cb) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/iptables/replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ module.exports = function (options, cb) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
10 changes: 5 additions & 5 deletions lib/iptables/zero.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ module.exports = function (/* options?, cb */) {
*/
exec(cmd.concat(args).join(' '), function (error, stdout, stderror) {
if (error && cb) {
cb({
msg : stderror.split('\n')[0],
cmd : cmd.concat(args).join(' '),
code: error.code
});
var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;

cb(err);
}
else if (cb) {
cb(null);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name" : "netfilter",
"version" : "0.2.2",
"version" : "0.2.3",
"description" : "Packet filtering framework. Wrapper to provide netfilter capabilities from Node.js",
"main" : "index.js",
"keywords" : [
Expand Down

0 comments on commit 557204e

Please sign in to comment.