Project

General

Profile

Bug #75532

Mail aliases with recursive references break sendmail

Added by Luis Oliveira over 1 year ago. Updated over 1 year ago.

Status:
Done
Priority:
No priority
Assignee:
Waqar Ahmed
Category:
Middleware
Seen in:
Severity:
New
Reason for Closing:
Reason for Blocked:
Needs QA:
No
Needs Doc:
No
Needs Merging:
No
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:
ChangeLog Required:
No

Description

When an e-mail alias in /etc/aliases has a circular reference, e.g. `user: user`, the script /etc/find_alias_for_smtplib.py gets stuck and using 100%-ish CPU in a while loop.
This may happen when a user is created with the e-mail field set to the same value as the username. (And then you spend some hours debugging :)
Only affects e-mails if they are sent using sendmail.

Replicate:
1. Edit /etc/aliases and add:

test: test

2. Try send e-mail:
sendmail root << EOF
Test
EOF

Effect: Does not exit, or send the e-mail.

Possible solution:
1. Throw error, and let the user fix it:

--- find_alias_for_smtplib.old  2019-02-16 16:17:53.411873917 -0800
+++ find_alias_for_smtplib.py   2019-02-16 16:22:40.039208948 -0800
@@ -106,6 +106,9 @@
                 doround = False
             for key, val in aliases.items():
                 if val in aliases:
+                    if aliases[key] == aliases[val]:
+                        syslog.syslog('Found a recursive dependency in /etc/aliases.')
+                        raise ValueError('Found a recursive dependency in /etc/aliases.')
                     aliases[key] = aliases[val]
                     doround = True
         return aliases

Pro: The user will know. Con: E-mails will not be sent.

2. Ignore:

--- find_alias_for_smtplib.old  2019-02-16 16:17:53.411873917 -0800
+++ find_alias_for_smtplib.py   2019-02-16 16:30:24.776847110 -0800
@@ -106,8 +106,11 @@
                 doround = False
             for key, val in aliases.items():
                 if val in aliases:
-                    aliases[key] = aliases[val]
-                    doround = True
+                    if aliases[key] == aliases[val]:
+                        syslog.syslog('Warning: Found a recursive dependency in /etc/aliases.')
+                    else:
+                        aliases[key] = aliases[val]
+                        doround = True
         return aliases

Pro: E-mails will be sent (for other aliases/e-mails). Con: Users may not detect the issue.


Related issues

Copied to FreeNAS - Bug #75991: Fix recursive dependency for mail aliases Done

Associated revisions

Revision 1ee916f7 (diff)
Added by Waqar Ahmed over 1 year ago

Fix recursive dependency for aliases This commit fixes a recursive dependency for aliases which resulted in an infinite loop. Ticket: #75532

Revision 4699ad75 (diff)
Added by Waqar Ahmed over 1 year ago

Fix recursive dependency for aliases This commit fixes a recursive dependency for aliases which resulted in an infinite loop. Ticket: #75532 (cherry picked from commit 1ee916f7009ee771d9abe4f8be99cd189ed4ccd6)

History

#1 Updated by Dru Lavigne over 1 year ago

  • Category changed from OS to Middleware
  • Assignee changed from Release Council to William Grzybowski

#2 Updated by William Grzybowski over 1 year ago

  • Assignee changed from William Grzybowski to Waqar Ahmed
  • Target version changed from Backlog to 11.2-U3

#3 Updated by Waqar Ahmed over 1 year ago

  • Status changed from Unscreened to In Progress

#4 Updated by Bug Clerk over 1 year ago

  • Status changed from In Progress to Ready for Testing

#5 Updated by Bug Clerk over 1 year ago

  • Target version changed from 11.2-U3 to 11.3-BETA1

#6 Updated by Bug Clerk over 1 year ago

  • Copied to Bug #75991: Fix recursive dependency for mail aliases added

#7 Updated by Dru Lavigne over 1 year ago

  • Status changed from Ready for Testing to Done
  • Target version changed from 11.3-BETA1 to Master - FreeNAS Nightlies
  • Needs QA changed from Yes to No
  • Needs Doc changed from Yes to No
  • Needs Merging changed from Yes to No

Also available in: Atom PDF