summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEray Aslan <eras@gentoo.org>2011-06-08 12:24:51 +0000
committerEray Aslan <eras@gentoo.org>2011-06-08 12:24:51 +0000
commit371904570163813e37ca53ddcb2bf440ae0ef540 (patch)
tree4e73e66dd77a81a02dd098c8ca5e10d904d36351 /mail-filter
parentUpdate the makefile patch so the gtk is really optional. (diff)
downloadhistorical-371904570163813e37ca53ddcb2bf440ae0ef540.tar.gz
historical-371904570163813e37ca53ddcb2bf440ae0ef540.tar.bz2
historical-371904570163813e37ca53ddcb2bf440ae0ef540.zip
Security bump - bug #310049. Don't spam check authenticated
users - bug #265621. Fix received headers - bug #264304 Package-Manager: portage-2.1.10/cvs/Linux x86_64
Diffstat (limited to 'mail-filter')
-rw-r--r--mail-filter/spamass-milter/ChangeLog12
-rw-r--r--mail-filter/spamass-milter/Manifest26
-rw-r--r--mail-filter/spamass-milter/files/spamass-milter-auth_users.patch92
-rw-r--r--mail-filter/spamass-milter/files/spamass-milter-header.patch15
-rw-r--r--mail-filter/spamass-milter/files/spamass-milter-popen.patch233
-rw-r--r--mail-filter/spamass-milter/spamass-milter-0.3.1-r4.ebuild51
6 files changed, 421 insertions, 8 deletions
diff --git a/mail-filter/spamass-milter/ChangeLog b/mail-filter/spamass-milter/ChangeLog
index 565b40f2a82b..6344477148dc 100644
--- a/mail-filter/spamass-milter/ChangeLog
+++ b/mail-filter/spamass-milter/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for mail-filter/spamass-milter
-# Copyright 2000-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/mail-filter/spamass-milter/ChangeLog,v 1.22 2009/08/23 00:11:45 mrness Exp $
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/spamass-milter/ChangeLog,v 1.23 2011/06/08 12:24:51 eras Exp $
+
+*spamass-milter-0.3.1-r4 (08 Jun 2011)
+
+ 08 Jun 2011; Eray Aslan <eras@gentoo.org> +spamass-milter-0.3.1-r4.ebuild,
+ +files/spamass-milter-auth_users.patch, +files/spamass-milter-header.patch,
+ +files/spamass-milter-popen.patch:
+ Security bump - bug #310049. Don't spam check authenticated users - bug
+ #265621. Fix received headers - bug #264304
*spamass-milter-0.3.1-r3 (23 Aug 2009)
diff --git a/mail-filter/spamass-milter/Manifest b/mail-filter/spamass-milter/Manifest
index c29db04527c5..baa6f073fbb4 100644
--- a/mail-filter/spamass-milter/Manifest
+++ b/mail-filter/spamass-milter/Manifest
@@ -1,7 +1,10 @@
-----BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
+Hash: SHA256
AUX README.gentoo 1680 RMD160 db0fa0f42f83626d9a62a6d3fdb9b69ff67b1967 SHA1 1241d8eb3be3d19cf2cecd572b58510a942ee652 SHA256 3ae980f0f8f6c82e2ae8a0677751275e0467e9c1f33b1a835a964a2ee3e80bbf
+AUX spamass-milter-auth_users.patch 3570 RMD160 51c98d93f3510818548c9d743072a18ddd570bc0 SHA1 9a638034c8372d96797e11b59c469b1d30bd70fd SHA256 7838552434d4da78bf33d3ce1f21243adcf1df5b1bd39f9550d2453c832049b9
+AUX spamass-milter-header.patch 631 RMD160 40f8bae7a0c6ca5a36e3dbf897259f27456c1797 SHA1 62f66a25ec9457832f85adfa6c6e0a117f736f0a SHA256 8286c2b6c6ea5fb760ffa4f2f1815b2ef7aa596fa5e160a78cb778e887a3ffad
+AUX spamass-milter-popen.patch 6117 RMD160 6a85ef58265981e3c051fa515dec76a679682257 SHA1 66e07e44932ba86d47227541bcbed30127ca918e SHA256 e8e5a20e94efda41f3d83aa68559f79abbae340ffaebb45c4143045745520547
AUX spamass-milter.conf2 445 RMD160 0cdfdb269142d732780d0cc028494d5a606ef8bd SHA1 dd177e36ec5672b1991ef11d852a6da636a3202d SHA256 a7f4f6c57bbfb76fab2c627e916696812e9a562f8c2b3657899de6448f40bd06
AUX spamass-milter.conf3 903 RMD160 04d98b6b4cd9bf3b0966b596ae4ba710c1c6f90a SHA1 7f16ac4ec6a118b822517777000247381d0634d8 SHA256 f1969e8d1dcba108c379469a5e88e4286624c994bb8e22fd563d1f5cc4063617
AUX spamass-milter.rc2 702 RMD160 bd20e0bb09a96af2f2192b05bbfd6107d231baef SHA1 65e631aed7c495317602ab019acc562cb37361a4 SHA256 669242a2c1e65fd651e03fb2f4a537b816b08b9a88e1f4790d8f9b4928357f7a
@@ -10,12 +13,23 @@ DIST spamass-milter-0.3.1.tar.bz2 116591 RMD160 49946c80ac99e04190981cd6c8de12ef
EBUILD spamass-milter-0.3.1-r1.ebuild 1301 RMD160 7b29dbab0576a93fd7624c5f9993bdb93a748fcf SHA1 f5326e5fada4bfa9f741aaf0cfd115eaa27dbbb6 SHA256 c0495c418c45788c27dced8c19f61607649865d3d90d55c0133d812cc2c0fbd8
EBUILD spamass-milter-0.3.1-r2.ebuild 1314 RMD160 be9fbfe3282b9b175940417676c10c91002827c5 SHA1 a4e996f4b5909fa0c1e9199c2afb7c6873a0a44f SHA256 6a3b53439d0e9c7961cd27c319679d2ac0e45a15f22163835af2afe14613187c
EBUILD spamass-milter-0.3.1-r3.ebuild 1292 RMD160 9dd759e1b332cf57fbb1415844650f49ff61f9bd SHA1 9d082dcea86819a90dd1041303702d1e59d0d5fc SHA256 a402460c2b5e84a2b9ea21df4a01343e4a9b6eb8a80b58efdc55cc2fe94ab342
-MISC ChangeLog 3815 RMD160 decf34de0dd76f3fe19855e81f0ab9c9c575bb06 SHA1 5df9a52468c4a0a31787cfd17a19ecec69d84842 SHA256 259e4c2ea855cf092f66c0cbeda5cfcb13fcbef8f1014a437a471248aba188a2
+EBUILD spamass-milter-0.3.1-r4.ebuild 1328 RMD160 af0b99d40b748dee365de7e575f20d96a99d3341 SHA1 0ba6c77df609ca656b29cd1117c7acf18268e4be SHA256 e3e6bdd83dc944a31fbb949a5b23d6eb8bfcb030a719aa23dd8f8420095de9e6
+MISC ChangeLog 4166 RMD160 b26a0f4ad119d70a0b90dafaeb20059ee629ebd1 SHA1 bfcad5f32ffb657298e97c25314fbd2fb3cd3b15 SHA256 d4c925036e678dee3b918e586d6acc0de2750b09f4a6901bd28c28fe0f21544f
MISC metadata.xml 162 RMD160 fd38b82541901b3c6df18b630d79fe7883ae3f01 SHA1 e6aecefcc2137d6047cedfe447686775ab59cb48 SHA256 569031668e39895fb20829fb17a49a91a83e8f41b2195b0f04825c4340d2af6b
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.11 (GNU/Linux)
+Version: GnuPG v2.0.17 (GNU/Linux)
-iEYEARECAAYFAkqQiU4ACgkQ9A5kJBGSrsvE4gCePiGGK/3kT/KJqAviy1opLPSZ
-LDQAmQFiqYE9aKPzd55r28l/fb9f8i+X
-=fAMu
+iQIcBAEBCAAGBQJN72ogAAoJEHfx8XVYajsfJigP/jvTV+4ydQpICIDlOyz8GmhO
+ubEMK4fXimWhmqEX7F6VWPIVB928hJuUEhB4Vvi1JRFjNV9vLRX4zwjZYTNByjJ0
+mWk1P0cVkEL7zcIgMunfASa8U7YZetqwZUxmy3UcX6w63fo+rX2FdR57atvsSK3O
+QnxyBMrTrNHX8EeOLQT3RXLfmyZEyrEN3nh6TfEiMPjuiu6nrFwJMs72oySGtAi3
+3EUiz8JYka1SE1fLkAncVXYFgn6DDZAGb8OJaTtxsI6wB5o6lGttNpIwuXNWTI30
+R8XjfEgM4yhhv62WjZLLiyoPhgg/sAx/KuzihWTAkdoiRyx9bChujVFjf34eT5u9
+Ad2Ib8uT7/rdi7gFFVVn0Kqv5xak66gbHzgnwIAsn8ZD9DA3pcYX5neK8c9z7Oo8
+Pj+cPFM2reR2nraKbX3197elIL91VICIWMmBB0fX71BPJzSxDQrJ+9joJsz6uYHu
+q/NU5iRhRC+8va2k0Idbes4DJPa1MSa5BxImDG+tTb/vjQjFrAccxmDbp5LpE2cj
+9NuGPaCidl/hCZgF76WnVBODizqCJF0lL3fEWAUyr0VZCfrjCHHuBjdNZXWbolNS
+6cUNF1kjCDQ8ZjBk74qCU8V2HKBqiTBWrGx0WlusPz8zNleevkLETDz8mTMY6/Q/
+NLMAH+qiYouG3ULRIttu
+=74vZ
-----END PGP SIGNATURE-----
diff --git a/mail-filter/spamass-milter/files/spamass-milter-auth_users.patch b/mail-filter/spamass-milter/files/spamass-milter-auth_users.patch
new file mode 100644
index 000000000000..8bfc24e4306f
--- /dev/null
+++ b/mail-filter/spamass-milter/files/spamass-milter-auth_users.patch
@@ -0,0 +1,92 @@
+Based on the debian patch:
+http://patch-tracker.debian.org/patch/series/view/spamass-milter/0.3.1-10/10_dont_handle_authenticated_users.diff
+
+--- spamass-milter.cpp 2011-06-08 11:56:33.000000000 +0000
++++ spamass-milter.cpp 2011-06-08 12:04:41.000000000 +0000
+@@ -170,6 +170,7 @@
+ bool flag_full_email = false; /* pass full email address to spamc */
+ bool flag_expand = false; /* alias/virtusertable expansion */
+ bool warnedmacro = false; /* have we logged that we couldn't fetch a macro? */
++bool ignore_authenticated_senders = false;
+
+ #if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */
+ static pthread_mutex_t popen_mutex = PTHREAD_MUTEX_INITIALIZER;
+@@ -181,7 +182,7 @@
+ main(int argc, char* argv[])
+ {
+ int c, err = 0;
+- const char *args = "fd:mMp:P:r:u:D:i:b:B:e:x";
++ const char *args = "fd:mMp:P:r:u:D:i:Ib:B:e:x";
+ char *sock = NULL;
+ bool dofork = false;
+ char *pidfilename = NULL;
+@@ -213,6 +214,10 @@
+ debug(D_MISC, "Parsing ignore list");
+ parse_networklist(optarg, &ignorenets);
+ break;
++ case 'I':
++ debug(D_MISC, "Ignore authenticated senders");
++ ignore_authenticated_senders = true;
++ break;
+ case 'm':
+ dontmodifyspam = true;
+ smfilter.xxfi_flags &= ~SMFIF_CHGBODY;
+@@ -280,7 +285,7 @@
+ cout << PACKAGE_NAME << " - Version " << PACKAGE_VERSION << endl;
+ cout << "SpamAssassin Sendmail Milter Plugin" << endl;
+ cout << "Usage: spamass-milter -p socket [-b|-B bucket] [-d xx[,yy...]] [-D host]" << endl;
+- cout << " [-e defaultdomain] [-f] [-i networks] [-m] [-M]" << endl;
++ cout << " [-e defaultdomain] [-f] [-i networks] [-I] [-m] [-M]" << endl;
+ cout << " [-P pidfile] [-r nn] [-u defaultuser] [-x]" << endl;
+ cout << " [-- spamc args ]" << endl;
+ cout << " -p socket: path to create socket" << endl;
+@@ -294,6 +299,7 @@
+ cout << " -f: fork into background" << endl;
+ cout << " -i: skip (ignore) checks from these IPs or netblocks" << endl;
+ cout << " example: -i 192.168.12.5,10.0.0.0/8,172.16.0.0/255.255.0.0" << endl;
++ cout << " -I: skip (ignore) checks if sender is authenticated" << endl;
+ cout << " -m: don't modify body, Content-type: or Subject:" << endl;
+ cout << " -M: don't modify the message at all" << endl;
+ cout << " -P pidfile: Put processid in pidfile" << endl;
+@@ -783,6 +789,22 @@
+ }
+ /* debug(D_ALWAYS, "ZZZ got private context %p", sctx); */
+
++ if (ignore_authenticated_senders)
++ {
++ char *auth_authen;
++
++ auth_authen = smfi_getsymval(ctx, "{auth_authen}");
++ debug(D_MISC, "auth_authen=%s", auth_authen ?: "<unauthenticated>");
++
++ if (auth_authen)
++ {
++ debug(D_MISC, "sender authenticated (%s) - accepting message",
++ auth_authen);
++ debug(D_FUNC, "mlfi_envfrom: exit ignore");
++ return SMFIS_ACCEPT;
++ }
++ }
++
+ debug(D_FUNC, "mlfi_envfrom: enter");
+ try {
+ // launch new SpamAssassin
+--- spamass-milter.1.in 2011-06-08 12:05:35.000000000 +0000
++++ spamass-milter.1.in 2011-06-08 12:06:57.000000000 +0000
+@@ -14,6 +14,7 @@
+ .Op Fl e Ar defaultdomain
+ .Op Fl f
+ .Op Fl i Ar networks
++.Op Fl I
+ .Op Fl m
+ .Op Fl M
+ .Op Fl P Ar pidfile
+@@ -119,6 +120,8 @@
+ flags will append to the list.
+ For example, if you list all your internal networks, no outgoing emails
+ will be filtered.
++.It Fl I
++Ignores messages if the sender has authenticated via SMTP AUTH.
+ .It Fl m
+ Disables modification of the
+ .Ql Subject:
diff --git a/mail-filter/spamass-milter/files/spamass-milter-header.patch b/mail-filter/spamass-milter/files/spamass-milter-header.patch
new file mode 100644
index 000000000000..450b08cd89a8
--- /dev/null
+++ b/mail-filter/spamass-milter/files/spamass-milter-header.patch
@@ -0,0 +1,15 @@
+Do not mangle headers - bug #264304
+--- spamass-milter.cppi~ 2011-06-08 11:33:25.000000000 +0000
++++ spamass-milter.cpp 2011-06-08 11:34:31.000000000 +0000
+@@ -1002,9 +1002,9 @@
+
+ assassin->output((string)
+ "Received: from "+macro_s+" ("+macro__+")\r\n\t"+
+- "by "+macro_j+"("+macro_v+"/"+macro_Z+") with "+macro_r+" id "+macro_i+"\r\n\t"+
++ "by "+macro_j+" ("+macro_v+"/"+macro_Z+") with "+macro_r+" id "+macro_i+"\r\n\t"+
+ macro_b+"\r\n\t"+
+- "(envelope-from "+assassin->from()+"\r\n");
++ "(envelope-from "+assassin->from()+")\r\n");
+
+ } else
+ assassin->output((string)"X-Envelope-To: "+envrcpt[0]+"\r\n");
diff --git a/mail-filter/spamass-milter/files/spamass-milter-popen.patch b/mail-filter/spamass-milter/files/spamass-milter-popen.patch
new file mode 100644
index 000000000000..3a7279cc2bda
--- /dev/null
+++ b/mail-filter/spamass-milter/files/spamass-milter-popen.patch
@@ -0,0 +1,233 @@
+See bug #310049
+
+Index: spamass-milter.cpp
+===================================================================
+RCS file: /cvsroot/spamass-milt/spamass-milt/spamass-milter.cpp,v
+retrieving revision 1.91
+diff -u -r1.91 spamass-milter.cpp
+--- spamass-milter.cpp 24 Jul 2006 19:59:17 -0000 1.91
++++ spamass-milter.cpp 10 Mar 2010 18:52:22 -0000
+@@ -171,10 +171,6 @@
+ bool flag_expand = false; /* alias/virtusertable expansion */
+ bool warnedmacro = false; /* have we logged that we couldn't fetch a macro? */
+
+-#if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */
+-static pthread_mutex_t popen_mutex = PTHREAD_MUTEX_INITIALIZER;
+-#endif
+-
+ // {{{ main()
+
+ int
+@@ -461,59 +457,24 @@
+ send another copy. The milter API will not let you send the
+ message AND return a failure code to the sender, so this is
+ the only way to do it. */
+-#if defined(__FreeBSD__)
+- int rv;
+-#endif
+-
+-#if defined(HAVE_ASPRINTF)
+- char *buf;
+-#else
+- char buf[1024];
+-#endif
+- char *fmt="%s \"%s\"";
++ char *popen_argv[3];
+ FILE *p;
+
+-#if defined(HAVE_ASPRINTF)
+- asprintf(&buf, fmt, SENDMAIL, spambucket);
+-#else
+-#if defined(HAVE_SNPRINTF)
+- snprintf(buf, sizeof(buf)-1, fmt, SENDMAIL, spambucket);
+-#else
+- /* XXX possible buffer overflow here */
+- sprintf(buf, fmt, SENDMAIL, spambucket);
+-#endif
+-#endif
+-
+- debug(D_COPY, "calling %s", buf);
+-#if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */
+- rv = pthread_mutex_lock(&popen_mutex);
+- if (rv)
+- {
+- debug(D_ALWAYS, "Could not lock popen mutex: %s", strerror(rv));
+- abort();
+- }
+-#endif
+- p = popen(buf, "w");
++ popen_argv[0] = SENDMAIL;
++ popen_argv[1] = spambucket;
++ popen_argv[2] = NULL;
++
++ debug(D_COPY, "calling %s %s", SENDMAIL, spambucket);
++ p = popenv(popen_argv, "w");
+ if (!p)
+ {
+- debug(D_COPY, "popen failed(%s). Will not send a copy to spambucket", strerror(errno));
++ debug(D_COPY, "popenv failed(%s). Will not send a copy to spambucket", strerror(errno));
+ } else
+ {
+ // Send message provided by SpamAssassin
+ fwrite(assassin->d().c_str(), assassin->d().size(), 1, p);
+- pclose(p); p = NULL;
++ fclose(p); p = NULL;
+ }
+-#if defined(__FreeBSD__)
+- rv = pthread_mutex_unlock(&popen_mutex);
+- if (rv)
+- {
+- debug(D_ALWAYS, "Could not unlock popen mutex: %s", strerror(rv));
+- abort();
+- }
+-#endif
+-#if defined(HAVE_ASPRINTF)
+- free(buf);
+-#endif
+ }
+ return SMFIS_REJECT;
+ }
+@@ -842,30 +803,19 @@
+ /* open a pipe to sendmail so we can do address expansion */
+
+ char buf[1024];
+- char *fmt="%s -bv \"%s\" 2>&1";
+-
+-#if defined(HAVE_SNPRINTF)
+- snprintf(buf, sizeof(buf)-1, fmt, SENDMAIL, envrcpt[0]);
+-#else
+- /* XXX possible buffer overflow here */
+- sprintf(buf, fmt, SENDMAIL, envrcpt[0]);
+-#endif
++ char *popen_argv[4];
++
++ popen_argv[0] = SENDMAIL;
++ popen_argv[1] = "-bv";
++ popen_argv[2] = envrcpt[0];
++ popen_argv[3] = NULL;
+
+- debug(D_RCPT, "calling %s", buf);
++ debug(D_RCPT, "calling %s -bv %s", SENDMAIL, envrcpt[0]);
+
+-#if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */
+- rv = pthread_mutex_lock(&popen_mutex);
+- if (rv)
+- {
+- debug(D_ALWAYS, "Could not lock popen mutex: %s", strerror(rv));
+- abort();
+- }
+-#endif
+-
+- p = popen(buf, "r");
++ p = popenv(popen_argv, "r");
+ if (!p)
+ {
+- debug(D_RCPT, "popen failed(%s). Will not expand aliases", strerror(errno));
++ debug(D_RCPT, "popenv failed(%s). Will not expand aliases", strerror(errno));
+ assassin->expandedrcpt.push_back(envrcpt[0]);
+ } else
+ {
+@@ -890,16 +840,8 @@
+ assassin->expandedrcpt.push_back(p+7);
+ }
+ }
+- pclose(p); p = NULL;
++ fclose(p); p = NULL;
+ }
+-#if defined(__FreeBSD__)
+- rv = pthread_mutex_unlock(&popen_mutex);
+- if (rv)
+- {
+- debug(D_ALWAYS, "Could not unlock popen mutex: %s", strerror(rv));
+- abort();
+- }
+-#endif
+ } else
+ {
+ assassin->expandedrcpt.push_back(envrcpt[0]);
+@@ -2157,5 +2099,71 @@
+ warnedmacro = true;
+ }
+
++/*
++ untrusted-argument-safe popen function - only supports "r" and "w" modes
++ for simplicity, and always reads stdout and stderr in "r" mode. Call
++ fclose to close the FILE.
++*/
++FILE *popenv(char *const argv[], const char *type)
++{
++ FILE *iop;
++ int pdes[2];
++ int save_errno;
++ if ((*type != 'r' && *type != 'w') || type[1])
++ {
++ errno = EINVAL;
++ return (NULL);
++ }
++ if (pipe(pdes) < 0)
++ return (NULL);
++ switch (fork()) {
++
++ case -1: /* Error. */
++ save_errno = errno;
++ (void)close(pdes[0]);
++ (void)close(pdes[1]);
++ errno = save_errno;
++ return (NULL);
++ /* NOTREACHED */
++ case 0: /* Child. */
++ if (*type == 'r') {
++ /*
++ * The dup2() to STDIN_FILENO is repeated to avoid
++ * writing to pdes[1], which might corrupt the
++ * parent's copy. This isn't good enough in
++ * general, since the exit() is no return, so
++ * the compiler is free to corrupt all the local
++ * variables.
++ */
++ (void)close(pdes[0]);
++ (void)dup2(pdes[1], STDOUT_FILENO);
++ (void)dup2(pdes[1], STDERR_FILENO);
++ if (pdes[1] != STDOUT_FILENO && pdes[1] != STDERR_FILENO) {
++ (void)close(pdes[1]);
++ }
++ } else {
++ if (pdes[0] != STDIN_FILENO) {
++ (void)dup2(pdes[0], STDIN_FILENO);
++ (void)close(pdes[0]);
++ }
++ (void)close(pdes[1]);
++ }
++ execv(argv[0], argv);
++ exit(127);
++ /* NOTREACHED */
++ }
++
++ /* Parent; assume fdopen can't fail. */
++ if (*type == 'r') {
++ iop = fdopen(pdes[0], type);
++ (void)close(pdes[1]);
++ } else {
++ iop = fdopen(pdes[1], type);
++ (void)close(pdes[0]);
++ }
++
++ return (iop);
++}
++
+ // }}}
+ // vim6:ai:noexpandtab
+Index: spamass-milter.h
+===================================================================
+RCS file: /cvsroot/spamass-milt/spamass-milt/spamass-milter.h,v
+retrieving revision 1.23
+diff -u -r1.23 spamass-milter.h
+--- spamass-milter.h 7 Apr 2005 02:04:24 -0000 1.23
++++ spamass-milter.h 10 Mar 2010 18:52:22 -0000
+@@ -186,5 +186,6 @@
+ void parse_debuglevel(char* string);
+ char *strlwr(char *str);
+ void warnmacro(char *macro, char *scope);
++FILE *popenv(char *const argv[], const char *type);
+
+ #endif
diff --git a/mail-filter/spamass-milter/spamass-milter-0.3.1-r4.ebuild b/mail-filter/spamass-milter/spamass-milter-0.3.1-r4.ebuild
new file mode 100644
index 000000000000..e5446c9b123f
--- /dev/null
+++ b/mail-filter/spamass-milter/spamass-milter-0.3.1-r4.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/spamass-milter/spamass-milter-0.3.1-r4.ebuild,v 1.1 2011/06/08 12:24:51 eras Exp $
+
+EAPI=4
+
+inherit eutils
+
+IUSE=""
+
+DESCRIPTION="A milter for SpamAssassin"
+HOMEPAGE="http://savannah.nongnu.org/projects/spamass-milt/"
+SRC_URI="http://savannah.nongnu.org/download/spamass-milt/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+
+DEPEND="|| ( mail-filter/libmilter mail-mta/sendmail )
+ >=mail-filter/spamassassin-3.1.0"
+RDEPEND="${DEPEND}"
+
+pkg_setup() {
+ enewgroup milter
+ enewuser milter -1 -1 /var/lib/milter milter
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-header.patch
+ epatch "${FILESDIR}"/${PN}-auth_users.patch
+ epatch "${FILESDIR}"/${PN}-popen.patch
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+
+ newinitd "${FILESDIR}"/spamass-milter.rc3 spamass-milter
+ newconfd "${FILESDIR}"/spamass-milter.conf3 spamass-milter
+ dodir /var/run/milter
+ keepdir /var/run/milter
+ fowners milter:milter /var/run/milter
+ dodir /var/lib/milter
+ keepdir /var/lib/milter
+ fowners milter:milter /var/lib/milter
+
+ dodoc AUTHORS NEWS README ChangeLog "${FILESDIR}/README.gentoo"
+}
+
+pkg_postinst() {
+ elog "Documentation is installed in /usr/share/doc/${P}"
+}