Update of /cvsroot/mailman/mailman/Mailman/Cgi
In directory sc8-pr-cvs1:/tmp/cvs-serv19541

Modified Files:
      Tag: Release_2_1-maint
        create.py 
Log Message:
process_request(): In response to SF bug # 835870, we now check the
calculated host name, and if VIRTUAL_HOST_OVERVIEW is true, that host
name must match one of our known virtual hosts.  Otherwise we'll
refuse to create the list.  If VIRTUAL_HOST_OVERVIEW is false, we'll
do no checking (meaning the old behavior of being able to create a
list with a non-fqdn hostname still exists).

Also, pass the email host name into the MailList.Create() call.


Index: create.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Cgi/create.py,v
retrieving revision 2.21.2.1
retrieving revision 2.21.2.2
diff -u -d -r2.21.2.1 -r2.21.2.2
--- create.py   28 Sep 2003 16:04:06 -0000      2.21.2.1
+++ create.py   24 Nov 2003 23:51:46 -0000      2.21.2.2
@@ -93,7 +93,7 @@
     auth     = cgidata.getvalue('auth', '').strip()
     langs    = cgidata.getvalue('langs', [mm_cfg.DEFAULT_SERVER_LANGUAGE])
 
-    if type(langs) <> ListType:
+    if not isinstance(langs, ListType):
         langs = [langs]
     # Sanity check
     safelistname = Utils.websafe(listname)
@@ -152,6 +152,15 @@
             doc, cgidata,
             _('You are not authorized to create new mailing lists'))
         return
+    # Make sure the web hostname matches one of our virtual domains
+    hostname = Utils.get_domain()
+    if mm_cfg.VIRTUAL_HOST_OVERVIEW and \
+           not mm_cfg.VIRTUAL_HOSTS.has_key(hostname):
+        safehostname = Utils.websafe(hostname)
+        request_creation(doc, cgidata,
+                         _('Unknown virtual host: %(safehostname)s'))
+        return
+    emailhost = mm_cfg.VIRTUAL_HOSTS.get(hostname, mm_cfg.DEFAULT_EMAIL_HOST)
     # We've got all the data we need, so go ahead and try to create the list
     # See admin.py for why we need to set up the signal handler.
     mlist = MailList.MailList()
@@ -175,7 +184,7 @@
         oldmask = os.umask(002)
         try:
             try:
-                mlist.Create(listname, owner, pw, langs)
+                mlist.Create(listname, owner, pw, langs, emailhost)
             finally:
                 os.umask(oldmask)
         except Errors.MMBadEmailError, s:
@@ -199,11 +208,9 @@
 
         # Initialize the host_name and web_page_url attributes, based on
         # virtual hosting settings and the request environment variables.
-        hostname = Utils.get_domain()
         mlist.default_member_moderation = moderate
         mlist.web_page_url = mm_cfg.DEFAULT_URL_PATTERN % hostname
-        mlist.host_name = mm_cfg.VIRTUAL_HOSTS.get(
-            hostname, mm_cfg.DEFAULT_EMAIL_HOST)
+        mlist.host_name = emailhost
         mlist.Save()
     finally:
         # Now be sure to unlock the list.  It's okay if we get a signal here



_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins

Reply via email to