Registry caching and directory synchronization
This commit is contained in:
@@ -111,7 +111,11 @@ impl<T: SessionStream> Session<T> {
|
||||
.and_then(|access_token| access_token.assert_has_permission(Permission::EmailSend));
|
||||
|
||||
let result = match result {
|
||||
Ok(access_token) => self.server.account_info(access_token.account_id()).await,
|
||||
Ok(access_token) => {
|
||||
self.server
|
||||
.account_info(access_token.account_id())
|
||||
.await
|
||||
}
|
||||
Err(err) => Err(err),
|
||||
};
|
||||
|
||||
@@ -198,7 +202,7 @@ impl<T: SessionStream> Session<T> {
|
||||
self.data.authenticated_as.is_some()
|
||||
}
|
||||
|
||||
pub fn authenticated_emails(&self) -> impl Iterator<Item = &str> {
|
||||
pub fn authenticated_emails(&self) -> &[String] {
|
||||
self.data.authenticated_as.as_ref().unwrap().addresses()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +245,10 @@ impl<T: SessionStream> Session<T> {
|
||||
{
|
||||
let address_lcase = self.data.mail_from.as_ref().unwrap().address_lcase.as_str();
|
||||
if authenticated_as != address_lcase
|
||||
&& !self.authenticated_emails().any(|e| e == address_lcase)
|
||||
&& !self
|
||||
.authenticated_emails()
|
||||
.iter()
|
||||
.any(|e| e == address_lcase)
|
||||
{
|
||||
trc::event!(
|
||||
Smtp(SmtpEvent::MailFromUnauthorized),
|
||||
@@ -255,6 +258,7 @@ impl<T: SessionStream> Session<T> {
|
||||
.into_iter()
|
||||
.chain(
|
||||
self.authenticated_emails()
|
||||
.iter()
|
||||
.map(|e| trc::Value::String(e.into()))
|
||||
)
|
||||
.collect::<Vec<_>>()
|
||||
|
||||
Reference in New Issue
Block a user