=== modified file 'Mailman/Cgi/edithtml.py' --- Mailman/Cgi/edithtml.py 2017-06-06 05:47:05 +0000 +++ Mailman/Cgi/edithtml.py 2018-05-31 09:57:34 +0000 @@ -46,6 +46,8 @@ template_data = ( ('listinfo.html', _('General list information page')), + ('listinfo_nosubscribe.html', + _('General list information page(no subscription form)')), ('subscribe.html', _('Subscribe results page')), ('options.html', _('User specific options page')), ('subscribeack.txt', _('Welcome email text file')), === modified file 'Mailman/Cgi/listinfo.py' --- Mailman/Cgi/listinfo.py 2018-05-26 16:22:35 +0000 +++ Mailman/Cgi/listinfo.py 2018-05-31 06:27:40 +0000 @@ -180,51 +180,59 @@ replacements = mlist.GetStandardReplacements(lang) - if not mlist.digestable or not mlist.nondigestable: - replacements[''] = "" - replacements[''] = "" - replacements[''] = '' - else: - replacements[''] = mlist.FormatDigestButton() - replacements[''] = \ - mlist.FormatUndigestButton() - replacements[''] = '' - replacements[''] = '' - replacements[''] = \ - mlist.FormatPlainDigestsButton() - replacements[''] = mlist.FormatMimeDigestsButton() - replacements[''] = mlist.FormatBox('email', size=30) - replacements[''] = mlist.FormatButton( - 'email-button', text=_('Subscribe')) - replacements[''] = mlist.FormatSecureBox('pw') - replacements[''] = mlist.FormatSecureBox('pw-conf') - replacements[''] = mlist.FormatFormStart( - 'subscribe') - if mm_cfg.SUBSCRIBE_FORM_SECRET: - now = str(int(time.time())) - remote = os.environ.get('HTTP_FORWARDED_FOR', - os.environ.get('HTTP_X_FORWARDED_FOR', - os.environ.get('REMOTE_ADDR', - 'w.x.y.z'))) - # Try to accept a range in case of load balancers, etc. (LP: #1447445) - if remote.find('.') >= 0: - # ipv4 - drop last octet - remote = remote.rsplit('.', 1)[0] + if mlist.subscribe_policy != 4: + htmlbase = 'listinfo.html' + if not mlist.digestable or not mlist.nondigestable: + replacements[''] = "" + replacements[''] = "" + replacements[''] = '' else: - # ipv6 - drop last 16 (could end with :: in which case we just - # drop one : resulting in an invalid format, but it's only - # for our hash so it doesn't matter. - remote = remote.rsplit(':', 1)[0] - replacements[''] += ( + replacements[''] = \ + mlist.FormatDigestButton() + replacements[''] = \ + mlist.FormatUndigestButton() + replacements[''] = '' + replacements[''] = '' + replacements[''] = \ + mlist.FormatPlainDigestsButton() + replacements[''] = \ + mlist.FormatMimeDigestsButton() + replacements[''] = mlist.FormatBox('email', size=30) + replacements[''] = mlist.FormatButton( + 'email-button', text=_('Subscribe')) + replacements[''] = mlist.FormatSecureBox('pw') + replacements[''] = \ + mlist.FormatSecureBox('pw-conf') + replacements[''] = mlist.FormatFormStart( + 'subscribe') + if mm_cfg.SUBSCRIBE_FORM_SECRET: + now = str(int(time.time())) + remote = os.environ.get('HTTP_FORWARDED_FOR', + os.environ.get('HTTP_X_FORWARDED_FOR', + os.environ.get('REMOTE_ADDR', + 'w.x.y.z'))) + # Try to accept a range in case of load balancers, etc. + # (LP: #1447445) + if remote.find('.') >= 0: + # ipv4 - drop last octet + remote = remote.rsplit('.', 1)[0] + else: + # ipv6 - drop last 16 (could end with :: in which case we just + # drop one : resulting in an invalid format, but it's + # only for our hash so it doesn't matter. + remote = remote.rsplit(':', 1)[0] + replacements[''] += ( '\n' % (now, Utils.sha_new(mm_cfg.SUBSCRIBE_FORM_SECRET + - now + - mlist.internal_name() + - remote - ).hexdigest() + now + + mlist.internal_name() + + remote + ).hexdigest() ) ) + else: + htmlbase = 'listinfo_nosubscribe.html' # Roster form substitutions replacements[''] = mlist.FormatFormStart('roster') replacements[''] = mlist.FormatRosterOptionForUser(lang) @@ -258,7 +266,7 @@ replacements[''] = '' # Do the expansion. - doc.AddItem(mlist.ParseTags('listinfo.html', replacements, lang)) + doc.AddItem(mlist.ParseTags(htmlbase, replacements, lang)) print doc.Format() === modified file 'Mailman/Cgi/subscribe.py' --- Mailman/Cgi/subscribe.py 2018-04-11 09:36:40 +0000 +++ Mailman/Cgi/subscribe.py 2018-05-30 16:53:10 +0000 @@ -118,6 +118,12 @@ def process_form(mlist, doc, cgidata, lang): + # short cut + if mlist.subscribe_policy == 4: + results = _(""" Your subscription is not allowed because the list + don't accept any new subscriptions by policy.""") + print_results(mlist, results, doc, lang) + return listowner = mlist.GetOwnerEmail() realname = mlist.real_name results = [] @@ -253,6 +259,10 @@ results = _("""The email address you supplied is banned from this mailing list. If you think this restriction is erroneous, please contact the list owners at %(listowner)s.""") + # foolproof + except Errors.MembershipIsRejectedByPolicy: + results = _(""" Your subscription is not allowed because the list + don't accept any new subscriptions by policy.""") except Errors.MMBadEmailError: results = _("""\ The email address you supplied is not valid. (E.g. it must contain an === modified file 'Mailman/Commands/cmd_subscribe.py' --- Mailman/Commands/cmd_subscribe.py 2008-04-27 00:59:18 +0000 +++ Mailman/Commands/cmd_subscribe.py 2018-06-01 18:30:00 +0000 @@ -46,6 +46,10 @@ def process(res, args): mlist = res.mlist + # short cut + if mlist.subscribe_policy == 4: + res.results.append(_('New subscription is forbidden by policy')) + return STOP digest = None password = None address = None @@ -115,6 +119,11 @@ If you think this restriction is erroneous, please contact the list owners at %(listowner)s.""")) return STOP + # foolproof + except Errors.MembershipIsRejectedByPolicy: + results = _(""" Your subscription is not allowed because the list + don't accept any new subscriptions by policy.""") + return STOP except Errors.MMBadEmailError: res.results.append(_("""\ Mailman won't accept the given email address as a valid address. === modified file 'Mailman/Defaults.py.in' --- Mailman/Defaults.py.in 2018-01-30 04:06:24 +0000 +++ Mailman/Defaults.py.in 2018-05-30 13:59:45 +0000 @@ -1310,6 +1310,7 @@ # 1 - confirmation required for subscribes # 2 - admin approval required for subscribes # 3 - both confirmation and admin approval required +# 4 - forbid new subscription # # ** please do not choose option 0 if you are not allowing open # subscribes (next variable) === modified file 'Mailman/Errors.py' --- Mailman/Errors.py 2009-01-20 20:22:08 +0000 +++ Mailman/Errors.py 2018-05-30 14:20:58 +0000 @@ -40,6 +40,7 @@ class CantDigestError(MemberError): pass class MustDigestError(MemberError): pass class MembershipIsBanned(MemberError): pass +class MembershipIsRejectedByPolicy(MemberError): pass # Exception hierarchy for various authentication failures, can be # raised from functions in SecurityManager.py === modified file 'Mailman/Gui/Privacy.py' --- Mailman/Gui/Privacy.py 2017-06-06 05:47:05 +0000 +++ Mailman/Gui/Privacy.py 2018-05-31 16:14:17 +0000 @@ -59,7 +59,8 @@ (_('None'), _('Confirm'), _('Require approval'), - _('Confirm and approve')), + _('Confirm and approve'), + _('Forbid')), 0, _('What steps are required for subscription?
'), _("""None - no verification steps (Not @@ -67,7 +68,8 @@ Confirm (*) - email confirmation step required
Require approval - require list administrator Approval for subscriptions
- Confirm and approve - both confirm and approve + Confirm and approve - both confirm and approve
+ Forbid - reject all new subscription request

(*) when someone requests a subscription, Mailman sends them a notice with a unique @@ -82,13 +84,15 @@ # choices (_('Confirm'), _('Require approval'), - _('Confirm and approve')), + _('Confirm and approve'), + _('Forbid')), 1, _('What steps are required for subscription?
'), _("""Confirm (*) - email confirmation required
Require approval - require list administrator approval for subscriptions
- Confirm and approve - both confirm and approve + Confirm and approve - both confirm and approve
+ Forbid - reject all new subscription request

(*) when someone requests a subscription, Mailman sends them a notice with a unique === modified file 'Mailman/HTMLFormatter.py' --- Mailman/HTMLFormatter.py 2017-07-31 00:37:30 +0000 +++ Mailman/HTMLFormatter.py 2018-05-31 07:04:12 +0000 @@ -202,6 +202,10 @@ by the list moderator. You will be notified of the moderator's decision by email.""") also = _("also ") + elif self.subscribe_policy == 4: + msg += _("""This is a closed list which don't accept any new + subscription request.""") + also = _("also ") if msg: msg += ' ' if self.private_roster == 1: === modified file 'Mailman/MailList.py' --- Mailman/MailList.py 2018-04-11 09:36:40 +0000 +++ Mailman/MailList.py 2018-06-01 18:57:13 +0000 @@ -898,6 +898,15 @@ # Trying to subscribe the list to itself! raise Errors.MMBadEmailError realname = self.real_name + # Does the list allow new subscription? + if self.subscribe_policy == 4: + if remote: + whence = ' from %s' % remote + else: + whence = '' + syslog('vette', '%s reject subscription: %s%s (by policy)', + realname, email, whence) + raise Errors.MembershipIsRejectedByPolicy # Is the subscribing address banned from this list? pattern = self.GetBannedPattern(email) if pattern: === modified file 'misc/sitelist.cfg' --- misc/sitelist.cfg 2009-01-11 16:06:13 +0000 +++ misc/sitelist.cfg 2018-05-31 06:38:46 +0000 @@ -178,6 +178,7 @@ # 1 = "Confirm" # 2 = "Require approval" # 3 = "Confirm and approve" +# 4 = "Forbid" subscribe_policy = 2 # When members want to leave a list, they will make an unsubscription === added file 'templates/en/listinfo_nosubscribe.html' --- templates/en/listinfo_nosubscribe.html 1970-01-01 00:00:00 +0000 +++ templates/en/listinfo_nosubscribe.html 2018-05-31 06:05:16 +0000 @@ -0,0 +1,76 @@ + + + + + <MM-List-Name> Info Page + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ -- + +
+

  +

+ About + + + +
+

+

To see the collection of prior postings to the list, + visit the + Archives. + +

+
+ Using +
+ To post a message to all the list members, send email to + . + +

You can change your existing + subscription, in the sections below. +

+ + Subscribers +
+ + + +

+ + + +

+ + + === added file 'templates/ja/listinfo_nosubscribe.html' --- templates/ja/listinfo_nosubscribe.html 1970-01-01 00:00:00 +0000 +++ templates/ja/listinfo_nosubscribe.html 2018-05-31 16:19:12 +0000 @@ -0,0 +1,78 @@ + + + + + <MM-List-Name> 案内ページ + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ -- + +
+

  +

+ について + + + +
+

+

このメーリングリストに投稿された過去のメールは, + + 保存書庫をご覧下さい. + +

+
+ の利用法 +
+ メーリングリストの全会員に送るメールは, + + のアドレス宛に送信してください. + +

メーリングリストの現在の会員オプションの変更は, + 以下のフォームをご利用ください. +

+ + 会員の方へ +
+ + + +

+ + + +

+ + +