Browse Source

test: pummel/*ci-reneg* handle EPIPE

When calling out to the openssl client handle the child closing and
returning EPIPE on writes
v0.11.12-release
Timothy J Fontaine 11 years ago
parent
commit
de56ffa58b
  1. 16
      test/pummel/test-https-ci-reneg-attack.js
  2. 16
      test/pummel/test-tls-ci-reneg-attack.js

16
test/pummel/test-https-ci-reneg-attack.js

@ -67,8 +67,11 @@ function test(next) {
var args = ('s_client -connect 127.0.0.1:' + common.PORT).split(' '); var args = ('s_client -connect 127.0.0.1:' + common.PORT).split(' ');
var child = spawn(common.opensslCli, args); var child = spawn(common.opensslCli, args);
child.stdout.pipe(process.stdout); //child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr); //child.stderr.pipe(process.stderr);
child.stdout.resume();
child.stderr.resume();
// count handshakes, start the attack after the initial handshake is done // count handshakes, start the attack after the initial handshake is done
var handshakes = 0; var handshakes = 0;
@ -89,7 +92,14 @@ function test(next) {
var closed = false; var closed = false;
child.stdin.on('error', function(err) { child.stdin.on('error', function(err) {
assert.equal(err.code, 'ECONNRESET'); switch (err.code) {
case 'ECONNRESET':
case 'EPIPE':
break;
default:
assert.equal(err.code, 'ECONNRESET');
break;
}
closed = true; closed = true;
}); });
child.stdin.on('close', function() { child.stdin.on('close', function() {

16
test/pummel/test-tls-ci-reneg-attack.js

@ -65,8 +65,11 @@ function test(next) {
var args = ('s_client -connect 127.0.0.1:' + common.PORT).split(' '); var args = ('s_client -connect 127.0.0.1:' + common.PORT).split(' ');
var child = spawn(common.opensslCli, args); var child = spawn(common.opensslCli, args);
child.stdout.pipe(process.stdout); //child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr); //child.stderr.pipe(process.stderr);
child.stdout.resume();
child.stderr.resume();
// count handshakes, start the attack after the initial handshake is done // count handshakes, start the attack after the initial handshake is done
var handshakes = 0; var handshakes = 0;
@ -87,7 +90,14 @@ function test(next) {
var closed = false; var closed = false;
child.stdin.on('error', function(err) { child.stdin.on('error', function(err) {
assert.equal(err.code, 'ECONNRESET'); switch (err.code) {
case 'ECONNRESET':
case 'EPIPE':
break;
default:
assert.equal(err.code, 'ECONNRESET');
break;
}
closed = true; closed = true;
}); });
child.stdin.on('close', function() { child.stdin.on('close', function() {

Loading…
Cancel
Save