summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanno Boeck <hanno@gentoo.org>2008-02-05 11:24:01 +0000
committerHanno Boeck <hanno@gentoo.org>2008-02-05 11:24:01 +0000
commit881d4d626c79d429d132bacaa2ae1fa5dc6df2ed (patch)
tree7acbd92459ed52e703ccb50181846a9c0f476084 /net-mail
parentStable on ppc64 (diff)
downloadhistorical-881d4d626c79d429d132bacaa2ae1fa5dc6df2ed.tar.gz
historical-881d4d626c79d429d132bacaa2ae1fa5dc6df2ed.tar.bz2
historical-881d4d626c79d429d132bacaa2ae1fa5dc6df2ed.zip
mailman security bump
Package-Manager: portage-2.1.4.1
Diffstat (limited to 'net-mail')
-rw-r--r--net-mail/mailman/ChangeLog8
-rw-r--r--net-mail/mailman/Manifest12
-rw-r--r--net-mail/mailman/files/mailman-2.1.9-fix-XSS.patch275
-rw-r--r--net-mail/mailman/mailman-2.1.9-r3.ebuild147
4 files changed, 436 insertions, 6 deletions
diff --git a/net-mail/mailman/ChangeLog b/net-mail/mailman/ChangeLog
index 8d66c1a1a953..dda00d042dcd 100644
--- a/net-mail/mailman/ChangeLog
+++ b/net-mail/mailman/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for net-mail/mailman
# Copyright 2002-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-mail/mailman/ChangeLog,v 1.105 2008/01/31 20:29:02 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-mail/mailman/ChangeLog,v 1.106 2008/02/05 11:24:00 hanno Exp $
+
+*mailman-2.1.9-r3 (05 Feb 2008)
+
+ 05 Feb 2008; Hanno Boeck <hanno@gentoo.org>
+ +files/mailman-2.1.9-fix-XSS.patch, +mailman-2.1.9-r3.ebuild:
+ Patch XSS issues, CVE-2008-0564.
31 Jan 2008; Benedikt Böhm <hollow@gentoo.org> mailman-2.1.9.ebuild,
mailman-2.1.9-r1.ebuild, mailman-2.1.9-r2.ebuild:
diff --git a/net-mail/mailman/Manifest b/net-mail/mailman/Manifest
index c0b33e2a2c36..967434818afd 100644
--- a/net-mail/mailman/Manifest
+++ b/net-mail/mailman/Manifest
@@ -5,18 +5,20 @@ AUX 50_mailman.conf 429 RMD160 54104453464b725adc18e5fb66bee265089013f6 SHA1 7b0
AUX README.gentoo 5625 RMD160 15596c932922b3cec66f937862542aa36453de49 SHA1 c46bdd790f9bb2005e7e9e695287da087c1c0bc5 SHA256 35a6975e7d8d82f7dfa623637da680aefd09080d978b1cb16ab6950557140cce
AUX README.gentoo-r2 5537 RMD160 8d753bb466666bac03ee4da4b7e35456d66dfec3 SHA1 f2702f1dbcab75397795b55883972a047b39463e SHA256 3809aa17e4e9a244cdf7c06af1605c3ce660329b0e279a93c4c3650b8d9ffa42
AUX mailman-2.1.8_rc1-directory-check.patch 1287 RMD160 3bf6d1216a79a32d68340cb0df5db9b5f44a3931 SHA1 ad2b689ce7911b509f999cd849d0402c36ded97c SHA256 2d31eda834429a55edad1fea3c379ecb3e8f05c03fac82f172989caeab85314d
+AUX mailman-2.1.9-fix-XSS.patch 11287 RMD160 b4dff793463c976cef7bdfe2cded986a8f7820ab SHA1 d01f299044ddaf8c0c6df53cb7b8ec73f3f183a4 SHA256 cd2ffb0e19dd12205d375f3c83b7d6a3177c0f3389bf15db37bce1e63e459307
AUX mailman.conf 385 RMD160 bec3c71140385fa88078ffb38be14bfd8ec068c6 SHA1 64e15fce12231bac8e9a5dd831d9c4f134df77a1 SHA256 fdd86c4a72318ade5dfe0f075ce62470979f93d8a4c862993dc32e7bdb422eab
AUX mailman.rc 597 RMD160 be0a574298a1d8d547a4ca76f864dd5fee9b897d SHA1 f464f5ba7310934d300a9af7c614fdf7498f7d2b SHA256 ef4f5482cf68ba44a0fbb83acde29295bd8dcb6512d259d14387dfc29beeb625
DIST mailman-2.1.9.tgz 7829201 RMD160 135f94eeecca1f562f98dfe98c1a367bed229372 SHA1 e9f6f55e2551c3e576460749383da20599412d42 SHA256 1b7a2c853c21bfd22205167dc3678c634a3f981721d95d1cd923ca84967cc986
EBUILD mailman-2.1.9-r1.ebuild 3732 RMD160 3b9aefb9408a7b7adad6014b243b66d37cb206b8 SHA1 5f6b59edb71c8f2f82552b2a9f489f17ec1b629c SHA256 3787443ac3a883af3c097d33f63ba820fb4cc35cd28bb604d68554914a2ec8ac
EBUILD mailman-2.1.9-r2.ebuild 4977 RMD160 73dcf3deaa66ca1be2ec8a8c87792624a7263d81 SHA1 991b46196755b8db8e3428f41c266e0c021e1d2b SHA256 5fa2c51818e5adfd4cdd921fb9c44b8447e004bc0b9df146416441acb8b958e0
+EBUILD mailman-2.1.9-r3.ebuild 5047 RMD160 fd96e2897707b822ac9238b4ae72742d43db7831 SHA1 7274374277a30199e62e3296e87faa53ebdbba36 SHA256 c7147169bcb59953741a3110008de91dde12b91a9587fedd9d71b752a185bb75
EBUILD mailman-2.1.9.ebuild 3393 RMD160 1703e46af8759ee0691535cee49b6e675bbdbe96 SHA1 b72dfd0dc1dd27690f9d37afdc71fbfe2da81112 SHA256 ae07962a7eb5aaabcbc3f25ee1652c987139e86aea4332c80fb4e0f0b24aa429
-MISC ChangeLog 14083 RMD160 3bdc06edccd0eb539035751afeedbf95bc2dfe75 SHA1 8ee85fa9548ba472b81e733db99b1ec116ab33b3 SHA256 c22eda5dd13a438883d06380190d8f8c4e344d9d7e8c9c052937c5633830f6c3
+MISC ChangeLog 14261 RMD160 e797fe8f63328eb00c1a3834cd41b067c06b98fe SHA1 3f5b615f151a2c242ad4c5a3a9cc4acaf253604f SHA256 fb2827010f49ee901f63fffbcbd4aa24ac4ca89cae7d8540373d3a4fd51bbbb8
MISC metadata.xml 218 RMD160 30759d93f0209fdd74f29393ae54999fe6b2bdff SHA1 486b307ff1dae10aef7d18472460a21bc2decdfb SHA256 09421ca1b9299683d07f68ddbbd3ed97251dac613121b420841a3251da7fcb89
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.8 (GNU/Linux)
+Version: GnuPG v2.0.7 (GNU/Linux)
-iEYEARECAAYFAkeiL5cACgkQmPFBzbX68WF0EQCbBZY7s4ZNpKZtCmT87bEBiM9Z
-eVIAoJFjh5WSKFtznABRgn/JysB4IUJM
-=BzPp
+iD4DBQFHqEdtr2QksT29OyARAiJTAJYs1xvFRXk4E/7ZnUHlUQVhdV8VAKChMZG7
+c62Ib3gNq+AC4NaiY+3Y7w==
+=O2OT
-----END PGP SIGNATURE-----
diff --git a/net-mail/mailman/files/mailman-2.1.9-fix-XSS.patch b/net-mail/mailman/files/mailman-2.1.9-fix-XSS.patch
new file mode 100644
index 000000000000..b80c50dca6fd
--- /dev/null
+++ b/net-mail/mailman/files/mailman-2.1.9-fix-XSS.patch
@@ -0,0 +1,275 @@
+=== modified file 'Mailman/Cgi/edithtml.py'
+--- Mailman/Cgi/edithtml.py 2006-08-30 14:54:22 +0000
++++ Mailman/Cgi/edithtml.py 2007-12-04 19:52:18 +0000
+@@ -1,4 +1,4 @@
+-# Copyright (C) 1998-2006 by the Free Software Foundation, Inc.
++# Copyright (C) 1998-2007 by the Free Software Foundation, Inc.
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License
+@@ -159,7 +159,20 @@
+ doc.AddItem('<hr>')
+ return
+ code = cgi_info['html_code'].value
+- code = re.sub(r'<([/]?script.*?)>', r'&lt;\1&gt;', code)
++ if Utils.suspiciousHTML(code):
++ doc.AddItem(Header(3,
++ _("""The page you saved contains suspicious HTML that could
++potentially expose your users to cross-site scripting attacks. This change
++has therefore been rejected. If you still want to make these changes, you
++must have shell access to your Mailman server.
++ """)))
++ doc.AddItem(_('See '))
++ doc.AddItem(Link(
++'http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq04.048.htp',
++ _('FAQ 4.48.')))
++ doc.AddItem(Header(3,_("Page Unchanged.")))
++ doc.AddItem('<hr>')
++ return
+ langdir = os.path.join(mlist.fullpath(), mlist.preferred_language)
+ # Make sure the directory exists
+ omask = os.umask(0)
+
+=== modified file 'Mailman/Gui/General.py'
+--- Mailman/Gui/General.py 2006-08-30 14:54:22 +0000
++++ Mailman/Gui/General.py 2007-12-04 19:52:18 +0000
+@@ -1,4 +1,4 @@
+-# Copyright (C) 2001-2006 by the Free Software Foundation, Inc.
++# Copyright (C) 2001-2007 by the Free Software Foundation, Inc.
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License
+@@ -436,17 +442,21 @@
+ # Convert any html entities to Unicode
+ mlist.subject_prefix = Utils.canonstr(
+ val, mlist.preferred_language)
++ elif property == 'info':
++ if val <> mlist.info:
++ if Utils.suspiciousHTML(val):
++ doc.addError(_("""The <b>info</b> attribute you saved
++contains suspicious HTML that could potentially expose your users to cross-site
++scripting attacks. This change has therefore been rejected. If you still want
++to make these changes, you must have shell access to your Mailman server.
++This change can be made with bin/withlist or with bin/config_list by setting
++mlist.info.
++ """))
++ else:
++ mlist.info = val
+ else:
+ GUIBase._setValue(self, mlist, property, val, doc)
+
+- def _escape(self, property, value):
+- # The 'info' property allows HTML, but let's sanitize it to avoid XSS
+- # exploits. Everything else should be fully escaped.
+- if property <> 'info':
+- return GUIBase._escape(self, property, value)
+- # Sanitize <script> and </script> tags but nothing else. Not the best
+- # solution, but expedient.
+- return re.sub(r'(?i)<([/]?script.*?)>', r'&lt;\1&gt;', value)
+
+ def _postValidate(self, mlist, doc):
+ if not mlist.reply_to_address.strip() and \
+
+=== modified file 'Mailman/Gui/GUIBase.py'
+--- Mailman/Gui/GUIBase.py 2005-08-27 01:40:17 +0000
++++ Mailman/Gui/GUIBase.py 2007-11-18 20:01:26 +0000
+@@ -1,4 +1,4 @@
+-# Copyright (C) 2002-2004 by the Free Software Foundation, Inc.
++# Copyright (C) 2002-2007 by the Free Software Foundation, Inc.
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License
+@@ -12,7 +12,8 @@
+ #
+ # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
++# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
++# USA.
+
+ """Base class for all web GUI components."""
+
+@@ -122,10 +127,6 @@
+ # Validate all the attributes for this category
+ pass
+
+- def _escape(self, property, value):
+- value = value.replace('<', '&lt;')
+- return value
+-
+ def handleForm(self, mlist, category, subcat, cgidata, doc):
+ for item in self.GetConfigInfo(mlist, category, subcat):
+ # Skip descriptions and legacy non-attributes
+@@ -144,10 +145,9 @@
+ elif not cgidata.has_key(property):
+ continue
+ elif isinstance(cgidata[property], ListType):
+- val = [self._escape(property, x.value)
+- for x in cgidata[property]]
++ val = [x.value for x in cgidata[property]]
+ else:
+- val = self._escape(property, cgidata[property].value)
++ val = cgidata[property].value
+ # Coerce the value to the expected type, raising exceptions if the
+ # value is invalid.
+ try:
+
+=== modified file 'Mailman/Utils.py'
+--- Mailman/Utils.py 2007-11-25 08:04:30 +0000
++++ Mailman/Utils.py 2007-12-04 19:52:18 +0000
+@@ -876,3 +876,154 @@
+ except (LookupError, UnicodeError, ValueError, HeaderParseError):
+ # possibly charset problem. return with undecoded string in one line.
+ return EMPTYSTRING.join(s.splitlines())
++
++
++# Patterns and functions to flag possible XSS attacks in HTML.
++# This list is compiled from information at http://ha.ckers.org/xss.html,
++# http://www.quirksmode.org/js/events_compinfo.html,
++# http://www.htmlref.com/reference/appa/events1.htm,
++# http://lxr.mozilla.org/mozilla/source/content/events/src/nsDOMEvent.cpp#59,
++# http://www.w3.org/TR/DOM-Level-2-Events/events.html and
++# http://www.xulplanet.com/references/elemref/ref_EventHandlers.html
++# Many thanks are due to Moritz Naumann for his assistance with this.
++_badwords = [
++ '<i?frame',
++ '<link',
++ '<meta',
++ '<script',
++ r'(?:^|\W)j(?:ava)?script(?:\W|$)',
++ r'(?:^|\W)vbs(?:cript)?(?:\W|$)',
++ r'(?:^|\W)domactivate(?:\W|$)',
++ r'(?:^|\W)domattrmodified(?:\W|$)',
++ r'(?:^|\W)domcharacterdatamodified(?:\W|$)',
++ r'(?:^|\W)domfocus(?:in|out)(?:\W|$)',
++ r'(?:^|\W)dommenuitem(?:in)?active(?:\W|$)',
++ r'(?:^|\W)dommousescroll(?:\W|$)',
++ r'(?:^|\W)domnodeinserted(?:intodocument)?(?:\W|$)',
++ r'(?:^|\W)domnoderemoved(?:fromdocument)?(?:\W|$)',
++ r'(?:^|\W)domsubtreemodified(?:\W|$)',
++ r'(?:^|\W)fscommand(?:\W|$)',
++ r'(?:^|\W)onabort(?:\W|$)',
++ r'(?:^|\W)on(?:de)?activate(?:\W|$)',
++ r'(?:^|\W)on(?:after|before)print(?:\W|$)',
++ r'(?:^|\W)on(?:after|before)update(?:\W|$)',
++ r'(?:^|\W)onbefore(?:(?:de)?activate|copy|cut|editfocus|paste)(?:\W|$)',
++ r'(?:^|\W)onbeforeunload(?:\W|$)',
++ r'(?:^|\W)onbegin(?:\W|$)',
++ r'(?:^|\W)onblur(?:\W|$)',
++ r'(?:^|\W)onbounce(?:\W|$)',
++ r'(?:^|\W)onbroadcast(?:\W|$)',
++ r'(?:^|\W)on(?:cell)?change(?:\W|$)',
++ r'(?:^|\W)oncheckboxstatechange(?:\W|$)',
++ r'(?:^|\W)on(?:dbl)?click(?:\W|$)',
++ r'(?:^|\W)onclose(?:\W|$)',
++ r'(?:^|\W)oncommand(?:update)?(?:\W|$)',
++ r'(?:^|\W)oncomposition(?:end|start)(?:\W|$)',
++ r'(?:^|\W)oncontextmenu(?:\W|$)',
++ r'(?:^|\W)oncontrolselect(?:\W|$)',
++ r'(?:^|\W)oncopy(?:\W|$)',
++ r'(?:^|\W)oncut(?:\W|$)',
++ r'(?:^|\W)ondataavailable(?:\W|$)',
++ r'(?:^|\W)ondataset(?:changed|complete)(?:\W|$)',
++ r'(?:^|\W)ondrag(?:drop|end|enter|exit|gesture|leave|over)?(?:\W|$)',
++ r'(?:^|\W)ondragstart(?:\W|$)',
++ r'(?:^|\W)ondrop(?:\W|$)',
++ r'(?:^|\W)onend(?:\W|$)',
++ r'(?:^|\W)onerror(?:update)?(?:\W|$)',
++ r'(?:^|\W)onfilterchange(?:\W|$)',
++ r'(?:^|\W)onfinish(?:\W|$)',
++ r'(?:^|\W)onfocus(?:in|out)?(?:\W|$)',
++ r'(?:^|\W)onhelp(?:\W|$)',
++ r'(?:^|\W)oninput(?:\W|$)',
++ r'(?:^|\W)onkey(?:up|down|press)(?:\W|$)',
++ r'(?:^|\W)onlayoutcomplete(?:\W|$)',
++ r'(?:^|\W)on(?:un)?load(?:\W|$)',
++ r'(?:^|\W)onlosecapture(?:\W|$)',
++ r'(?:^|\W)onmedia(?:complete|error)(?:\W|$)',
++ r'(?:^|\W)onmouse(?:down|enter|leave|move|out|over|up|wheel)(?:\W|$)',
++ r'(?:^|\W)onmove(?:end|start)?(?:\W|$)',
++ r'(?:^|\W)on(?:off|on)line(?:\W|$)',
++ r'(?:^|\W)onoutofsync(?:\W|$)',
++ r'(?:^|\W)onoverflow(?:changed)?(?:\W|$)',
++ r'(?:^|\W)onpage(?:hide|show)(?:\W|$)',
++ r'(?:^|\W)onpaint(?:\W|$)',
++ r'(?:^|\W)onpaste(?:\W|$)',
++ r'(?:^|\W)onpause(?:\W|$)',
++ r'(?:^|\W)onpopup(?:hidden|hiding|showing|shown)(?:\W|$)',
++ r'(?:^|\W)onprogress(?:\W|$)',
++ r'(?:^|\W)onpropertychange(?:\W|$)',
++ r'(?:^|\W)onradiostatechange(?:\W|$)',
++ r'(?:^|\W)onreadystatechange(?:\W|$)',
++ r'(?:^|\W)onrepeat(?:\W|$)',
++ r'(?:^|\W)onreset(?:\W|$)',
++ r'(?:^|\W)onresize(?:end|start)?(?:\W|$)',
++ r'(?:^|\W)onresume(?:\W|$)',
++ r'(?:^|\W)onreverse(?:\W|$)',
++ r'(?:^|\W)onrow(?:delete|enter|exit|inserted)(?:\W|$)',
++ r'(?:^|\W)onrows(?:delete|enter|inserted)(?:\W|$)',
++ r'(?:^|\W)onscroll(?:\W|$)',
++ r'(?:^|\W)onseek(?:\W|$)',
++ r'(?:^|\W)onselect(?:start)?(?:\W|$)',
++ r'(?:^|\W)onselectionchange(?:\W|$)',
++ r'(?:^|\W)onstart(?:\W|$)',
++ r'(?:^|\W)onstop(?:\W|$)',
++ r'(?:^|\W)onsubmit(?:\W|$)',
++ r'(?:^|\W)onsync(?:from|to)preference(?:\W|$)',
++ r'(?:^|\W)onsyncrestored(?:\W|$)',
++ r'(?:^|\W)ontext(?:\W|$)',
++ r'(?:^|\W)ontimeerror(?:\W|$)',
++ r'(?:^|\W)ontrackchange(?:\W|$)',
++ r'(?:^|\W)onunderflow(?:\W|$)',
++ r'(?:^|\W)onurlflip(?:\W|$)',
++ r'(?:^|\W)seeksegmenttime(?:\W|$)',
++ r'(?:^|\W)svgabort(?:\W|$)',
++ r'(?:^|\W)svgerror(?:\W|$)',
++ r'(?:^|\W)svgload(?:\W|$)',
++ r'(?:^|\W)svgresize(?:\W|$)',
++ r'(?:^|\W)svgscroll(?:\W|$)',
++ r'(?:^|\W)svgunload(?:\W|$)',
++ r'(?:^|\W)svgzoom(?:\W|$)',
++ ]
++
++
++# This is the actual re to look for the above patterns
++_badhtml = re.compile('|'.join(_badwords), re.IGNORECASE)
++# This is used to filter non-printable us-ascii characters, some of which
++# can be used to break words to avoid recognition.
++_filterchars = re.compile('[\000-\011\013\014\016-\037\177-\237]')
++# This is used to recognize '&#' and '%xx' strings for _translate which
++# translates them to characters
++_encodedchars = re.compile('(&#[0-9]+;?)|(&#x[0-9a-f]+;?)|(%[0-9a-f]{2})',
++ re.IGNORECASE)
++
++
++def _translate(mo):
++ """Translate &#... and %xx encodings into the encoded character."""
++ match = mo.group().lower().strip('&#;')
++ try:
++ if match.startswith('x') or match.startswith('%'):
++ val = int(match[1:], 16)
++ else:
++ val = int(match, 10)
++ except ValueError:
++ return ''
++ if val < 256:
++ return chr(val)
++ else:
++ return ''
++
++
++def suspiciousHTML(html):
++ """Check HTML string for various tags, script language names and
++ 'onxxx' actions that can be used in XSS attacks.
++ Currently, this a very simple minded test. It just looks for
++ patterns without analyzing context. Thus, it potentially flags lots
++ of benign stuff.
++ Returns True if anything suspicious found, False otherwise.
++ """
++
++ if _badhtml.search(_filterchars.sub(
++ '', _encodedchars.sub(_translate, html))):
++ return True
++ else:
++ return False
+
diff --git a/net-mail/mailman/mailman-2.1.9-r3.ebuild b/net-mail/mailman/mailman-2.1.9-r3.ebuild
new file mode 100644
index 000000000000..78941571db85
--- /dev/null
+++ b/net-mail/mailman/mailman-2.1.9-r3.ebuild
@@ -0,0 +1,147 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-mail/mailman/mailman-2.1.9-r3.ebuild,v 1.1 2008/02/05 11:24:00 hanno Exp $
+
+inherit eutils python multilib
+
+DESCRIPTION="A python-based mailing list server with an extensive web interface"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tgz"
+HOMEPAGE="http://www.list.org/"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+IUSE=""
+
+DEPEND=">=dev-lang/python-2.3
+ virtual/mta
+ virtual/cron
+ virtual/httpd-cgi"
+
+pkg_setup() {
+ INSTALLDIR=${MAILMAN_PREFIX:-"/usr/$(get_libdir)/mailman"}
+ VAR_PREFIX=${MAILMAN_VAR_PREFIX:-"/var/lib/mailman"}
+ CGIGID=${MAILMAN_CGIGID:-81}
+ MAILUSR=${MAILMAN_MAILUSR:-mailman}
+ MAILUID=${MAILMAN_MAILUID:-280}
+ MAILGRP=${MAILMAN_MAILGRP:-mailman}
+ MAILGID=${MAILMAN_MAILGID:-280}
+
+ # Bug #58526: switch to enew{group,user}.
+ # need to add mailman here for compile process.
+ # Duplicated at pkg_postinst() for binary install.
+ enewgroup ${MAILGRP} ${MAILGID}
+ enewuser ${MAILUSR} ${MAILUID} /bin/bash ${INSTALLDIR} mailman -G cron -c "mailman"
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}/${PN}-2.1.8_rc1-directory-check.patch" || die "patch failed."
+ epatch "${FILESDIR}/mailman-2.1.9-fix-XSS.patch" || die "patch failed."
+}
+
+src_compile() {
+ econf --without-permcheck \
+ --prefix="${INSTALLDIR}" \
+ --with-mail-gid=${MAILGID} \
+ --with-cgi-gid=${CGIGID} \
+ --with-cgi-ext="${MAILMAN_CGIEXT}" \
+ --with-var-prefix="${VAR_PREFIX}" \
+ --with-username=${MAILUSR} \
+ --with-groupname=${MAILGRP} \
+ || die "configure failed"
+
+ emake || die "make failed"
+}
+
+src_install () {
+ emake "DESTDIR=${D}" doinstall || die
+
+ insinto /etc/apache2/modules.d
+ doins "${FILESDIR}/50_mailman.conf"
+ dosed "s:/usr/local/mailman/cgi-bin:${INSTALLDIR}/cgi-bin:g" /etc/apache2/modules.d/50_mailman.conf
+ dosed "s:/usr/local/mailman/archives:${VAR_PREFIX}/archives:g" /etc/apache2/modules.d/50_mailman.conf
+
+ newdoc "${FILESDIR}/README.gentoo-r2" README.gentoo || die "newdoc failed"
+
+ dodoc ACK* BUGS FAQ NEWS README* TODO UPGRADING INSTALL contrib/mailman.mc \
+ contrib/README.check_perms_grsecurity contrib/virtusertable || die "dodoc failed"
+
+ exeinto ${INSTALLDIR}/bin
+ doexe build/contrib/*.py contrib/majordomo2mailman.pl contrib/auto \
+ contrib/mm-handler* || die
+
+ dodir /etc/mailman
+ mv "${D}/${INSTALLDIR}/Mailman/mm_cfg.py" "${D}/etc/mailman"
+ dosym /etc/mailman/mm_cfg.py ${INSTALLDIR}/Mailman/mm_cfg.py
+
+ # Save the old config for updates from pre-2.1.9-r2
+ # To be removed some distant day
+ for i in /var/mailman /home/mailman /usr/local/mailman ${INSTALLDIR}
+ do
+ if [ -f ${i}/Mailman/mm_cfg.py ] && ! [ -L ${i}/Mailman/mm_cfg.py ]; then
+ cp ${i}/Mailman/mm_cfg.py "${D}/etc/mailman/mm_cfg.py"
+ fi
+ done
+
+ newinitd "${FILESDIR}/mailman.rc" mailman
+
+ keepdir ${VAR_PREFIX}/logs
+ keepdir ${VAR_PREFIX}/locks
+ keepdir ${VAR_PREFIX}/spam
+ keepdir ${VAR_PREFIX}/archives/public
+ keepdir ${VAR_PREFIX}/archives/private
+ keepdir ${VAR_PREFIX}/lists
+ keepdir ${VAR_PREFIX}/qfiles
+
+ chown -R ${MAILUSR}:${MAILGRP} "${D}/${VAR_PREFIX}" "${D}/${INSTALLDIR}" "${D}"/etc/mailman/*
+ chmod 2775 "${D}/${INSTALLDIR}" "${D}/${INSTALLDIR}"/templates/* \
+ "${D}/${INSTALLDIR}"/messages/* "${D}/${VAR_PREFIX}" "${D}/${VAR_PREFIX}"/{logs,lists,spam,locks,archives/public}
+ chmod 2750 "${D}/${VAR_PREFIX}/archives/private"
+ chmod 2770 "${D}/${VAR_PREFIX}/qfiles"
+ chmod 2755 "${D}/${INSTALLDIR}"/cgi-bin/* "${D}/${INSTALLDIR}/mail/mailman"
+
+}
+
+pkg_postinst() {
+ python_mod_optimize ${INSTALLDIR}/bin/ ${INSTALLDIR}/Mailman
+
+ enewgroup ${MAILGRP} ${MAILGID}
+ enewuser ${MAILUSR} ${MAILUID} -1 ${INSTALLDIR} mailman -G cron -c "mailman"
+ elog
+ elog "Please read /usr/share/doc/${PF}/README.gentoo.bz2 for additional"
+ elog "Setup information, mailman will NOT run unless you follow"
+ elog "those instructions!"
+ elog
+
+ elog "An example Mailman configuration file for Apache has been installed into:"
+ elog " ${APACHE_MODULES_CONFDIR}/50_mailman.conf"
+ elog
+ elog "To enable, you will need to add \"-D MAILMAN\" to"
+ elog "/etc/conf.d/apache2."
+ elog
+
+ ewarn "Default-Configuration has changed deeply in 2.1.9-r2. You can configure"
+ ewarn "mailman with the following variables:"
+ ewarn "MAILMAN_PREFIX (default: /usr/$(get_libdir)/mailman)"
+ ewarn "MAILMAN_VAR_PREFIX (default: /var/lib/mailman)"
+ ewarn "MAILMAN_CGIGID (default: 81)"
+ ewarn "MAILMAN_CGIEXT (default: empty)"
+ ewarn "MAILMAN_MAILUSR (default: mailman)"
+ ewarn "MAILMAN_MAILUID (default: 280)"
+ ewarn "MAILMAN_MAILGRP (default: mailman)"
+ ewarn "MAILMAN_MAILGID (default: 280)"
+ ewarn
+ ewarn "Config file is now symlinked in /etc/mailman, so etc-update works."
+ ewarn
+ ewarn "If you're upgrading from below 2.1.9-r2 or changed MAILMAN_PREFIX, you"
+ ewarn "MUST change the homedir of the mailman-user manually:"
+ ewarn "usermod -d ${INSTALLDIR} mailman"
+ ebeep
+}
+
+pkg_postrm() {
+ INSTALLDIR=${MAILMAN_PREFIX:-"/usr/$(get_libdir)/mailman"}
+ python_mod_cleanup ${INSTALLDIR}/bin ${INSTALLDIR}/Mailman
+}