Merge upstream v0.16.24
Eight conflicted files resolved, plus the lock file and the schema:
- crates/services/src/task_manager/spam_classifier.rs: upstream's rules
update now replaces existing rules, DNSBL servers, lookups and file
extensions, keeping only whether each is on. Taken, with one difference:
an object an admin edited is kept as it is. Every object an update writes
is fingerprinted (content without `enable`, SHA-256, stored under
SUBSPACE_INBUXA "Sf"), and only one that still matches is replaced.
Scores are never replaced, as upstream has it. The AU-1.10 summary record
now names what was added, replaced and kept, and the bundled rules are
marked applied only when the update fully succeeded, so a failure runs
again on the next start. The marker becomes "3.0.2+2", which runs the
update once on upgrade to fingerprint every rule still as bundled.
- crates/common/src/network/autoconfig/autodiscover.rs: upstream's rewrite
(implicit TLS first, labeled SSL), with the per-protocol switches (LP-7,
LP-14a) passed in as a filter.
- crates/store/src/backend/mysql/{search,write}.rs: upstream's chunked
deletes (no unbounded first DELETE, stop on a short chunk, halve the
chunk on the new chunk-too-large errors) inside the fork's query timeout.
- crates/smtp/src/lib.rs: the fork's queue spawn kept. It already fixed the
stall upstream fixes here (a node without outboundMta stops accepting
mail at about 1024 queued messages), and follows role changes live.
- crates/jmap/src/registry/mapping/bootstrap.rs: the log path stays
/var/log/inbuxa/; upstream's PowerDNS mapping taken.
- crates/main/Cargo.toml: the AGPL-only license kept, version 0.16.24.
- tests/src/jmap/principal/get.rs: the fork's capabilities kept.
- resources/schema/schema.json.gz: merged as JSON; upstream relabeled the
vendor Sieve extensions "(Stalwart)", kept as "(vnd.inbuxa)".
- Cargo.lock: upstream's, with the fork's crates added by Cargo.
Also:
- tests/src/smtp/inbound/spam_rules_kept.rs: an edited rule survives an
update, an unedited one is updated, rules from before fingerprints are
handled, and the audit summary says so. Upstream's own spam_rules test
passes unchanged.
- tests/src/smtp/reporting/reschedule.rs moves to port 19058; upstream's
new spam_rules test took 19057.
- tools/fork/renames.py renames the "(Stalwart)" labels and the default
log path, so neither conflicts again.
- tools/fork/notice-check.py compares against the newest snapshot in the
checked-out history instead of the upstream branch head, so moving the
branch no longer fails other open pull requests.
- tests/src/directory/issuer.rs (since v0.16.23) stays out, and is on the
build check's known list: it tests issuer-based directory routing, which
the fork doesn't have (DIR-2).
- Strip report: docs/fork/strip-reports/v0.16.24.{md,json}.
This commit is contained in:
@@ -620,6 +620,7 @@ pub enum DnsServerBootstrapType {
|
||||
Vultr = 68,
|
||||
WebSupport = 69,
|
||||
YandexCloud = 70,
|
||||
PowerDns = 71,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
@@ -696,6 +697,7 @@ pub enum DnsServerType {
|
||||
Vultr = 67,
|
||||
WebSupport = 68,
|
||||
YandexCloud = 69,
|
||||
PowerDns = 70,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
|
||||
@@ -3023,6 +3023,7 @@ impl EnumImpl for DnsServerBootstrapType {
|
||||
b"Vultr" => DnsServerBootstrapType::Vultr,
|
||||
b"WebSupport" => DnsServerBootstrapType::WebSupport,
|
||||
b"YandexCloud" => DnsServerBootstrapType::YandexCloud,
|
||||
b"PowerDns" => DnsServerBootstrapType::PowerDns,
|
||||
}
|
||||
.copied()
|
||||
}
|
||||
@@ -3100,6 +3101,7 @@ impl EnumImpl for DnsServerBootstrapType {
|
||||
DnsServerBootstrapType::Vultr => "Vultr",
|
||||
DnsServerBootstrapType::WebSupport => "WebSupport",
|
||||
DnsServerBootstrapType::YandexCloud => "YandexCloud",
|
||||
DnsServerBootstrapType::PowerDns => "PowerDns",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3180,11 +3182,12 @@ impl EnumImpl for DnsServerBootstrapType {
|
||||
68 => Some(DnsServerBootstrapType::Vultr),
|
||||
69 => Some(DnsServerBootstrapType::WebSupport),
|
||||
70 => Some(DnsServerBootstrapType::YandexCloud),
|
||||
71 => Some(DnsServerBootstrapType::PowerDns),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
const COUNT: usize = 71;
|
||||
const COUNT: usize = 72;
|
||||
}
|
||||
|
||||
impl serde::Serialize for DnsServerBootstrapType {
|
||||
@@ -3281,6 +3284,7 @@ impl EnumImpl for DnsServerType {
|
||||
b"Vultr" => DnsServerType::Vultr,
|
||||
b"WebSupport" => DnsServerType::WebSupport,
|
||||
b"YandexCloud" => DnsServerType::YandexCloud,
|
||||
b"PowerDns" => DnsServerType::PowerDns,
|
||||
}
|
||||
.copied()
|
||||
}
|
||||
@@ -3357,6 +3361,7 @@ impl EnumImpl for DnsServerType {
|
||||
DnsServerType::Vultr => "Vultr",
|
||||
DnsServerType::WebSupport => "WebSupport",
|
||||
DnsServerType::YandexCloud => "YandexCloud",
|
||||
DnsServerType::PowerDns => "PowerDns",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3436,11 +3441,12 @@ impl EnumImpl for DnsServerType {
|
||||
67 => Some(DnsServerType::Vultr),
|
||||
68 => Some(DnsServerType::WebSupport),
|
||||
69 => Some(DnsServerType::YandexCloud),
|
||||
70 => Some(DnsServerType::PowerDns),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
const COUNT: usize = 70;
|
||||
const COUNT: usize = 71;
|
||||
}
|
||||
|
||||
impl serde::Serialize for DnsServerType {
|
||||
|
||||
@@ -1042,6 +1042,7 @@ pub enum Property {
|
||||
SentinelUsername = 914,
|
||||
Separator = 97,
|
||||
ServerHostname = 121,
|
||||
ServerId = 934,
|
||||
Servers = 308,
|
||||
ServiceAccountJson = 316,
|
||||
ServiceName = 913,
|
||||
|
||||
@@ -1195,6 +1195,7 @@ impl EnumImpl for Property {
|
||||
b"sentinelUsername" => Property::SentinelUsername,
|
||||
b"separator" => Property::Separator,
|
||||
b"serverHostname" => Property::ServerHostname,
|
||||
b"serverId" => Property::ServerId,
|
||||
b"servers" => Property::Servers,
|
||||
b"serviceAccountJson" => Property::ServiceAccountJson,
|
||||
b"serviceName" => Property::ServiceName,
|
||||
@@ -2134,6 +2135,7 @@ impl EnumImpl for Property {
|
||||
Property::SentinelUsername => "sentinelUsername",
|
||||
Property::Separator => "separator",
|
||||
Property::ServerHostname => "serverHostname",
|
||||
Property::ServerId => "serverId",
|
||||
Property::Servers => "servers",
|
||||
Property::ServiceAccountJson => "serviceAccountJson",
|
||||
Property::ServiceName => "serviceName",
|
||||
@@ -3077,6 +3079,7 @@ impl EnumImpl for Property {
|
||||
914 => Some(Property::SentinelUsername),
|
||||
97 => Some(Property::Separator),
|
||||
121 => Some(Property::ServerHostname),
|
||||
934 => Some(Property::ServerId),
|
||||
308 => Some(Property::Servers),
|
||||
316 => Some(Property::ServiceAccountJson),
|
||||
913 => Some(Property::ServiceName),
|
||||
@@ -3227,7 +3230,7 @@ impl EnumImpl for Property {
|
||||
}
|
||||
}
|
||||
|
||||
const COUNT: usize = 934;
|
||||
const COUNT: usize = 935;
|
||||
}
|
||||
|
||||
impl serde::Serialize for Property {
|
||||
@@ -4493,6 +4496,7 @@ impl ObjectInner {
|
||||
ObjectInner::DnsServer(DnsServer::Vultr(obj)) => obj.member_tenant_id,
|
||||
ObjectInner::DnsServer(DnsServer::WebSupport(obj)) => obj.member_tenant_id,
|
||||
ObjectInner::DnsServer(DnsServer::YandexCloud(obj)) => obj.member_tenant_id,
|
||||
ObjectInner::DnsServer(DnsServer::PowerDns(obj)) => obj.member_tenant_id,
|
||||
ObjectInner::Domain(obj) => obj.member_tenant_id,
|
||||
ObjectInner::MailingList(obj) => obj.member_tenant_id,
|
||||
ObjectInner::OAuthClient(obj) => obj.member_tenant_id,
|
||||
@@ -4595,6 +4599,7 @@ impl ObjectInner {
|
||||
ObjectInner::DnsServer(DnsServer::Vultr(obj)) => obj.member_tenant_id = Some(id),
|
||||
ObjectInner::DnsServer(DnsServer::WebSupport(obj)) => obj.member_tenant_id = Some(id),
|
||||
ObjectInner::DnsServer(DnsServer::YandexCloud(obj)) => obj.member_tenant_id = Some(id),
|
||||
ObjectInner::DnsServer(DnsServer::PowerDns(obj)) => obj.member_tenant_id = Some(id),
|
||||
ObjectInner::Domain(obj) => obj.member_tenant_id = Some(id),
|
||||
ObjectInner::MailingList(obj) => obj.member_tenant_id = Some(id),
|
||||
ObjectInner::OAuthClient(obj) => obj.member_tenant_id = Some(id),
|
||||
|
||||
@@ -1457,6 +1457,7 @@ pub enum DnsServer {
|
||||
Vultr(DnsServerCloud),
|
||||
WebSupport(DnsServerWebSupport),
|
||||
YandexCloud(DnsServerYandexCloud),
|
||||
PowerDns(DnsServerPowerDns),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
@@ -1672,6 +1673,7 @@ pub enum DnsServerBootstrap {
|
||||
Vultr(DnsServerCloud),
|
||||
WebSupport(DnsServerWebSupport),
|
||||
YandexCloud(DnsServerYandexCloud),
|
||||
PowerDns(DnsServerPowerDns),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
@@ -2435,6 +2437,31 @@ pub struct DnsServerPorkbun {
|
||||
pub propagation_delay: Option<Duration>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct DnsServerPowerDns {
|
||||
#[serde(rename = "apiKey")]
|
||||
pub api_key: SecretKey,
|
||||
#[serde(rename = "endpoint")]
|
||||
pub endpoint: Option<String>,
|
||||
#[serde(rename = "serverId")]
|
||||
pub server_id: Option<String>,
|
||||
#[serde(rename = "description")]
|
||||
pub description: String,
|
||||
#[serde(rename = "memberTenantId")]
|
||||
pub member_tenant_id: Option<Id>,
|
||||
#[serde(rename = "timeout")]
|
||||
pub timeout: Duration,
|
||||
#[serde(rename = "ttl")]
|
||||
pub ttl: Duration,
|
||||
#[serde(rename = "pollingInterval")]
|
||||
pub polling_interval: Duration,
|
||||
#[serde(rename = "propagationTimeout")]
|
||||
pub propagation_timeout: Duration,
|
||||
#[serde(rename = "propagationDelay")]
|
||||
pub propagation_delay: Option<Duration>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct DnsServerRoute53 {
|
||||
|
||||
@@ -10559,6 +10559,7 @@ impl ObjectImpl for DnsServer {
|
||||
DnsServer::Vultr(inner) => inner.validate(errors),
|
||||
DnsServer::WebSupport(inner) => inner.validate(errors),
|
||||
DnsServer::YandexCloud(inner) => inner.validate(errors),
|
||||
DnsServer::PowerDns(inner) => inner.validate(errors),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10772,6 +10773,9 @@ impl ObjectImpl for DnsServer {
|
||||
DnsServer::YandexCloud(object) => {
|
||||
object.index(i);
|
||||
}
|
||||
DnsServer::PowerDns(object) => {
|
||||
object.index(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11064,6 +11068,10 @@ impl Pickle for DnsServer {
|
||||
69u16.pickle(out);
|
||||
inner.pickle(out);
|
||||
}
|
||||
DnsServer::PowerDns(inner) => {
|
||||
70u16.pickle(out);
|
||||
inner.pickle(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11139,6 +11147,7 @@ impl Pickle for DnsServer {
|
||||
67 => Pickle::unpickle(stream).map(DnsServer::Vultr),
|
||||
68 => Pickle::unpickle(stream).map(DnsServer::WebSupport),
|
||||
69 => Pickle::unpickle(stream).map(DnsServer::YandexCloud),
|
||||
70 => Pickle::unpickle(stream).map(DnsServer::PowerDns),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -11635,6 +11644,13 @@ impl IntoValue for DnsServer {
|
||||
.insert_unchecked(Property::Type, JmapValue::Str("YandexCloud".into()));
|
||||
obj
|
||||
}
|
||||
DnsServer::PowerDns(obj) => {
|
||||
let mut obj = obj.into_value();
|
||||
obj.as_object_mut()
|
||||
.unwrap()
|
||||
.insert_unchecked(Property::Type, JmapValue::Str("PowerDns".into()));
|
||||
obj
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11719,6 +11735,7 @@ impl RegistryJsonPatch for DnsServer {
|
||||
DnsServerType::Vultr => *self = DnsServer::Vultr(Default::default()),
|
||||
DnsServerType::WebSupport => *self = DnsServer::WebSupport(Default::default()),
|
||||
DnsServerType::YandexCloud => *self = DnsServer::YandexCloud(Default::default()),
|
||||
DnsServerType::PowerDns => *self = DnsServer::PowerDns(Default::default()),
|
||||
}
|
||||
}
|
||||
match self {
|
||||
@@ -11792,6 +11809,7 @@ impl RegistryJsonPatch for DnsServer {
|
||||
DnsServer::Vultr(inner) => inner.patch(pointer, value),
|
||||
DnsServer::WebSupport(inner) => inner.patch(pointer, value),
|
||||
DnsServer::YandexCloud(inner) => inner.patch(pointer, value),
|
||||
DnsServer::PowerDns(inner) => inner.patch(pointer, value),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11869,6 +11887,7 @@ impl DnsServer {
|
||||
DnsServer::Vultr(_) => DnsServerType::Vultr,
|
||||
DnsServer::WebSupport(_) => DnsServerType::WebSupport,
|
||||
DnsServer::YandexCloud(_) => DnsServerType::YandexCloud,
|
||||
DnsServer::PowerDns(_) => DnsServerType::PowerDns,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12704,6 +12723,7 @@ impl DnsServerBootstrap {
|
||||
DnsServerBootstrap::Vultr(inner) => inner.validate(errors),
|
||||
DnsServerBootstrap::WebSupport(inner) => inner.validate(errors),
|
||||
DnsServerBootstrap::YandexCloud(inner) => inner.validate(errors),
|
||||
DnsServerBootstrap::PowerDns(inner) => inner.validate(errors),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12999,6 +13019,10 @@ impl Pickle for DnsServerBootstrap {
|
||||
70u16.pickle(out);
|
||||
inner.pickle(out);
|
||||
}
|
||||
DnsServerBootstrap::PowerDns(inner) => {
|
||||
71u16.pickle(out);
|
||||
inner.pickle(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13075,6 +13099,7 @@ impl Pickle for DnsServerBootstrap {
|
||||
68 => Pickle::unpickle(stream).map(DnsServerBootstrap::Vultr),
|
||||
69 => Pickle::unpickle(stream).map(DnsServerBootstrap::WebSupport),
|
||||
70 => Pickle::unpickle(stream).map(DnsServerBootstrap::YandexCloud),
|
||||
71 => Pickle::unpickle(stream).map(DnsServerBootstrap::PowerDns),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -13576,6 +13601,13 @@ impl IntoValue for DnsServerBootstrap {
|
||||
.insert_unchecked(Property::Type, JmapValue::Str("YandexCloud".into()));
|
||||
obj
|
||||
}
|
||||
DnsServerBootstrap::PowerDns(obj) => {
|
||||
let mut obj = obj.into_value();
|
||||
obj.as_object_mut()
|
||||
.unwrap()
|
||||
.insert_unchecked(Property::Type, JmapValue::Str("PowerDns".into()));
|
||||
obj
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13793,6 +13825,9 @@ impl RegistryJsonPatch for DnsServerBootstrap {
|
||||
DnsServerBootstrapType::YandexCloud => {
|
||||
*self = DnsServerBootstrap::YandexCloud(Default::default())
|
||||
}
|
||||
DnsServerBootstrapType::PowerDns => {
|
||||
*self = DnsServerBootstrap::PowerDns(Default::default())
|
||||
}
|
||||
}
|
||||
}
|
||||
match self {
|
||||
@@ -13867,6 +13902,7 @@ impl RegistryJsonPatch for DnsServerBootstrap {
|
||||
DnsServerBootstrap::Vultr(inner) => inner.patch(pointer, value),
|
||||
DnsServerBootstrap::WebSupport(inner) => inner.patch(pointer, value),
|
||||
DnsServerBootstrap::YandexCloud(inner) => inner.patch(pointer, value),
|
||||
DnsServerBootstrap::PowerDns(inner) => inner.patch(pointer, value),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13945,6 +13981,7 @@ impl DnsServerBootstrap {
|
||||
DnsServerBootstrap::Vultr(_) => DnsServerBootstrapType::Vultr,
|
||||
DnsServerBootstrap::WebSupport(_) => DnsServerBootstrapType::WebSupport,
|
||||
DnsServerBootstrap::YandexCloud(_) => DnsServerBootstrapType::YandexCloud,
|
||||
DnsServerBootstrap::PowerDns(_) => DnsServerBootstrapType::PowerDns,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18228,6 +18265,148 @@ impl RegistryJsonPropertyPatch for DnsServerPorkbun {
|
||||
}
|
||||
}
|
||||
|
||||
impl DnsServerPowerDns {
|
||||
fn validate(&self, errors: &mut Vec<ValidationError>) -> bool {
|
||||
let neb = errors.len();
|
||||
let value = &self.api_key;
|
||||
value.validate(errors);
|
||||
if let Some(value) = &self.endpoint {
|
||||
if value.is_empty() {
|
||||
errors.push(ValidationError::required(Property::Endpoint));
|
||||
}
|
||||
}
|
||||
if let Some(value) = &self.server_id {
|
||||
if value.is_empty() {
|
||||
errors.push(ValidationError::required(Property::ServerId));
|
||||
}
|
||||
}
|
||||
let value = &self.description;
|
||||
if value.is_empty() {
|
||||
errors.push(ValidationError::required(Property::Description));
|
||||
}
|
||||
if let Some(value) = &self.member_tenant_id {
|
||||
if !value.is_valid() {
|
||||
errors.push(ValidationError::required(Property::MemberTenantId));
|
||||
}
|
||||
}
|
||||
errors.len() == neb
|
||||
}
|
||||
|
||||
fn index<'x>(&'x self, i: &mut IndexBuilder<'x>) {
|
||||
i.foreign_key(ObjectType::Tenant, self.member_tenant_id, None);
|
||||
if let Some(value) = &self.member_tenant_id {
|
||||
i.search(Property::MemberTenantId, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Pickle for DnsServerPowerDns {
|
||||
fn pickle(&self, out: &mut Vec<u8>) {
|
||||
self.api_key.pickle(out);
|
||||
self.endpoint.pickle(out);
|
||||
self.server_id.pickle(out);
|
||||
self.description.pickle(out);
|
||||
self.member_tenant_id.pickle(out);
|
||||
self.timeout.pickle(out);
|
||||
self.ttl.pickle(out);
|
||||
self.polling_interval.pickle(out);
|
||||
self.propagation_timeout.pickle(out);
|
||||
self.propagation_delay.pickle(out);
|
||||
}
|
||||
|
||||
fn unpickle(stream: &mut crate::pickle::PickledStream<'_>) -> Option<Self> {
|
||||
let mut this = Self::default();
|
||||
this.api_key = Pickle::unpickle(stream)?;
|
||||
this.endpoint = Pickle::unpickle(stream)?;
|
||||
this.server_id = Pickle::unpickle(stream)?;
|
||||
this.description = Pickle::unpickle(stream)?;
|
||||
this.member_tenant_id = Pickle::unpickle(stream)?;
|
||||
this.timeout = Pickle::unpickle(stream)?;
|
||||
this.ttl = Pickle::unpickle(stream)?;
|
||||
this.polling_interval = Pickle::unpickle(stream)?;
|
||||
this.propagation_timeout = Pickle::unpickle(stream)?;
|
||||
this.propagation_delay = Pickle::unpickle(stream)?;
|
||||
Some(this)
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for DnsServerPowerDns {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
api_key: Default::default(),
|
||||
endpoint: Default::default(),
|
||||
server_id: Default::default(),
|
||||
description: Default::default(),
|
||||
member_tenant_id: Default::default(),
|
||||
timeout: Duration::from_millis(30000),
|
||||
ttl: Duration::from_millis(300000),
|
||||
polling_interval: Duration::from_millis(15000),
|
||||
propagation_timeout: Duration::from_millis(60000),
|
||||
propagation_delay: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoValue for DnsServerPowerDns {
|
||||
fn into_value(self) -> JmapValue<'static> {
|
||||
let mut map = jmap_tools::Map::with_capacity(12);
|
||||
map.insert_unchecked(Property::ApiKey, self.api_key.into_value());
|
||||
map.insert_unchecked(Property::Endpoint, self.endpoint.into_value());
|
||||
map.insert_unchecked(Property::ServerId, self.server_id.into_value());
|
||||
map.insert_unchecked(Property::Description, self.description.into_value());
|
||||
map.insert_unchecked(Property::MemberTenantId, self.member_tenant_id.into_value());
|
||||
map.insert_unchecked(Property::Timeout, self.timeout.into_value());
|
||||
map.insert_unchecked(Property::Ttl, self.ttl.into_value());
|
||||
map.insert_unchecked(
|
||||
Property::PollingInterval,
|
||||
self.polling_interval.into_value(),
|
||||
);
|
||||
map.insert_unchecked(
|
||||
Property::PropagationTimeout,
|
||||
self.propagation_timeout.into_value(),
|
||||
);
|
||||
map.insert_unchecked(
|
||||
Property::PropagationDelay,
|
||||
self.propagation_delay.into_value(),
|
||||
);
|
||||
JmapValue::Object(map)
|
||||
}
|
||||
}
|
||||
|
||||
impl RegistryJsonPropertyPatch for DnsServerPowerDns {
|
||||
fn patch_property<'x>(
|
||||
&mut self,
|
||||
mut pointer: JsonPointerPatch<'_>,
|
||||
value: JmapValue<'x>,
|
||||
) -> PatchResult<'x> {
|
||||
match pointer.next_property() {
|
||||
Some(Property::ApiKey) => self.api_key.patch(pointer, value),
|
||||
Some(Property::Endpoint) => self
|
||||
.endpoint
|
||||
.patch(pointer.with_validators(&[StringValidator::Trim]), value),
|
||||
Some(Property::ServerId) => self
|
||||
.server_id
|
||||
.patch(pointer.with_validators(&[StringValidator::Trim]), value),
|
||||
Some(Property::Description) => self
|
||||
.description
|
||||
.patch(pointer.with_validators(&[StringValidator::Trim]), value),
|
||||
Some(Property::MemberTenantId) => self
|
||||
.member_tenant_id
|
||||
.patch(pointer.assert_can_set_tenant()?, value),
|
||||
Some(Property::Timeout) => self.timeout.patch(pointer, value),
|
||||
Some(Property::Ttl) => self.ttl.patch(pointer, value),
|
||||
Some(Property::PollingInterval) => self.polling_interval.patch(pointer, value),
|
||||
Some(Property::PropagationTimeout) => self.propagation_timeout.patch(pointer, value),
|
||||
Some(Property::PropagationDelay) => self.propagation_delay.patch(pointer, value),
|
||||
Some(Property::Type) => Ok(MaybeUnpatched::Unpatched {
|
||||
property: Property::Type,
|
||||
value,
|
||||
}),
|
||||
_ => Err(PatchError::new(pointer, "Invalid property")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DnsServerRoute53 {
|
||||
fn validate(&self, errors: &mut Vec<ValidationError>) -> bool {
|
||||
let neb = errors.len();
|
||||
|
||||
@@ -14,6 +14,7 @@ pub mod dkim;
|
||||
pub mod http;
|
||||
pub mod report;
|
||||
pub mod secret;
|
||||
pub mod spam;
|
||||
pub mod task;
|
||||
|
||||
impl Roles {
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <[email protected]>
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use crate::schema::prelude::{SpamDnsblServer, SpamRule};
|
||||
|
||||
impl SpamRule {
|
||||
pub fn enable(&self) -> bool {
|
||||
match self {
|
||||
SpamRule::Any(rule) => rule.enable,
|
||||
SpamRule::Url(rule) => rule.enable,
|
||||
SpamRule::Domain(rule) => rule.enable,
|
||||
SpamRule::Email(rule) => rule.enable,
|
||||
SpamRule::Ip(rule) => rule.enable,
|
||||
SpamRule::Header(rule) => rule.enable,
|
||||
SpamRule::Body(rule) => rule.enable,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_enable(&mut self, enable: bool) {
|
||||
match self {
|
||||
SpamRule::Any(rule) => rule.enable = enable,
|
||||
SpamRule::Url(rule) => rule.enable = enable,
|
||||
SpamRule::Domain(rule) => rule.enable = enable,
|
||||
SpamRule::Email(rule) => rule.enable = enable,
|
||||
SpamRule::Ip(rule) => rule.enable = enable,
|
||||
SpamRule::Header(rule) => rule.enable = enable,
|
||||
SpamRule::Body(rule) => rule.enable = enable,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SpamDnsblServer {
|
||||
pub fn enable(&self) -> bool {
|
||||
match self {
|
||||
SpamDnsblServer::Any(server) => server.enable,
|
||||
SpamDnsblServer::Url(server) => server.enable,
|
||||
SpamDnsblServer::Domain(server) => server.enable,
|
||||
SpamDnsblServer::Email(server) => server.enable,
|
||||
SpamDnsblServer::Ip(server) => server.enable,
|
||||
SpamDnsblServer::Header(server) => server.enable,
|
||||
SpamDnsblServer::Body(server) => server.enable,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_enable(&mut self, enable: bool) {
|
||||
match self {
|
||||
SpamDnsblServer::Any(server) => server.enable = enable,
|
||||
SpamDnsblServer::Url(server) => server.enable = enable,
|
||||
SpamDnsblServer::Domain(server) => server.enable = enable,
|
||||
SpamDnsblServer::Email(server) => server.enable = enable,
|
||||
SpamDnsblServer::Ip(server) => server.enable = enable,
|
||||
SpamDnsblServer::Header(server) => server.enable = enable,
|
||||
SpamDnsblServer::Body(server) => server.enable = enable,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user