Skip to content

Commit

Permalink
Fix add-relay-rule for non-sender rules
Browse files Browse the repository at this point in the history
Settings must be copied across different rule types: in case of Default
and Recipient settings are shared. This aligns the add-relay-rule action
behavior to the correct behavior of alter-relay-rule.

Refs NethServer/dev#7069
  • Loading branch information
DavidePrincipi committed Nov 26, 2024
1 parent a42176c commit 67bd45f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion imageroot/actions/add-relay-rule/20add-relay-rule
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ try:
sys.exit(5)
if rule_type != 'sender':
# Copy auth and transport settings to existing rules with the same host:port key
cur.execute("""UPDATE relayrules SET transport=:transport, tls=:mandatory_tls, username=:username, password=:password WHERE host=:host AND port=:port AND rule_type=:rule_type""", values)
cur.execute("""UPDATE relayrules SET transport=:transport, tls=:mandatory_tls, username=:username, password=:password WHERE (rule_type != 'sender' AND host=:host AND port=:port)""", values)
cur.execute("""INSERT INTO relayrules (rule_type, rule_subject, transport, host, port, tls, username, password, enabled) VALUES (:rule_type, :rule_subject, :transport, :host, :port, :mandatory_tls, :username, :password, :enabled)""", values)

except Exception as err:
Expand Down

0 comments on commit 67bd45f

Please sign in to comment.