auth: Log the username used for authentication

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 7e235f8748)
This commit is contained in:
Jakub Jelen
2026-01-16 16:35:14 +01:00
parent dbb4c4cc11
commit 7ecca1fd26

View File

@@ -1294,6 +1294,11 @@ int ssh_userauth_publickey_auto(ssh_session session,
if (session == NULL) {
return SSH_AUTH_ERROR;
}
SSH_LOG(SSH_LOG_INFO,
"Starting authentication as a user %s",
username ? username : session->opts.username);
if (! (session->opts.flags & SSH_OPT_FLAG_PUBKEY_AUTH)) {
session->auth.supported_methods &= ~SSH_AUTH_METHOD_PUBLICKEY;
return SSH_AUTH_DENIED;