]> git.donarmstrong.com Git - deb_pkgs/spamass-milter.git/blobdiff - spamass-milter.cpp
Load spamass-milter-0.3.0 into spamass-milter/trunk.
[deb_pkgs/spamass-milter.git] / spamass-milter.cpp
index 6cf8e4cbf383c87d62498e2c77b5c7a43c0e8217..06e54f216cd37b548a9fa6e9f40014541b302fa9 100644 (file)
@@ -169,6 +169,7 @@ bool flag_bucket_only = false;
 char *spambucket;
 bool flag_full_email = false;          /* pass full email address to spamc */
 bool flag_expand = false;      /* alias/virtusertable expansion */
+bool ignore_authenticated_senders = false;
 
 #if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */
 static pthread_mutex_t popen_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -180,7 +181,7 @@ int
 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;
@@ -212,6 +213,10 @@ main(int argc, char* argv[])
                                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;
@@ -279,7 +284,7 @@ main(int argc, char* argv[])
       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;
@@ -293,6 +298,7 @@ main(int argc, char* argv[])
       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/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;
@@ -761,6 +767,22 @@ mlfi_envfrom(SMFICTX* ctx, char** envfrom)
   struct context *sctx = (struct context *)smfi_getpriv(ctx);
   char *queueid;
 
+  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