~msapiro/mailman/topics

« back to all changes in this revision

Viewing changes to Mailman/Cgi/roster.py

  • Committer: Mark Sapiro
  • Date: 2014-12-03 23:47:23 UTC
  • mfrom: (1006.1.356 2.2)
  • Revision ID: mark@msapiro.net-20141203234723-3pcwx85xua4n84yx
Merged the 2.2 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 1998-2008 by the Free Software Foundation, Inc.
 
1
# Copyright (C) 1998-2014 by the Free Software Foundation, Inc.
2
2
#
3
3
# This program is free software; you can redistribute it and/or
4
4
# modify it under the terms of the GNU General Public License
54
54
    except Errors.MMListError, e:
55
55
        # Avoid cross-site scripting attacks
56
56
        safelistname = Utils.websafe(listname)
 
57
        # Send this with a 404 status.
 
58
        print 'Status: 404 Not Found'
57
59
        error_page(_('No such list <em>%(safelistname)s</em>'))
58
 
        syslog('error', 'roster: no such list "%s": %s', listname, e)
 
60
        syslog('error', 'roster: No such list "%s": %s', listname, e)
59
61
        return
60
62
 
61
63
    cgidata = cgi.FieldStorage()
71
73
    # "admin"-only, then we try to cookie authenticate the user, and failing
72
74
    # that, we check roster-email and roster-pw fields for a valid password.
73
75
    # (also allowed: the list moderator, the list admin, and the site admin).
74
 
    password = cgidata.getvalue('roster-pw', '')
75
 
    addr = cgidata.getvalue('roster-email', '')
 
76
    password = cgidata.getvalue('roster-pw', '').strip()
 
77
    addr = cgidata.getvalue('roster-email', '').strip()
76
78
    list_hidden = (not mlist.WebAuthenticate((mm_cfg.AuthUser,),
77
79
                                             password, addr)
78
80
                   and mlist.WebAuthenticate((mm_cfg.AuthListModerator,
99
101
        realname = mlist.real_name
100
102
        doc = Document()
101
103
        doc.set_language(lang)
 
104
        # Send this with a 401 status.
 
105
        print 'Status: 401 Unauthorized'
102
106
        error_page_doc(doc, _('%(realname)s roster authentication failed.'))
103
107
        doc.AddItem(mlist.GetMailmanFooter())
104
108
        print doc.Format()