So far it's just on/off switch, but it's a start :)
Enjoy.
This is also going to be posted to the qmailadmin sourceforge project
within the hour.
The patch was made against qmailadmin 1.2.0 but I don't forsee any
difficulty with making against any other version.
Beware, if you're using the old method of --enable-spam-command this
patch removes that functionality (the spam command stuff for ./configure
is still there, but none of the functionality is)
Any pre-existing spam command'ed accounts should work fine, this is
simply a patch to go along with the spamc calling in vdelivermail that
Ken posted a few weeks ago.
-Jeremy
--
Jeremy Kitchen
Systems Administrator
[EMAIL PROTECTED]
Kitchen @ #qmail on EFNet - Join the party!
.....................
Inter7 Internet Technologies, Inc.
www.inter7.com
866.528.3530 toll free
847.492.0470 int'l
847.492.0632 fax
GNUPG key ID: 93BDD6CE
diff -urN qmailadmin-1.2.0-orig/template.c qmailadmin-1.2.0-spam/template.c
--- qmailadmin-1.2.0-orig/template.c 2004-01-25 18:41:07.000000000 -0600
+++ qmailadmin-1.2.0-spam/template.c 2004-03-18 13:19:21.000000000 -0600
@@ -729,6 +729,13 @@
return;
}
+ if ( newchar=='9') {
+ vpw = vauth_getpw(ActionUser, Domain);
+ if (vpw->pw_gid ^ NO_SPAMASSASSIN) {
+ printf("checked ");
+ }
+ }
+
if (fs1 == NULL) {
if (newchar=='0'){
printf("checked ");
@@ -774,33 +781,6 @@
}
}
- i = 0;
- do {
- if (newchar == '3' && (NTmpBuf[0] == '/' ||
- strstr(NTmpBuf, SPAM_COMMAND)!=NULL) ) {
- printf("checked ");
- return;
- }
- if ( newchar == '2' ) {
- if (NTmpBuf[0]=='/') continue;
- if (NTmpBuf[0]=='|') continue;
- if ( i>0 ) printf(", ");
- if (NTmpBuf[0]=='&') {
- printf("%s", strtok(&NTmpBuf[1], "\n"));
- } else {
- printf("%s", NTmpBuf[0]);
- }
- ++i;
- }
- /* Jeff Hedlund ([EMAIL PROTECTED]) 28 May 2003 */
- /* i9: "checked" if spam filtering on */
- if ( newchar == '9' && strstr(NTmpBuf, SPAM_COMMAND)!=NULL ) {
- printf("checked ");
- return;
- }
- } while(fgets(NTmpBuf,sizeof(NTmpBuf),fs1) != NULL );
-
-
return;
} else {
diff -urN qmailadmin-1.2.0-orig/user.c qmailadmin-1.2.0-spam/user.c
--- qmailadmin-1.2.0-orig/user.c 2004-01-26 12:16:40.000000000 -0600
+++ qmailadmin-1.2.0-spam/user.c 2004-03-18 13:19:31.000000000 -0600
@@ -493,11 +493,10 @@
#ifdef MODIFY_SPAM
GetValue(TmpCGI, spamvalue, "spamcheck=", sizeof(spamvalue));
- if(strcmp(spamvalue, "on") == 0) {
- snprintf(NewBuf, sizeof(NewBuf), "%s/.qmail", mypw->pw_dir);
- fs = fopen(NewBuf, "w+");
- fprintf(fs, "%s\n", SPAM_COMMAND);
- fclose(fs);
+ if(strcmp(spamvalue, "off") == 0) {
+ mypw = vauth_getpw(ActionUser, Domain);
+ mypw->pw_gid |= NO_SPAMASSASSIN;
+ vauth_setpw(mypw, Domain);
}
#endif
@@ -805,6 +804,7 @@
}
#endif
+
GetValue(TmpCGI,Gecos, "gecos=", sizeof(Gecos));
if ( strlen( Gecos ) != 0 ) {
vpw = vauth_getpw(ActionUser, Domain);
@@ -857,7 +857,15 @@
/* get value of the spam filter box */
GetValue(TmpCGI,box, "spamcheck=", sizeof(box));
- if ( strcmp(box,"on") == 0 ) spam_check = 1;
+ if ( strcmp(box,"on") == 0 ) {
+ vpw = vauth_getpw(ActionUser, Domain);
+ vpw->pw_gid &= ~NO_SPAMASSASSIN;
+ vauth_setpw(vpw, Domain);
+ } else {
+ vpw = vauth_getpw(ActionUser, Domain);
+ vpw->pw_gid |= NO_SPAMASSASSIN;
+ vauth_setpw(vpw, Domain);
+ }
/* get the value of the cforward radio button */
GetValue(TmpCGI,box, "cforward=", sizeof(box));
@@ -870,13 +878,6 @@
snprintf(NewBuf,sizeof(NewBuf),"%s/.qmail", vpw->pw_dir);
unlink(NewBuf);
- /* if the mail is to be checked for spam, rewrite the file with command */
- if( spam_check == 1 ) {
- fs = fopen(NewBuf, "w+");
- fprintf(fs, "%s\n", SPAM_COMMAND);
- fclose(fs);
- }
-
/* delete any vacation directory */
snprintf(NewBuf,sizeof(NewBuf),"%s/vacation", vpw->pw_dir);
vdelfiles(NewBuf);
@@ -924,12 +925,7 @@
/* if they want to save a copy */
GetValue(TmpCGI,box, "fsaved=", sizeof(box));
if ( strcmp(box,"on") == 0 ) {
- if( spam_check == 1 ) {
- /* if spam check is enabled, that will save the message*/
- fprintf(fs, "%s\n", SPAM_COMMAND);
- } else {
- fprintf(fs,"%s/Maildir/\n", vpw->pw_dir);
- }
+ fprintf(fs,"%s/Maildir/\n", vpw->pw_dir);
}
fclose(fs);
@@ -958,11 +954,7 @@
fprintf(fs, "| %s/autorespond 86400 3 %s/vacation/message %s/vacation\n",
AUTORESPOND_PATH, vpw->pw_dir, vpw->pw_dir );
- /* save a copy for the user (if checking for spam, it will keep a copy)*/
- if(spam_check==1)
- fprintf(fs, "%s\n", SPAM_COMMAND);
- else
- fprintf(fs,"%s/Maildir/\n", vpw->pw_dir);
+ fprintf(fs,"%s/Maildir/\n", vpw->pw_dir);
fclose(fs);
/* set up the message file */