]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virnetsshsession: Don't check for auth callbacks in virNetSSHAuthenticatePassword()
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 14 May 2026 18:22:04 +0000 (20:22 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 18 May 2026 07:58:55 +0000 (09:58 +0200)
For the VIR_NET_SSH_AUTH_PASSWORD authentication mechanism the
virNetSSHAuthenticatePassword() is called. Inside it,
virAuthGetPasswordPath() is called to obtain password. Firstly
reading from our auth.conf file is attempted and if that fails
then corresponding callback from virConnectAuthCallbackPtr is
called. But virAuthGetPasswordPath() checks whether the callback
is NULL or not. There is no need for
virNetSSHAuthenticatePassword() to check it too. Drop the
duplicate check.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Richrad W.M. Jones <rjones@redhat.com>
src/rpc/virnetsshsession.c

index 83c86304807d4ff9dfbb4ef3e09068b4facd7bd0..3f60315822c0a0626d0b4b6f4bb3d2fa932c024b 100644 (file)
@@ -661,13 +661,6 @@ virNetSSHAuthenticatePassword(virNetSSHSession *sess)
 
     VIR_DEBUG("sess=%p", sess);
 
-    /* password authentication with interactive password request */
-    if (!sess->cred || !sess->cred->cb) {
-        virReportError(VIR_ERR_SSH, "%s",
-                       _("Can't perform authentication: Authentication callback not provided"));
-        goto cleanup;
-    }
-
     /* Try the authenticating the set amount of times. The server breaks the
      * connection if maximum number of bad auth tries is exceeded */
     while (true) {