Fix some logic errors in Sender::send, as before it was sending to the
sender rather than the recipient
This commit is contained in:
parent
50644d2d68
commit
b7378dba78
2 changed files with 7 additions and 10 deletions
|
@ -1,8 +1,5 @@
|
||||||
use crate::prelude::{Host, Mailbox, Mailuser, Message, ParseMailboxError};
|
use crate::prelude::{Host, Mailbox, Mailuser, Message, ParseMailboxError};
|
||||||
use std::{
|
use std::{collections::HashMap, str::FromStr};
|
||||||
collections::HashMap,
|
|
||||||
str::FromStr,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use {
|
use {
|
||||||
crate::prelude::{CertificateStore, ClientCertificateStore, Request, Response},
|
crate::prelude::{CertificateStore, ClientCertificateStore, Mailuser, Request, Response},
|
||||||
rustls::{internal::msgs::codec::Codec, ClientConfig, ClientConnection, StreamOwned},
|
rustls::{internal::msgs::codec::Codec, ClientConfig, ClientConnection, StreamOwned},
|
||||||
std::{
|
std::{
|
||||||
io::{self, Read, Write},
|
io::{self, Read, Write},
|
||||||
|
@ -25,7 +25,7 @@ where
|
||||||
pub request: Request,
|
pub request: Request,
|
||||||
/// A [CertificateStore] for servers known to us
|
/// A [CertificateStore] for servers known to us
|
||||||
pub store: S,
|
pub store: S,
|
||||||
/// A [CertificateStore] for mailboxes which exist on this system
|
/// A [ClientCertificateStore] for mailboxes which exist on this system
|
||||||
pub client_store: C,
|
pub client_store: C,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,13 +47,13 @@ where
|
||||||
self.request.sender.host.to_string()
|
self.request.sender.host.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send(self) -> Result<Response, Error> {
|
pub fn send(self, recipient: &Mailuser) -> Result<Response, Error> {
|
||||||
let dnsname = self
|
let dnsname = recipient
|
||||||
.host_string()
|
.to_string()
|
||||||
.as_str()
|
.as_str()
|
||||||
.try_into()
|
.try_into()
|
||||||
.map_err(|_| Error::DnsError)?;
|
.map_err(|_| Error::DnsError)?;
|
||||||
let mut it = self.request.sender.host.to_socket_addrs()?;
|
let mut it = recipient.host.to_socket_addrs()?;
|
||||||
let client_cert = self.client_store.get_certificate(&self.request.sender);
|
let client_cert = self.client_store.get_certificate(&self.request.sender);
|
||||||
let verifier = Arc::new(Verifier::new(self.store));
|
let verifier = Arc::new(Verifier::new(self.store));
|
||||||
let Some(socket_addrs) = it.next() else {
|
let Some(socket_addrs) = it.next() else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue