@@ -161,7 +161,7 @@ public void Multifactor_Password_ExceedsPartialSuccessLimit()
161
161
. Update ( )
162
162
. Restart ( ) ;
163
163
164
- var connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegulatUserPasswordAuthenticationMethod ( ) ) ;
164
+ var connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegularUserPasswordAuthenticationMethod ( ) ) ;
165
165
using ( var client = new SftpClient ( connectionInfo ) )
166
166
{
167
167
try
@@ -187,7 +187,7 @@ public void Multifactor_Password_MatchPartialSuccessLimit()
187
187
. Update ( )
188
188
. Restart ( ) ;
189
189
190
- var connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegulatUserPasswordAuthenticationMethod ( ) ) ;
190
+ var connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegularUserPasswordAuthenticationMethod ( ) ) ;
191
191
using ( var client = new SftpClient ( connectionInfo ) )
192
192
{
193
193
client . Connect ( ) ;
@@ -205,7 +205,7 @@ public void Multifactor_Password_Or_PublicKeyAndKeyboardInteractive()
205
205
. Restart ( ) ;
206
206
207
207
var connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegularUserPrivateKeyAuthenticationMethod ( ) ,
208
- _authenticationMethodFactory . CreateRegulatUserPasswordAuthenticationMethod ( ) ) ;
208
+ _authenticationMethodFactory . CreateRegularUserPasswordAuthenticationMethod ( ) ) ;
209
209
using ( var client = new SftpClient ( connectionInfo ) )
210
210
{
211
211
client . Connect ( ) ;
@@ -243,7 +243,7 @@ public void Multifactor_PasswordAndPublicKey_Or_PasswordAndPassword()
243
243
. Update ( )
244
244
. Restart ( ) ;
245
245
246
- var connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegulatUserPasswordAuthenticationMethod ( ) ,
246
+ var connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegularUserPasswordAuthenticationMethod ( ) ,
247
247
_authenticationMethodFactory . CreateRegularUserPrivateKeyAuthenticationMethodWithBadKey ( ) ) ;
248
248
using ( var client = new SftpClient ( connectionInfo ) )
249
249
{
@@ -275,14 +275,14 @@ public void Multifactor_PasswordAndPassword_Or_PublicKey()
275
275
. Update ( )
276
276
. Restart ( ) ;
277
277
278
- var connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegulatUserPasswordAuthenticationMethod ( ) ,
278
+ var connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegularUserPasswordAuthenticationMethod ( ) ,
279
279
_authenticationMethodFactory . CreateRegularUserPrivateKeyAuthenticationMethodWithBadKey ( ) ) ;
280
280
using ( var client = new SftpClient ( connectionInfo ) )
281
281
{
282
282
client . Connect ( ) ;
283
283
}
284
284
285
- connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegulatUserPasswordAuthenticationMethod ( ) ) ;
285
+ connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegularUserPasswordAuthenticationMethod ( ) ) ;
286
286
using ( var client = new SftpClient ( connectionInfo ) )
287
287
{
288
288
client . Connect ( ) ;
@@ -297,13 +297,13 @@ public void Multifactor_Password_Or_Password()
297
297
. Update ( )
298
298
. Restart ( ) ;
299
299
300
- var connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegulatUserPasswordAuthenticationMethod ( ) ) ;
300
+ var connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegularUserPasswordAuthenticationMethod ( ) ) ;
301
301
using ( var client = new SftpClient ( connectionInfo ) )
302
302
{
303
303
client . Connect ( ) ;
304
304
}
305
305
306
- connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegulatUserPasswordAuthenticationMethod ( ) ,
306
+ connectionInfo = _connectionInfoFactory . Create ( _authenticationMethodFactory . CreateRegularUserPasswordAuthenticationMethod ( ) ,
307
307
_authenticationMethodFactory . CreateRegularUserPrivateKeyAuthenticationMethodWithBadKey ( ) ) ;
308
308
using ( var client = new SftpClient ( connectionInfo ) )
309
309
{
@@ -423,5 +423,35 @@ public void KeyboardInteractiveConnectionInfo()
423
423
Assert . AreEqual ( connectionInfo . Host , SshServerHostName ) ;
424
424
Assert . AreEqual ( connectionInfo . Username , User . UserName ) ;
425
425
}
426
+
427
+ [ TestMethod ]
428
+ public void KeyboardInteractive_NoResponseSet_ThrowsSshAuthenticationException ( )
429
+ {
430
+ // ...instead of a cryptic ArgumentNullException
431
+ // https://github.com/sshnet/SSH.NET/issues/382
432
+
433
+ _remoteSshdConfig . WithAuthenticationMethods ( Users . Regular . UserName , "keyboard-interactive" )
434
+ . WithChallengeResponseAuthentication ( true )
435
+ . WithKeyboardInteractiveAuthentication ( true )
436
+ . WithUsePAM ( true )
437
+ . Update ( )
438
+ . Restart ( ) ;
439
+
440
+ var connectionInfo = _connectionInfoFactory . Create ( new KeyboardInteractiveAuthenticationMethod ( Users . Regular . UserName ) ) ;
441
+
442
+ using ( var client = new SftpClient ( connectionInfo ) )
443
+ {
444
+ try
445
+ {
446
+ client . Connect ( ) ;
447
+ Assert . Fail ( ) ;
448
+ }
449
+ catch ( SshAuthenticationException ex )
450
+ {
451
+ Assert . IsNull ( ex . InnerException ) ;
452
+ Assert . IsTrue ( ex . Message . StartsWith ( "AuthenticationPrompt.Response is null for prompt \" Password: \" " ) , $ "Message was \" { ex . Message } \" ") ;
453
+ }
454
+ }
455
+ }
426
456
}
427
457
}
0 commit comments