Socket
Socket
Sign inDemoInstall

vpnc

Package Overview
Dependencies
9
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.1 to 1.4.2

37

lib/vpnc.js
var _ = require('underscore');
var debuggable = require('debuggable');
var exec = require('child_process').exec;
var inpathSync = require('inpath').sync;
var spawn = require('child_process').spawn;
var exec = require('child_process').exec;
var sudo = require('sudo');
var tempFile = require('temp').path;
var writeFile = require('fs').writeFile;
var inpathSync = require('inpath').sync;
var sudo = require('sudo');

@@ -16,3 +17,2 @@ var vpncConfig = require('./vpnc-config');

var vpncDisconnectBinary = inpathSync('vpnc-disconnect', path);
var debug = false;

@@ -23,8 +23,5 @@ exports = module.exports = {

disconnect: disconnect,
setDebug: setDebug,
};
function setDebug() {
debug = true;
}
debuggable(exports);

@@ -90,11 +87,2 @@ function available(callback) {

function printDebug(d) {
var lines = d.toString().split('\n');
lines.forEach(function (line) {
if (line.length) {
console.log('vpnc: ' + line);
}
});
}
function connect(config, routes, callback) {

@@ -110,2 +98,3 @@ if (typeof routes === 'function') {

var configFile = tempFile({ suffix: '.vpnc.conf' });
exports.dlog('config file: ', configFile);
writeFile(configFile, vpncConfig(config), 'utf-8', function (err) {

@@ -131,7 +120,10 @@ if (err) {

var options = { cachePassword: true, spawnOptions: { env: env } };
var cp = sudo([ '-E', vpncBinary, '--debug', '1', configFile ], options);
if (debug) {
cp.stderr.on('data', printDebug);
cp.stdout.on('data', printDebug);
}
var args = [ '-E', vpncBinary, '--debug', '1', configFile ];
exports.dlog('sudo ' + args.join(' '));
var cp = sudo(args, options);
function logVpnc(line) { exports.dlog(line); } // Present save caller function to dlog
cp.stderr.on('data', function (data) { data.toString().split('\n').forEach(logVpnc); });
cp.stdout.on('data', function (data) { data.toString().split('\n').forEach(logVpnc); });
cp.on('exit', function (code) {

@@ -144,2 +136,3 @@ callback(null, code);

function disconnect(callback) {
exports.dlog('sudo ' + vpncDisconnectBinary);
var cp = sudo([ vpncDisconnectBinary ], { cachePassword: true });

@@ -146,0 +139,0 @@ cp.on('exit', function (code) {

@@ -5,3 +5,3 @@ {

"description": "Cisco VPN connector / vpnc wrapper",
"version": "1.4.1",
"version": "1.4.2",
"homepage": "https://github.com/calmh/node-vpnc",

@@ -19,3 +19,4 @@ "repository": {

"inpath": "~1.0.0",
"sudo": "~1.0.1"
"sudo": "~1.0.1",
"debuggable": "~1.0.0"
},

@@ -22,0 +23,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc