Edgewall Software
Modify

Opened 12 years ago

Closed 10 years ago

#10846 closed defect (worksforme)

admit_domains value not effect to mail notification.

Reported by: masato-ka Owned by:
Priority: normal Milestone:
Component: notification Version: 0.12.2
Severity: normal Keywords: admit_domains
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

We found a bug on admit_domains options. Intrinsically, admit_domains can do designation email address using domain. because, Trac admin screen describe to admit_domains below to "Comma-separated list of domains that should be considered as valid for email addresses (such as localdomain)." But, not behave it.

I read souce code "trac/notification.py". and I fixed this bug.

  • trac/trac/notification.py

     
    267267        admit_domains = self.env.config.get('notification', 'admit_domains')
    268268        if admit_domains:
    269269            pos = addrfmt.find('@')
     270            row_domains = [x.strip() for x in admit_domains.split(',')]
     271            admit_re = re.compile(r'[\w\d_\.\-\*]+')
     272            for row_domain in row_domains:
     273                if not admit_re.match(row_domain):
     274                    raise TracError("Invalid format admit_domains. %s" % admit_domains)
    270275            domains = '|'.join([x.strip() for x in \
    271                                 admit_domains.replace('.','\.').split(',')])
    272             addrfmt = r'%s@(?:(?:%s)|%s)' % (addrfmt[:pos], addrfmt[pos+1:],
    273                                               domains)
     276                                    admit_domains.replace('.','\.').split(',')])
     277            if domains:
     278                addrfmt = r'%s@(?:%s)' %(addrfmt[:pos],domains)
     279            else:
     280                addrfmt = r'%s@(?:(?:%s)|%s)' % (addrfmt[:pos], addrfmt[pos+1:],
     281                                                  domains)
    274282        self.shortaddr_re = re.compile(r'\s*(%s)\s*$' % addrfmt)
    275283        self.longaddr_re = re.compile(r'^\s*(.*)\s+<\s*(%s)\s*>\s*$' % addrfmt)
    276284        self._init_pref_encoding()

Perhaps, Other version trac(1.0) have same bug.

Please fixed to your trunk.

Regards masato-ka.

Attachments (0)

Change History (3)

comment:1 by Jun Omae, 12 years ago

This is not a bug.

admit_domains option provides a way to add valid domains for users if the domain is a local domain name (e.g. root@localhost, root@localdomain, etc…). The option doesn't provide a way to restrict the email domains.

comment:2 by Christian Boos, 11 years ago

Milestone: undecided

All the tickets for {20} from last year have probably been seen multiple times by now, yet are still to be triaged…

comment:3 by Jun Omae, 10 years ago

Milestone: undecided
Resolution: worksforme
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.