mirror of
https://github.com/curl/curl.git
synced 2026-06-16 06:15:38 +03:00
libssh2: do not use deprecated macros when unavailable
To support building with `LIBSSH2_NO_DEPRECATED` macro defined, a future libssh2 that may have dropped these macros. Ref: https://github.com/libssh2/libssh2/pull/1977 Closes #21867
This commit is contained in:
parent
3c7d136225
commit
5c9ac36e58
1 changed files with 11 additions and 3 deletions
|
|
@ -276,9 +276,11 @@ static enum curl_khtype convert_ssh2_keytype(int sshkeytype)
|
|||
case LIBSSH2_HOSTKEY_TYPE_RSA:
|
||||
keytype = CURLKHTYPE_RSA;
|
||||
break;
|
||||
case LIBSSH2_HOSTKEY_TYPE_DSS:
|
||||
#ifdef LIBSSH2_HOSTKEY_TYPE_DSS
|
||||
case LIBSSH2_HOSTKEY_TYPE_DSS: /* deprecated upstream */
|
||||
keytype = CURLKHTYPE_DSS;
|
||||
break;
|
||||
#endif
|
||||
#ifdef LIBSSH2_HOSTKEY_TYPE_ECDSA_256
|
||||
case LIBSSH2_HOSTKEY_TYPE_ECDSA_256:
|
||||
keytype = CURLKHTYPE_ECDSA;
|
||||
|
|
@ -337,9 +339,11 @@ static CURLcode ssh_knownhost(struct Curl_easy *data,
|
|||
case LIBSSH2_HOSTKEY_TYPE_RSA:
|
||||
keybit = LIBSSH2_KNOWNHOST_KEY_SSHRSA;
|
||||
break;
|
||||
case LIBSSH2_HOSTKEY_TYPE_DSS:
|
||||
#ifdef LIBSSH2_HOSTKEY_TYPE_DSS
|
||||
case LIBSSH2_HOSTKEY_TYPE_DSS: /* deprecated upstream */
|
||||
keybit = LIBSSH2_KNOWNHOST_KEY_SSHDSS;
|
||||
break;
|
||||
#endif
|
||||
case LIBSSH2_HOSTKEY_TYPE_ECDSA_256:
|
||||
keybit = LIBSSH2_KNOWNHOST_KEY_ECDSA_256;
|
||||
break;
|
||||
|
|
@ -618,7 +622,9 @@ static CURLcode ssh_force_knownhost_key_type(struct Curl_easy *data,
|
|||
static const char hostkey_method_ssh_ecdsa_256[] = "ecdsa-sha2-nistp256";
|
||||
static const char hostkey_method_ssh_rsa_all[] =
|
||||
"rsa-sha2-256,rsa-sha2-512,ssh-rsa";
|
||||
#ifdef LIBSSH2_KNOWNHOST_KEY_SSHDSS
|
||||
static const char hostkey_method_ssh_dss[] = "ssh-dss";
|
||||
#endif
|
||||
bool found = FALSE;
|
||||
|
||||
if(sshc->kh &&
|
||||
|
|
@ -687,9 +693,11 @@ static CURLcode ssh_force_knownhost_key_type(struct Curl_easy *data,
|
|||
case LIBSSH2_KNOWNHOST_KEY_SSHRSA:
|
||||
hostkey_method = hostkey_method_ssh_rsa_all;
|
||||
break;
|
||||
case LIBSSH2_KNOWNHOST_KEY_SSHDSS:
|
||||
#ifdef LIBSSH2_KNOWNHOST_KEY_SSHDSS
|
||||
case LIBSSH2_KNOWNHOST_KEY_SSHDSS: /* deprecated upstream */
|
||||
hostkey_method = hostkey_method_ssh_dss;
|
||||
break;
|
||||
#endif
|
||||
case LIBSSH2_KNOWNHOST_KEY_RSA1:
|
||||
failf(data, "Found host key type RSA1 which is not supported");
|
||||
return CURLE_SSH;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue