From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Max Reitz <mreitz@redhat.com>, Pino Toscano <ptoscano@redhat.com>
Cc: kwolf@redhat.com, fam@euphon.net, qemu-block@nongnu.org,
sw@weilnetz.de, qemu-devel@nongnu.org, rjones@redhat.com,
alex.bennee@linaro.org
Subject: Re: [Qemu-devel] [PATCH v9] ssh: switch from libssh2 to libssh
Date: Fri, 14 Jun 2019 17:15:57 +0200 [thread overview]
Message-ID: <e4c2f281-e4d4-4ee9-c9ee-73eb32af8174@redhat.com> (raw)
In-Reply-To: <a6ba02da-711d-77c7-6bd1-b9ede5aecd81@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 3248 bytes --]
On 6/14/19 4:34 PM, Max Reitz wrote:
> On 14.06.19 16:29, Pino Toscano wrote:
>> On Thursday, 13 June 2019 21:31:40 CEST Max Reitz wrote:
>>> On 13.06.19 15:20, Pino Toscano wrote:
[...]
>>>> - case LIBSSH2_KNOWNHOST_CHECK_NOTFOUND:
>>>> + case SSH_KNOWN_HOSTS_OTHER:
>>>> ret = -EINVAL;
>>>> - session_error_setg(errp, s, "no host key was found in known_hosts");
>>>> + error_setg(errp,
>>>> + "host key for this server not found, another type exists");
>>>> goto out;
>>>> - case LIBSSH2_KNOWNHOST_CHECK_FAILURE:
>>>> + case SSH_KNOWN_HOSTS_UNKNOWN:
>>>> ret = -EINVAL;
>>>> - session_error_setg(errp, s,
>>>> - "failure matching the host key with known_hosts");
>>>> + error_setg(errp, "no host key was found in known_hosts");
>>>> + goto out;
>>>> + case SSH_KNOWN_HOSTS_NOT_FOUND:
>>>> + ret = -ENOENT;
>>>> + error_setg(errp, "known_hosts file not found");
>>>> + goto out;
>>>> + case SSH_KNOWN_HOSTS_ERROR:
>>>> + ret = -EINVAL;
>>>> + error_setg(errp, "error while checking the host");
>>>> goto out;
>>>> default:
>>>> ret = -EINVAL;
>>>> - session_error_setg(errp, s, "unknown error matching the host key"
>>>> - " with known_hosts (%d)", r);
>>>> + error_setg(errp, "error while checking for known server");
>>>> goto out;
>>>> }
>>>> +#else /* !HAVE_LIBSSH_0_8 */
>>>> + int state;
>>>> +
>>>> + state = ssh_is_server_known(s->session);
>>>> + trace_ssh_server_status(state);
>>>> +
>>>> + switch (state) {
>>>> + case SSH_SERVER_KNOWN_OK:
>>>> + /* OK */
>>>> + trace_ssh_check_host_key_knownhosts();
>>>> + break;
>>>> + case SSH_SERVER_KNOWN_CHANGED:
>>>> + ret = -EINVAL;
>>>> + error_setg(errp, "host key does not match the one in known_hosts");
>>>> + goto out;
>>>> + case SSH_SERVER_FOUND_OTHER:
>>>> + ret = -EINVAL;
>>>> + error_setg(errp,
>>>> + "host key for this server not found, another type exists");
>>>> + goto out;
>>>> + case SSH_SERVER_FILE_NOT_FOUND:
>>>> + ret = -ENOENT;
>>>> + error_setg(errp, "known_hosts file not found");
>>>> + goto out;
>>>> + case SSH_SERVER_NOT_KNOWN:
>>>> + ret = -EINVAL;
>>>> + error_setg(errp, "no host key was found in known_hosts");
>>>> + goto out;
>>>> + case SSH_SERVER_ERROR:
>>>> + ret = -EINVAL;
>>>> + error_setg(errp, "server error");
>>>> + goto out;
>>>
>>> No default here?
>>
>> This switch is for libssh < 0.8.0, so enumerating all the possible
>> values of the enum of the old API is enough.
>
> state is an integer. I feel very uneasy about not having a default
> clause for a plain integer, especially if it is supplied by an external
> library.
Agreed. What's odd is I tested it on Ubuntu Xenial which is 0.6.3 and no
got no cpp warning. I wonder if it is using a backported patch adding
ssh_session_is_known_server(), like 0.7.1 on Ubuntu Bionic. Anyway,
better add a default.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2019-06-14 15:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-13 13:20 [Qemu-devel] [PATCH v9] ssh: switch from libssh2 to libssh Pino Toscano
2019-06-13 13:50 ` Philippe Mathieu-Daudé
2019-06-13 16:24 ` no-reply
2019-06-13 17:15 ` Philippe Mathieu-Daudé
2019-06-13 18:18 ` Paolo Bonzini
2019-06-14 15:12 ` Philippe Mathieu-Daudé
2019-06-13 19:31 ` Max Reitz
2019-06-13 20:06 ` Eric Blake
2019-06-14 14:26 ` Philippe Mathieu-Daudé
2019-06-14 14:30 ` Max Reitz
2019-06-14 15:09 ` Philippe Mathieu-Daudé
2019-06-14 14:29 ` Pino Toscano
2019-06-14 14:34 ` Max Reitz
2019-06-14 15:15 ` Philippe Mathieu-Daudé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e4c2f281-e4d4-4ee9-c9ee-73eb32af8174@redhat.com \
--to=philmd@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=ptoscano@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
--cc=sw@weilnetz.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.