@@ -1564,17 +1564,6 @@ nc_server_ssh_auth(struct nc_session *session, struct nc_server_ssh_opts *opts,
15641564 }
15651565 }
15661566
1567- if ((method != SSH_AUTH_METHOD_NONE ) && (method != SSH_AUTH_METHOD_PASSWORD ) &&
1568- (method != SSH_AUTH_METHOD_PUBLICKEY ) && (method != SSH_AUTH_METHOD_INTERACTIVE )) {
1569- ++ session -> opts .server .ssh_auth_attempts ;
1570- VRB (session , "Authentication method \"%s\" not supported." , str_method );
1571- ssh_message_reply_default (msg );
1572- return 0 ;
1573- }
1574-
1575- /* CONFIG READ LOCK */
1576- pthread_rwlock_rdlock (& server_opts .config_lock );
1577-
15781567 /* try authenticating, if local users are supported, then the configured user must authenticate via all of his
15791568 * configured auth methods, otherwise for system users just one is needed,
15801569 * 0 return indicates success, 1 fail (msg not yet replied to), -1 fail (msg was replied to) */
@@ -1584,14 +1573,15 @@ nc_server_ssh_auth(struct nc_session *session, struct nc_server_ssh_opts *opts,
15841573 ret = nc_server_ssh_auth_password (session , local_users_supported , auth_client , msg );
15851574 } else if (method == SSH_AUTH_METHOD_PUBLICKEY ) {
15861575 ret = nc_server_ssh_auth_pubkey (session , local_users_supported , auth_client , msg );
1587- } else {
1588- assert (method == SSH_AUTH_METHOD_INTERACTIVE );
1576+ } else if (method == SSH_AUTH_METHOD_INTERACTIVE ) {
15891577 ret = nc_server_ssh_auth_kbdint (session , local_users_supported , auth_client , msg );
1578+ } else {
1579+ ++ session -> opts .server .ssh_auth_attempts ;
1580+ VRB (session , "Authentication method \"%s\" not supported." , str_method );
1581+ ssh_message_reply_default (msg );
1582+ return 0 ;
15901583 }
15911584
1592- /* CONFIG UNLOCK */
1593- pthread_rwlock_unlock (& server_opts .config_lock );
1594-
15951585 if (!ret ) {
15961586 auth_state -> success_methods |= method ;
15971587 auth_state -> success_count ++ ;
0 commit comments