milter-sa.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. Index: configure
  2. --- configure.orig 2006-04-05 18:00:01 +0200
  3. +++ configure 2007-08-06 21:18:29 +0200
  4. @@ -7080,9 +7080,6 @@
  5. # Check for libmilter and its header files in the usual locations
  6. -if test -d /usr/lib/libmilter ; then
  7. - LDFLAGS="$LDFLAGS -L/usr/lib/libmilter"
  8. -fi
  9. echo "$as_me:$LINENO: checking for mi_stop in -lmilter" >&5
  10. echo $ECHO_N "checking for mi_stop in -lmilter... $ECHO_C" >&6
  11. @@ -7369,7 +7366,7 @@
  12. fi
  13. -for ac_header in libmilter/mfapi.h
  14. +for ac_header in milter/mfapi.h
  15. do
  16. as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
  17. if eval "test \"\${$as_ac_Header+set}\" = set"; then
  18. Index: spamass-milter.1.in
  19. --- spamass-milter.1.in.orig 2004-03-18 19:37:08 +0100
  20. +++ spamass-milter.1.in 2007-08-06 21:18:46 +0200
  21. @@ -20,6 +20,7 @@
  22. .Op Fl r Ar nn
  23. .Op Fl u Ar defaultuser
  24. .Op Fl x
  25. +.Op Fl a
  26. .Op Fl - Ar spamc flags ...
  27. .Sh DESCRIPTION
  28. The
  29. @@ -199,6 +200,9 @@
  30. Requires the
  31. .Fl u
  32. flag.
  33. +.It Fl a
  34. +Causes spamass-milter to pass through unchecked any messages from connections
  35. +established using SMTP authentication. This is useful for sites with remote users.
  36. .It Fl - Ar spamc flags ...
  37. Pass all remaining options to spamc.
  38. This allows you to connect to a remote spamd with
  39. Index: spamass-milter.cpp
  40. --- spamass-milter.cpp.orig 2006-03-23 22:41:36 +0100
  41. +++ spamass-milter.cpp 2007-08-06 21:18:29 +0200
  42. @@ -100,7 +100,7 @@
  43. extern "C" {
  44. #endif
  45. -#include "libmilter/mfapi.h"
  46. +#include "milter/mfapi.h"
  47. //#include "libmilter/mfdef.h"
  48. #if !HAVE_DECL_STRSEP
  49. @@ -170,6 +170,7 @@
  50. bool flag_full_email = false; /* pass full email address to spamc */
  51. bool flag_expand = false; /* alias/virtusertable expansion */
  52. bool warnedmacro = false; /* have we logged that we couldn't fetch a macro? */
  53. +bool auth = false; /* don't scan authenticated users */
  54. #if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */
  55. static pthread_mutex_t popen_mutex = PTHREAD_MUTEX_INITIALIZER;
  56. @@ -181,7 +182,7 @@
  57. main(int argc, char* argv[])
  58. {
  59. int c, err = 0;
  60. - const char *args = "fd:mMp:P:r:u:D:i:b:B:e:x";
  61. + const char *args = "fd:mMp:P:r:u:D:i:b:B:e:xa";
  62. char *sock = NULL;
  63. bool dofork = false;
  64. char *pidfilename = NULL;
  65. @@ -196,6 +197,9 @@
  66. /* Process command line options */
  67. while ((c = getopt(argc, argv, args)) != -1) {
  68. switch (c) {
  69. + case 'a':
  70. + auth = true;
  71. + break;
  72. case 'f':
  73. dofork = true;
  74. break;
  75. @@ -281,7 +285,7 @@
  76. cout << "SpamAssassin Sendmail Milter Plugin" << endl;
  77. cout << "Usage: spamass-milter -p socket [-b|-B bucket] [-d xx[,yy...]] [-D host]" << endl;
  78. cout << " [-e defaultdomain] [-f] [-i networks] [-m] [-M]" << endl;
  79. - cout << " [-P pidfile] [-r nn] [-u defaultuser] [-x]" << endl;
  80. + cout << " [-P pidfile] [-r nn] [-u defaultuser] [-x] [-a]" << endl;
  81. cout << " [-- spamc args ]" << endl;
  82. cout << " -p socket: path to create socket" << endl;
  83. cout << " -b bucket: redirect spam to this mail address. The orignal" << endl;
  84. @@ -302,6 +306,7 @@
  85. cout << " -u defaultuser: pass the recipient's username to spamc.\n"
  86. " Uses 'defaultuser' if there are multiple recipients." << endl;
  87. cout << " -x: pass email address through alias and virtusertable expansion." << endl;
  88. + cout << " -a: don't scan messages over an authenticated connection." << endl;
  89. cout << " -- spamc args: pass the remaining flags to spamc." << endl;
  90. exit(EX_USAGE);
  91. @@ -783,6 +788,15 @@
  92. }
  93. /* debug(D_ALWAYS, "ZZZ got private context %p", sctx); */
  94. + if (auth) {
  95. + const char *auth_type = smfi_getsymval(ctx, "{auth_type}");
  96. +
  97. + if (auth_type) {
  98. + debug(D_MISC, "auth_type=%s", auth_type);
  99. + return SMFIS_ACCEPT;
  100. + }
  101. + }
  102. +
  103. debug(D_FUNC, "mlfi_envfrom: enter");
  104. try {
  105. // launch new SpamAssassin