diff options
| author | mailman | 1998-05-20 17:08:50 +0000 |
|---|---|---|
| committer | mailman | 1998-05-20 17:08:50 +0000 |
| commit | a41c223e09519af43a4b4a2f4c9c035797510a0c (patch) | |
| tree | fe52fb01e6b4b2d2a93bc3d367d353929a325a2a | |
| parent | b1fb740084dfd6ec4a485447b41215c4d3ba3915 (diff) | |
| download | mailman-a41c223e09519af43a4b4a2f4c9c035797510a0c.tar.gz mailman-a41c223e09519af43a4b4a2f4c9c035797510a0c.tar.zst mailman-a41c223e09519af43a4b4a2f4c9c035797510a0c.zip | |
FormatListinfoOverview(): Check the host being visited, and only
include in the roster those lists that think they belong to that
host. (We're using the HTTP_HOST CGI var, which is almost certainly
*not* portable across all servers. However, i don't know and haven't
gotten any clues about any portable mechanism, so this'll have to do
for now. It'll be important to, eg, ISPs that rent out virtual client
hosts to *not* list all the different client's maillists in each
client's roster...)
| -rwxr-xr-x | cgi/admin | 18 | ||||
| -rwxr-xr-x | cgi/listinfo | 22 |
2 files changed, 35 insertions, 5 deletions
@@ -5,7 +5,7 @@ To run stand-alone for debugging, set env var PATH_INFO to name of list and, optionally, options category.""" -__version__ = "$Revision: 461 $" +__version__ = "$Revision: 528 $" import sys sys.path.append('/home/mailman/mailman/modules') @@ -127,13 +127,27 @@ def FormatAdminOverview(error=None): table.AddCellInfo(max(table.GetCurrentRowIndex(), 0), 0, colspan=2, bgcolor="#99ccff") + # XXX We need a portable way to determine the host by which we are being + # visited! An absolute URL would do... + if os.environ.has_key('HTTP_HOST'): + http_host = os.environ['HTTP_HOST'] + else: + http_host = None + advertised = [] names = mm_utils.list_names() names.sort() for n in names: l = maillist.MailList(n) l.Unlock() - if l.advertised: advertised.append(l) + if l.advertised: + if (http_host + and (string.find(http_host, l.host_name) == -1 + and string.find(l.host_name, http_host) == -1)): + # List is for different identity for this host - skip it. + continue + else: + advertised.append(l) if error: greeting = FontAttr(error, color="ff5060", size="+1") diff --git a/cgi/listinfo b/cgi/listinfo index e8aee7ad0..4437defed 100755 --- a/cgi/listinfo +++ b/cgi/listinfo @@ -4,7 +4,7 @@ Errors are redirected to logs/errors.""" -__version__ = "$Revision: 413 $" +__version__ = "$Revision: 528 $" # No lock needed in this script, because we don't change data. @@ -27,6 +27,7 @@ def main(): path = os.environ['PATH_INFO'] except KeyError: path = "" + list_info = mm_utils.GetPathPieces(path) if len(list_info) == 0: @@ -47,7 +48,7 @@ def main(): FormatListListinfo(list) def FormatListinfoOverview(error=None): - "Present a general welcome and itemize the (public) lists." + "Present a general welcome and itemize the (public) lists for this host." doc = Document() legend = "%s maillists" % mm_cfg.DEFAULT_HOST_NAME doc.SetTitle(legend) @@ -60,10 +61,25 @@ def FormatListinfoOverview(error=None): advertised = [] names = mm_utils.list_names() names.sort() + + # XXX We need a portable way to determine the host by which we are being + # visited! An absolute URL would do... + if os.environ.has_key('HTTP_HOST'): + http_host = os.environ['HTTP_HOST'] + else: + http_host = None + for n in names: l = maillist.MailList(n) l.Unlock() - if l.advertised: advertised.append(l) + if l.advertised: + if (http_host + and (string.find(http_host, l.host_name) == -1 + and string.find(l.host_name, http_host) == -1)): + # List is for different identity for this host - skip it. + continue + else: + advertised.append(l) if error: greeting = FontAttr(error, color="ff5060", size="+1") |
