Project

General

Profile

Bug #75991

Fix recursive dependency for mail aliases

Added by Bug Clerk over 2 years ago. Updated over 2 years ago.

Status:
Done
Priority:
No priority
Assignee:
Waqar Ahmed
Category:
Middleware
Target version:
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

Has duplicate FreeNAS - Bug #77251: endless loop in /etc/find_alias_for_smtplib.py in case email is identical to user nameClosed
Copied from FreeNAS - Bug #75532: Mail aliases with recursive references break sendmailDone

History

#1 Updated by Bug Clerk over 2 years ago

  • Copied from Bug #75532: Mail aliases with recursive references break sendmail added

#2 Updated by Bug Clerk over 2 years ago

  • Target version changed from Master - FreeNAS Nightlies to 11.2-U3

#3 Updated by Bug Clerk over 2 years ago

  • Status changed from Unscreened to In Progress

#4 Updated by Bug Clerk over 2 years ago

  • Status changed from In Progress to Ready for Testing

#5 Updated by Dru Lavigne over 2 years ago

  • Subject changed from Mail aliases with recursive references break sendmail to Fix recursive dependency for mail aliases
  • Needs Doc changed from Yes to No
  • Needs Merging changed from Yes to No

#6 Updated by Dru Lavigne over 2 years ago

  • Has duplicate Bug #77251: endless loop in /etc/find_alias_for_smtplib.py in case email is identical to user name added

#10 Updated by Jeff Ervin over 2 years ago

60735

Test Passed FreeNAS-11.2-U2-INTERNAL100

Command did not hang.

#11 Updated by Dru Lavigne over 2 years ago

  • Status changed from Passed Testing to Done

Also available in: Atom PDF