bdy 1.23.6-dev → 1.23.7-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/distTs/package.json +10 -2
- package/distTs/src/agent/linux.js +53 -3
- package/distTs/src/agent/manager.js +3 -6
- package/distTs/src/agent/osx.js +51 -3
- package/distTs/src/agent/system.js +400 -21
- package/distTs/src/agent/windows.js +4 -7
- package/distTs/src/command/agent/debug.js +2 -2
- package/distTs/src/command/agent/install.js +37 -10
- package/distTs/src/command/agent/restart.js +2 -2
- package/distTs/src/command/agent/run.js +3 -0
- package/distTs/src/command/agent/start.js +2 -2
- package/distTs/src/command/agent/status.js +19 -0
- package/distTs/src/command/agent/stop.js +2 -2
- package/distTs/src/command/agent/uninstall.js +5 -8
- package/distTs/src/command/agent/update.js +2 -2
- package/distTs/src/command/artifact/publish.js +3 -1
- package/distTs/src/command/version.js +13 -5
- package/distTs/src/logger.js +40 -4
- package/distTs/src/texts.js +35 -19
- package/distTs/src/utils.js +98 -3
- package/node_modules/asn1/Jenkinsfile +65 -0
- package/node_modules/asn1/LICENSE +19 -0
- package/node_modules/asn1/README.md +50 -0
- package/node_modules/asn1/lib/ber/errors.js +13 -0
- package/node_modules/asn1/lib/ber/index.js +27 -0
- package/node_modules/asn1/lib/ber/reader.js +262 -0
- package/node_modules/asn1/lib/ber/types.js +36 -0
- package/node_modules/asn1/lib/ber/writer.js +317 -0
- package/node_modules/asn1/lib/index.js +20 -0
- package/node_modules/asn1/package.json +31 -0
- package/node_modules/bcrypt-pbkdf/CONTRIBUTING.md +13 -0
- package/node_modules/bcrypt-pbkdf/LICENSE +66 -0
- package/node_modules/bcrypt-pbkdf/README.md +45 -0
- package/node_modules/bcrypt-pbkdf/index.js +556 -0
- package/node_modules/bcrypt-pbkdf/package.json +15 -0
- package/node_modules/safer-buffer/LICENSE +21 -0
- package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
- package/node_modules/safer-buffer/Readme.md +156 -0
- package/node_modules/safer-buffer/dangerous.js +58 -0
- package/node_modules/safer-buffer/package.json +34 -0
- package/node_modules/safer-buffer/safer.js +77 -0
- package/node_modules/safer-buffer/tests.js +406 -0
- package/node_modules/ssh2/.eslintignore +4 -0
- package/node_modules/ssh2/.eslintrc.js +5 -0
- package/node_modules/ssh2/.github/workflows/ci.yml +110 -0
- package/node_modules/ssh2/.github/workflows/lint.yml +27 -0
- package/node_modules/ssh2/LICENSE +19 -0
- package/node_modules/ssh2/README.md +1529 -0
- package/node_modules/ssh2/SFTP.md +413 -0
- package/node_modules/ssh2/examples/server-chat.js +238 -0
- package/node_modules/ssh2/examples/sftp-server-download-only.js +134 -0
- package/node_modules/ssh2/install.js +27 -0
- package/node_modules/ssh2/lib/Channel.js +295 -0
- package/node_modules/ssh2/lib/agent.js +1123 -0
- package/node_modules/ssh2/lib/client.js +2176 -0
- package/node_modules/ssh2/lib/http-agents.js +84 -0
- package/node_modules/ssh2/lib/index.js +44 -0
- package/node_modules/ssh2/lib/keygen.js +582 -0
- package/node_modules/ssh2/lib/protocol/Protocol.js +2136 -0
- package/node_modules/ssh2/lib/protocol/SFTP.js +4052 -0
- package/node_modules/ssh2/lib/protocol/constants.js +356 -0
- package/node_modules/ssh2/lib/protocol/crypto/binding.gyp +23 -0
- package/node_modules/ssh2/lib/protocol/crypto/poly1305.js +43 -0
- package/node_modules/ssh2/lib/protocol/crypto/src/binding.cc +2300 -0
- package/node_modules/ssh2/lib/protocol/crypto.js +1602 -0
- package/node_modules/ssh2/lib/protocol/handlers.js +16 -0
- package/node_modules/ssh2/lib/protocol/handlers.misc.js +1285 -0
- package/node_modules/ssh2/lib/protocol/kex.js +1908 -0
- package/node_modules/ssh2/lib/protocol/keyParser.js +1484 -0
- package/node_modules/ssh2/lib/protocol/node-fs-compat.js +115 -0
- package/node_modules/ssh2/lib/protocol/utils.js +356 -0
- package/node_modules/ssh2/lib/protocol/zlib.js +255 -0
- package/node_modules/ssh2/lib/server.js +1380 -0
- package/node_modules/ssh2/lib/utils.js +336 -0
- package/node_modules/ssh2/package.json +49 -0
- package/node_modules/ssh2/test/common.js +316 -0
- package/node_modules/ssh2/test/fixtures/bad_rsa_private_key +26 -0
- package/node_modules/ssh2/test/fixtures/https_cert.pem +33 -0
- package/node_modules/ssh2/test/fixtures/https_key.pem +52 -0
- package/node_modules/ssh2/test/fixtures/id_dsa +12 -0
- package/node_modules/ssh2/test/fixtures/id_ecdsa +5 -0
- package/node_modules/ssh2/test/fixtures/id_rsa +15 -0
- package/node_modules/ssh2/test/fixtures/id_rsa.ppk +26 -0
- package/node_modules/ssh2/test/fixtures/id_rsa_enc +30 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa +21 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc +22 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm +23 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa +9 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc +10 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm +10 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519 +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa +27 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc +28 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm +29 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa +12 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc +15 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa +5 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa +27 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc +30 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256 +54 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub.result +6 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.result +6 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc +17 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa +26 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc +18 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub +9 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub +10 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub +11 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub +11 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub +13 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/openssh_new_rsa +27 -0
- package/node_modules/ssh2/test/fixtures/ssh_host_dsa_key +12 -0
- package/node_modules/ssh2/test/fixtures/ssh_host_ecdsa_key +5 -0
- package/node_modules/ssh2/test/fixtures/ssh_host_rsa_key +15 -0
- package/node_modules/ssh2/test/test-exec.js +578 -0
- package/node_modules/ssh2/test/test-integration-openssh.js +486 -0
- package/node_modules/ssh2/test/test-keygen.js +60 -0
- package/node_modules/ssh2/test/test-misc-client-server.js +1460 -0
- package/node_modules/ssh2/test/test-openssh.js +261 -0
- package/node_modules/ssh2/test/test-protocol-crypto.js +631 -0
- package/node_modules/ssh2/test/test-protocol-keyparser.js +177 -0
- package/node_modules/ssh2/test/test-server-hostkeys.js +138 -0
- package/node_modules/ssh2/test/test-sftp.js +842 -0
- package/node_modules/ssh2/test/test-shell.js +109 -0
- package/node_modules/ssh2/test/test-userauth-agent-openssh.js +110 -0
- package/node_modules/ssh2/test/test-userauth-agent.js +171 -0
- package/node_modules/ssh2/test/test-userauth.js +611 -0
- package/node_modules/ssh2/test/test-worker-imports.js +25 -0
- package/node_modules/ssh2/test/test.js +20 -0
- package/node_modules/ssh2/util/build_pagent.bat +2 -0
- package/node_modules/ssh2/util/pagent.c +88 -0
- package/node_modules/ssh2/util/pagent.exe +0 -0
- package/node_modules/tweetnacl/.npmignore +4 -0
- package/node_modules/tweetnacl/AUTHORS.md +28 -0
- package/node_modules/tweetnacl/CHANGELOG.md +221 -0
- package/node_modules/tweetnacl/LICENSE +24 -0
- package/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md +20 -0
- package/node_modules/tweetnacl/README.md +459 -0
- package/node_modules/tweetnacl/nacl-fast.js +2388 -0
- package/node_modules/tweetnacl/nacl-fast.min.js +2 -0
- package/node_modules/tweetnacl/nacl.d.ts +98 -0
- package/node_modules/tweetnacl/nacl.js +1175 -0
- package/node_modules/tweetnacl/nacl.min.js +1 -0
- package/node_modules/tweetnacl/package.json +58 -0
- package/package.json +10 -2
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const assert = require('assert');
|
|
4
|
+
const { inspect } = require('util');
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
mustCall,
|
|
8
|
+
mustCallAtLeast,
|
|
9
|
+
setupSimple,
|
|
10
|
+
} = require('./common.js');
|
|
11
|
+
|
|
12
|
+
const DEBUG = false;
|
|
13
|
+
|
|
14
|
+
const setup = setupSimple.bind(undefined, DEBUG);
|
|
15
|
+
|
|
16
|
+
{
|
|
17
|
+
const { client, server } = setup('Simple exec()');
|
|
18
|
+
|
|
19
|
+
const COMMAND = 'foo --bar';
|
|
20
|
+
const STDOUT_DATA = 'stdout data!\n';
|
|
21
|
+
const STDERR_DATA = 'stderr data!\n';
|
|
22
|
+
|
|
23
|
+
server.on('connection', mustCall((conn) => {
|
|
24
|
+
conn.on('ready', mustCall(() => {
|
|
25
|
+
conn.on('session', mustCall((accept, reject) => {
|
|
26
|
+
accept().on('exec', mustCall((accept, reject, info) => {
|
|
27
|
+
assert(info.command === COMMAND,
|
|
28
|
+
`Wrong exec command: ${info.command}`);
|
|
29
|
+
const stream = accept();
|
|
30
|
+
stream.stderr.write(STDERR_DATA);
|
|
31
|
+
stream.write(STDOUT_DATA);
|
|
32
|
+
stream.exit(100);
|
|
33
|
+
stream.end();
|
|
34
|
+
conn.end();
|
|
35
|
+
}));
|
|
36
|
+
}));
|
|
37
|
+
}));
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
client.on('ready', mustCall(() => {
|
|
41
|
+
let out = '';
|
|
42
|
+
let outErr = '';
|
|
43
|
+
const events = [];
|
|
44
|
+
const EXPECTED_EVENTS = [ 'exit', 'close' ];
|
|
45
|
+
const EXPECTED_EXIT_CLOSE_ARGS = [ 100 ];
|
|
46
|
+
client.on('close', mustCall(() => {
|
|
47
|
+
assert(out === STDOUT_DATA, `Wrong stdout data: ${inspect(out)}`);
|
|
48
|
+
assert(outErr === STDERR_DATA, `Wrong stderr data: ${inspect(outErr)}`);
|
|
49
|
+
assert.deepStrictEqual(
|
|
50
|
+
events,
|
|
51
|
+
EXPECTED_EVENTS,
|
|
52
|
+
`Wrong command event order: ${events}`
|
|
53
|
+
);
|
|
54
|
+
})).exec(COMMAND, mustCall((err, stream) => {
|
|
55
|
+
assert(!err, `Unexpected exec error: ${err}`);
|
|
56
|
+
stream.on('data', mustCallAtLeast((d) => {
|
|
57
|
+
out += d;
|
|
58
|
+
})).on('exit', mustCall((...args) => {
|
|
59
|
+
assert.deepStrictEqual(args,
|
|
60
|
+
EXPECTED_EXIT_CLOSE_ARGS,
|
|
61
|
+
`Wrong exit args: ${inspect(args)}`);
|
|
62
|
+
events.push('exit');
|
|
63
|
+
})).on('close', mustCall((...args) => {
|
|
64
|
+
assert.deepStrictEqual(args,
|
|
65
|
+
EXPECTED_EXIT_CLOSE_ARGS,
|
|
66
|
+
`Wrong close args: ${inspect(args)}`);
|
|
67
|
+
events.push('close');
|
|
68
|
+
})).stderr.on('data', mustCallAtLeast((d) => {
|
|
69
|
+
outErr += d;
|
|
70
|
+
}));
|
|
71
|
+
}));
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
{
|
|
76
|
+
const { client, server } = setup('Simple exec() (exit signal)');
|
|
77
|
+
|
|
78
|
+
const COMMAND = 'foo --bar';
|
|
79
|
+
const STDOUT_DATA = 'stdout data!\n';
|
|
80
|
+
const STDERR_DATA = 'stderr data!\n';
|
|
81
|
+
|
|
82
|
+
server.on('connection', mustCall((conn) => {
|
|
83
|
+
conn.on('ready', mustCall(() => {
|
|
84
|
+
conn.on('session', mustCall((accept, reject) => {
|
|
85
|
+
accept().on('exec', mustCall((accept, reject, info) => {
|
|
86
|
+
assert(info.command === COMMAND,
|
|
87
|
+
`Wrong exec command: ${info.command}`);
|
|
88
|
+
const stream = accept();
|
|
89
|
+
stream.stderr.write(STDERR_DATA);
|
|
90
|
+
stream.write(STDOUT_DATA);
|
|
91
|
+
assert.throws(() => stream.exit('SIGFAKE'));
|
|
92
|
+
stream.exit('SIGKILL');
|
|
93
|
+
stream.end();
|
|
94
|
+
conn.end();
|
|
95
|
+
}));
|
|
96
|
+
}));
|
|
97
|
+
}));
|
|
98
|
+
}));
|
|
99
|
+
|
|
100
|
+
client.on('ready', mustCall(() => {
|
|
101
|
+
let out = '';
|
|
102
|
+
let outErr = '';
|
|
103
|
+
const events = [];
|
|
104
|
+
const EXPECTED_EVENTS = [ 'exit', 'close' ];
|
|
105
|
+
const EXPECTED_EXIT_CLOSE_ARGS = [ null, 'SIGKILL', false, '' ];
|
|
106
|
+
client.on('close', mustCall(() => {
|
|
107
|
+
assert(out === STDOUT_DATA, `Wrong stdout data: ${inspect(out)}`);
|
|
108
|
+
assert(outErr === STDERR_DATA, `Wrong stderr data: ${inspect(outErr)}`);
|
|
109
|
+
assert.deepStrictEqual(
|
|
110
|
+
events,
|
|
111
|
+
EXPECTED_EVENTS,
|
|
112
|
+
`Wrong command event order: ${events}`
|
|
113
|
+
);
|
|
114
|
+
})).exec(COMMAND, mustCall((err, stream) => {
|
|
115
|
+
assert(!err, `Unexpected exec error: ${err}`);
|
|
116
|
+
stream.on('data', mustCallAtLeast((d) => {
|
|
117
|
+
out += d;
|
|
118
|
+
})).on('exit', mustCall((...args) => {
|
|
119
|
+
assert.deepStrictEqual(args,
|
|
120
|
+
EXPECTED_EXIT_CLOSE_ARGS,
|
|
121
|
+
`Wrong exit args: ${inspect(args)}`);
|
|
122
|
+
events.push('exit');
|
|
123
|
+
})).on('close', mustCall((...args) => {
|
|
124
|
+
assert.deepStrictEqual(args,
|
|
125
|
+
EXPECTED_EXIT_CLOSE_ARGS,
|
|
126
|
+
`Wrong close args: ${inspect(args)}`);
|
|
127
|
+
events.push('close');
|
|
128
|
+
})).stderr.on('data', mustCallAtLeast((d) => {
|
|
129
|
+
outErr += d;
|
|
130
|
+
}));
|
|
131
|
+
}));
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
{
|
|
136
|
+
const { client, server } = setup('Simple exec() (exit signal -- no "SIG")');
|
|
137
|
+
|
|
138
|
+
const COMMAND = 'foo --bar';
|
|
139
|
+
const STDOUT_DATA = 'stdout data!\n';
|
|
140
|
+
const STDERR_DATA = 'stderr data!\n';
|
|
141
|
+
|
|
142
|
+
server.on('connection', mustCall((conn) => {
|
|
143
|
+
conn.on('ready', mustCall(() => {
|
|
144
|
+
conn.on('session', mustCall((accept, reject) => {
|
|
145
|
+
accept().on('exec', mustCall((accept, reject, info) => {
|
|
146
|
+
assert(info.command === COMMAND,
|
|
147
|
+
`Wrong exec command: ${info.command}`);
|
|
148
|
+
const stream = accept();
|
|
149
|
+
stream.stderr.write(STDERR_DATA);
|
|
150
|
+
stream.write(STDOUT_DATA);
|
|
151
|
+
assert.throws(() => stream.exit('FAKE'));
|
|
152
|
+
stream.exit('KILL');
|
|
153
|
+
stream.end();
|
|
154
|
+
conn.end();
|
|
155
|
+
}));
|
|
156
|
+
}));
|
|
157
|
+
}));
|
|
158
|
+
}));
|
|
159
|
+
|
|
160
|
+
client.on('ready', mustCall(() => {
|
|
161
|
+
let out = '';
|
|
162
|
+
let outErr = '';
|
|
163
|
+
const events = [];
|
|
164
|
+
const EXPECTED_EVENTS = [ 'exit', 'close' ];
|
|
165
|
+
const EXPECTED_EXIT_CLOSE_ARGS = [ null, 'SIGKILL', false, '' ];
|
|
166
|
+
client.on('close', mustCall(() => {
|
|
167
|
+
assert(out === STDOUT_DATA, `Wrong stdout data: ${inspect(out)}`);
|
|
168
|
+
assert(outErr === STDERR_DATA, `Wrong stderr data: ${inspect(outErr)}`);
|
|
169
|
+
assert.deepStrictEqual(
|
|
170
|
+
events,
|
|
171
|
+
EXPECTED_EVENTS,
|
|
172
|
+
`Wrong command event order: ${events}`
|
|
173
|
+
);
|
|
174
|
+
})).exec(COMMAND, mustCall((err, stream) => {
|
|
175
|
+
assert(!err, `Unexpected exec error: ${err}`);
|
|
176
|
+
stream.on('data', mustCallAtLeast((d) => {
|
|
177
|
+
out += d;
|
|
178
|
+
})).on('exit', mustCall((...args) => {
|
|
179
|
+
assert.deepStrictEqual(args,
|
|
180
|
+
EXPECTED_EXIT_CLOSE_ARGS,
|
|
181
|
+
`Wrong exit args: ${inspect(args)}`);
|
|
182
|
+
events.push('exit');
|
|
183
|
+
})).on('close', mustCall((...args) => {
|
|
184
|
+
assert.deepStrictEqual(args,
|
|
185
|
+
EXPECTED_EXIT_CLOSE_ARGS,
|
|
186
|
+
`Wrong close args: ${inspect(args)}`);
|
|
187
|
+
events.push('close');
|
|
188
|
+
})).stderr.on('data', mustCallAtLeast((d) => {
|
|
189
|
+
outErr += d;
|
|
190
|
+
}));
|
|
191
|
+
}));
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
{
|
|
196
|
+
const { client, server } = setup('Exec with signal()');
|
|
197
|
+
|
|
198
|
+
const COMMAND = 'foo --bar';
|
|
199
|
+
const STDOUT_DATA = 'stdout data!\n';
|
|
200
|
+
const STDERR_DATA = 'stderr data!\n';
|
|
201
|
+
|
|
202
|
+
server.on('connection', mustCall((conn) => {
|
|
203
|
+
conn.on('ready', mustCall(() => {
|
|
204
|
+
conn.on('session', mustCall((accept, reject) => {
|
|
205
|
+
let stream;
|
|
206
|
+
accept().on('exec', mustCall((accept, reject, info) => {
|
|
207
|
+
assert(info.command === COMMAND,
|
|
208
|
+
`Wrong exec command: ${info.command}`);
|
|
209
|
+
stream = accept();
|
|
210
|
+
stream.stderr.write(STDERR_DATA);
|
|
211
|
+
stream.write(STDOUT_DATA);
|
|
212
|
+
})).on('signal', mustCall((accept, reject, info) => {
|
|
213
|
+
assert(info.name === 'INT', `Wrong client signal name: ${info.name}`);
|
|
214
|
+
stream.exit(100);
|
|
215
|
+
stream.end();
|
|
216
|
+
conn.end();
|
|
217
|
+
}));
|
|
218
|
+
}));
|
|
219
|
+
}));
|
|
220
|
+
}));
|
|
221
|
+
|
|
222
|
+
client.on('ready', mustCall(() => {
|
|
223
|
+
let out = '';
|
|
224
|
+
let outErr = '';
|
|
225
|
+
const events = [];
|
|
226
|
+
const EXPECTED_EVENTS = [ 'exit', 'close' ];
|
|
227
|
+
const EXPECTED_EXIT_CLOSE_ARGS = [ 100 ];
|
|
228
|
+
client.on('close', mustCall(() => {
|
|
229
|
+
assert(out === STDOUT_DATA, `Wrong stdout data: ${inspect(out)}`);
|
|
230
|
+
assert(outErr === STDERR_DATA, `Wrong stderr data: ${inspect(outErr)}`);
|
|
231
|
+
assert.deepStrictEqual(
|
|
232
|
+
events,
|
|
233
|
+
EXPECTED_EVENTS,
|
|
234
|
+
`Wrong command event order: ${events}`
|
|
235
|
+
);
|
|
236
|
+
})).exec(COMMAND, mustCall((err, stream) => {
|
|
237
|
+
assert(!err, `Unexpected exec error: ${err}`);
|
|
238
|
+
const sendSignal = (() => {
|
|
239
|
+
let sent = false;
|
|
240
|
+
return () => {
|
|
241
|
+
if (sent)
|
|
242
|
+
return;
|
|
243
|
+
sent = true;
|
|
244
|
+
assert.throws(() => stream.signal('FAKE'));
|
|
245
|
+
assert.throws(() => stream.signal('SIGFAKE'));
|
|
246
|
+
stream.signal('SIGINT');
|
|
247
|
+
};
|
|
248
|
+
})();
|
|
249
|
+
stream.on('data', mustCallAtLeast((d) => {
|
|
250
|
+
out += d;
|
|
251
|
+
sendSignal();
|
|
252
|
+
})).on('exit', mustCall((...args) => {
|
|
253
|
+
assert.deepStrictEqual(args,
|
|
254
|
+
EXPECTED_EXIT_CLOSE_ARGS,
|
|
255
|
+
`Wrong exit args: ${inspect(args)}`);
|
|
256
|
+
events.push('exit');
|
|
257
|
+
})).on('close', mustCall((...args) => {
|
|
258
|
+
assert.deepStrictEqual(args,
|
|
259
|
+
EXPECTED_EXIT_CLOSE_ARGS,
|
|
260
|
+
`Wrong close args: ${inspect(args)}`);
|
|
261
|
+
events.push('close');
|
|
262
|
+
})).stderr.on('data', mustCallAtLeast((d) => {
|
|
263
|
+
outErr += d;
|
|
264
|
+
}));
|
|
265
|
+
}));
|
|
266
|
+
}));
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
{
|
|
270
|
+
const { client, server } = setup('Exec with signal() -- no "SIG"');
|
|
271
|
+
|
|
272
|
+
const COMMAND = 'foo --bar';
|
|
273
|
+
const STDOUT_DATA = 'stdout data!\n';
|
|
274
|
+
const STDERR_DATA = 'stderr data!\n';
|
|
275
|
+
|
|
276
|
+
server.on('connection', mustCall((conn) => {
|
|
277
|
+
conn.on('ready', mustCall(() => {
|
|
278
|
+
conn.on('session', mustCall((accept, reject) => {
|
|
279
|
+
let stream;
|
|
280
|
+
accept().on('exec', mustCall((accept, reject, info) => {
|
|
281
|
+
assert(info.command === COMMAND,
|
|
282
|
+
`Wrong exec command: ${info.command}`);
|
|
283
|
+
stream = accept();
|
|
284
|
+
stream.stderr.write(STDERR_DATA);
|
|
285
|
+
stream.write(STDOUT_DATA);
|
|
286
|
+
})).on('signal', mustCall((accept, reject, info) => {
|
|
287
|
+
assert(info.name === 'INT', `Wrong client signal name: ${info.name}`);
|
|
288
|
+
stream.exit(100);
|
|
289
|
+
stream.end();
|
|
290
|
+
conn.end();
|
|
291
|
+
}));
|
|
292
|
+
}));
|
|
293
|
+
}));
|
|
294
|
+
}));
|
|
295
|
+
|
|
296
|
+
client.on('ready', mustCall(() => {
|
|
297
|
+
let out = '';
|
|
298
|
+
let outErr = '';
|
|
299
|
+
const events = [];
|
|
300
|
+
const EXPECTED_EVENTS = [ 'exit', 'close' ];
|
|
301
|
+
const EXPECTED_EXIT_CLOSE_ARGS = [ 100 ];
|
|
302
|
+
client.on('close', mustCall(() => {
|
|
303
|
+
assert(out === STDOUT_DATA, `Wrong stdout data: ${inspect(out)}`);
|
|
304
|
+
assert(outErr === STDERR_DATA, `Wrong stderr data: ${inspect(outErr)}`);
|
|
305
|
+
assert.deepStrictEqual(
|
|
306
|
+
events,
|
|
307
|
+
EXPECTED_EVENTS,
|
|
308
|
+
`Wrong command event order: ${events}`
|
|
309
|
+
);
|
|
310
|
+
})).exec(COMMAND, mustCall((err, stream) => {
|
|
311
|
+
assert(!err, `Unexpected exec error: ${err}`);
|
|
312
|
+
const sendSignal = (() => {
|
|
313
|
+
let sent = false;
|
|
314
|
+
return () => {
|
|
315
|
+
if (sent)
|
|
316
|
+
return;
|
|
317
|
+
sent = true;
|
|
318
|
+
stream.signal('INT');
|
|
319
|
+
};
|
|
320
|
+
})();
|
|
321
|
+
stream.on('data', mustCallAtLeast((d) => {
|
|
322
|
+
out += d;
|
|
323
|
+
sendSignal();
|
|
324
|
+
})).on('exit', mustCall((...args) => {
|
|
325
|
+
assert.deepStrictEqual(args,
|
|
326
|
+
EXPECTED_EXIT_CLOSE_ARGS,
|
|
327
|
+
`Wrong exit args: ${inspect(args)}`);
|
|
328
|
+
events.push('exit');
|
|
329
|
+
})).on('close', mustCall((...args) => {
|
|
330
|
+
assert.deepStrictEqual(args,
|
|
331
|
+
EXPECTED_EXIT_CLOSE_ARGS,
|
|
332
|
+
`Wrong close args: ${inspect(args)}`);
|
|
333
|
+
events.push('close');
|
|
334
|
+
})).stderr.on('data', mustCallAtLeast((d) => {
|
|
335
|
+
outErr += d;
|
|
336
|
+
}));
|
|
337
|
+
}));
|
|
338
|
+
}));
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
{
|
|
342
|
+
const { client, server } = setup('Exec with environment set');
|
|
343
|
+
|
|
344
|
+
const env = { SSH2NODETEST: 'foo' };
|
|
345
|
+
|
|
346
|
+
server.on('connection', mustCall((conn) => {
|
|
347
|
+
conn.on('ready', mustCall(() => {
|
|
348
|
+
conn.on('session', mustCall((accept, reject) => {
|
|
349
|
+
accept().on('env', mustCall((accept, reject, info) => {
|
|
350
|
+
accept && accept();
|
|
351
|
+
assert(info.key === Object.keys(env)[0],
|
|
352
|
+
'Wrong env key');
|
|
353
|
+
assert(info.val === Object.values(env)[0],
|
|
354
|
+
'Wrong env value');
|
|
355
|
+
})).on('exec', mustCall((accept, reject, info) => {
|
|
356
|
+
assert(info.command === 'foo --bar',
|
|
357
|
+
`Wrong exec command: ${info.command}`);
|
|
358
|
+
const stream = accept();
|
|
359
|
+
stream.exit(100);
|
|
360
|
+
stream.end();
|
|
361
|
+
conn.end();
|
|
362
|
+
}));
|
|
363
|
+
}));
|
|
364
|
+
}));
|
|
365
|
+
}));
|
|
366
|
+
|
|
367
|
+
client.on('ready', mustCall(() => {
|
|
368
|
+
client.exec('foo --bar', { env }, mustCall((err, stream) => {
|
|
369
|
+
assert(!err, `Unexpected exec error: ${err}`);
|
|
370
|
+
stream.resume();
|
|
371
|
+
}));
|
|
372
|
+
}));
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
{
|
|
376
|
+
const { client, server } = setup('Exec with setWindow()');
|
|
377
|
+
|
|
378
|
+
const dimensions = {
|
|
379
|
+
rows: 60,
|
|
380
|
+
cols: 115,
|
|
381
|
+
height: 480,
|
|
382
|
+
width: 640,
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
server.on('connection', mustCall((conn) => {
|
|
386
|
+
conn.on('ready', mustCall(() => {
|
|
387
|
+
conn.on('session', mustCall((accept, reject) => {
|
|
388
|
+
accept().on('window-change', mustCall((accept, reject, info) => {
|
|
389
|
+
accept && accept();
|
|
390
|
+
assert.deepStrictEqual(info, dimensions, 'Wrong dimensions');
|
|
391
|
+
})).on('exec', mustCall((accept, reject, info) => {
|
|
392
|
+
assert(info.command === 'foo --bar',
|
|
393
|
+
`Wrong exec command: ${info.command}`);
|
|
394
|
+
const stream = accept();
|
|
395
|
+
stream.exit(100);
|
|
396
|
+
stream.end();
|
|
397
|
+
conn.end();
|
|
398
|
+
}));
|
|
399
|
+
}));
|
|
400
|
+
}));
|
|
401
|
+
}));
|
|
402
|
+
|
|
403
|
+
client.on('ready', mustCall(() => {
|
|
404
|
+
client.exec('foo --bar', mustCall((err, stream) => {
|
|
405
|
+
assert(!err, `Unexpected exec error: ${err}`);
|
|
406
|
+
stream.setWindow(...Object.values(dimensions));
|
|
407
|
+
stream.resume();
|
|
408
|
+
}));
|
|
409
|
+
}));
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
{
|
|
413
|
+
const { client, server } = setup('Exec with pty set');
|
|
414
|
+
|
|
415
|
+
const pty = {
|
|
416
|
+
rows: 2,
|
|
417
|
+
cols: 4,
|
|
418
|
+
width: 0,
|
|
419
|
+
height: 0,
|
|
420
|
+
term: 'vt220',
|
|
421
|
+
modes: {},
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
server.on('connection', mustCall((conn) => {
|
|
425
|
+
conn.on('ready', mustCall(() => {
|
|
426
|
+
conn.on('session', mustCall((accept, reject) => {
|
|
427
|
+
let sawPty = false;
|
|
428
|
+
accept().on('pty', mustCall((accept, reject, info) => {
|
|
429
|
+
assert.deepStrictEqual(info, pty, 'Wrong pty info');
|
|
430
|
+
sawPty = true;
|
|
431
|
+
accept && accept();
|
|
432
|
+
})).on('exec', mustCall((accept, reject, info) => {
|
|
433
|
+
assert(sawPty, 'Expected pty to be set up');
|
|
434
|
+
assert(info.command === 'foo --bar',
|
|
435
|
+
`Wrong exec command: ${info.command}`);
|
|
436
|
+
const stream = accept();
|
|
437
|
+
stream.exit(100);
|
|
438
|
+
stream.end();
|
|
439
|
+
conn.end();
|
|
440
|
+
}));
|
|
441
|
+
}));
|
|
442
|
+
}));
|
|
443
|
+
}));
|
|
444
|
+
|
|
445
|
+
client.on('ready', mustCall(() => {
|
|
446
|
+
client.exec('foo --bar', { pty }, mustCall((err, stream) => {
|
|
447
|
+
assert(!err, `Unexpected exec error: ${err}`);
|
|
448
|
+
stream.resume();
|
|
449
|
+
}));
|
|
450
|
+
}));
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
{
|
|
454
|
+
const { client, server } = setup('Exec with X11 forwarding');
|
|
455
|
+
|
|
456
|
+
server.on('connection', mustCall((conn) => {
|
|
457
|
+
conn.on('ready', mustCall(() => {
|
|
458
|
+
conn.on('session', mustCall((accept, reject) => {
|
|
459
|
+
let sawX11 = false;
|
|
460
|
+
accept().on('x11', mustCall((accept, reject, info) => {
|
|
461
|
+
assert.strictEqual(info.single,
|
|
462
|
+
false,
|
|
463
|
+
`Wrong x11 single: ${info.single}`);
|
|
464
|
+
assert.strictEqual(info.screen,
|
|
465
|
+
0,
|
|
466
|
+
`Wrong x11 screen: ${info.screen}`);
|
|
467
|
+
assert.strictEqual(info.protocol,
|
|
468
|
+
'MIT-MAGIC-COOKIE-1',
|
|
469
|
+
`Wrong x11 protocol: ${info.protocol}`);
|
|
470
|
+
assert(Buffer.isBuffer(info.cookie), 'Expected cookie Buffer');
|
|
471
|
+
assert.strictEqual(
|
|
472
|
+
info.cookie.length,
|
|
473
|
+
32,
|
|
474
|
+
`Invalid x11 cookie length: ${info.cookie.length}`
|
|
475
|
+
);
|
|
476
|
+
sawX11 = true;
|
|
477
|
+
accept && accept();
|
|
478
|
+
})).on('exec', mustCall((accept, reject, info) => {
|
|
479
|
+
assert(sawX11, 'Expected x11 before exec');
|
|
480
|
+
assert(info.command === 'foo --bar',
|
|
481
|
+
`Wrong exec command: ${info.command}`);
|
|
482
|
+
const stream = accept();
|
|
483
|
+
conn.x11('127.0.0.1', 4321, mustCall((err, xstream) => {
|
|
484
|
+
assert(!err, `Unexpected x11() error: ${err}`);
|
|
485
|
+
xstream.resume();
|
|
486
|
+
xstream.on('end', mustCall(() => {
|
|
487
|
+
stream.exit(100);
|
|
488
|
+
stream.end();
|
|
489
|
+
conn.end();
|
|
490
|
+
})).end();
|
|
491
|
+
}));
|
|
492
|
+
}));
|
|
493
|
+
}));
|
|
494
|
+
}));
|
|
495
|
+
}));
|
|
496
|
+
|
|
497
|
+
client.on('ready', mustCall(() => {
|
|
498
|
+
client.on('x11', mustCall((info, accept, reject) => {
|
|
499
|
+
assert.strictEqual(info.srcIP,
|
|
500
|
+
'127.0.0.1',
|
|
501
|
+
`Invalid x11 srcIP: ${info.srcIP}`);
|
|
502
|
+
assert.strictEqual(info.srcPort,
|
|
503
|
+
4321,
|
|
504
|
+
`Invalid x11 srcPort: ${info.srcPort}`);
|
|
505
|
+
accept();
|
|
506
|
+
})).exec('foo --bar', { x11: true }, mustCall((err, stream) => {
|
|
507
|
+
assert(!err, `Unexpected exec error: ${err}`);
|
|
508
|
+
stream.resume();
|
|
509
|
+
}));
|
|
510
|
+
}));
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
{
|
|
514
|
+
const { client, server } = setup(
|
|
515
|
+
'Exec with X11 forwarding (custom X11 settings)'
|
|
516
|
+
);
|
|
517
|
+
|
|
518
|
+
const x11 = {
|
|
519
|
+
single: true,
|
|
520
|
+
screen: 1234,
|
|
521
|
+
protocol: 'YUMMY-MAGIC-COOKIE-1',
|
|
522
|
+
cookie: '00112233445566778899001122334455',
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
server.on('connection', mustCall((conn) => {
|
|
526
|
+
conn.on('ready', mustCall(() => {
|
|
527
|
+
conn.on('session', mustCall((accept, reject) => {
|
|
528
|
+
let sawX11 = false;
|
|
529
|
+
accept().on('x11', mustCall((accept, reject, info) => {
|
|
530
|
+
assert.strictEqual(info.single,
|
|
531
|
+
x11.single,
|
|
532
|
+
`Wrong x11 single: ${info.single}`);
|
|
533
|
+
assert.strictEqual(info.screen,
|
|
534
|
+
x11.screen,
|
|
535
|
+
`Wrong x11 screen: ${info.screen}`);
|
|
536
|
+
assert.strictEqual(info.protocol,
|
|
537
|
+
x11.protocol,
|
|
538
|
+
`Wrong x11 protocol: ${info.protocol}`);
|
|
539
|
+
assert(Buffer.isBuffer(info.cookie), 'Expected cookie Buffer');
|
|
540
|
+
assert.strictEqual(info.cookie.toString(),
|
|
541
|
+
x11.cookie,
|
|
542
|
+
`Wrong x11 cookie: ${info.cookie}`);
|
|
543
|
+
sawX11 = true;
|
|
544
|
+
accept && accept();
|
|
545
|
+
})).on('exec', mustCall((accept, reject, info) => {
|
|
546
|
+
assert(sawX11, 'Expected x11 before exec');
|
|
547
|
+
assert(info.command === 'foo --bar',
|
|
548
|
+
`Wrong exec command: ${info.command}`);
|
|
549
|
+
const stream = accept();
|
|
550
|
+
conn.x11('127.0.0.1', 4321, mustCall((err, xstream) => {
|
|
551
|
+
assert(!err, `Unexpected x11() error: ${err}`);
|
|
552
|
+
xstream.resume();
|
|
553
|
+
xstream.on('end', mustCall(() => {
|
|
554
|
+
stream.exit(100);
|
|
555
|
+
stream.end();
|
|
556
|
+
conn.end();
|
|
557
|
+
})).end();
|
|
558
|
+
}));
|
|
559
|
+
}));
|
|
560
|
+
}));
|
|
561
|
+
}));
|
|
562
|
+
}));
|
|
563
|
+
|
|
564
|
+
client.on('ready', mustCall(() => {
|
|
565
|
+
client.on('x11', mustCall((info, accept, reject) => {
|
|
566
|
+
assert.strictEqual(info.srcIP,
|
|
567
|
+
'127.0.0.1',
|
|
568
|
+
`Invalid x11 srcIP: ${info.srcIP}`);
|
|
569
|
+
assert.strictEqual(info.srcPort,
|
|
570
|
+
4321,
|
|
571
|
+
`Invalid x11 srcPort: ${info.srcPort}`);
|
|
572
|
+
accept();
|
|
573
|
+
})).exec('foo --bar', { x11 }, mustCall((err, stream) => {
|
|
574
|
+
assert(!err, `Unexpected exec error: ${err}`);
|
|
575
|
+
stream.resume();
|
|
576
|
+
}));
|
|
577
|
+
}));
|
|
578
|
+
}
|