server session BUGFIX moved place for chekcing max auth attempts
diff --git a/src/session_server_ssh.c b/src/session_server_ssh.c
index 56da365..2d0f5d6 100644
--- a/src/session_server_ssh.c
+++ b/src/session_server_ssh.c
@@ -900,12 +900,6 @@
return 0;
}
- if (session->ssh_auth_attempts >= ((struct nc_server_ssh_opts *)session->data)->auth_attempts) {
- /* too many failed attempts */
- ssh_message_reply_default(msg);
- return 0;
- }
-
/* save the username, do not let the client change it */
username = ssh_message_auth_user(msg);
if (!session->username) {
@@ -1145,6 +1139,11 @@
return -1;
}
+ if (session->opts.server.ssh_auth_attempts >= opts->auth_attempts) {
+ ERR("Too many failed authentication attempts of user \"%s\".", session->username);
+ return -1;
+ }
+
if (session->flags & NC_SESSION_SSH_AUTHENTICATED) {
break;
}