mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2024-09-20 07:16:18 +08:00
Support multiple secret columns in SQL directories
Some checks failed
trivy / Check (push) Failing after -7m39s
Some checks failed
trivy / Check (push) Failing after -7m39s
This commit is contained in:
parent
f18b1d2fd4
commit
8d3931b76e
|
@ -32,9 +32,9 @@ impl SqlDirectory {
|
|||
.unwrap_or_default()
|
||||
.to_string(),
|
||||
column_secret: config
|
||||
.value((&prefix, "columns.secret"))
|
||||
.unwrap_or_default()
|
||||
.to_string(),
|
||||
.values((&prefix, "columns.secret"))
|
||||
.map(|(_, v)| v.to_string())
|
||||
.collect(),
|
||||
column_quota: config
|
||||
.value((&prefix, "columns.quota"))
|
||||
.unwrap_or_default()
|
||||
|
|
|
@ -209,7 +209,11 @@ impl SqlMappings {
|
|||
|
||||
if let Some(row) = rows.rows.into_iter().next() {
|
||||
for (name, value) in rows.names.into_iter().zip(row.values) {
|
||||
if name.eq_ignore_ascii_case(&self.column_secret) {
|
||||
if self
|
||||
.column_secret
|
||||
.iter()
|
||||
.any(|c| name.eq_ignore_ascii_case(c))
|
||||
{
|
||||
if let Value::Text(secret) = value {
|
||||
principal.secrets.push(secret.into_owned());
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ pub(crate) struct SqlMappings {
|
|||
query_verify: String,
|
||||
query_expand: String,
|
||||
column_description: String,
|
||||
column_secret: String,
|
||||
column_secret: Vec<String>,
|
||||
column_quota: String,
|
||||
column_type: String,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue