tokio-xmpp: Update dependencies
Update tokio_rustls, idna, webpki_roots. https://github.com/rustls/rustls/releases/tag/v%2F0.22.0 > ConfigBuilder::with_safe_defaults - calls to this can simply be deleted since safe defaults are now implicit. > OwnedTrustAnchor - use rustls_pki_types::TrustAnchor instead, and replace from_subject_spki_name_constraints with direct assignment to the struct fields. `RootCertStore::add_trust_anchors` seems to be removed too. Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
6b4bdc1641
commit
5b1706a311
3 changed files with 10 additions and 15 deletions
|
@ -18,7 +18,7 @@ log = "0.4"
|
||||||
tokio = { version = "1", features = ["net", "rt", "rt-multi-thread", "macros"] }
|
tokio = { version = "1", features = ["net", "rt", "rt-multi-thread", "macros"] }
|
||||||
tokio-stream = { version = "0.1", features = [] }
|
tokio-stream = { version = "0.1", features = [] }
|
||||||
tokio-util = { version = "0.7", features = ["codec"] }
|
tokio-util = { version = "0.7", features = ["codec"] }
|
||||||
webpki-roots = { version = "0.25", optional = true }
|
webpki-roots = { version = "0.26", optional = true }
|
||||||
rxml = { version = "0.11.1", features = ["compact_str"] }
|
rxml = { version = "0.11.1", features = ["compact_str"] }
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
syntect = { version = "5", optional = true }
|
syntect = { version = "5", optional = true }
|
||||||
|
@ -29,10 +29,10 @@ minidom = { version = "0.16" }
|
||||||
|
|
||||||
# these are only needed for starttls ServerConnector support
|
# these are only needed for starttls ServerConnector support
|
||||||
hickory-resolver = { version = "0.24", optional = true}
|
hickory-resolver = { version = "0.24", optional = true}
|
||||||
idna = { version = "0.5", optional = true}
|
idna = { version = "1.0", optional = true}
|
||||||
native-tls = { version = "0.2", optional = true }
|
native-tls = { version = "0.2", optional = true }
|
||||||
tokio-native-tls = { version = "0.3", optional = true }
|
tokio-native-tls = { version = "0.3", optional = true }
|
||||||
tokio-rustls = { version = "0.24", optional = true }
|
tokio-rustls = { version = "0.26", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = { version = "0.11", default-features = false, features = ["auto-color", "humantime"] }
|
env_logger = { version = "0.11", default-features = false, features = ["auto-color", "humantime"] }
|
||||||
|
|
|
@ -7,7 +7,7 @@ use std::borrow::Cow;
|
||||||
use std::error::Error as StdError;
|
use std::error::Error as StdError;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
#[cfg(all(feature = "tls-rust", not(feature = "tls-native")))]
|
#[cfg(all(feature = "tls-rust", not(feature = "tls-native")))]
|
||||||
use tokio_rustls::rustls::client::InvalidDnsNameError;
|
use tokio_rustls::rustls::pki_types::InvalidDnsNameError;
|
||||||
#[cfg(all(feature = "tls-rust", not(feature = "tls-native")))]
|
#[cfg(all(feature = "tls-rust", not(feature = "tls-native")))]
|
||||||
use tokio_rustls::rustls::Error as TlsError;
|
use tokio_rustls::rustls::Error as TlsError;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,8 @@ use {
|
||||||
std::sync::Arc,
|
std::sync::Arc,
|
||||||
tokio_rustls::{
|
tokio_rustls::{
|
||||||
client::TlsStream,
|
client::TlsStream,
|
||||||
rustls::{ClientConfig, OwnedTrustAnchor, RootCertStore, ServerName},
|
rustls::pki_types::ServerName,
|
||||||
|
rustls::{ClientConfig, RootCertStore},
|
||||||
TlsConnector,
|
TlsConnector,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -128,18 +129,12 @@ async fn get_tls_stream<S: AsyncRead + AsyncWrite + Unpin>(
|
||||||
xmpp_stream: XMPPStream<S>,
|
xmpp_stream: XMPPStream<S>,
|
||||||
) -> Result<TlsStream<S>, Error> {
|
) -> Result<TlsStream<S>, Error> {
|
||||||
let domain = xmpp_stream.jid.domain().to_string();
|
let domain = xmpp_stream.jid.domain().to_string();
|
||||||
let domain = ServerName::try_from(domain.as_str())?;
|
let domain = ServerName::try_from(domain)?;
|
||||||
let stream = xmpp_stream.into_inner();
|
let stream = xmpp_stream.into_inner();
|
||||||
let mut root_store = RootCertStore::empty();
|
let root_store = RootCertStore {
|
||||||
root_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| {
|
roots: webpki_roots::TLS_SERVER_ROOTS.into(),
|
||||||
OwnedTrustAnchor::from_subject_spki_name_constraints(
|
};
|
||||||
ta.subject,
|
|
||||||
ta.spki,
|
|
||||||
ta.name_constraints,
|
|
||||||
)
|
|
||||||
}));
|
|
||||||
let config = ClientConfig::builder()
|
let config = ClientConfig::builder()
|
||||||
.with_safe_defaults()
|
|
||||||
.with_root_certificates(root_store)
|
.with_root_certificates(root_store)
|
||||||
.with_no_client_auth();
|
.with_no_client_auth();
|
||||||
let tls_stream = TlsConnector::from(Arc::new(config))
|
let tls_stream = TlsConnector::from(Arc::new(config))
|
||||||
|
|
Loading…
Reference in a new issue