]> www.infradead.org Git - users/dwmw2/crm114-spamd.git/commitdiff
allow setting the dspam mode
authorJohannes Berg <johannes@sipsolutions.net>
Thu, 11 May 2006 10:33:24 +0000 (12:33 +0200)
committerJohannes Berg <johannes@johannes.(none)>
Thu, 11 May 2006 10:33:24 +0000 (12:33 +0200)
README
dspam-spamd.c

diff --git a/README b/README
index f9ee6efc549d375630806c0cafef984931099c76..c4a4dea63fe79f69e3315d8e5ee43bf1b4cc47d9 100644 (file)
--- a/README
+++ b/README
@@ -11,8 +11,14 @@ It will
  - report 10*probability if dspam determines the message to be spam,
    and report that it is spam
  - always set the points required to 0
+ - setuid() to the user given in the User: header line in the protocol
+ - set the dspam mode to the mode given as in the User: header line
+   (for these two, the User: header line looks like this:
+     User: username mode
+   where the mode is optional)
 
-Hence, you probably never want to use the spam/not-spam verdict of this tool
-to make an automatic decision but rather go from the points.
+Due to the way the points are calculated, you probably never want to use the
+spam/not-spam verdict of this tool to make an automatic decision but rather
+go from the points.
 
 It only handles messages smaller than 5mb!
index 2d7ac72aa2dd4c352285bb4302cab3463d2620cc..7911cbc6fa435ff44a153e628b6627247013e315 100644 (file)
@@ -24,7 +24,7 @@ int main()
        char buf[200];
        char cmd[50];
        char version[50];
-       char user[50], userarg[60];
+       char user[50], userarg[60], mode[50], modearg[60];
        char *message;
        int length;
        int fork_result;
@@ -75,7 +75,8 @@ int main()
        if (strlen(buf) > 50)
                ERROR(EX_PROTOCOL, "line too long");
 
-       if (sscanf(buf, "User: %s", user) != 1)
+       mode[0] = '\0';
+       if (sscanf(buf, "User: %s %s", user, mode) < 1)
                ERROR(EX_PROTOCOL, "invalid input line (user)");
 
        if (strcmp(id, user) && strcmp(id, "root") && strcmp(id, "Debian-exim"))
@@ -134,7 +135,8 @@ int main()
                dup2(dspam_out[1], 1);
                dup2(dspam_err[1], 2);
                sprintf(userarg, "--user=%s", user);
-               execl("/usr/bin/dspam", "/usr/bin/dspam", "--mode=toe",
+               sprintf(modearg, "--mode=%s", mode[0] ? mode : "notrain");
+               execl("/usr/bin/dspam", "/usr/bin/dspam", modearg,
                      "--deliver=innocent,spam", "--stdout", userarg, NULL);
                return 1;
        }