aboutsummaryrefslogtreecommitdiff
path: root/Mailman
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2019-07-05 17:37:17 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2019-07-05 17:37:17 +0300
commit4647af06b0d1911a96d84c5e58c4ea5122d86532 (patch)
tree49036176196db8ff19ab2ec7a57603851c5e3b5d /Mailman
parentb3901df95ed4e0bba64522f7859b50de92d8db68 (diff)
downloadmailman-4647af06b0d1911a96d84c5e58c4ea5122d86532.tar.gz
mailman-4647af06b0d1911a96d84c5e58c4ea5122d86532.tar.bz2
Build findmail
Diffstat (limited to 'Mailman')
-rw-r--r--Mailman/Cgi/findmail.py74
-rw-r--r--Mailman/Cgi/listarchive.py2
2 files changed, 75 insertions, 1 deletions
diff --git a/Mailman/Cgi/findmail.py b/Mailman/Cgi/findmail.py
new file mode 100644
index 0000000..d5f3c25
--- /dev/null
+++ b/Mailman/Cgi/findmail.py
@@ -0,0 +1,74 @@
+import os
+import sys
+import cgi
+import mimetypes
+import time
+import glob
+import stat
+
+from Mailman import mm_cfg
+from Mailman import Utils
+from Mailman import MailList
+from Mailman import Errors
+from Mailman import i18n
+from Mailman.htmlformat import *
+from Mailman.Logging.Syslog import syslog
+
+# Set up i18n. Until we know which list is being requested, we use the
+# server's default.
+_ = i18n._
+i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
+
+script_name = 'findmail'
+
+def main():
+ env = os.environ
+ doc = Document()
+ doc.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
+
+ form = cgi.FieldStorage()
+ listname = form.getvalue('idxname','')
+
+ if listname:
+ try:
+ mlist = MailList.MailList(listname, lock=0)
+ except Errors.MMListError, e:
+ # Avoid cross-site scripting attacks
+ safelistname = Utils.websafe(listname)
+ msg = _('No such list <em>%(safelistname)s</em>')
+ doc.SetTitle(_("Archive Error - %(msg)s"))
+ doc.AddItem(Header(2, msg))
+ print doc.Format()
+ syslog('error', 'No such list "%s": %s\n', listname, e)
+ return
+
+ if mlist.archive_private:
+ username = form.getvalue('username', '')
+ password = form.getvalue('password', '')
+ message = ''
+ if not mlist.WebAuthenticate((mm_cfg.AuthUser,
+ mm_cfg.AuthListModerator,
+ mm_cfg.AuthListAdmin,
+ mm_cfg.AuthSiteAdmin),
+ password, username):
+ if form.has_key('submit'):
+ # This is a re-authorization attempt
+ message = Bold(FontSize('+1', _('Authorization failed.'))).Format()
+ # Output the password form
+ charset = Utils.GetCharSet(mlist.preferred_language)
+ print 'Content-type: text/html; charset=' + charset + '\n\n'
+ # Put the original full path in the authorization form, but
+ # avoid trailing slash if we're not adding parts.
+ # We add it below.
+ action = mlist.GetScriptURL(script_name, absolute=1) + \
+ '?' + os.getenv('QUERY_STRING')
+ # Escape web input parameter to avoid cross-site scripting.
+ print Utils.maketext('private.html',
+ {'action' : Utils.websafe(action),
+ 'realname': mlist.real_name,
+ 'message' : message,
+ }, mlist=mlist)
+ return
+
+ finder = os.getenv('MAIL_FINDER_CGI')
+ os.execl(finder, os.path.basename(finder))
diff --git a/Mailman/Cgi/listarchive.py b/Mailman/Cgi/listarchive.py
index 873a7be..40c6fcf 100644
--- a/Mailman/Cgi/listarchive.py
+++ b/Mailman/Cgi/listarchive.py
@@ -196,7 +196,7 @@ def main():
return
loc = script_name + '/' + listname + '/' + plist[n] + '/'
- print "Location: %s%s\n" % (mm_cfg.DEFAULT_HOST_NAME or mm_cfg.DEFAULT_EMAIL_HOST, loc)
+ print "Location: http://mail.gnu.org.ua%s\n" % loc
return

Return to:

Send suggestions and report system problems to the System administrator.