-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathssh_exception.js
175 lines (150 loc) · 5.37 KB
/
ssh_exception.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
paramikojs.ssh_exception = {}
/*
Exception raised by failures in SSH2 protocol negotiation or logic errors.
*/
paramikojs.ssh_exception.SSHException = function(message) {
this.message = message;
this.custom = true;
this.name = "SSHException";
};
paramikojs.ssh_exception.SSHException.prototype.toString = function () {
return this.name + ': "' + this.message + '"';
}
paramikojs.ssh_exception.WaitException = function(message) {
var baseEx = new paramikojs.ssh_exception.SSHException(message);
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "WaitException";
}
paramikojs.ssh_exception.CipherException = function(message) {
var baseEx = new paramikojs.ssh_exception.SSHException(message);
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "CipherException";
}
paramikojs.ssh_exception.EOFError = function(message) {
var baseEx = new paramikojs.ssh_exception.SSHException(message);
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "EOFError";
}
paramikojs.ssh_exception.IOError = function(message) {
var baseEx = new paramikojs.ssh_exception.SSHException(message);
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "IOError";
}
paramikojs.ssh_exception.SFTPError = function(message) {
var baseEx = new paramikojs.ssh_exception.SSHException(message);
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "SFTPError";
}
paramikojs.ssh_exception.UserRequestedDisconnect = function(message) {
var baseEx = new paramikojs.ssh_exception.SSHException(message);
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "UserRequestedDisconnect";
}
paramikojs.ssh_exception.IsPuttyKey = function(message, lines) {
var baseEx = new paramikojs.ssh_exception.SSHException(message);
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "IsPuttyKey";
this.lines = lines;
}
paramikojs.ssh_exception.BERException = function(message) {
var baseEx = new paramikojs.ssh_exception.SSHException(message);
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "BERException";
}
paramikojs.ssh_exception.NeedRekeyException = function(message) {
var baseEx = new paramikojs.ssh_exception.SSHException(message);
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "NeedRekeyException";
}
/*
Exception raised when authentication failed for some reason. It may be
possible to retry with different credentials. (Other classes specify more
specific reasons.)
@since: 1.6
*/
paramikojs.ssh_exception.AuthenticationException = function(message) {
var baseEx = new paramikojs.ssh_exception.SSHException(message);
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "AuthenticationException";
}
/*
Exception raised when a password is needed to unlock a private key file.
*/
paramikojs.ssh_exception.PasswordRequiredException = function(message) {
var baseEx = new paramikojs.ssh_exception.SSHException(message);
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "PasswordRequiredException";
}
/*
Exception raised when an authentication type (like password) is used, but
the server isn't allowing that type. (It may only allow public-key, for
example.)
@ivar allowed_types: list of allowed authentication types provided by the
server (possible values are: C{"none"}, C{"password"}, and
C{"publickey"}).
@type allowed_types: list
@since: 1.1
*/
paramikojs.ssh_exception.BadAuthenticationType = function(message, types) {
var baseEx = new paramikojs.ssh_exception.SSHException(message);
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "BadAuthenticationType";
this.allowed_types = types;
}
paramikojs.ssh_exception.BadAuthenticationType.prototype.toString = function () {
return this.name + ': "' + this.message + '"' + '(allowed_types=' + JSON.stringify(this.allowed_types) + ')';
}
/*
An internal exception thrown in the case of partial authentication.
*/
paramikojs.ssh_exception.PartialAuthentication = function(types) {
var baseEx = new paramikojs.ssh_exception.SSHException('partial authentication');
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "PartialAuthentication";
this.allowed_types = types;
}
/*
Exception raised when an attempt to open a new L{Channel} fails.
@ivar code: the error code returned by the server
@type code: int
@since: 1.6
*/
paramikojs.ssh_exception.ChannelException = function(code, text) {
var baseEx = new paramikojs.ssh_exception.SSHException(text);
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "ChannelException";
this.code = code;
}
/*
The host key given by the SSH server did not match what we were expecting.
@ivar hostname: the hostname of the SSH server
@type hostname: str
@ivar key: the host key presented by the server
@type key: L{PKey}
@ivar expected_key: the host key expected
@type expected_key: L{PKey}
@since: 1.6
*/
paramikojs.ssh_exception.BadHostKeyException = function(hostname, got_key, expected_key) {
var baseEx = new paramikojs.ssh_exception.SSHException('Host key for server ' + hostname + ' does not match!');
inherit(this, baseEx);
this.toString = baseEx.toString;
this.name = "BadHostKeyException";
this.hostname = hostname;
this.key = got_key;
this.expected_key = expected_key;
}