# # Copyright (C) 2001 Guillaume Morin # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """Verify that the admin password of a mailing list in a parsable way """ # No lock needed in this script, because we don't change data. import os import string import cgi from Mailman import mm_cfg from Mailman import Utils from Mailman import MailList from Mailman import Errors from Mailman.htmlformat import * from Mailman.Logging.Syslog import syslog def main(): form = cgi.FieldStorage() if form.has_key('password') and form.has_key('list'): password = form['password'] if type(password) == type([]): password = password[0] password = password.value list = form['list'] if type(list) == type([]): list = list[0] list = list.value try: mlist = MailList.MailList(list, lock=0) result = mlist.ConfirmAdminPassword(password) result = "%d" % result result = result+' '+mlist.GetAdminEmail()+' '+str(mlist.advertised)+' '+mlist.description result = string.replace(result,"\n"," ") except Errors.MMListError: result = 0 except Errors.MMBadPasswordError: result = 2 else: result = 0 print "Content-type: text/html\n" print "" print "" print result print "" print "" if __name__ == "__main__": main()