You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(33) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(2) |
Feb
(21) |
Mar
(34) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(11) |
Jun
(12) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
|
Nov
(4) |
Dec
(11) |
2009 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
|
Dec
(1) |
2011 |
Jan
(18) |
Feb
|
Mar
|
Apr
(2) |
May
(8) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ton...@us...> - 2004-02-29 23:17:25
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15039 Modified Files: backend.php functions.php Log Message: filter_* functions call local_filter_* Index: functions.php =================================================================== RCS file: /cvsroot/serverfilters/functions.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** functions.php 24 Feb 2004 05:44:59 -0000 1.15 --- functions.php 29 Feb 2004 22:58:59 -0000 1.16 *************** *** 14,52 **** include_once ('../plugins/serversidefilter/backend.php'); } /* * Filter functions * These are the functions you call to get or write the filter files */ ! function filter_get() { ! global $username; ! ! $localfile = "/tmp/serversidefilter/"; ! mkdirs($localfile, 0777); ! chmod($localfile, 0777); ! ! $localfile .= "filterfile.$username"; ! if (filter_exists()) { ! $result = invoke_filtercmd("getrc filter", "", $localfile); ! } else ! touch($localfile); ! ! return $localfile; } function filter_exists() { ! $exists = invoke_filtercmd("rcexists filter", "", ""); ! if ($exists == 0) { ! return true; ! } else { ! return false; ! } } - // Put the filter file - function filter_put($file) { ! $result = invoke_filtercmd("putrc filter", $file, ""); } function write_forward() { global $username, $FILTER_FILE_PATH, $FORWARD_FILE_TYPE, $FILTER_APP_PATH; --- 14,36 ---- include_once ('../plugins/serversidefilter/backend.php'); } + /* * Filter functions * These are the functions you call to get or write the filter files + * These simply call the only available backend, "local" */ ! function filter_get() { ! return local_filter_get(); } function filter_exists() { ! return local_filter_exists(); } function filter_put($file) { ! return local_filter_put($file); } + function write_forward() { global $username, $FILTER_FILE_PATH, $FORWARD_FILE_TYPE, $FILTER_APP_PATH; *************** *** 64,68 **** fclose($fd); ! $result = invoke_filtercmd("putrc forward", $tmpfile, ""); } --- 48,52 ---- fclose($fd); ! $result = local_write_forward($tmpfile); } |
From: <ton...@us...> - 2004-02-29 23:15:29
|
Update of /cvsroot/serverfilters/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14698 Modified Files: filtercmd.c checkcreds_cclient.c Log Message: Fixes/cleanups Index: filtercmd.c =================================================================== RCS file: /cvsroot/serverfilters/script/filtercmd.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** filtercmd.c 23 Feb 2004 17:07:57 -0000 1.8 --- filtercmd.c 29 Feb 2004 22:57:04 -0000 1.9 *************** *** 98,109 **** /* define DEBUG for debugging output */ ! #define DEBUG /* define this in filtercmd.opts */ ! #ifndef CONFIGFILE ! #define CONFIGFILE "/etc/squirrelmail/config.php" #endif #ifndef SERVERSIDEFILTERHOME ! #define SERVERSIDEFILTERHOME "/usr/share/squirrelmail/plugins/serversidefilter/" #endif --- 98,109 ---- /* define DEBUG for debugging output */ ! /* #define DEBUG */ /* define this in filtercmd.opts */ ! #ifndef SQUIRRELMAILCONFIGFILE ! #define SQUIRRELMAILCONFIGFILE "/etc/squirrelmail/config.php" #endif #ifndef SERVERSIDEFILTERHOME ! #define SERVERSIDEFILTERHOME "../plugins/serversidefilter/" #endif *************** *** 116,131 **** #include "filtercmd.h" ! void eperror(register char *); ! int rcexists(char *); ! int getrc(char*); ! int putrc(char*, uid_t, gid_t); ! int copy_file(char*, FILE*, char*, FILE*); int checkcredentials(char*, char*, char*); ! ! /* global variables -- used in path calculation code */ ! char user[STR_MAX]; ! char real_user[STR_MAX]; ! char *domain; int main(int argc, char *argv[]){ --- 116,128 ---- #include "filtercmd.h" ! /* externally defined functions */ int checkcredentials(char*, char*, char*); ! /* global variables -- used in path calculation code (findfilterfile) */ ! char separator[2] = "@"; /* the separator character */ ! char user[STR_MAX]; /* IMAP username possibly including domain name */ ! char real_user[STR_MAX]; /* real unix user */ ! char dom_user[STR_MAX]; /* IMAP username, sans any domain name */ ! char *domain; /* The domain of the IMAP username */ int main(int argc, char *argv[]){ *************** *** 151,157 **** if (err) return inerror(err); ! err = readvirtualdomain(user, real_user, STR_MAX); ! if (err) return inerror(err); ! err = finduidgid(real_user, &UID, &GID); if (err) return inerror(err); --- 148,168 ---- if (err) return inerror(err); ! #ifdef DEBUG ! fprintf(stderr, "user: %s\n", user); ! #endif ! ! if (splitdomain(user, &domain, dom_user, STR_MAX)) { ! err = readvirtualdomain(domain, real_user, STR_MAX); ! if (err) return inerror(err); ! } else { ! /* without domain mapping file, assume IMAP username is a real unix username */ ! strncpy(real_user, user, STR_MAX); ! } ! ! #ifdef DEBUG ! fprintf(stderr, "domain: %s\n", domain); ! fprintf(stderr, "dom_user: %s\n", dom_user); ! #endif ! err = finduidgid(real_user, &UID, &GID); if (err) return inerror(err); *************** *** 272,276 **** /* ! * Reads IMAP server information from CONFIGFILE. * * Parameters: --- 283,287 ---- /* ! * Reads IMAP server information from SQUIRRELMAILCONFIGFILE. * * Parameters: *************** *** 286,295 **** { int foundserver; ! foundserver = readconfigvar(CONFIGFILE, "$imapServerAddress", server, serverlen); return foundserver ? ERR_OK : ERR_CANT_READ_IMAP_SERVER; } /* ! * Reads a setting from CONFIGFILE. * * Parameters: --- 297,306 ---- { int foundserver; ! foundserver = readconfigvar(SQUIRRELMAILCONFIGFILE, "$imapServerAddress", server, serverlen); return foundserver ? ERR_OK : ERR_CANT_READ_IMAP_SERVER; } /* ! * Reads a setting from a config file. * * Parameters: *************** *** 379,390 **** if (s == NULL) return 0; ! /* look for // comment marker */ ! commentpos = strstr(line, "//"); if (commentpos && commentpos < s) return 0; - #ifdef DEBUG - /*fprintf(stderr, "parsephpstring: varname=%s line=%s", varname, line);*/ - #endif - /* skip ahead to either ' or " */ s += strcspn(s, "\"'\0\n") + 1; --- 390,398 ---- if (s == NULL) return 0; ! /* look for // comment marker, making sure the // can't be ! treated as a comment by the compiler */ ! commentpos = strstr(line, "/" "/"); if (commentpos && commentpos < s) return 0; /* skip ahead to either ' or " */ s += strcspn(s, "\"'\0\n") + 1; *************** *** 394,401 **** dest[n] = '\0'; - #ifdef DEBUG - /*fprintf(stderr, "parsephpstring -> %s\n", dest);*/ - #endif - return 1; } --- 402,405 ---- *************** *** 473,495 **** int findfilterfile(char *filter_type, char *filter_file, int buflen) { int err; - char *tmp; - char *dom_user; err = findfilterpath(filter_type, filter_file, buflen); if (err) return err; fprintf(stderr, "filter_file: %s\n", filter_file); ! ! /* TODO: these need to be replaced with global variable references */ ! strcpy(dom_user, user); ! tmp = index(dom_user, '@'); ! *tmp = '\0'; ! replace(filter_file, buflen, "[USERNAME]",dom_user); ! replace(filter_file, buflen, "[DOMAIN]", domain ? domain : ""); ! replace(filter_file, buflen, "[DOMUSER]", real_user); ! /* DEBUG */ fprintf(stderr, "filter_file: %s\n", filter_file); } --- 477,498 ---- int findfilterfile(char *filter_type, char *filter_file, int buflen) { int err; err = findfilterpath(filter_type, filter_file, buflen); if (err) return err; + #ifdef DEBUG fprintf(stderr, "filter_file: %s\n", filter_file); ! fprintf(stderr, "dom_user: %s\n", dom_user); ! fprintf(stderr, "domain: %s\n", domain); ! fprintf(stderr, "real_user: %s\n", real_user); ! #endif ! replace(filter_file, buflen, "[USERNAME]", dom_user); ! replace(filter_file, buflen, "[DOMAIN]", domain); ! replace(filter_file, buflen, "[DOMUSER]", real_user); ! #ifdef DEBUG fprintf(stderr, "filter_file: %s\n", filter_file); + #endif } *************** *** 554,571 **** } ! int readvirtualdomain(char *user, char *real_user, int buflen) { FILE *f; char line[STR_MAX]; char *colon, *s; int err; ! ! domain = strchr(user, '@'); ! if (domain == NULL) { ! /* no at sign in username implies no virtual domain -- not necessarily correct */ ! strncpy(real_user, user, buflen); ! return ERR_OK; ! } ! domain++; ! /* find the first line with a colon that matches the domain up to the colon. * copy the rest of the line (or up to another colon) into the real_user --- 557,617 ---- } ! ! /* ! * Handles splitting a user into a username and a domain. ! * ! * Globals: ! * separator - IN. This should be a one-character string, usually "@" ! * Parameters: ! * user - IN. This can possibly contain the separator character. ! * domain - OUT. This pointer will be set to part of the dom_user buffer. ! * dom_user - OUT. This buffer will be set to the first part of the user. ! * buflen - IN. Length of the dom_user buffer. ! * Returns: ! * 1 if the user contained the separator character, 0 if not. ! */ ! int splitdomain(char *user, char** domain, char* dom_user, int buflen) { ! char *dom; ! strncpy(dom_user, user, buflen); ! dom = strchr(dom_user, separator[0]); ! #ifdef DEBUG ! fprintf(stderr, "user:%s dom_user:%s dom:%s buflen:%d\n", user, dom_user, dom, buflen); ! #endif ! if (dom == NULL) { ! /* no at sign in username implies no virtual domain. */ ! /* make domain be the empty string */ ! dom = dom_user + strlen(dom_user); ! *domain = dom; ! return 0; ! } else { ! /* terminate the dom_user string at the separator and ! make domain point to the rest of the string */ ! #ifdef DEBUG ! fprintf(stderr, "user:%s dom_user:%s dom:%s\n", user, dom_user, dom); ! #endif ! ! *dom = '\0'; ! (*dom)++; ! *domain = dom; ! return 1; ! } ! } ! ! /* ! * Reads the virtualdomain file to find the real unix user name for a domain. ! * ! * Parameters: ! * domain - IN. The domain name. ! * real_user - OUT. This buffer will be set to the real unix username. ! * buflen - IN. Length of the real_user buffer. ! * Returns: ! * ERR_OK if an entry was found, an error message if not. ! */ ! int readvirtualdomain(char *domain, char *real_user, int buflen) { FILE *f; char line[STR_MAX]; char *colon, *s; int err; ! /* find the first line with a colon that matches the domain up to the colon. * copy the rest of the line (or up to another colon) into the real_user *************** *** 593,597 **** } ! /* open a file while verifying that it is sufficiently protected so that * we can trust its contents. That means the file must be owned by root, * and either not group readable or be in root's group. The same test is --- 639,643 ---- } ! /* Open a file while verifying that it is sufficiently protected so that * we can trust its contents. That means the file must be owned by root, * and either not group readable or be in root's group. The same test is *************** *** 628,635 **** *ix = '\0'; } while (1); ! } int trusted_error(char *err, char *path, char *file) { fprintf(stderr, "trust error on %s while checking %s\n %s\n", path, file, err); return ERR_CANT_TRUST_FILE; } --- 674,683 ---- *ix = '\0'; } while (1); ! } int trusted_error(char *err, char *path, char *file) { + #ifdef DEBUG fprintf(stderr, "trust error on %s while checking %s\n %s\n", path, file, err); + #endif return ERR_CANT_TRUST_FILE; } Index: checkcreds_cclient.c =================================================================== RCS file: /cvsroot/serverfilters/script/checkcreds_cclient.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** checkcreds_cclient.c 14 Dec 2003 20:55:27 -0000 1.1 --- checkcreds_cclient.c 29 Feb 2004 22:57:04 -0000 1.2 *************** *** 10,13 **** --- 10,17 ---- #include MAIL_H + #ifndef MAILBOXFLAGS + #define MAILBOXFLAGS "/norsh/notls" + #endif + static char *callback_user, *callback_passwd; *************** *** 45,49 **** mail_parameters(NIL, SET_MAXLOGINTRIALS, (void*)1); ! snprintf(mailboxname, MAILTMPLEN, "{%s/norsh/service=imap/user=\"%s\"}INBOX", imapserver, user); stream = mail_open(NIL, mailboxname, NIL); --- 49,53 ---- mail_parameters(NIL, SET_MAXLOGINTRIALS, (void*)1); ! snprintf(mailboxname, MAILTMPLEN, "{%s/service=imap/user=\"%s\"" MAILBOXFLAGS "}INBOX", imapserver, user); stream = mail_open(NIL, mailboxname, NIL); |
From: <ton...@us...> - 2004-02-29 23:15:02
|
Update of /cvsroot/serverfilters/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14597 Added Files: README Log Message: Documentation --- NEW FILE: README --- OVERVIEW This directory contains the source code for filtercmd, a setuid binary that serversidefilter uses in order to read and write filter/forward files. COMPILING AND INSTALLING To compile filtercmd, edit the Makefile to change any settings, and then run make. Then run make test to ensure the setuid binary / configuration settings are set up properly. The binary should reside in this directory. PREREQUISITES * A C compiler * Root access. This script must be setuid root, because it will need to write files as any mail user on the system. * The c-client library. The Makefile has more details. TROUBLESHOOTING To be written. |
From: <ton...@us...> - 2004-02-29 23:14:38
|
Update of /cvsroot/serverfilters/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14536 Modified Files: Makefile Log Message: Build instructions Index: Makefile =================================================================== RCS file: /cvsroot/serverfilters/script/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 22 Feb 2004 21:20:17 -0000 1.4 --- Makefile 29 Feb 2004 22:56:11 -0000 1.5 *************** *** 1,23 **** HTTPD_GROUP=apache CFLAGS= #CFLAGS=-DDEBUG ! # c-client credentials checking CHECKCREDS=checkcreds_cclient.o LIBS=/usr/lib/c-client.a -lssl -lpam -L/usr/kerberos/lib/ -lgssapi_krb5 -lcrypt I=/usr/include/imap CCLIENT_CFLAGS=-I$I '-DMAIL_H="mail.h"' '-DLINKAGE_C="linkage.c"' -DIMAP_TIMEOUT=2 all: filtercmd ! filtercmd: filtercmd.o $(CHECKCREDS) gcc -o filtercmd filtercmd.o $(CHECKCREDS) $(LIBS) chmod 4750 filtercmd chown root:$(HTTPD_GROUP) filtercmd ! filtercmd.o: filtercmd.c filtercmd.opts ! gcc -c filtercmd.c $(CFLAGS) `cat filtercmd.opts` ! checkcreds_cclient.o: checkcreds_cclient.c gcc -c checkcreds_cclient.c $(CFLAGS) $(CCLIENT_CFLAGS) --- 1,75 ---- + # Makefile for filtercmd, part of serversidefilter + # See README for background information + # + + ### GENERAL OPTIONS ### + + # change this to match the group your HTTPD server runs as. + # The resulting binary will be owned by this group. HTTPD_GROUP=apache + + # If you are having problems connecting, recompile with this + # flag changed and send the output to the mailing list. CFLAGS= #CFLAGS=-DDEBUG ! # Edit the location of the squirrelmail config file here. ! SQUIRRELMAILCONFIGFILE=/etc/squirrelmail/config.php ! FILTERCMD_CFLAGS=-DSQUIRRELMAILCONFIGFILE='"$(SQUIRRELMAILCONFIGFILE)"' ! ! # The default location for the serversidefilter directory should work. ! # Uncomment the line below, and change the test.sh file, if you want to ! # change it. ! SERVERSIDEFILTERHOME=../plugins/serversidefilter ! #FILTERCMD_CFLAGS=$(FILTERCMD_CFLAGS) -DSERVERSIDEFILTERHOME='"$(SERVERSIDEFILTERHOME)"' ! ! ### C-CLIENT OPTIONS ### ! ! # filtercmd validates usernames and passwords with the c-client library from ! # UW. This library is part of pine and UW IMAP and is installed separately ! # on many Linux systems. See http://www.washington.edu/imap/ for more ! # information. ! ! # This line selects c-client credentials checking. This is currently the ! # only option. CHECKCREDS=checkcreds_cclient.o + + # You may need to adjust the following line. LIBS=/usr/lib/c-client.a -lssl -lpam -L/usr/kerberos/lib/ -lgssapi_krb5 -lcrypt + + # This directory should contain a file named mail.h I=/usr/include/imap + + # These settings should work fine. CCLIENT_CFLAGS=-I$I '-DMAIL_H="mail.h"' '-DLINKAGE_C="linkage.c"' -DIMAP_TIMEOUT=2 + # filtercmd uses c-client's mailbox naming conventions to control how the + # connection to the IMAP server will happen. The standard mailbox name will + # look like: {localhost/imap4/user=.../norsh} + # See http://www.washington.edu/imap/documentation/naming.txt.html for more details. + # You can add more flags, and/or remove the /norsh flag, by uncommenting the + # line below. + + # The default settings (uncomment and edit) + #CCLIENT_CFLAGS=$(CCLIENT_CFLAGS) -DMAILBOXFLAGS=/norsh + + # The /notls flag will work around SSL problems. + #CCLIENT_CFLAGS=$(CCLIENT_CFLAGS) -DMAILBOXFLAGS=/norsh/notls + + ### END OF C-CLIENT OPTIONS ### + + ### END OF CONFIGURABLE OPTIONS ### + all: filtercmd ! filtercmd: filtercmd.o Makefile $(CHECKCREDS) gcc -o filtercmd filtercmd.o $(CHECKCREDS) $(LIBS) chmod 4750 filtercmd chown root:$(HTTPD_GROUP) filtercmd ! filtercmd.o: filtercmd.c Makefile ! gcc -c filtercmd.c $(CFLAGS) $(FILTERCMD_CFLAGS) ! checkcreds_cclient.o: checkcreds_cclient.c Makefile gcc -c checkcreds_cclient.c $(CFLAGS) $(CCLIENT_CFLAGS) *************** *** 26,28 **** clean: ! rm *.o *~ --- 78,80 ---- clean: ! -rm *.o *~ test_creds filter |
From: <ton...@us...> - 2004-02-29 23:14:23
|
Update of /cvsroot/serverfilters/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14442 Modified Files: test.sh Log Message: made test.sh not specific to author Index: test.sh =================================================================== RCS file: /cvsroot/serverfilters/script/test.sh,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test.sh 22 Feb 2004 21:18:01 -0000 1.4 --- test.sh 29 Feb 2004 22:55:55 -0000 1.5 *************** *** 1,4 **** ! (echo tony; echo somepassword) | ./filtercmd getrc filter > filter; echo "RESULT:" $? ! echo '# hello world ' >> filter ! (echo tony; echo somepassword; cat filter) | ./filtercmd putrc filter; echo "RESULT:" $? ! (echo to...@so...; echo somepassword) | ./filtercmd getrc filter /tmp/test; echo "RESULT:" $? --- 1,21 ---- ! #!/bin/sh ! ! # need a valid username/password for testing ! if [ ! -s test_creds ]; then ! echo Enter a valid IMAP username and password on separate lines: ! head -2 > test_creds ! fi ! ! # to run the command as the PHP files will, need to change to a different ! # directory first. If SERVERSIDEFILTERHOME is changed, this must be changed ! # also. ! RUNFROM=../../../src ! SCRIPTDIR=../plugins/serversidefilter/script ! ! cd $RUNFROM ! cat $SCRIPTDIR/test_creds | $SCRIPTDIR/filtercmd getrc filter > $SCRIPTDIR/filter; echo "RESULT:" $? ! echo '# filtercmd testing ' >> $SCRIPTDIR/filter ! cat $SCRIPTDIR/test_creds | $SCRIPTDIR/filtercmd putrc filter; echo "RESULT:" $? ! cat $SCRIPTDIR/test_creds | $SCRIPTDIR/filtercmd getrc filter; echo "RESULT:" $? ! ! echo If you do not need to perform additional tests, remove the file 'test_creds' |
From: <jgs...@us...> - 2004-02-24 15:34:14
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4664 Modified Files: ChangeLog README config.php options.php recipie_functions.php Log Message: Fixed bug in spam filter generation. Index: README =================================================================== RCS file: /cvsroot/serverfilters/README,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** README 22 Feb 2004 21:20:16 -0000 1.6 --- README 24 Feb 2004 15:19:56 -0000 1.7 *************** *** 14,17 **** --- 14,18 ---- dot-qmail files for delivery. + Dot-forward files can also be generated to invoke the filter app. Requirements Index: config.php =================================================================== RCS file: /cvsroot/serverfilters/config.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** config.php 24 Feb 2004 06:15:16 -0000 1.12 --- config.php 24 Feb 2004 15:19:56 -0000 1.13 *************** *** 3,7 **** /* * ServersideFilter - Serverside filter plugin for SquirrelMail ! * By Patrick Swieskowski, Rick Sheaffer, and Jon Stroud */ --- 3,14 ---- /* * ServersideFilter - Serverside filter plugin for SquirrelMail ! * By Jon Stroud and Tony Lownds ! * ! * This config file controls how your filter files will be generated ! * All variables that ask for a path can use the following constructs: ! * [USERNAME] = will get replaced with the actual username of the person logged in ! * [DOMAIN] = will get replaced with the email domain name ! * [DOMUSER] = in a virtual domain setting, this gets replaced with the system user ! * that owns the virtual domain. */ *************** *** 24,31 **** /* * This is the directory where the filter files will be stored - * you may put [DOMAIN] and [USERNAME] in this entry - * and the appropriate domain name and username will be entered. - * Additionally for virtual domains you can use [DOMUSER] which will be replaced - * with the username that owns the domain. */ $FILTER_FILE_PATH = '/home/email/[DOMUSER]/users/[USERNAME]/.mailfilter'; --- 31,34 ---- *************** *** 57,61 **** * ALLOW_UNSUBSCRIBED * Uncomment the following line to allow filtering to unsubscribed mailboxes ! * Comment line out to disable to only allow filtering to subscribed mailboxes. */ $ALLOW_UNSUBSCRIBED = true; --- 60,64 ---- * ALLOW_UNSUBSCRIBED * Uncomment the following line to allow filtering to unsubscribed mailboxes ! * Comment line out to disable and only allow filtering to subscribed mailboxes. */ $ALLOW_UNSUBSCRIBED = true; *************** *** 86,91 **** * LOCAL_MAILDIR * Set the path to the Maildir here. This is used in the filter ! * file itself. add [USERNAME] if the username is part of the ! * path, and this will get replaced with the correct username. */ //$LOCAL_MAILDIR = '$HOME/Maildir/'; // This would be a good example for a --- 89,93 ---- * LOCAL_MAILDIR * Set the path to the Maildir here. This is used in the filter ! * file itself. */ //$LOCAL_MAILDIR = '$HOME/Maildir/'; // This would be a good example for a Index: options.php =================================================================== RCS file: /cvsroot/serverfilters/options.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** options.php 24 Feb 2004 05:44:24 -0000 1.13 --- options.php 24 Feb 2004 15:19:56 -0000 1.14 *************** *** 231,234 **** --- 231,235 ---- .'<input type=hidden name=field value="' . $SPAMHEADER . '">' .'<input type=hidden name=string value="' . $SPAMVALUE . '">' + .'<input type=hidden name=matching vaule="0">' ._("if message is marked as").' <b>'._("SPAM").'</b> '._("then") .' <select name=action>' Index: recipie_functions.php =================================================================== RCS file: /cvsroot/serverfilters/recipie_functions.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** recipie_functions.php 24 Feb 2004 05:44:24 -0000 1.8 --- recipie_functions.php 24 Feb 2004 15:19:56 -0000 1.9 *************** *** 236,239 **** --- 236,240 ---- if ($recipies[$i]['field'] == $SPAMHEADER) { print('<input type=hidden name=field value="' . $SPAMHEADER . '">'); + print('<input type=hidden name=matching value="0">'); if ($recipies[$i]['string'] == $UNSUREVALUE) { print('<input type=hidden name=string value="'.$UNSUREVALUE.'">'); |
From: <jgs...@us...> - 2004-02-24 06:29:16
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29726 Modified Files: config.php Log Message: Fixed up some of the comments |
From: <jgs...@us...> - 2004-02-24 05:58:58
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24738 Modified Files: functions.php Log Message: Removed debug line |
From: <jgs...@us...> - 2004-02-24 05:58:23
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24509 Modified Files: backend.php config.php functions.php options.php recipie_functions.php Log Message: Fixed "To or Cc" option that never worked. Miscellaneous bug fixes. Index: config.php =================================================================== RCS file: /cvsroot/serverfilters/config.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** config.php 22 Feb 2004 21:20:16 -0000 1.10 --- config.php 24 Feb 2004 05:44:24 -0000 1.11 *************** *** 7,14 **** ! global $ALWAYS_CREATE, $FILTERDIR, $FILTER_APP_PATH, $DEFAULT_DELIVERY, $ALLOW_UNSUBSCRIBED, $SPAMFILTER, $SPAMHEADER, $SPAMFILTERMAXKB, $SPAMVALUE, $UNSUREVALUE, $VIRTUAL_DOMAINS, $LOCAL_MAILDIR, ! $USE_MAILDIRS, $SEPERATOR, $CREATE_DOT_QMAIL, $DOT_QMAIL_DIR; /** --- 7,14 ---- ! global $ALWAYS_CREATE, $FILTER_APP_PATH, $DEFAULT_DELIVERY, $ALLOW_UNSUBSCRIBED, $SPAMFILTER, $SPAMHEADER, $SPAMFILTERMAXKB, $SPAMVALUE, $UNSUREVALUE, $VIRTUAL_DOMAINS, $LOCAL_MAILDIR, ! $USE_MAILDIRS, $SEPERATOR; /** *************** *** 32,36 **** */ //$FILTERDIR = '/var/lib/squirrelmail/home/[DOMAIN]/[USERNAME]'; ! $FILTERDIR = '/home/email/[DOMUSER]/users/[USERNAME]'; /* --- 32,38 ---- */ //$FILTERDIR = '/var/lib/squirrelmail/home/[DOMAIN]/[USERNAME]'; ! //$FILTERDIR = '/home/email/[DOMUSER]/users/[USERNAME]'; ! //$FILTER_FILE_PATH = '/home/email/[DOMUSER]/users/[USERNAME]/.mailfilter'; ! $FILTER_FILE_PATH = '/home/email/[DOMUSER]/users/[USERNAME]/.procmailrc'; /* *************** *** 41,46 **** * 'maildrop' */ ! //$FILTER_APP_PATH = '/usr/bin/procmail'; ! $FILTER_APP_PATH = '/usr/bin/maildrop'; /** --- 43,48 ---- * 'maildrop' */ ! $FILTER_APP_PATH = '/usr/bin/procmail'; ! //$FILTER_APP_PATH = '/usr/bin/maildrop'; /** *************** *** 117,125 **** // option will be ignored if virtual domains are enabled. If you really // want this capability try adding a "| forward" to the default delivery ! $CREATE_DOT_QMAIL = true; ! $DOT_QMAIL_DIR = "/home/email/[DOMUSER]/"; ! ! $CREATE_DOT_FORWARD = false; ! $DOT_FORWARD_DIR = "/home/email/[DOMUSER]/"; ?> --- 119,124 ---- // option will be ignored if virtual domains are enabled. If you really // want this capability try adding a "| forward" to the default delivery ! $FORWARD_FILE_TYPE = "qmail"; ! $FORWARD_FILE_PATH = "/home/email/[DOMUSER]/.qmail-[USERNAME]"; ?> Index: functions.php =================================================================== RCS file: /cvsroot/serverfilters/functions.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** functions.php 24 Feb 2004 03:29:40 -0000 1.13 --- functions.php 24 Feb 2004 05:44:24 -0000 1.14 *************** *** 50,64 **** function write_forward() { ! global $username, $FORWARD_FILE_PATH, $FORWARD_FILE_TYPE, $FILTER_APP_PATH; $tmpfile = "/tmp/forwardfile-$username"; $fd = fopen($tmpfile,"w"); ! $filterpath = vd_replace($FORWARD_FILE_PATH); $contents_array = array( ! "qmail" => "|preline $FILTER_APP_PATH $filterfile\n", ! "forward" => "|$FILTER_APP_PATH $filterfile\n" ); $contents = $contents_array[$FORWARD_FILE_TYPE]; fwrite($fd, $contents); fclose($fd); --- 50,65 ---- function write_forward() { ! global $username, $FILTER_FILE_PATH, $FORWARD_FILE_TYPE, $FILTER_APP_PATH; $tmpfile = "/tmp/forwardfile-$username"; $fd = fopen($tmpfile,"w"); ! $filterpath = vd_replace($FILTER_FILE_PATH); $contents_array = array( ! "qmail" => "|preline $FILTER_APP_PATH $filterpath\n", ! "forward" => "|$FILTER_APP_PATH $filterpath\n" ); $contents = $contents_array[$FORWARD_FILE_TYPE]; + echo "Forward file: " . $contents; fwrite($fd, $contents); fclose($fd); Index: options.php =================================================================== RCS file: /cvsroot/serverfilters/options.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** options.php 24 Feb 2004 03:29:40 -0000 1.12 --- options.php 24 Feb 2004 05:44:24 -0000 1.13 *************** *** 116,123 **** else $new['toAddress'] = 'off'; ! if ($_POST['add_string'] != null) ! $new['add_string'] = $_POST['add_string']; ! if (get_magic_quotes_gpc() == 1) ! $new['add_string'] = stripslashes($new['add_string']); else $new['add_string'] = ""; array_push($recipies, $new); --- 116,124 ---- else $new['toAddress'] = 'off'; ! if ($_POST['add_string'] != null) { ! $new['add_string'] = $_POST['add_string']; ! if (get_magic_quotes_gpc() == 1) ! $new['add_string'] = stripslashes($new['add_string']); ! } else $new['add_string'] = ""; array_push($recipies, $new); *************** *** 175,179 **** } ! unlink($file); $value = count($recipies); displayPageHeader($color, 'None'); --- 176,181 ---- } ! unlink($file); ! unlink("/tmp/filterfile.$username.tmp"); $value = count($recipies); displayPageHeader($color, 'None'); Index: recipie_functions.php =================================================================== RCS file: /cvsroot/serverfilters/recipie_functions.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** recipie_functions.php 24 Feb 2004 03:30:09 -0000 1.7 --- recipie_functions.php 24 Feb 2004 05:44:24 -0000 1.8 *************** *** 115,119 **** function write_recipies($oldfile, $newfile) { global $username, $recipies, $SEPERATOR, $SPAMFILTER, $SPAMHEADER, $UNSUREVALUE, $SPAMVALUE, ! $VIRTUAL_DOMAINS, $LOCAL_MAILDIR, $FILE_BACKEND; if (isset($VIRTUAL_DOMAINS) && $VIRTUAL_DOMAINS==1) --- 115,119 ---- function write_recipies($oldfile, $newfile) { global $username, $recipies, $SEPERATOR, $SPAMFILTER, $SPAMHEADER, $UNSUREVALUE, $SPAMVALUE, ! $VIRTUAL_DOMAINS, $LOCAL_MAILDIR, $FILE_BACKEND, $FORWARD_FILE_PATH; if (isset($VIRTUAL_DOMAINS) && $VIRTUAL_DOMAINS==1) |
From: <ton...@us...> - 2004-02-24 03:44:04
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1504 Modified Files: recipie_functions.php Log Message: deprecate , |
From: <ton...@us...> - 2004-02-24 03:43:35
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1407 Modified Files: backend.php functions.php options.php Log Message: deprecate , Index: functions.php =================================================================== RCS file: /cvsroot/serverfilters/functions.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** functions.php 23 Feb 2004 20:59:05 -0000 1.12 --- functions.php 24 Feb 2004 03:29:40 -0000 1.13 *************** *** 19,23 **** */ function filter_get() { ! global $username, $FILTERFILE; $localfile = "/tmp/serversidefilter/"; --- 19,23 ---- */ function filter_get() { ! global $username; $localfile = "/tmp/serversidefilter/"; *************** *** 25,29 **** chmod($localfile, 0777); ! $localfile .= "$FILTERFILE.$username"; if (filter_exists()) { $result = invoke_filtercmd("getrc filter", "", $localfile); --- 25,29 ---- chmod($localfile, 0777); ! $localfile .= "filterfile.$username"; if (filter_exists()) { $result = invoke_filtercmd("getrc filter", "", $localfile); *************** *** 49,80 **** } ! function write_dot_qmail() { ! global $username, $FILTERDIR, $FILTERFILE, $FILTER_APP_PATH; ! ! $tmpfile = "/tmp/.qmail-$username"; ! ! $fd = fopen($tmpfile,"w"); ! $filterpath = vd_replace($FILTERDIR); ! $filterfile = "$filterpath/$FILTERFILE"; ! $contents = "|preline $FILTER_APP_PATH $filterfile\n"; ! fwrite($fd, $contents); ! fclose($fd); ! ! $result = invoke_filtercmd("putrc forward", $tmpfile, ""); ! } ! ! function write_dot_forward() { ! global $username, $VIRTUAL_DOMAINS, $FILTERDIR, $FILTERFILE, $FILTER_APP_PATH; ! if ($VIRTUAL_DOMAINS) { ! return; ! } ! ! $tmpfile = "/tmp/.forward-$username"; $fd = fopen($tmpfile,"w"); ! $filterpath = vd_replace($FILTERDIR); ! $filterfile = "$filterpath/$FILTERFILE"; ! $contents = "|$FILTER_APP_PATH $filterfile\n"; fwrite($fd, $contents); fclose($fd); --- 49,64 ---- } ! function write_forward() { ! global $username, $FORWARD_FILE_PATH, $FORWARD_FILE_TYPE, $FILTER_APP_PATH; ! $tmpfile = "/tmp/forwardfile-$username"; $fd = fopen($tmpfile,"w"); ! $filterpath = vd_replace($FORWARD_FILE_PATH); ! $contents_array = array( ! "qmail" => "|preline $FILTER_APP_PATH $filterfile\n", ! "forward" => "|$FILTER_APP_PATH $filterfile\n" ! ); ! $contents = $contents_array[$FORWARD_FILE_TYPE]; fwrite($fd, $contents); fclose($fd); *************** *** 93,98 **** $FILTER_ARRY = explode("/", $FILTER_APP_PATH); $FILTER_APP = $FILTER_ARRY[count($FILTER_ARRY)-1]; - $set_filterfile = $FILTER_APP.'_set_filterfile'; - $set_filterfile(); } --- 77,80 ---- Index: options.php =================================================================== RCS file: /cvsroot/serverfilters/options.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** options.php 24 Feb 2004 00:27:12 -0000 1.11 --- options.php 24 Feb 2004 03:29:40 -0000 1.12 *************** *** 122,127 **** else $new['add_string'] = ""; array_push($recipies, $new); ! write_recipies($file, "/tmp/$FILTERFILE.$username.tmp"); ! filter_put("/tmp/$FILTERFILE.$username.tmp"); } elseif (array_key_exists('modify_x', $_POST)) { // Modify an existing entry --- 122,127 ---- else $new['add_string'] = ""; array_push($recipies, $new); ! write_recipies($file, "/tmp/filterfile.$username.tmp"); ! filter_put("/tmp/filterfile.$username.tmp"); } elseif (array_key_exists('modify_x', $_POST)) { // Modify an existing entry *************** *** 145,156 **** $recipies[$_POST['rule']]['toAddress'] = 'off'; $recipies[$_POST['rule']]['add_string'] = $_POST['add_string']; ! write_recipies($file, "/tmp/$FILTERFILE.$username.tmp"); ! filter_put("/tmp/$FILTERFILE.$username.tmp"); } elseif (array_key_exists('delete_x', $_POST)) { // Delete an entry $recipies = array_merge(array_slice($recipies, 0, $_POST['rule']), array_slice($recipies, $_POST['rule']+1)); ! write_recipies($file, "/tmp/$FILTERFILE.$username.tmp"); ! filter_put("/tmp/$FILTERFILE.$username.tmp"); } elseif (array_key_exists('up_x', $_POST)) { --- 145,156 ---- $recipies[$_POST['rule']]['toAddress'] = 'off'; $recipies[$_POST['rule']]['add_string'] = $_POST['add_string']; ! write_recipies($file, "/tmp/filterfile.$username.tmp"); ! filter_put("/tmp/filterfile.$username.tmp"); } elseif (array_key_exists('delete_x', $_POST)) { // Delete an entry $recipies = array_merge(array_slice($recipies, 0, $_POST['rule']), array_slice($recipies, $_POST['rule']+1)); ! write_recipies($file, "/tmp/filterfile.$username.tmp"); ! filter_put("/tmp/filterfile.$username.tmp"); } elseif (array_key_exists('up_x', $_POST)) { *************** *** 160,165 **** $recipies[$_POST['rule']] = $recipies[$_POST['rule']-1]; $recipies[$_POST['rule']-1] = $tmp; ! write_recipies($file, "/tmp/$FILTERFILE.$username.tmp"); ! filter_put("/tmp/$FILTERFILE.$username.tmp"); } } elseif (array_key_exists('down_x', $_POST)) { --- 160,165 ---- $recipies[$_POST['rule']] = $recipies[$_POST['rule']-1]; $recipies[$_POST['rule']-1] = $tmp; ! write_recipies($file, "/tmp/filterfile.$username.tmp"); ! filter_put("/tmp/filterfile.$username.tmp"); } } elseif (array_key_exists('down_x', $_POST)) { *************** *** 170,175 **** $recipies[$_POST['rule']] = $recipies[$_POST['rule']+1]; $recipies[$_POST['rule']+1] = $tmp; ! write_recipies($file, "/tmp/$FILTERFILE.$username.tmp"); ! filter_put("/tmp/$FILTERFILE.$username.tmp"); } } --- 170,175 ---- $recipies[$_POST['rule']] = $recipies[$_POST['rule']+1]; $recipies[$_POST['rule']+1] = $tmp; ! write_recipies($file, "/tmp/filterfile.$username.tmp"); ! filter_put("/tmp/filterfile.$username.tmp"); } } |
From: <jgs...@us...> - 2004-02-24 00:41:15
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv639 Modified Files: backend.php options.php Log Message: Added more advanced filtering options Index: options.php =================================================================== RCS file: /cvsroot/serverfilters/options.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** options.php 23 Feb 2004 20:59:05 -0000 1.10 --- options.php 24 Feb 2004 00:27:12 -0000 1.11 *************** *** 59,63 **** $key = $_COOKIE['key']; ! $fields = array("From", "Subject", "To", "Cc", "TO_"); $matching = array("Contains", "Begins With", "Ends With", "Is Exactly", "Custom"); $spamrule_set = false; --- 59,63 ---- $key = $_COOKIE['key']; ! $fields = array("From", "Subject", "To", "Cc", "TO_", "Body", "Any Header", "Any part of Message"); $matching = array("Contains", "Begins With", "Ends With", "Is Exactly", "Custom"); $spamrule_set = false; |
From: <jgs...@us...> - 2004-02-23 21:12:48
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19085 Modified Files: backend.php functions.php options.php recipie_functions.php Log Message: Added more advanced filtering options. Index: functions.php =================================================================== RCS file: /cvsroot/serverfilters/functions.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** functions.php 22 Feb 2004 22:14:41 -0000 1.11 --- functions.php 23 Feb 2004 20:59:05 -0000 1.12 *************** *** 19,29 **** */ function filter_get() { ! global $username; $localfile = "/tmp/serversidefilter/"; mkdirs($localfile, 0777); chmod($localfile, 0777); $localfile .= "$FILTERFILE.$username"; ! if (filter_exists($file)) { $result = invoke_filtercmd("getrc filter", "", $localfile); } else --- 19,30 ---- */ function filter_get() { ! global $username, $FILTERFILE; $localfile = "/tmp/serversidefilter/"; mkdirs($localfile, 0777); chmod($localfile, 0777); + $localfile .= "$FILTERFILE.$username"; ! if (filter_exists()) { $result = invoke_filtercmd("getrc filter", "", $localfile); } else *************** *** 97,106 **** function write_filter_recipie($fd, $action, $field, $string, $folder, ! $toFolder, $toAddress, $add_string) { global $FILTER_APP; $wr_filter = $FILTER_APP.'_write_filter_recipie'; $wr_filter($fd, $action, $field, $string, $folder, ! $toFolder, $toAddress, $add_string); } --- 98,107 ---- function write_filter_recipie($fd, $action, $field, $string, $folder, ! $toFolder, $toAddress, $add_string, $matching) { global $FILTER_APP; $wr_filter = $FILTER_APP.'_write_filter_recipie'; $wr_filter($fd, $action, $field, $string, $folder, ! $toFolder, $toAddress, $add_string, $matching); } Index: options.php =================================================================== RCS file: /cvsroot/serverfilters/options.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** options.php 22 Feb 2004 21:50:32 -0000 1.9 --- options.php 23 Feb 2004 20:59:05 -0000 1.10 *************** *** 60,64 **** $fields = array("From", "Subject", "To", "Cc", "TO_"); ! $matching = array("Contains", "Begins with", "Ends With", "Is Exactly"); $spamrule_set = false; $unsurerule_set = false; --- 60,64 ---- $fields = array("From", "Subject", "To", "Cc", "TO_"); ! $matching = array("Contains", "Begins With", "Ends With", "Is Exactly", "Custom"); $spamrule_set = false; $unsurerule_set = false; *************** *** 107,110 **** --- 107,111 ---- $new['folder'] = $folders[$_POST['folder']]; $new['action'] = $_POST['action']; + $new['matching'] = $matching[$_POST['matching']]; if (isset($_POST['toFolder'])) $new['toFolder'] = 'on'; *************** *** 134,137 **** --- 135,139 ---- $recipies[$_POST['rule']]['folder'] = $folders[$_POST['folder']]; $recipies[$_POST['rule']]['action'] = $_POST['action']; + $recipies[$_POST['rule']]['matching'] = $matching[$_POST['matching']]; if (isset($_POST['toFolder'])) $recipies[$_POST['rule']]['toFolder'] = 'on'; *************** *** 191,195 **** <input type=hidden name="create.x" value="<?php print($value++)?>"> <tr><td align=right valign=top> ! <?php echo _("If") . " " . fieldDropdown('') . " " . matchingDropdown('') . " <input type=text name=string size=10> " . _("then") . " " ?> <select name=action> <option value=m>move</option> --- 193,202 ---- <input type=hidden name="create.x" value="<?php print($value++)?>"> <tr><td align=right valign=top> ! <?php ! print(_("If") . " "); ! fieldDropdown(''); ! matchingDropdown(''); ! print("* <input type=text name=string size=10> " . _("then") . " ") ! ?> <select name=action> <option value=m>move</option> *************** *** 210,213 **** --- 217,223 ---- <td align=center valign=top><input type=image src="images/saveas.gif" border=0 name=create alt="save new"></td> </tr> + <tr> + <td colspan=8>* Selecting "Custom" allows you to enter your own Regular Expression (ie: you use wildcard characters such as *)</td> + </tr> </form> <?php Index: recipie_functions.php =================================================================== RCS file: /cvsroot/serverfilters/recipie_functions.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** recipie_functions.php 22 Feb 2004 21:20:16 -0000 1.5 --- recipie_functions.php 23 Feb 2004 20:59:05 -0000 1.6 *************** *** 100,105 **** if (isset($tmp[5])) $new['toAddress'] = stripslashes($tmp[5]); else $new['toAddress'] = 'off'; ! if (isset($tmp[6])) $new['add_string'] = stripslashes(trim($tmp[6])); else $new['add_string'] = ""; array_push($recipies, $new); } --- 100,107 ---- if (isset($tmp[5])) $new['toAddress'] = stripslashes($tmp[5]); else $new['toAddress'] = 'off'; ! if (isset($tmp[6])) $new['add_string'] = stripslashes($tmp[6]); else $new['add_string'] = ""; + if (isset($tmp[7])) $new['matching'] = stripslashes(trim($tmp[7])); + else $new['matching'] = "Contains"; array_push($recipies, $new); } *************** *** 148,151 **** --- 150,154 ---- $toAddress = $recipies[$i]['toAddress']; $add_string = $recipies[$i]['add_string']; + $matching = $recipies[$i]['matching']; $ssfield = addslashes($recipies[$i]['field']); *************** *** 156,163 **** $sstoAddress = addslashes($recipies[$i]['toAddress']); $ssadd_string = addslashes($recipies[$i]['add_string']); ! ! fputs($nf, "\n###${ssfield} '' ${ssstring} '' ${ssfolder} '' ${ssaction} '' ${sstoFolder} '' ${sstoAddress} '' ${ssadd_string} \n"); write_filter_recipie($nf, $action, $field, $string, $folder, ! $toFolder, $toAddress, $add_string); } --- 159,167 ---- $sstoAddress = addslashes($recipies[$i]['toAddress']); $ssadd_string = addslashes($recipies[$i]['add_string']); ! $ssmatching = addslashes($recipies[$i]['matching']); ! ! fputs($nf, "\n###${ssfield} '' ${ssstring} '' ${ssfolder} '' ${ssaction} '' ${sstoFolder} '' ${sstoAddress} '' ${ssadd_string} '' ${ssmatching} \n"); write_filter_recipie($nf, $action, $field, $string, $folder, ! $toFolder, $toAddress, $add_string, $matching); } *************** *** 246,250 **** print(_("If") . " "); fieldDropdown($recipies[$i]['field']); ! print(_("contains") . " <input type=text name=string size=10 value=\"$str\"> " . _("then") . " "); } print("<select name=action>\n"); --- 250,255 ---- print(_("If") . " "); fieldDropdown($recipies[$i]['field']); ! matchingDropdown($recipies[$i]['matching']); ! print(" <input type=text name=string size=10 value=\"$str\"> " . _("then") . " "); } print("<select name=action>\n"); |
From: <jgs...@us...> - 2004-02-23 17:21:32
|
Update of /cvsroot/serverfilters/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29719 Modified Files: filtercmd.c Log Message: Fixed some of the "replace" functions. Index: filtercmd.c =================================================================== RCS file: /cvsroot/serverfilters/script/filtercmd.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** filtercmd.c 22 Feb 2004 21:18:01 -0000 1.7 --- filtercmd.c 23 Feb 2004 17:07:57 -0000 1.8 *************** *** 473,476 **** --- 473,478 ---- int findfilterfile(char *filter_type, char *filter_file, int buflen) { int err; + char *tmp; + char *dom_user; err = findfilterpath(filter_type, filter_file, buflen); *************** *** 480,486 **** /* TODO: these need to be replaced with global variable references */ ! replace(filter_file, buflen, "[USERNAME]", real_user); replace(filter_file, buflen, "[DOMAIN]", domain ? domain : ""); ! replace(filter_file, buflen, "[DOMUSER]", user); /* DEBUG */ --- 482,492 ---- /* TODO: these need to be replaced with global variable references */ ! ! strcpy(dom_user, user); ! tmp = index(dom_user, '@'); ! *tmp = '\0'; ! replace(filter_file, buflen, "[USERNAME]",dom_user); replace(filter_file, buflen, "[DOMAIN]", domain ? domain : ""); ! replace(filter_file, buflen, "[DOMUSER]", real_user); /* DEBUG */ |
From: <jgs...@us...> - 2004-02-23 16:26:59
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16956 Modified Files: config.php.sample Log Message: this file was way out of date. just bringing up to current. |
From: <ton...@us...> - 2004-02-23 01:35:43
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13903 Added Files: migrate_config.php Log Message: Initial check-in -- writes new config on stdout |
From: <ton...@us...> - 2004-02-22 22:27:41
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10751 Modified Files: functions.php backend.php Log Message: When invoking filtercmd, pass an RC file type instead of a full RC file path Index: backend.php =================================================================== RCS file: /cvsroot/serverfilters/backend.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** backend.php 22 Feb 2004 21:20:16 -0000 1.10 --- backend.php 22 Feb 2004 22:14:41 -0000 1.11 *************** *** 13,32 **** function local_filter_get() { ! global $username, $FILTERDIR, $FILTERFILE, $VIRTUAL_DOMAINS, $SEPERATOR; ! ! $path = vd_replace($FILTERDIR); ! ! if (!file_exists($path)) { ! mkdirs($path,0700); ! } - $file = "$path/$FILTERFILE"; $localfile = "/tmp/$FILTERFILE.$username"; ! if (local_file_exists($file)) { ! $err_code = invoke_filtercmd("getrc $file", "", $localfile); ! if ($err_code != 0) exit("filtercmd returned $err_code"); ! } else ! touch($localfile); ! return $localfile; } --- 13,22 ---- function local_filter_get() { ! global $username, $FILTERDIR, $FILTERFILE, $VIRTUAL_DOMAINS; $localfile = "/tmp/$FILTERFILE.$username"; ! touch($localfile); ! $err_code = invoke_filtercmd("getrc filter", "", $localfile); ! if ($err_code != 0) exit("filtercmd returned $err_code"); return $localfile; } *************** *** 69,83 **** function local_filter_exists() { ! global $username, $FILTERDIR, $FILTERFILE, $VIRTUAL_DOMAINS, $SEPERATOR; ! ! $path = vd_replace($FILTERDIR); ! ! $file = "$path/$FILTERFILE"; ! return local_file_exists($file); ! ! } ! ! function local_file_exists($file) { ! $exists = invoke_filtercmd("rcexists $file", "", ""); if ($exists == 0) return true; --- 59,63 ---- function local_filter_exists() { ! $exists = invoke_filtercmd("rcexists filter", "", ""); if ($exists == 0) return true; *************** *** 89,108 **** function local_filter_put($file) { ! global $username, $FILTERDIR, $FILTERFILE, $VIRTUAL_DOMAINS, $SEPERATOR; ! ! $path = vd_replace($FILTERDIR); ! ! if (!file_exists($path)) { ! mkdirs($path,0700); ! } ! ! $newfile = "$path/$FILTERFILE"; ! ! if ($VIRTUAL_DOMAINS) ! $user = my_virtual_domain_user($vdomain); ! else ! $user = $username; ! ! $err_code = invoke_filtercmd("putrc $user $file", $localfile, ""); } --- 69,73 ---- function local_filter_put($file) { ! $err_code = invoke_filtercmd("putrc filter", $localfile, ""); } |
From: <ton...@us...> - 2004-02-22 22:03:29
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4914 Modified Files: options.php Log Message: |
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29133 Modified Files: README backend.php config.php options.php package recipie_functions.php setup.php version Log Message: Several bugfixes and feature changes Index: backend.php =================================================================== RCS file: /cvsroot/serverfilters/backend.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** backend.php 12 Jan 2004 15:45:33 -0000 1.9 --- backend.php 22 Feb 2004 21:20:16 -0000 1.10 *************** *** 63,67 **** //DEBUG: uncomment to help debug problems ! //if ($result) echo("$command -> $result<br>\n"); return $result; --- 63,67 ---- //DEBUG: uncomment to help debug problems ! if ($result) echo("$command -> $result<br>\n"); return $result; *************** *** 119,123 **** function procmail_write_filter_recipie($fd, $action, $field, $string, $folder, $toFolder, $toAddress, $add_string) { ! global $default_folder_prefix, $optional_delimiter, $USE_MAILDIRS; if ($action == "m") --- 119,123 ---- function procmail_write_filter_recipie($fd, $action, $field, $string, $folder, $toFolder, $toAddress, $add_string) { ! global $default_folder_prefix, $USE_MAILDIRS; if ($action == "m") Index: config.php =================================================================== RCS file: /cvsroot/serverfilters/config.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** config.php 25 Dec 2003 02:17:53 -0000 1.9 --- config.php 22 Feb 2004 21:20:16 -0000 1.10 *************** *** 71,75 **** $SPAMHEADER = 'X-Spam-Flag'; $SPAMVALUE = 'Yes'; ! //$SPAMFILTER= '/usr/bin/sb_filter.py -f'; //$SPAMHEADER = 'X-SpamBayes-Classification'; //$SPAMVALUE = 'spam'; --- 71,75 ---- $SPAMHEADER = 'X-Spam-Flag'; $SPAMVALUE = 'Yes'; ! //$SPAMFILTER= '/usr/bin/sb_filter.py'; //$SPAMHEADER = 'X-SpamBayes-Classification'; //$SPAMVALUE = 'spam'; *************** *** 121,125 **** $CREATE_DOT_FORWARD = false; ! $DOT_FORWARD_DIR = "/home/[USERNAME]/"; ?> --- 121,125 ---- $CREATE_DOT_FORWARD = false; ! $DOT_FORWARD_DIR = "/home/email/[DOMUSER]/"; ?> Index: options.php =================================================================== RCS file: /cvsroot/serverfilters/options.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** options.php 11 Dec 2003 15:51:40 -0000 1.7 --- options.php 22 Feb 2004 21:20:16 -0000 1.8 *************** *** 43,47 **** global $username, $key, $imapServerAddress, $imapPort; ! global $fields, $folders, $imapConnection, $imap_stream; global $recipies, $SPAMHEADER, $SPAMVALUE, $UNSUREVALUE; --- 43,47 ---- global $username, $key, $imapServerAddress, $imapPort; ! global $fields, $matching, $folders, $imapConnection, $imap_stream; global $recipies, $SPAMHEADER, $SPAMVALUE, $UNSUREVALUE; *************** *** 60,63 **** --- 60,64 ---- $fields = array("From", "Subject", "To", "Cc", "TO_"); + $matching = array("Conatains", "Begins with", "Ends With", "Is Exactly"); $spamrule_set = false; $unsurerule_set = false; *************** *** 190,194 **** <input type=hidden name="create.x" value="<?php print($value++)?>"> <tr><td align=right valign=top> ! <?php echo _("If") . " "; echo fieldDropdown('') . " " . _("contains") . " <input type=text name=string size=10> " . _("then") . " " ?> <select name=action> <option value=m>move</option> --- 191,195 ---- <input type=hidden name="create.x" value="<?php print($value++)?>"> <tr><td align=right valign=top> ! <?php echo _("If") . " "; echo fieldDropdown('') . " " . echo matchingDropdown('') . " <input type=text name=string size=10> " . _("then") . " " ?> <select name=action> <option value=m>move</option> Index: package =================================================================== RCS file: /cvsroot/serverfilters/package,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** package 9 Dec 2003 20:05:53 -0000 1.6 --- package 22 Feb 2004 21:20:16 -0000 1.7 *************** *** 1,3 **** --- 1,7 ---- #!/bin/sh + if [ -e serversidefilter ] ; then + rm -rf serversidefilter + fi + mkdir serversidefilter mkdir serversidefilter/script *************** *** 19,31 **** cp config.php serversidefilter/config.php.sample ! cp setup.php options.php functions.php backend.php ChangeLog index.php README virtualdomains.sample recipie_functions.php version serversidefilter/ cp images/*.gif serversidefilter/images ! cp script/filtercmd.c serversidefilter/script/ chown -R apache.apache serversidefilter/ ! gcc -o serversidefilter/script/filtercmd script/filtercmd.c ! chown root.apache serversidefilter/script/filtercmd ! chmod 4750 serversidefilter/script/filtercmd tar czvf ../serversidefilter-$VERSION.tar.gz serversidefilter/ --- 23,35 ---- cp config.php serversidefilter/config.php.sample ! cp setup.php options.php functions.php backend.php ChangeLog FAQ index.php README virtualdomains.sample recipie_functions.php version serversidefilter/ cp images/*.gif serversidefilter/images ! cp script/* serversidefilter/script/ chown -R apache.apache serversidefilter/ ! cd serversidefilter/script/ ! make ! cd ../../ tar czvf ../serversidefilter-$VERSION.tar.gz serversidefilter/ Index: recipie_functions.php =================================================================== RCS file: /cvsroot/serverfilters/recipie_functions.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** recipie_functions.php 11 Dec 2003 16:28:51 -0000 1.4 --- recipie_functions.php 22 Feb 2004 21:20:16 -0000 1.5 *************** *** 59,62 **** --- 59,78 ---- } + + function matchingDropdown($str) { + global $matching; + + print("<select name=matching>\n"); + + for ($i = 0; $i < count($matching); $i++) { + print("<option value=\"$i\""); + if ($matching[$i] == $str) + print(" selected"); + print(">$matching[$i]</option>\n"); + } + + print("</select>\n"); + } + function read_recipies($file) { global $recipies, $spamrule_set, $unsurerule_set, $SPAMHEADER, $SPAMVALUE, $UNSUREVALUE; Index: setup.php =================================================================== RCS file: /cvsroot/serverfilters/setup.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** setup.php 4 Dec 2003 23:15:04 -0000 1.1.1.1 --- setup.php 22 Feb 2004 21:20:17 -0000 1.2 *************** *** 28,32 **** function serversidefilter_version() { ! return '1.33'; } --- 28,32 ---- function serversidefilter_version() { ! return '1.40beta1'; } Index: version =================================================================== RCS file: /cvsroot/serverfilters/version,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** version 4 Dec 2003 23:15:05 -0000 1.1.1.1 --- version 22 Feb 2004 21:20:17 -0000 1.2 *************** *** 1,2 **** Serverside Filter Configuration ! 1.33 --- 1,2 ---- Serverside Filter Configuration ! 1.40beta1 |
From: <jgs...@us...> - 2004-02-22 21:33:34
|
Update of /cvsroot/serverfilters/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29133/script Modified Files: Makefile Log Message: Several bugfixes and feature changes Index: Makefile =================================================================== RCS file: /cvsroot/serverfilters/script/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 14 Dec 2003 20:55:27 -0000 1.3 --- Makefile 22 Feb 2004 21:20:17 -0000 1.4 *************** *** 5,10 **** # c-client credentials checking CHECKCREDS=checkcreds_cclient.o ! LIBS=/usr/src/local/pine4.58/imap/c-client/c-client.a -lssl -lpam -L/usr/kerberos/lib/ -lgssapi_krb5 -lcrypt ! I=/usr/src/local/pine4.58/imap/c-client/ CCLIENT_CFLAGS=-I$I '-DMAIL_H="mail.h"' '-DLINKAGE_C="linkage.c"' -DIMAP_TIMEOUT=2 --- 5,10 ---- # c-client credentials checking CHECKCREDS=checkcreds_cclient.o ! LIBS=/usr/lib/c-client.a -lssl -lpam -L/usr/kerberos/lib/ -lgssapi_krb5 -lcrypt ! I=/usr/include/imap CCLIENT_CFLAGS=-I$I '-DMAIL_H="mail.h"' '-DLINKAGE_C="linkage.c"' -DIMAP_TIMEOUT=2 |
From: <ton...@us...> - 2004-02-22 21:30:57
|
Update of /cvsroot/serverfilters/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28324 Modified Files: filtercmd.c filtercmd.h test.sh Log Message: filtercmd no longer takes file paths as arguments; instead it takes symbolic names for the types of files it manipulates (eg "filter" "forward") and looks up the correct path in a secure configuration file (config.php in the serversidefilter directory). The configuration directives that control the file are $FILTER_FILE_PATH and $FORWARD_FILE_PATH. Index: filtercmd.c =================================================================== RCS file: /cvsroot/serverfilters/script/filtercmd.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** filtercmd.c 25 Dec 2003 02:08:32 -0000 1.6 --- filtercmd.c 22 Feb 2004 21:18:01 -0000 1.7 *************** *** 1,6 **** ! /* ! * filtercmd -- installs/reads filter files (.procmailrc, etc) for squirrelmail * */ #define STR_MAX 1024 #define MAXLEN 1024 --- 1,97 ---- ! /* NAME: ! * ! * filtercmd -- installs/reads filter files (.procmailrc, etc) for squirrelmail ! * ! * SYNOPSYS: ! * ! * filtercmd getrc rctype > temprcfile < credentials ! * filtercmd putrc rctype < credentials < temprcfile ! * filtercmd rcexists rctype < credentials ! * ! * DESCRIPTION: ! * ! * The filtercmd program allows an unpriviledged program ! * (squirrelmail) to work with users' mail filtering configuration ! * files. The format of the mail filtering configuration files is not ! * parsed in any way. This program only handles reading and writing ! * the configuration files. These general steps are followed by filtercmd: ! * - read in IMAP credentials. ! * - verify credentials (log in to IMAP server). ! * - determine file location of rc file. ! * - act upon rc file as directed by command (first argument) ! * ! * The getrc command will copy the rc file to standard output. ! * ! * The putrc command will read an rc file from standard input, after ! * reading the credentials, and replace the existing rcfile. Note: the use ! * of two input-redirections is intended to indicate that the ! * ! * The rcexists command will return a zero exit status if the rc file exists, ! * non-zero otherwise. ! * ! * CREDENTIALS ! * ! * Credentials are passed to standard input. The username and ! * password should be terminated with newline (\n) characters. No other ! * characters should be passed. ! * ! * The credentials are used to log in to an IMAP server. The server host ! * name and port is read from the squirrelmail configuration file. ! * ! * Authentication is performed using the c-client software from UW. ! * See checkcreds_cclient.c for more details. ! * ! * RC FILE LOCATIONS ! * ! * RC file locations are calculated from settings in the serversidefilter ! * configuration file. The settings can contain the following markers which ! * are be replaced with values calculated from the username. ! * [USERNAME] ! * text in username before an @ character. ! * ! * [DOMAIN] ! * text in username after an @ character. ! * ! * [DOMUSER] ! * virtualdomains file, with lines in format domain:user, ! * is consulted. The value is the "user" matching the domain ! * as described above. ! * ! * If there is no @ character in the username, [USERNAME] will be the entire ! * text of the username, [DOMAIN] will be blank, [DOMUSER] will be blank and the ! * virtualdomains file will not be consulted. If the domain is not found in the ! * virtualdomains file then [DOMUSER] will be blank. ! * ! * More than one type of RC file can be handled by this script. The RC file ! * types are: ! * forward (.qmail file, or .forward file) ! * filter (.procmailrc, or .mailfilter) ! * ! * The settings in the configuration file that control the locations are: ! * $FORWARD_FILE_PATH (for "foward" rc type) ! * $FILTER_FILE_PATH (for "filter" rc type) ! * ! * RC FILE OWNERSHIP ! * ! * The RC files will be owned by the user named by [DOMUSER], or [USERNAME] if the ! * [DOMUSER] is blank. ! * ! * CONFIGURATION FILES ! * ! * filtercmd reads three different configuration files: ! * squirrelmail/config.php ! * serversidefilter/config.php ! * serversidefilter/virtualdomains * + * Each of the configuration files must be owned by root. + * + * DIAGNOSTICS + * + * filtercmd will exit with a non-zero status if an error occurs. + * filtercmd will write text to standard error in the case of + * some errors. See filtercmd.h for details. + * */ + #define STR_MAX 1024 #define MAXLEN 1024 *************** *** 9,12 **** --- 100,111 ---- #define DEBUG + /* define this in filtercmd.opts */ + #ifndef CONFIGFILE + #define CONFIGFILE "/etc/squirrelmail/config.php" + #endif + #ifndef SERVERSIDEFILTERHOME + #define SERVERSIDEFILTERHOME "/usr/share/squirrelmail/plugins/serversidefilter/" + #endif + #include <stdio.h> #include <string.h> *************** *** 22,31 **** int putrc(char*, uid_t, gid_t); int copy_file(char*, FILE*, char*, FILE*); - int validrcpath(char*); - int validtmppath(char*); - int checkpath(char*, char*); - int validpath(char*, char**); int checkcredentials(char*, char*, char*); int main(int argc, char *argv[]){ /* --- 121,132 ---- int putrc(char*, uid_t, gid_t); int copy_file(char*, FILE*, char*, FILE*); int checkcredentials(char*, char*, char*); + + /* global variables -- used in path calculation code */ + char user[STR_MAX]; + char real_user[STR_MAX]; + char *domain; + int main(int argc, char *argv[]){ /* *************** *** 37,42 **** int err, ok; char cmd[STR_MAX]; - char user[STR_MAX]; - char real_user[STR_MAX]; char passwd[STR_MAX]; char filter_file[STR_MAX]; --- 138,141 ---- *************** *** 45,49 **** uid_t UID; gid_t GID; ! err = readcredentials(user, passwd, STR_MAX); if (err) return inerror(err); --- 144,148 ---- uid_t UID; gid_t GID; ! err = readcredentials(user, passwd, STR_MAX); if (err) return inerror(err); *************** *** 74,78 **** return ERR_USAGE; } ! strncpy(filter_file, argv[2], STR_MAX); return getrc(filter_file); } else if (!strcmp("putrc", cmd)) { --- 173,181 ---- return ERR_USAGE; } ! ! if (!findfilterfile(argv[2], filter_file, STR_MAX)) { ! return inerror(ERR_BAD_RC_PATH); ! } ! return getrc(filter_file); } else if (!strcmp("putrc", cmd)) { *************** *** 81,85 **** return ERR_USAGE; } ! strncpy(filter_file, argv[2], STR_MAX); return putrc(filter_file, UID, GID); } else if (!strcmp("rcexists",cmd)) { --- 184,191 ---- return ERR_USAGE; } ! if (!findfilterfile(argv[2], filter_file, STR_MAX)) { ! return inerror(ERR_BAD_RC_PATH); ! } ! return putrc(filter_file, UID, GID); } else if (!strcmp("rcexists",cmd)) { *************** *** 88,92 **** return ERR_USAGE; } ! strncpy(filter_file, argv[2], STR_MAX); return rcexists(filter_file); } else if (argc > 1) { --- 194,201 ---- return ERR_USAGE; } ! if (!findfilterfile(argv[2], filter_file, STR_MAX)) { ! return inerror(ERR_BAD_RC_PATH); ! } ! return rcexists(filter_file); } else if (argc > 1) { *************** *** 162,169 **** } - #ifndef CONFIGFILE - #define CONFIGFILE "/etc/squirrelmail/config.php" - #endif - /* * Reads IMAP server information from CONFIGFILE. --- 271,274 ---- *************** *** 180,194 **** int serverlen; { FILE *f; char line[STR_MAX]; ! int err, foundserver = 0; ! err = trusted_open(&f, CONFIGFILE, "r"); if (err) return err; while (fgets(line, STR_MAX, f)) { ! if (!foundserver) ! foundserver = parsephpstring("$imapServerAddress", line, server, serverlen); } ! return foundserver ? ERR_OK : ERR_CANT_READ_IMAP_SERVER; } --- 285,321 ---- int serverlen; { + int foundserver; + foundserver = readconfigvar(CONFIGFILE, "$imapServerAddress", server, serverlen); + return foundserver ? ERR_OK : ERR_CANT_READ_IMAP_SERVER; + } + + /* + * Reads a setting from CONFIGFILE. + * + * Parameters: + * phpvar - IN. the name of the PHP variable in config.php to parse out. + * outbuf - OUT. the setting as read from config.php + * outbuflen - IN. buffer size of the outbuf buffer. + * Returns: + * 1 if it the parameter, 0 if not. + */ + + int readconfigvar(configfile, phpvar, outbuf, outbuflen) + char *phpvar; + char *outbuf; + int outbuflen; + { FILE *f; char line[STR_MAX]; ! int err, found = 0; ! err = trusted_open(&f, configfile, "r"); if (err) return err; while (fgets(line, STR_MAX, f)) { ! /*fprintf(stderr, "config: %s", line);*/ ! if (!found) ! found = parsephpstring(phpvar, line, outbuf, outbuflen); } ! return found; } *************** *** 246,259 **** { char *s; int n; ! s = strstr(line, varname); ! if (s == NULL) return 0; /* skip ahead to either ' or " */ ! s += strcspn(line, "\"'\0\n") + 1; n = strcspn(s, "\"'\0\n"); if (n > destlen) n = destlen; strncpy(dest, s, n); return 1; } --- 373,401 ---- { char *s; + char *commentpos; int n; ! s = strstr(line, varname); ! if (s == NULL) return 0; ! ! /* look for // comment marker */ ! commentpos = strstr(line, "//"); ! if (commentpos && commentpos < s) return 0; + #ifdef DEBUG + /*fprintf(stderr, "parsephpstring: varname=%s line=%s", varname, line);*/ + #endif + /* skip ahead to either ' or " */ ! s += strcspn(s, "\"'\0\n") + 1; n = strcspn(s, "\"'\0\n"); if (n > destlen) n = destlen; strncpy(dest, s, n); + dest[n] = '\0'; + + #ifdef DEBUG + /*fprintf(stderr, "parsephpstring -> %s\n", dest);*/ + #endif + return 1; } *************** *** 262,268 **** { FILE *filter; - if (!validrcpath(filter_file)) { - return inerror(ERR_BAD_RC_PATH); - } if(!(filter=fopen(filter_file,"r"))){ --- 404,407 ---- *************** *** 279,286 **** int result; - if (!validrcpath(filter_file)) { - return inerror(ERR_BAD_RC_PATH); - } - result = copy_file(filter_file, NULL, NULL, stdout); return result; --- 418,421 ---- *************** *** 291,298 **** int result; - if (!validrcpath(filter_file)) { - return inerror(ERR_BAD_RC_PATH); - } - result = copy_file(NULL, stdin, filter_file, NULL); if (result) { --- 426,429 ---- *************** *** 329,412 **** } ! /* Path checking code. To limit the files that this command will touch, ! * define RCHECK1,2,3 to be a path with a single '*', ! * e.g. "/home/ * /.procmailrc" (without the spaces) * ! * At least one check must pass for a given file to be touched. */ ! #ifndef RCCHECK1 ! #define RCCHECK1 "*" ! #endif ! #ifndef RCCHECK2 ! #define RCCHECK2 NULL ! #endif ! #ifndef RCCHECK3 ! #define RCCHECK3 NULL ! #endif ! static char *rcpathchecks[] = { ! RCCHECK1, ! RCCHECK2, ! RCCHECK3, ! NULL, ! }; ! #ifndef TMPCHECK1 ! #define TMPCHECK1 "*" ! #endif ! #ifndef TMPCHECK2 ! #define TMPCHECK2 NULL ! #endif ! #ifndef TMPCHECK3 ! #define TMPCHECK3 NULL ! #endif ! static char *tmppathchecks[] = { ! TMPCHECK1, ! TMPCHECK2, ! TMPCHECK3, ! NULL, ! }; ! int validrcpath(char* file) { ! return validpath(file, rcpathchecks); ! } ! int validtmppath(char* file) { ! return validpath(file, tmppathchecks); } ! int validpath(char *file, char **p) { ! for (; *p; p++) { ! if (checkpath(file, *p)) ! return 1; ! } ! return 0; ! } ! int checkpath(char* file, char* check) { ! char *starpos, *suffix; ! int filelen, starlen, minlen, suffixlen; ! ! starpos = strchr(check, '*'); ! if (starpos == NULL) ! starpos = strchr(check, '\0'); ! starlen = starpos - check; ! filelen = strlen(file); ! minlen = starlen < filelen ? starlen : filelen; ! suffix = starpos + 1; ! suffixlen = strlen(suffix); ! return filelen >= suffixlen \ ! && strncmp(file, check, minlen) == 0 \ ! && strcmp(file+(filelen-suffixlen), suffix) == 0; } - #ifndef SERVERSIDEFILTERHOME - #define SERVERSIDEFILTERHOME "/usr/share/squirrelmail/plugins/serversidefilter/" - #endif int readvirtualdomain(char *user, char *real_user, int buflen) { - char *domain; FILE *f; char line[STR_MAX]; --- 460,552 ---- } ! /* Path calculation code. * ! * ! * Parameters: ! * filter_type - IN. One of "filter", "forward". ! * filter_file - OUT. The resulting calculated path. ! * buflen - IN. Size of the filter_file buffer. ! * ! * Returns: ! * ERR_OK if the file was calculated, an error message if not. */ + int findfilterfile(char *filter_type, char *filter_file, int buflen) { + int err; ! err = findfilterpath(filter_type, filter_file, buflen); ! if (err) return err; ! fprintf(stderr, "filter_file: %s\n", filter_file); ! /* TODO: these need to be replaced with global variable references */ ! replace(filter_file, buflen, "[USERNAME]", real_user); ! replace(filter_file, buflen, "[DOMAIN]", domain ? domain : ""); ! replace(filter_file, buflen, "[DOMUSER]", user); ! ! /* DEBUG */ ! fprintf(stderr, "filter_file: %s\n", filter_file); ! } ! int findfilterpath(char* filter_type, char* filter_file, int buflen) { ! char* phpvar; ! if (0 == strcmp(filter_type, "filter")) { ! phpvar = "$FILTER_FILE_PATH"; ! } else if (0 == strcmp(filter_type, "forward")) { ! phpvar = "$FORWARD_FILE_PATH"; ! } else { ! return ERR_BAD_RC_FILE_TYPE; ! } ! fprintf(stderr, "phpvar: %s\n", phpvar); ! return readconfigvar(SERVERSIDEFILTERHOME "/config.php", phpvar, filter_file, buflen) ! ? ERR_OK : ERR_NO_RC_FILE_PATH; } ! /* Alter buf so that any instances of old are replaced by new ! * ! * Returns count of instances replaced. ! * ! * This is not a very good replace routine -- should not start from beginning ! * each time, and should not recalculate so many string lengths. ! */ ! int replace(char* buf, int buflen, char* old, char* new) { ! int oldlen = strlen(old); ! int newlen = strlen(new); ! int bufstrlen = strlen(buf); ! char* bufend = buf + bufstrlen; ! /* if negative, the string in buf gets shorter with each replacement */ ! /* if positive, the string in buf gets longer with each replacement */ ! int lendiff = newlen - oldlen; ! char *oldpos = strstr(buf, old); ! if (oldlen == 0) ! /* bad parameter - cannot search for empty substring */ ! return 0; ! ! if (oldpos == NULL) ! /* substring not found */ ! return 0; ! if ((bufstrlen + lendiff) > buflen) { ! /* buffer not big enough -- bail out */ ! #ifdef DEBUG ! fprintf(stderr, "replace: buffer not big enough -- bailing out\n"); ! #endif ! ! return 0; ! } ! ! if (lendiff > 0) { ! memmove(oldpos+lendiff, oldpos, bufend-oldpos+1); ! } ! strncpy(oldpos, new, newlen); ! if (lendiff < 0) { ! memmove(oldpos+newlen, oldpos+oldlen, bufend-(oldpos+oldlen)+1); ! } ! return 1 + replace(buf, buflen, old, new); } int readvirtualdomain(char *user, char *real_user, int buflen) { FILE *f; char line[STR_MAX]; *************** *** 428,432 **** err = trusted_open(&f, SERVERSIDEFILTERHOME "virtualdomains", "r"); if (err) return err; ! s = NULL; /* if s is set we know the domain was found */ while (fgets(line, STR_MAX, f)) { colon = strchr(line, ':'); --- 568,573 ---- err = trusted_open(&f, SERVERSIDEFILTERHOME "virtualdomains", "r"); if (err) return err; ! s = NULL; /* if s is set we know the domain was found */ ! while (fgets(line, STR_MAX, f)) { colon = strchr(line, ':'); Index: filtercmd.h =================================================================== RCS file: /cvsroot/serverfilters/script/filtercmd.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** filtercmd.h 25 Dec 2003 02:09:03 -0000 1.2 --- filtercmd.h 22 Feb 2004 21:18:01 -0000 1.3 *************** *** 18,21 **** --- 18,23 ---- #define ERR_CANT_FIND_VIRTUAL_DOMAIN 15 #define ERR_CANT_TRUST_FILE 16 + #define ERR_BAD_RC_FILE_TYPE 17 + #define ERR_NO_RC_FILE_PATH 18 static char *err_strings[] = { *************** *** 58,60 **** --- 60,66 ---- "Can't trust config file -- make sure they are all owned by root\n", + "Bad RC file type\n", + + "No RC file path found\n", + }; Index: test.sh =================================================================== RCS file: /cvsroot/serverfilters/script/test.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test.sh 25 Dec 2003 02:11:45 -0000 1.3 --- test.sh 22 Feb 2004 21:18:01 -0000 1.4 *************** *** 1,6 **** ! (echo tony; echo somepassword) | ./filtercmd getrc /home/tony/.procmailrc > filter; echo "RESULT:" $? echo '# hello world ' >> filter ! (echo tony; echo somepassword; cat filter) | ./filtercmd putrc /home/tony/.procmailrc; echo "RESULT:" $? ! (echo to...@so...; echo somepassword) | ./filtercmd getrc /home/tony/.procmailrc /tmp/test; echo "RESULT:" $? ! ! --- 1,4 ---- ! (echo tony; echo somepassword) | ./filtercmd getrc filter > filter; echo "RESULT:" $? echo '# hello world ' >> filter ! (echo tony; echo somepassword; cat filter) | ./filtercmd putrc filter; echo "RESULT:" $? ! (echo to...@so...; echo somepassword) | ./filtercmd getrc filter /tmp/test; echo "RESULT:" $? |
From: <jgs...@us...> - 2004-01-12 15:53:15
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1:/tmp/cvs-serv4665 Added Files: FAQ Log Message: Preliminary FAQ |
From: <jgs...@us...> - 2004-01-12 15:45:36
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1:/tmp/cvs-serv2568 Modified Files: backend.php Log Message: Changed the folder calculation stuff. Got rid of the $optional_delimiter that noone seems to have set. |
From: <ton...@us...> - 2003-12-25 02:17:56
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1:/tmp/cvs-serv30256 Modified Files: config.php Log Message: Include important command-line option on spambayes example setup. |
From: <ton...@us...> - 2003-12-25 02:14:33
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1:/tmp/cvs-serv29849 Modified Files: functions.php backend.php Log Message: filtercmd no longer uses temporary files. Index: backend.php =================================================================== RCS file: /cvsroot/serverfilters/backend.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** backend.php 13 Dec 2003 22:03:40 -0000 1.7 --- backend.php 25 Dec 2003 02:14:30 -0000 1.8 *************** *** 24,28 **** $localfile = "/tmp/$FILTERFILE.$username"; if (local_file_exists($file)) { ! $err_code = invoke_filtercmd("getrc $file $localfile"); if ($err_code != 0) exit("filtercmd returned $err_code"); } else --- 24,28 ---- $localfile = "/tmp/$FILTERFILE.$username"; if (local_file_exists($file)) { ! $err_code = invoke_filtercmd("getrc $file", "", $localfile); if ($err_code != 0) exit("filtercmd returned $err_code"); } else *************** *** 39,56 **** } ! function invoke_filtercmd($argstring) { global $username; $command = escapeshellcmd("../plugins/serversidefilter/script/filtercmd $argstring"); ! //DEBUG echo("command: $command"); $pipe = popen($command, "w"); ! if (!$pipe) exit("Could not run $command"); $password = get_password(); ! fwrite($pipe, "$username $password\n"); $result = pclose($pipe); // simulate WEXITSTATUS($result) -- this is not portable $result = $result / 256; ! //DEBUG ! if ($result) echo("$command -> $result<br>\n"); return $result; --- 39,67 ---- } ! function invoke_filtercmd($argstring, $inputfile, $outputfile) { global $username; $command = escapeshellcmd("../plugins/serversidefilter/script/filtercmd $argstring"); ! if ($outputfile) { ! $command .= " >$outputfile "; ! } ! $pipe = popen($command, "w"); ! if (!pipe) exit("Could not run $command"); $password = get_password(); ! fwrite($pipe, "$username\n$password\n"); ! if ($inputfile) { ! // copy the file to the pipe ! $handle = fopen($inputfile, "r"); ! while ($data = fread($handle, 8192)) { ! fwrite($pipe, $data); ! } ! fclose($handle); ! } $result = pclose($pipe); // simulate WEXITSTATUS($result) -- this is not portable $result = $result / 256; ! //DEBUG: uncomment to help debug problems ! //if ($result) echo("$command -> $result<br>\n"); return $result; *************** *** 68,72 **** function local_file_exists($file) { ! $exists = invoke_filtercmd("rcexists $file"); if ($exists == 0) return true; --- 79,83 ---- function local_file_exists($file) { ! $exists = invoke_filtercmd("rcexists $file", "", ""); if ($exists == 0) return true; *************** *** 93,97 **** $user = $username; ! $err_code = invoke_filtercmd("putrc $user $file $localfile"); } --- 104,108 ---- $user = $username; ! $err_code = invoke_filtercmd("putrc $user $file", $localfile, ""); } |