Re: [libvirt PATCH 3/3] rpc/ssh: ssh_userauth_agent() is not supported on win32

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

On Tue, Apr 11, 2023 at 11:10 AM Michal Prívozník <mprivozn@xxxxxxxxxx> wrote:
On 4/6/23 17:58, marcandre.lureau@xxxxxxxxxx wrote:
> From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
>
> The function does not exist on win32.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
> ---
>  src/rpc/virnetlibsshsession.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c
> index e71a79d0fb..e94b0d7a2e 100644
> --- a/src/rpc/virnetlibsshsession.c
> +++ b/src/rpc/virnetlibsshsession.c
> @@ -60,7 +60,9 @@ typedef enum {
>      VIR_NET_LIBSSH_AUTH_KEYBOARD_INTERACTIVE,
>      VIR_NET_LIBSSH_AUTH_PASSWORD,
>      VIR_NET_LIBSSH_AUTH_PRIVKEY,
> -    VIR_NET_LIBSSH_AUTH_AGENT
> +#ifndef WIN32
> +    VIR_NET_LIBSSH_AUTH_AGENT,
> +#endif
>  } virNetLibsshAuthMethods;


I'd just drop this hunk, and ...


> @@ -698,6 +700,7 @@ virNetLibsshAuthenticate(virNetLibsshSession *sess)
>              /* try to authenticate using the keyboard interactive way */
>              ret = virNetLibsshAuthenticateKeyboardInteractive(sess, auth);
>              break;
> +#ifndef WIN32
>          case VIR_NET_LIBSSH_AUTH_AGENT:
>              /* try to authenticate using ssh-agent */
>              ret = ssh_userauth_agent(sess->session, NULL);
> @@ -708,6 +711,7 @@ virNetLibsshAuthenticate(virNetLibsshSession *sess)
>                                 errmsg);
>              }
>              break;
> +#endif


.. here just wrap the actual ssh_userauth_agent() call in ifdnef. The
@ret is set to SSH_AUTH_DENIED beforehand, and later in the code a
proper error message is reported.

>          case VIR_NET_LIBSSH_AUTH_PRIVKEY:
>              /* try to authenticate using the provided ssh key */
>              ret = virNetLibsshAuthenticatePrivkey(sess, auth);
> @@ -861,8 +865,13 @@ virNetLibsshSessionAuthAddPasswordAuth(virNetLibsshSession *sess,
>  }

>  int
> -virNetLibsshSessionAuthAddAgentAuth(virNetLibsshSession *sess)
> +virNetLibsshSessionAuthAddAgentAuth(virNetLibsshSession *sess G_GNUC_UNUSED)
>  {
> +#ifdef WIN32
> +    virReportError(VIR_ERR_LIBSSH, "%s",
> +                   _("Agent authentication is not supported on this host"));
> +    return -1;
> +#else
>      virNetLibsshAuthMethod *auth;

>      virObjectLock(sess);
> @@ -873,6 +882,7 @@ virNetLibsshSessionAuthAddAgentAuth(virNetLibsshSession *sess)

>      virObjectUnlock(sess);
>      return 0;
> +#endif
>  }

>  int

This hunk alone is enough to ensure agent is not available on WIN32.


Sure, that's fine with me.

thanks

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux