milter-sa.patch 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. Index: spamass-milter.1.in
  2. --- spamass-milter.1.in.orig 2004-03-18 19:37:08 +0100
  3. +++ spamass-milter.1.in 2006-12-30 18:09:16 +0100
  4. @@ -199,6 +199,9 @@
  5. Requires the
  6. .Fl u
  7. flag.
  8. +.It Fl a
  9. +Causes spamass-milter to pass through unchecked any messages from connections
  10. +established using SMTP authentication. This is useful for sites with remote users.
  11. .It Fl - Ar spamc flags ...
  12. Pass all remaining options to spamc.
  13. This allows you to connect to a remote spamd with
  14. Index: spamass-milter.cpp
  15. --- spamass-milter.cpp.orig 2006-03-23 22:41:36 +0100
  16. +++ spamass-milter.cpp 2006-12-30 18:09:16 +0100
  17. @@ -170,6 +170,7 @@
  18. bool flag_full_email = false; /* pass full email address to spamc */
  19. bool flag_expand = false; /* alias/virtusertable expansion */
  20. bool warnedmacro = false; /* have we logged that we couldn't fetch a macro? */
  21. +bool auth = false; /* don't scan authenticated users */
  22. #if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */
  23. static pthread_mutex_t popen_mutex = PTHREAD_MUTEX_INITIALIZER;
  24. @@ -181,7 +182,7 @@
  25. main(int argc, char* argv[])
  26. {
  27. int c, err = 0;
  28. - const char *args = "fd:mMp:P:r:u:D:i:b:B:e:x";
  29. + const char *args = "fd:mMp:P:r:u:D:i:b:B:e:xa";
  30. char *sock = NULL;
  31. bool dofork = false;
  32. char *pidfilename = NULL;
  33. @@ -196,6 +197,9 @@
  34. /* Process command line options */
  35. while ((c = getopt(argc, argv, args)) != -1) {
  36. switch (c) {
  37. + case 'a':
  38. + auth = true;
  39. + break;
  40. case 'f':
  41. dofork = true;
  42. break;
  43. @@ -281,7 +285,7 @@
  44. cout << "SpamAssassin Sendmail Milter Plugin" << endl;
  45. cout << "Usage: spamass-milter -p socket [-b|-B bucket] [-d xx[,yy...]] [-D host]" << endl;
  46. cout << " [-e defaultdomain] [-f] [-i networks] [-m] [-M]" << endl;
  47. - cout << " [-P pidfile] [-r nn] [-u defaultuser] [-x]" << endl;
  48. + cout << " [-P pidfile] [-r nn] [-u defaultuser] [-x] [-a]" << endl;
  49. cout << " [-- spamc args ]" << endl;
  50. cout << " -p socket: path to create socket" << endl;
  51. cout << " -b bucket: redirect spam to this mail address. The orignal" << endl;
  52. @@ -302,6 +306,7 @@
  53. cout << " -u defaultuser: pass the recipient's username to spamc.\n"
  54. " Uses 'defaultuser' if there are multiple recipients." << endl;
  55. cout << " -x: pass email address through alias and virtusertable expansion." << endl;
  56. + cout << " -a: don't scan messages over an authenticated connection." << endl;
  57. cout << " -- spamc args: pass the remaining flags to spamc." << endl;
  58. exit(EX_USAGE);
  59. @@ -783,6 +788,15 @@
  60. }
  61. /* debug(D_ALWAYS, "ZZZ got private context %p", sctx); */
  62. + if (auth) {
  63. + const char *auth_type = smfi_getsymval(ctx, "{auth_type}");
  64. +
  65. + if (auth_type) {
  66. + debug(D_MISC, "auth_type=%s", auth_type);
  67. + return SMFIS_ACCEPT;
  68. + }
  69. + }
  70. +
  71. debug(D_FUNC, "mlfi_envfrom: enter");
  72. try {
  73. // launch new SpamAssassin