mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2024-10-23 06:57:26 +00:00
Fix: Local keys settings parsed incorrectly
Some checks are pending
trivy / Check (push) Waiting to run
Some checks are pending
trivy / Check (push) Waiting to run
This commit is contained in:
parent
3912fd0084
commit
1e0bde1008
1 changed files with 6 additions and 2 deletions
|
@ -34,11 +34,13 @@ pub struct Patterns {
|
|||
patterns: Vec<Pattern>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum Pattern {
|
||||
Include(MatchType),
|
||||
Exclude(MatchType),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum MatchType {
|
||||
Equal(String),
|
||||
StartsWith(String),
|
||||
|
@ -469,9 +471,9 @@ impl Patterns {
|
|||
}
|
||||
let match_type = if value == "*" {
|
||||
MatchType::All
|
||||
} else if let Some(value) = value.strip_prefix('*') {
|
||||
MatchType::StartsWith(value.to_string())
|
||||
} else if let Some(value) = value.strip_suffix('*') {
|
||||
MatchType::StartsWith(value.to_string())
|
||||
} else if let Some(value) = value.strip_prefix('*') {
|
||||
MatchType::EndsWith(value.to_string())
|
||||
} else if value.contains('*') {
|
||||
MatchType::Matches(GlobPattern::compile(&value, false))
|
||||
|
@ -485,6 +487,7 @@ impl Patterns {
|
|||
Pattern::Exclude(match_type)
|
||||
});
|
||||
}
|
||||
|
||||
if cfg_local_patterns.is_empty() {
|
||||
cfg_local_patterns = vec![
|
||||
Pattern::Include(MatchType::StartsWith("store.".to_string())),
|
||||
|
@ -494,6 +497,7 @@ impl Patterns {
|
|||
Pattern::Exclude(MatchType::StartsWith("server.allowed-ip.".to_string())),
|
||||
Pattern::Include(MatchType::StartsWith("server.".to_string())),
|
||||
Pattern::Include(MatchType::StartsWith("certificate.".to_string())),
|
||||
Pattern::Include(MatchType::StartsWith("config.local-keys.".to_string())),
|
||||
Pattern::Include(MatchType::StartsWith(
|
||||
"authentication.fallback-admin.".to_string(),
|
||||
)),
|
||||
|
|
Loading…
Reference in a new issue