(authMethods, isPartial)
| 1752 | } |
| 1753 | // 'ssh-userauth' service-specific |
| 1754 | authFailure(authMethods, isPartial) { |
| 1755 | if (!this._server) |
| 1756 | throw new Error('Server-only method called in client mode'); |
| 1757 | |
| 1758 | if (this._authsQueue.length === 0) |
| 1759 | throw new Error('No auth in progress'); |
| 1760 | |
| 1761 | let methods; |
| 1762 | |
| 1763 | if (typeof authMethods === 'boolean') { |
| 1764 | isPartial = authMethods; |
| 1765 | authMethods = undefined; |
| 1766 | } |
| 1767 | |
| 1768 | if (authMethods) { |
| 1769 | methods = []; |
| 1770 | for (let i = 0; i < authMethods.length; ++i) { |
| 1771 | if (authMethods[i].toLowerCase() === 'none') |
| 1772 | continue; |
| 1773 | methods.push(authMethods[i]); |
| 1774 | } |
| 1775 | methods = methods.join(','); |
| 1776 | } else { |
| 1777 | methods = ''; |
| 1778 | } |
| 1779 | |
| 1780 | const methodsLen = methods.length; |
| 1781 | let p = this._packetRW.write.allocStart; |
| 1782 | const packet = this._packetRW.write.alloc(1 + 4 + methodsLen + 1); |
| 1783 | |
| 1784 | packet[p] = MESSAGE.USERAUTH_FAILURE; |
| 1785 | |
| 1786 | writeUInt32BE(packet, methodsLen, ++p); |
| 1787 | packet.utf8Write(methods, p += 4, methodsLen); |
| 1788 | |
| 1789 | packet[p += methodsLen] = (isPartial === true ? 1 : 0); |
| 1790 | |
| 1791 | this._authsQueue.shift(); |
| 1792 | |
| 1793 | this._debug && this._debug('Outbound: Sending USERAUTH_FAILURE'); |
| 1794 | sendPacket(this, this._packetRW.write.finalize(packet)); |
| 1795 | } |
| 1796 | authSuccess() { |
| 1797 | if (!this._server) |
| 1798 | throw new Error('Server-only method called in client mode'); |
no test coverage detected