aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-01-10 22:35:26 +0100
committerRobin Jarry <robin@jarry.cc>2023-01-11 14:12:23 +0100
commit3602fc620bc6a5e5cb8a4223399b6cbad11f9d65 (patch)
tree8e6c8936f20f90417537c6497246e0d5ead6ad5f
parentbf0a3e0056d6dad150e418f758c9c6778db9d4ba (diff)
downloadaerc-3602fc620bc6a5e5cb8a4223399b6cbad11f9d65.tar.gz
config: fix accounts backend specific parameters detection
Since commit c56027b2e69e ("config: cleanup accounts.conf section parsing"), no backend-specific settings are parsed and stored into account.Params. The logic is completely broken. Any key is specific unless one field of the AccountConfig struct has a matching ini:"key" tag. The fields that are tagged ini:"-" are already handled in the parent switch block. Reported-by: Jose Lombera <jose@lombera.dev> Reported-by: Ben Cohen <ben@bencohen.net> Fixes: c56027b2e69e ("config: cleanup accounts.conf section parsing") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Jose Lombera <jose@lombera.dev>
-rw-r--r--config/accounts.go18
1 files changed, 2 insertions, 16 deletions
diff --git a/config/accounts.go b/config/accounts.go
index cbdf54a8..a95a4485 100644
--- a/config/accounts.go
+++ b/config/accounts.go
@@ -206,23 +206,9 @@ func parseAccounts(root string, accts []string) error {
typ := reflect.TypeOf(account)
for i := 0; i < typ.NumField(); i++ {
field := typ.Field(i)
- switch field.Tag.Get("ini") {
- case key:
- fallthrough
- case "source":
- fallthrough
- case "source-cred-cmd":
- fallthrough
- case "outgoing":
- fallthrough
- case "outgoing-cred-cmd":
- fallthrough
- case "outgoing-cred-cmd-cache":
- fallthrough
- case "subject-re-pattern":
- fallthrough
- case "pgp-error-level":
+ if field.Tag.Get("ini") == key {
backendSpecific = false
+ break
}
}
if backendSpecific {