MCPcopy Create free account
hub / github.com/mscdex/ssh2 / authPasswdChg

Method authPasswdChg

lib/protocol/Protocol.js:1846–1863  ·  view source on GitHub ↗
(prompt)

Source from the content-addressed store, hash-verified

1844 sendPacket(this, this._packetRW.write.finalize(packet));
1845 }
1846 authPasswdChg(prompt) {
1847 if (!this._server)
1848 throw new Error('Server-only method called in client mode');
1849
1850 const promptLen = Buffer.byteLength(prompt);
1851 let p = this._packetRW.write.allocStart;
1852 const packet = this._packetRW.write.alloc(1 + 4 + promptLen + 4);
1853
1854 packet[p] = MESSAGE.USERAUTH_PASSWD_CHANGEREQ;
1855
1856 writeUInt32BE(packet, promptLen, ++p);
1857 packet.utf8Write(prompt, p += 4, promptLen);
1858
1859 writeUInt32BE(packet, 0, p += promptLen); // Empty language tag
1860
1861 this._debug && this._debug('Outbound: Sending USERAUTH_PASSWD_CHANGEREQ');
1862 sendPacket(this, this._packetRW.write.finalize(packet));
1863 }
1864 authInfoReq(name, instructions, prompts) {
1865 if (!this._server)
1866 throw new Error('Server-only method called in client mode');

Callers 1

requestChangeMethod · 0.80

Calls 3

writeUInt32BEFunction · 0.85
allocMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected