pax_global_header00006660000000000000000000000064143051032100014477gustar00rootroot0000000000000052 comment=d69b3f4ef45eea9a5352a55c060c373aafd5da8f mailfilter-0.8.9/000077500000000000000000000000001430510321000136455ustar00rootroot00000000000000mailfilter-0.8.9/.travis.yml000066400000000000000000000002301430510321000157510ustar00rootroot00000000000000language: C install: - ./autogen.sh before_install: - sudo apt-get install -qq doxygen - sudo apt-get install -qq ncompress script: make alldist mailfilter-0.8.9/AUTHORS000066400000000000000000000017231430510321000147200ustar00rootroot00000000000000Mailfilter AUTHORS -=-=-=-=-=-=-=-=-= Andreas Bauer (Main developer, German translation) Ron Day (Maintainer of Mailfilter package for Slackware Linux) Etienne Herlent (French translation, Maintainer of Mailfilter package for Mac OS X) Joerg Jaspert (Maintainer of Mailfilter package for Debian Linux) Ilgiz Kalmetev (Russian translation) Dimitris Kamenopoulos (Greek translation) Frederic L. W. Meunier <0@pervalidus.net> (Portuguese translation) Matteo Merli (Italian translation) Bob Paddock (Maintainer of Mailfilter package for MS-Windows) Mike Polniak (Maintainer of Mailfilter package for Gentoo Linux) Carlos Valdivia Yage (Spanish translation) mailfilter-0.8.9/ChangeLog000066400000000000000000000212201430510321000154140ustar00rootroot00000000000000Mailfilter ChangeLog -=-=-=-=-=-=-=-=-=-= Please note, this file is kept only for historic reasons. Check git history for current change log from now on. Sun Jun 5 11:29:18 CEST 2016 Holger Hoffstätte - delete unused regex - delete unused variables - fix virutal function signatures - handle fgets return value - properly delete err_buf Mon Feb 29 16:44:08 CET 2016 baueran - src/rcfile.ll: yyin is now a reference. So use different ifstream pointer and pass it on. - src/pop3.cc: FlexLexer::switch_stream no longer has 2nd argument optional, it seems. So pass NULL as second object. Sat May 17 19:21:57 CEST 2014 baueran src/preferences.cc: (Hopefully) fixed Debian Bug #716522: mailfilter crashes with invalid file name in rc file that cannot be expanded properly. Sun May 11 17:11:43 CEST 2014 baueran Fix build problems due to bison not supporting YYPARSE_PARAM anylonger, documented e.g. here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733380 Sat Mar 3 17:40:14 EST 2012 baueran Index: src/socket.cc Index: src/header.cc Ignore time stamps. Index: src/preferences.cc Index: src/preferences.hh Add preferences to ignore time stamps. Index: src/mailfilter.cc Index: src/mailfilter.hh Add Options. Index: configure.ac Change version number. Index: man/mailfilterrc.5 Index: man/mailfilter.1 Index: man/mailfilterex.5 Update man pages. Fri Mar 19 20:03:19 EST 2010 baueran - src/header.cc: fix type incompatibility / compilation problem Sun Jun 7 11:51:11 EST 2009 baueran - src/header.hh: new custom exception, add_entry throws it when pop header is malformed - src/rfc822.yy: pass on exception to main filtering code Sun Jan 18 19:11:38 EST 2009 baueran - src/apop.cc: fix strlen dependency by including cstring - *: update email address and copyright information Sat Sep 15 17:48:33 EST 2007 baueran - src/socket.cc: update licensing to reflect SSL use - README: update licensing to reflect SSL use - TODO: remove 2007-03-12 07:25:35 -0700 (Mon, 12 Mar 2007) baueran - src/Makefile.am: make getopt conditional on GETOPT - configure.ac: add GETOPT conditional to check getopt 2007-03-12 07:31:00 -0700 (Mon, 12 Mar 2007) baueran - man/mailfilter*: reflect recent date 2007-03-03 13:14:15 -0800 (Sat, 03 Mar 2007) baueran - src/mailfilter.cc: add return_val to capture failed attempt to check mailbox for spam - src/socket.cc: syntax change 2007-01-22 14:00:26 -0800 (Mon, 22 Jan 2007) baueran - src/i18n.hh: remove - src/apop.cc, src/preferences.cc, src/rcfile.yy, src/pop3.cc, src/rfc822.yy, src/feedback.cc, src/rcfile.ll, src/header.cc, src/socket.cc, src/account.cc, src/mailfilter.hh, src/weeder.cc, src/Makefile.am, src/mailfilter.cc: remove all references to gettext, replace occurrences of "\n" with endl in the mailfilter output messages Mon Jan 1 14:37:49 CET 2007 Andreas Bauer * configure.ac: remove all m4 and gettext references * Makefile.am: reflect changes Sun Dec 31 21:40:38 CET 2006 Andreas Bauer * configure.ac: update version number and copyright information * src/preferences.*: use singleton design pattern * src/rcfile.yy: reflect changes * src/mailfilter.cc: reflect changes * src/socket.cc: reflect changes * src/feedback.*: use singleton design pattern Fri Jul 8 11:29:20 CEST 2005 Andreas Bauer * src/protocol.hh: add virtual destructor * all file: change date in copyright statement Fri Jul 8 11:29:20 CEST 2005 Alexander Kaganyuk * src/Makefile.am: change $^ to $< Sun Dec 5 10:01:16 CET 2004 Andreas Bauer * src/rcfile.ll, configure.ac: check for presence of wordexp.h Sat Dec 4 22:11:28 MET 2004 Andreas Bauer * src/apop.cc: add include * src/Makefile.am: remove mv long options Sun Nov 21 10:40:39 CET 2004 Kai Hildebrandt Andreas Bauer * src/Makefile.am: fix 'mv-dependencies' in rfc822parser.cc target Sat Nov 20 16:51:58 CET 2004 Andreas Bauer * src/preferences.*: remove prefs namespace and make class static * src/*.cc,*.hh: remove all references to prefs namespace Sun Oct 10 15:11:44 CEST 2004 Andreas Bauer * src/*.cc,*.hh: change const functions to function type const Sat Aug 7 20:21:47 CEST 2004 Andreas Bauer * src/socket.cc: prepare IMAP support * src/apop.cc:login: check for timestamp server message Sat Jun 5 15:22:58 CEST 2004 Hilmar Preusse * NEWS: add information about rcfile changes Sun May 30 16:03:58 CEST 2004 Andreas Bauer * src/apop.cc:login: new * src/socket.cc: added preliminary SSL support using OpenSSL * configure.ac: check for OpenSSL * src/account.cc: fix up error messages * src/preferences.cc: add protocol variant pop3/ssl and apop/ssl Sat Apr 24 19:44:37 CEST 2004 Andreas Bauer * src/weeder.cc:check_maxlength: unignore default value Sat Feb 14 12:13:21 CET 2004 Andreas Bauer * src/weeder.cc:check_duplicates: add check for empty Message-ID Sun Jan 25 13:54:44 CET 2004 Andreas Bauer * src/feedback.cc: print_header: new * man/mailfilterrc.1: reflect changes of SHOW_HEADERS Sat Jan 24 18:20:21 CET 2004 Andreas Bauer * man/Makefile.am: pdf: new target Sun Dec 28 13:20:58 CET 2003 Andreas Bauer * src/mailfilter.cc: fix today_ to store date properly Sat 27 Dec 2003 00:57:26 -0000 Til Schubbe * contrib/selectheader: changed Fri 26 Dec 2003 17:40:29 -0000 Til Schubbe * TODO: changed * contrib/selectheader: new * contrib/FILES: reflect changes Thu Dec 25 15:39:40 CET 2003 Andreas Bauer * src/rcfile.ll: rearranged state precedences * src/preferences.cc: fixed up open() to use its argument Tue Nov 25 21:47:48 CET 2003 Chris Vine * src/rcfile.yy: MAXSIZE_SCORE: new * src/rcfile.ll: MAXSIZE_SCORE: new * src/preferences.cc: set_max_size_score: new * src/preferences.cc: max_size_score: new Mon Nov 24 22:29:25 CET 2003 Andreas Bauer * src/rcfile.yy: RCParser: new class declarations * src/preferences.cc: rcflexer: remove all references * src/rcfile.hh: new file 13 Nov 2003 23:21:40 -0000 Til Schubbe * contrib/chrcformat_05-07: new * contrib/rmcrlf: new * contrib/FILES: updated * contrib/Makefile.am: updated Sun Oct 12 16:43:46 CEST 2003 Andreas Bauer * src/weeder.cc:check_scores: Fixed a bug concerning case sensivity * src/rcfile.ll: Include can handle environment variables now Sat Oct 11 19:36:26 CEST 2003 Andreas Bauer * src/pop3.cc: added delete functionality * src/rcfile.*: extended scanner and parser definitions * src/weeder.cc: added support for normalised subject filtering Thu Oct 9 15:55:34 CEST 2003 Andreas Bauer * src/weeder.cc:check_allow_rules: new * src/weeder.cc:check_deny_rules: new * src/weeder.cc:check_scores: new * src/weeder.cc:check_duplicates: new Mi Okt 8 22:19:22 CEST 2003 Andreas Bauer * src/score.cc: new Tue Oct 7 22:37:34 CEST 2003 Andreas Bauer * src/weeder.cc: is_weed: added support for negative deny rules Sun Oct 5 20:17:18 CEST 2003 Andreas Bauer * src/weeder.cc: is_weed: added support for negative allow rules Sat Oct 4 13:42:14 CEST 2003 Andreas Bauer * src/weeder.hh: new * src/weeder.cc: new * src/Makefile.am: add weeder.* to make targets Mi Aug 13 18:45:02 CEST 2003 Andreas Bauer * src/rcfile.yy: renamed lexer to rclexer * src/rfc822.yy: renamed lexer to rfclexer Sat Jul 26 15:26:22 CEST 2003 Andreas Bauer * src/rfc822.ll: new * src/rfc822.yy: new * src/Makefile.am: rfc_test: new compiler target Wed Jul 23 22:05:28 CEST 2003 Andreas Bauer * src/pop3.cc: status (): new Mon Jul 21 10:16:23 CEST 2003 Andreas Bauer * ChangeLog.1: new * src/account.cc: include header * src/RFC822.cc src/RFC822.hh: remove mailfilter-0.8.9/ChangeLog.1000066400000000000000000000600131430510321000155560ustar00rootroot00000000000000Mailfilter ChangeLog -=-=-=-=-=-=-=-=-=-= Sun Jul 20 23:09:01 CEST 2003 Andreas Bauer * Checked in 0.7 today and opened a branch for it. It is a complete rewrite of *all* mailfilter sources. Wed Feb 5 17:44:22 CET 2003 Andreas Bauer * Added --return-value command line switch * Set default value for HIGHSCORE to 100 * Updated man pages: mailfilter.1 and mailfilterex.5 Sun Feb 2 19:36:49 CET 2003 Andreas Bauer * mailfilter returns 0 if there's no messages on the servers, a positive integer otherwise Thu Jan 30 17:10:46 CET 2003 Andreas Bauer * Hopefully fixed parser; ID token definition is back to how it used to be in 0.5.0 Wed Jan 22 16:33:52 CET 2003 Andreas Bauer * Fixed SCORE_CASE and SCORE_NOCASE Sun Jan 19 12:33:44 CET 2003 Andreas Bauer * Added scoring Wed Jan 1 20:20:51 CET 2003 Andreas Bauer * Changed dates in source and Makefiles from 2002 to 2003 Sat Oct 26 19:49:58 EST 2002 Andreas Bauer * Added --test to command line options. * Readded configure.ac flag for dynamic/static linking. Fri Oct 25 15:18:07 EST 2002 Andreas Bauer * autogen.sh: use AC_CONFIG_HEADERS. * configure.ac: use AC_CONFIG_HEADERS, AM_INIT_AUTOMAKE w/o args, fix brackets, remove PETI_ENABLED_DYNAMIC_LINKING, etc. * src/Makefile.am: change YFLAGS Die Okt 8 17:19:06 CEST 2002 Joerg Jaspert * Big changeset. :) * Updated to autoconf2.54, automake-1.6, gettext 0.11.5 * This renames configure.in to configure.ac, so old autoconf's cant run anymore. You need the new one! * Added every header checks that autoscan suggested to the existing ones. Same goes for check_funcs. * Added a small macro to configure.ac. Now you are able to build a static version of mailfilter with just a configure switch. * Removed: acconfig.h, the whole macros subdir. * autogen.sh now does the work, it doesnt call another autogen.sh * Added subdir m4 with ChangeLog, Makefile.am and acinclude.m4. Everything else gets added at autogen.sh runtime. * Added Makefile.am to contrib/ and list every file there in EXTRA_DIST so they get into the next Release Tarball. * Added MakeVars to po/ to make gettext happy. * Changed some of the po/*.po files. One was missing a correct Charset definition (which breaks things), others just some format errors (%c%s in english, --%s in translated). If you are a Translator please adjust your file to the newest mailfilter version. And please always change the Header with the correct mailfilter version. I have done that for the missing ones, inserted 0.3.3 there for now. * Updated src/getopt.c src/getopt1.c and src/getopt.h to the newest versions. * Changed some files in src/ to have PACKAGE_NAME and PACKAGE_VERSION instead of NAME and VERSION now, new automake stuff now provides these defines. * Modified src/Makefile.am to work even if you do VPATH buildings and to still not include the autogenerated source in the dist tarball. * Now longer run gettextize in autogen.sh, we now use autopoint for that work. Son Okt 6 00:03:04 CEST 2002 Joerg Jaspert * Added contrib/mfdelete.stat from Tim Moore. Fre Sep 27 15:01:16 CEST 2002 Joerg Jaspert * Added contrib/* Files from Kay Schulz. Son Sep 22 03:10:02 CEST 2002 Joerg Jaspert * Applied patch to doc/win_src_Makefile.am, to get the lex/bison stuff always regenerated at built-time Sun Sep 22 10:33:03 EST 2002 Andreas Bauer * Merged my src/Makefile.am with Joerg's changes to that file Sat Sep 14 13:19:37 EST 2002 Andreas Bauer * Changed src/Makefile.am, such that make alldist works again Sun Aug 25 16:07:27 EST 2002 Andreas Bauer * Windows users can now use _mailfilterrc Fri Jul 26 12:03:28 EST 2002 Andreas Bauer * Updated man pages and documentation Wed Jul 17 09:07:36 EST 2002 Andreas Bauer * Added Greek language translation * Added APOP support (md5c.c, md5.h) * Modified man pages to reflect changes Tue Jun 18 12:25:48 CEST 2002 Andreas Bauer * Fixed Makefile.am bug that caused recompilation upon make install Fri May 31 22:40:55 CEST 2002 Andreas Bauer * Removed GNOME stuff from autogen (and related) scripts * Updated documentation for Windows installations * Added MAKE switch to the win_configure.in file Fri May 24 15:06:50 CEST 2002 Andreas Bauer * Updated man pages Sun May 12 17:42:52 CEST 2002 Andreas Bauer * Updated Spanish translations * Readded and modified acconfig.h for users of autoconf 2.13 (and lower numbers). Hope it doesn't break anything... Sat May 11 18:02:50 CEST 2002 Andreas Bauer * Updated TODO, German translations Sun Apr 28 10:00:55 CEST 2002 Andreas Bauer * Updated INSTALL, TODO, THANKS and FAQ Sun Apr 21 14:23:39 CEST 2002 Andreas Bauer * Changed this (overdue) ugly while-condition in SocketConnection once again, to explicitly differ between single- and multi-line responses * The TOP command can now be defined individually in the config.h file Sat Apr 20 16:16:35 CEST 2002 Andreas Bauer * Substantial changes in the SocketConnection::receiveHost() function: changed while-condition, such that mailfilter works with this weird Tiscali POP3 Proxy v1.0 Fri Apr 19 09:28:39 CEST 2002 Andreas Bauer * (Hopefully) Fixed a bug that caused mailfilter to crash upon syntax errors in the rcfile, once the filters have been pre-compiled * Minor modifications in Makefile.am * Added Russian translations Wed Apr 17 20:40:01 CEST 2002 Andreas Bauer * Fixed a bug that would ignore -L and -v switches if LOGFILE or VERBOSE were specified in the rcfile Sun Mar 3 11:40:49 CET 2002 Andreas Bauer * If there's a syntax error in the rcfiles, mailfilter now reports the proper file name and according line number * If rcfile can not be found, then the right error string gets printed now (oops) Sun Feb 24 10:12:08 CET 2002 Andreas Bauer * If verbose = 6 and show_headers = yes headers are logged only once now Thu Feb 21 13:51:06 CET 2002 Andreas Bauer * Catching write errors in SocketConnection.cc now (hopefully) * Runtime errors return program satus -1 now, instead of 0. Oops! * man pages are updates with INCLUDE keyword Wed Feb 20 22:37:14 CET 2002 Andreas Bauer * Added nested rcfiles Tue Feb 19 12:02:29 CET 2002 Andreas Bauer * Improved rcfile parsing, updated version number to 0.3.2 * Added stuff to INSTALL and FAQ * Added doc/supported_servers Sun Feb 17 22:01:47 CET 2002 Andreas Bauer * Mailfilter is showing allow rules in the log files if verbosity level is greater or equal 5 Sat Feb 16 17:32:09 CET 2002 Andreas Bauer * Hopefully fixed the parameter handling in the rcfile, i. e. password and username may consist of only digits from now on Wed Jan 2 15:25:13 GMT 2002 Andreas Bauer * Fixed a type conversion problem in signal handling code * Updated copyright remarks * Minor updates in Makefile.am (no, they don't break the Windows version...) Mon Dec 3 18:58:55 GMT 2001 Andreas Bauer * Fixed Windows bison configuration Sun Dec 2 12:34:30 GMT 2001 Andreas Bauer * Changed Makefile dependencies in src/ * Fixed up spec.in file Tue Nov 27 18:48:03 CET 2001 Andreas Bauer * Updated FAQ today, i. e. added Brian Hall's tunnel script to it * Added Carlos Valdivia Yage Spanish translation * Added some Italian translation additions by Matteo Merli Wed Nov 21 16:08:01 GMT 2001 Andreas Bauer * Rcfile parser "understands" tabs now, too Mon Nov 19 20:10:58 GMT 2001 Andreas Bauer * Added proper rcfile scanner + parser (rcfile.yy, rcfile.ll) * Adjusted doc/win_* for Cygwin/Windows to use the new functionality Wed Nov 14 17:03:03 GMT 2001 Andreas Bauer * Fixed a bug that caused Mailfilter to swallow a newline, in case of empty subject strings (bad) Sat Nov 10 10:08:58 GMT 2001 Andreas Bauer * Extended po/README.Developer so people can keep the translations up to date * Read() call in SocketConnection.cc only adds a null terminator on each line if necessary, not after _every_ line * Added more debug code to RFC822.cc to see what's happening with RE compilation Thu Nov 8 12:03:05 GMT 2001 Andreas Bauer * Added SIGALRM signal handling to SocketConnection.cc * Added SIGINT signal handling to mailfilter.cc Wed Nov 7 13:45:10 GMT 2001 Andreas Bauer * Removed additional null-terminator in RFC822.cc normalise() Sun Nov 4 15:59:25 GMT 2001 Andreas Bauer * Changed a couple of function signatures to return and take const values Sat Nov 3 23:05:58 GMT 2001 Andreas Bauer * Changed parsing of e-mail headers in RFC822.cc and rewrote Header.* pretty much totally Fri Nov 2 17:57:35 GMT 2001 Andreas Bauer * Fixed an error that caused wrong program output in the mailfilter logs Wed Oct 31 13:07:08 GMT 2001 Andreas Bauer * Some documentation updates * Minor code clean-ups * Fixed broken error handling, now you get a nifty message again if a time out occurs, or the network connection is dead, etc. Tue Oct 30 17:35:19 GMT 2001 Andreas Bauer * Made the bastard compile with Cygwin and added documentation for it to the doc/ directory Sun Oct 28 16:08:21 GMT 2001 Andreas Bauer * rcfile is not sought in /home/ anymore, by default; that will force the user to set $HOME correctly * Added Connection.* Checker.* SocketConnection.* WinSockConnection.* RegExp.* to src/ in order to seperate networking code from the rest of the program logics * Rewrote almost all string handling routines * Default value for MAXLENGTH is 0 now/again Wed Oct 10 18:38:37 GMT 2001 Andreas Bauer * Added option to define a time span in seconds that Mailfilter waits for a server response, after a command was issued Fri Sep 28 17:16:56 CEST 2001 Andreas Bauer * If maximum line length is exceeded, then Mailfilter prompts which header field caused the deletion * Rearranged some program output (nothing big) Wed Sep 26 22:27:04 CEST 2001 Andreas Bauer * Added Russian translation of the rcfile2.example (courtesy Alex A. Puchow) * Updated mailfilterrc man page to reflect changes * Added option to define maximum line lengths of header fields * Changed header parsing slightly, such that program output does not contain unwanted control characters anymore Wed Aug 15 15:10:17 CEST 2001 Andreas Bauer * Added negative filter descriptions to man/mailfilterrc.5 * Fixed up FAQ (with add-ons of Til Schubbe) Tue Aug 14 15:28:50 CEST 2001 Andreas Bauer * Fixed a bug in normalisation that threw Mailfilter in an endless loop if subjects ended with more than the two usual white-space characters * Added some boring debug code to Account.cc Sat Aug 11 21:12:56 CEST 2001 Andreas Bauer * Field-names in e-mail headers may now start with lower case letters, ie parsing should now be fully RFC822 compliant * Normalisation handles multiple white-space characters ok now Mon Jul 30 14:48:51 CEST 2001 Andreas Bauer * Headers are parsed now up to length() - 3 bytes, cause of the closing . which we are not interested in Sat Jul 28 18:03:12 CEST 2001 Andreas Bauer * config.h is only loaded if HAVE_CONFIG_H is specified * Changed mailfilter.spec.in (added translations) * Display message size when size limit is exceeded * Added rm -fr *~ to Makefile.am Wed Jul 18 11:28:34 CEST 2001 Andreas Bauer * Print line number of rcfile in case of an error Tue Jul 10 14:29:06 CEST 2001 Andreas Bauer * Changed source code, so Mailfilter compiles with the new GCC 3.0 * Updated doc/Makefile.am Mon Jul 9 14:04:39 CEST 2001 Andreas Bauer * Added sample rcfiles * Added (and modified) Portuguese translations (courtesy Frederic Meunier) * Updated man pages and FAQ to reflect change in verbosity levels Tue Jun 19 11:46:33 CEST 2001 Andreas Bauer * Bug fix: Normalisation works again properly Sun Jun 10 19:19:23 CEST 2001 Andreas Bauer * Fixed a bug that caused normalisation to break on capital-only message tags * Changed verbose levels so that usernames are appended to the current account names (Thanks to Etienne Herlent for the original patch) * Cleaned up documentation a bit (man page, faq) Thu May 31 20:26:52 CEST 2001 Andreas Bauer * Updated spec file * Switched version number to 0.2.0 * Updated documentation (man pages, FAQ, etc.) Wed May 23 20:53:43 CEST 2001 Andreas Bauer * Added keyword DEL_DUPLICATES * Created the seperate Header class to store the message header and provide additional functionality, e.g. to delete duplicate messages later on Wed May 16 20:02:38 CEST 2001 Andreas Bauer * Passwords don't show up in log files anymore Tue May 8 11:35:53 CEST 2001 Andreas Bauer * Added Italian translations (see AUTHORS file) Sun May 6 09:37:57 CEST 2001 Andreas Bauer * Code and directory strucutre clean-ups Sun Apr 29 11:05:34 CEST 2001 Andreas Bauer * Mailfilter now stores multiple lines if the "To:" or "Cc:", etc. fields are seperated by new-lines by diverting them into new-lines * Minor documentation updates (version numbers, typos and wrong references) Wed Apr 25 17:23:10 CEST 2001 Andreas Bauer * Created ABOUT-NLS in the top level directory of Mailfilter, added the gettext issues to the TODO list * Removed BUGS file Mon Apr 23 20:37:09 CEST 2001 Andreas Bauer * Replaced the algorithm for negative filters * Renamed checkForSpam() into checkFilter() and added checkNegFilter() Tue Feb 27 22:43:28 GMT+1 2001 Andreas Bauer * Added French translations, thanks to Etienne (see AUTHORS file) * Added more files to po/POTFILES.in so all texts get translated properly Mon Feb 26 10:54:00 GMT+1 2001 Andreas Bauer * Added basic support for GNU gettext to achieve internationalisation of Mailfilter, yet the translation has to be done though. What's there right now is only the configuration and set-up * Added section on negative message filters to mailfilterex(5) man page Sun Feb 25 16:14:32 GMT+1 2001 Andreas Bauer * Fixed up negative filters so they can be applied to any kind of email message tag Sat Feb 24 15:43:00 GMT+1 2001 Andreas Bauer * <> - filters are now case-sensitive as all the other filters Fri Feb 23 13:32:03 GMT+1 2001 Andreas Bauer * Added keyword DENY<> for negative filters * Fixed up program configuration (spec files, etc.) Tue Jan 30 17:53:04 GMT+1 2001 Andreas Bauer * Fixed up spelling mistakes (shame on me) and minor grammatical glitches Fri Jan 26 10:50:17 GMT+1 2001 Andreas Bauer * Fixed up mailfilter.cc: replaced exit() with return and changed help and version info * Fixed up documentation and man pages Thu Jan 25 17:08:58 GMT+1 2001 Andreas Bauer * Added mailfilterex(5) and mailfilterrc(5) man pages * Improved creation of error reports when malformed or deprecated keywords are found * Fixed a bug with the old error handling that didn't show the rcfile name correctly * Fixed up specs file for RPMs, INSTALL was added to it Wed Jan 24 22:43:05 GMT+1 2001 Andreas Bauer * Added proper man page mailfilter(1) and kicked out help2man instead * All man pages go in man/ from now on Sun Jan 21 14:39:10 GMT+1 2001 Andreas Bauer * Normalised subjects are checked after the 'pure' subject string has passed all filters * Added keyword REG_NEWLINE and replaced ICASE with REG_ICASE * Added keywords for RE testing: TEST and SHOW_HEADERS Thu Jan 18 18:49:40 GMT+1 2001 Andreas Bauer * Added support for extended Regular Expressions (keyword REG_TYPE) * Added normalisation of Subject lines (keyword NORMAL) Sun Jan 14 17:40:25 GMT+1 2001 Andreas Bauer * Added regfree() in Preferences.cc to clean up memory taken from all the RE stuff * Changed pre-compilation of REs from storing results in a temporary buffer to writing it directly into the according data structures Fri Jan 12 20:35:55 GMT+1 2001 Andreas Bauer * Added error message when the mail server connection could be established but the server does not respond to any commands of the client Sun Jan 7 14:47:11 GMT+1 2001 Andreas Bauer * Improved logging capabilities. Log file only gets opened once, instead of closing and opening it all the time. Also fixed up some error messages. * Other bug fixes, mainly to handle situations in which the DELE command failed. Fri Jan 5 20:57:58 GMT+1 2001 Andreas Bauer * Rewrote large parts of PopAccount.cc to improve error handling. Added receiveStatus() to have a very fast function for receiving server status messages. The good thing is it doesn't need to throw exceptions either. * Fixed obvious linkage problem with standard C header files Wed Jan 3 19:09:47 GMT+1 2001 Andreas Bauer * All Regular Expressions are now only compiled once to speed things up drastically * All messages get checked immediately instead of storing them first. This is to avoid running out of heap memory when huge ammounts of mail arrive * Added verbosity level 6 and made filters show up when messages get deleted Sat Dec 30 14:25:44 GMT+1 2000 Andreas Bauer * Added different levels of verbosity (0 - 5) Thu Dec 28 14:33:25 GMT+1 2000 Andreas Bauer * Added MAXSIZE_ALLOW and MAXSIZE_DENY keywords. Fixed bugs for the frehsly implemented ALLOW keyword. Wed Dec 27 22:57:34 GMT+1 2000 Andreas Bauer * Added keyword ALLOW to define messages that should always pass the filter Tue Dec 26 18:01:05 GMT+1 2000 Andreas Bauer * Added command RSET to the delete() function in PopAccount.cc to avoid unnecessary confusion in the mailbox when errors occur during delete Sun Dec 24 13:19:40 GMT+1 2000 Andreas Bauer * Removed a potential buffer overflow problem in PopAccount.cc. cmd[32] was either removed where possible or increased to cmd[64] where necessary. (Thanks to Etienne Herlent for pointing it out.) Sat Dec 23 10:27:48 GMT+1 2000 Andreas Bauer * Added keywords DENY_CASE and DENY_NOCASE to make filters more specific and to allow better filtering when having ICASE set to 'no' Tue Dec 19 20:02:06 GMT-5 2000 Matthew R. MacIntyre * src/Preferences.cc: added check for malformed keywords: causes an error message to be displayed to stderr and the program to be exited in error. Tue Dec 19 16:25:06 GMT+1 2000 Andreas Bauer * It seems Mailfilter was always reading at least one byte more from any input streams than allowed. These few extra bytes are now being caught and stored and hopefully new versions of glibc like Mailfilter a lot more now. * Mailfilter now allows ',' in the passwords and complains if the password that was sent to the server was incorrect. Wed Dec 13 15:31:17 GMT+1 2000 Andreas Bauer * Found and removed a silly bug that made Mailfilter delete messages several times if the e-mails apply to the filters several times. Thanks Bob for finding this behaviour in the program! Sun Dec 10 13:15:56 GMT+1 2000 Andreas Bauer * Made Mailfilter compatible with mail servers that use more than a single byte stream to send out their response - in particular IMail used on a Windows NT box. * Clean up of some objects in PopAccount.cc right after use instead of calling one big clean-up procedure. Does it fix memory problems? Fri Dec 8 11:51:21 GMT-5 2000 Matthew R. MacIntyre * src\Preferences.cc, src\Preferences.hh, src\PopAccount.cc: Applied patch created by Ivan Vitjuk to allow case-insensitive regular expression matching in the .mailfilterrc file. Tue Dec 5 13:20:56 GMT+1 2000 Andreas Bauer * Mailfilter now properly recognizes the end of an e-mail header with isHeaderEnd() - the closing CRLF was not read before * Again, rewrote major parts of the I/O routines after discovering another serious memory leak in them * Applied a patch to Mailfilter which fixes a problem reading the program's preferences. Thanks Ivan! * Fixed a bug that Mailfilter would delete messages that exceeded the MAXSIZE limit, but wouldn't report it in the log nor on the screen Fri Nov 24 13:32:16 GMT+1 2000 Andreas Bauer * Fixed a _major_ problem with I/O. Mailfilter doesn't break anymore under heavy network traffic mainly due to a complete rewrite of the part dealing with nonblocking access * I/O is much faster now * Parsing of messages fixed. The last line of the e-mail header used to lose its last few characters * Changed Mailfilter output slightly * Fixed problem with MAXSIZE. Messages got deleted when MAXSIZE was not set * Fixed lnsl issue. Mailfilter now compiles and runs under Solaris and Irix again and according to Matt also on FreeBSD * Changed from LICENSE to COPYING - more GNU compliant * Changed INSTALL and FAQ Tue Nov 21 21:10:23 GMT+1 2000 Matthew R. MacIntyre * Fixed issue with getopt. It is now always compiled in, no matter whether it's preinstalled or not; works for FreeBSD * Included lsocket and lnsl in configure.in; somehow lnsl is still broken though Tue Nov 21 14:00:38 GMT+1 2000 Andreas Bauer * Created PopAccount.cc, PopAccount.hh. Restructured source code to a more object oriented layout. PopAccount is now derived from a virtual class Account that takes care of storing headers as this should be the same for all kind of accounts, protocols, etc. * Fixed a small problem with the --mailfilterrc switch (thanks to Tobias Ebner for reporting this problem) Sun Nov 19 15:31:23 GMT+1 2000 Matthew R. MacIntyre * Improved help and version info * Improved error handling * Introduced automake to Mailfilter (does not work for Solaris yet) mailfilter-0.8.9/INSTALL000066400000000000000000000200421430510321000146740ustar00rootroot00000000000000Mailfilter INSTALL -=-=-=-=-=-=-=-=-= 0. REQUIREMENTS To run Mailfilter it's best to have a Unix-like operating system, but it also compiles fine with Windows 9x/NT/2000 if additional libraries and tools are installed (e.g., Cygwin, or DJGPP). 0.1 ADD-ON LIBRARIES & TOOLS To compile/install Mailfilter you also need to have a fairly recent version of a C and C++ compiler (e.g., GCC >= 3.0) and your system must support BSD-type sockets (in general, all Unix systems do meet this criterion). For compilation you will also need the programs flex and bison. NOTE: Please keep in mind that the GNU versions of flex and bison are `somewhat' peculiar. It is *highly* recommended to use your distribution's very own releases of these tools, rather than compiling from source (e.g. get them from the BSD-ports collection, or via apt). However, if you must get the source for flex (e.g. because your distribution ships a broken GNU flex), then use http://lex.sf.net/, but *never* GNU flex! It is broken! 0.2 SSL SUPPORT Should SSL support be desired, the OpenSSL library (or, an equivalent substitute) must be present. Potential SSL support should then be automatically detected by the configure script. 1. CONFIGURE If you have downloaded and installed a binary distribution of Mailfilter, then there is no need to read the following instructions. Continue with section 3 and 4 instead. If you have downloaded a compressed source code archive, then please proceed the following steps. Change to the Mailfilter distribution directory (where the INSTALL file can be found, e.g. /home/tux/mailfilter-x.y.z) and run ./configure For a list of available options for configuration, call configure with the --help parameter. Running configure creates a Makefile in your source code directory. If you like, have a look at it before you continue, though this should not be necessary, unless you want to have debugging information included or things like that. 2. INSTALL After configure has successfully guessed your system's specific values, you can compile the Mailfilter source code with make NOTE: On Linux systems make typically refers to GNU gmake. However, some operating systems (e.g., FreeBSD) ship with different versions of make and you will need to explicitly use the command 'gmake' (and later 'gmake install') in order to get Mailfilter compiled correctly. If you have not changed any of the predefined values for configure then Mailfilter will be installed in /usr/local/bin. Become 'root' now and run make install That's it - you're done with the installation, but please read on to find out what you have to do in order to make Mailfilter work. (IMPORTANT!!) 3. SET-UP MAILFILTER Before you can execute the Mailfilter application you must create a rcfile called .mailfilterrc in your home directory, e.g. /home/tux/.mailfilterrc. In this file you must specify the accounts you want Mailfilter to check for spam. Here is a very basic set of example rules you could use. I suggest you simply copy and paste it. For further information and a list of all supported key- words, please also read the mailfilterrc(5) and mailfilterex(5) man pages. More rcfiles are available in the doc/ directory of the Mailfilter distribution. # ----------------------------------------------------------- # Logile path (be sure you have write permission in this # directory; you MUST specify a logfile) LOGFILE = "$HOME/logs/mailfilter.log" # ----------------------------------------------------------- # Level of verbosity # # 0 Silent, show nothing at all # 1 Only show errors # 2 Only show "Deleted..." messages and errors # 3 Default; Show "Deleted..." messages, errors # and "Examining..." messages # 4 Like (3), except this also shows the current # account's username # 5 Like (4), except this also shows which filter # matched which string of an e-mail header # 6 Debugging mode; prints almost everything VERBOSE = 3 # ----------------------------------------------------------- # Server list (Do not change the order of the fields!!) # Note: Port 110 is usually the port APOP and POP3 servers use, # port 995 is required if (say) POP3/SSL is specified. SERVER = "pop.server.com" USER = "username" PASS = "password" PROTOCOL = "pop3" PORT = 110 SERVER = "pop.secondserver.com" USER = "anotherusername" PASS = "anotherusername" PROTOCOL = "pop3/ssl" PORT = 995 # ----------------------------------------------------------- # Do you want case sensitive e-mail filters? { yes | no } REG_CASE = "no" # ----------------------------------------------------------- # Sets the type of Regular Expression used { extended | basic } # # (The default is 'basic', don't change unless you know what you # are doing. Extended REs are more complex to set up.) REG_TYPE = "extended" # ----------------------------------------------------------- # Maximum e-mail size in bytes that should not be exceeded. MAXSIZE_DENY = 1000000 # ----------------------------------------------------------- # Set maximum line length of any field in the message header MAXLENGTH = 998 # ---------------------------------------------------------- # Filter rules for detecting spam (each rule must be placed # in a separate line) # These filters detect certain unpleasant e-mail subjects: DENY = "^Subject:.*Get penis enlargement" DENY = "^Subject:.*WIN MONEY" # This one filters mail from a certain person: DENY = "^From:.*spammer@any_spam_organisation\.com" # This one filters mail from everyone at a certain organisation: DENY = "^From:.*@any_provider_that_spams\.org" # We don't want any of those 'LEGAL' messages either # while stuff with 'legal' in the subject still interests us: DENY_CASE = "^Subject:.*LEGAL" # ----------------------------------------------------------- # Normalises the subject strings before parsing, e.g. # ',L.E-G,A.L; ,C.A-B`L`E, +.B-O`X` ;D`E`S,C;R,A.MB;L,E.R-]' # becomes 'LEGAL CABLE BOX DESCRAMBLER' which can be filtered. # # If NORMAL is switched on, Mailfilter tries to apply filters # to both the normalised and the original subject. NORMAL = "yes" # ----------------------------------------------------------- # The maximum e-mail size in bytes that messages from friends # should not exceed. Set this to 0 if all your friends (ALLOW) # can send messages as long as they want. MAXSIZE_ALLOW = 0 # ---------------------------------------------------------- # Set list of friends that always pass, if they do not # exceed the message length of MAXSIZE_ALLOW # This rule allows all mail from a friend who was unlucky enough # to have signed up with a spam organisation. With DENY we # block everyone else from that domain though! See above! ALLOW = "^From:.*a_friend_with_account@any_provider_that_spams.org" # Of course we allow e-mail from anyone who has something to say about # mailfilter: ALLOW = "^Subject:.*mailfilter" # We also let our girlfriend send any e-mail she wants: ALLOW = "^From:.*my_girlfriend@any_provider\.com" It is _very_ important to not change the order of the SERVER, USER, PASS, PROTOCOL and PORT fields. Generally the rcfile is not case-sensitive, which means it does not matter whether the keywords are spelled in capitals or not. You can place white space characters before and in between a command and its parameters, but usually not after the parameter! To find out how to set up more complex rules and options, please refer to the man pages and the FAQ provided with the Mailfilter program, or simply look up the webpage. If you do not set up a .mailfilterrc file, the program refuses to start. It is also recommended to change the permissions of this file to read-only, as it contains all your passwords en clear. 4. RUN MAILFILTER Now try it out! Mailfilter can be started with mailfilter on the command line. Be sure you have set up an individual rcfile (e.g. $HOME/.mailfilterrc) in your home directory. If you don't know how to do this, please read section 3 of this document again, or consult the Mailfilter FAQ in the doc/ directory for further information. mailfilter-0.8.9/LICENSE000066400000000000000000000432541430510321000146620ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. mailfilter-0.8.9/Makefile.am000066400000000000000000000054711430510321000157100ustar00rootroot00000000000000# Makefile.am: help build sources on mulitiple architectures # $Id: Makefile.am,v 1.20.2.3.2.8 2007/01/01 13:38:40 baueran Exp $ # Copyright (c) 2000 - 2020 Andreas Bauer # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # AUTOMAKE_OPTIONS = dist-shar dist-zip dist-tarZ AUTOMAKE_OPTIONS = dist-zip SUBDIRS = doc man src contrib EXTRA_DIST = ylwrap # EXTRA_DIST = config.rpath mkinstalldirs ABOUT-NLS ylwrap CLEANFILES = mailfilter*.gz mailfilter-*.zip mailfilter-*Z ACLOCAL_AMFLAGS = -I # build a distribution snapshot # TODO: # add a snap documentation target # check to see if there is already a previous snapshot there, # and don't overwrite it! @MAINT@snapshot: README-snapshot maintainer-clean @MAINT@ @a=`date -R` ;\ @MAINT@ echo "Last built on $$a" >> README-snapshot @MAINT@ @d=`pwd` ;\ @MAINT@ d=`basename $$d` ;\ @MAINT@ echo $$d ;\ @MAINT@ cd .. ;\ @MAINT@ tar -cvzf $$d-`date +%m%d%y`.tar.gz $$d ;\ @MAINT@ mv $$d-`date +%m%d%y`.tar.gz $$d/ ;\ @MAINT@ cd $$d @MAINT@doxygen: @MAINT@ cd $(top_srcdir)/doc ;\ @MAINT@ ${MAKE} doxygen @MAINT@alldist: man doxygen @MAINT@ ${MAKE} distcheck @MAINT@ ${MAKE} dist-shar @MAINT@ ${MAKE} dist-zip @MAINT@ ${MAKE} dist-tarZ @MAINT@cvsclean: maintainer-clean @MAINT@ @-rm -f `find . -name Makefile.in` @MAINT@ @-rm -f configure aclocal.m4 config.h.in stamp-h.in depcomp ylwrap @MAINT@ @-rm -f config.guess config.sub config.cache config.log config.status @MAINT@ @-rm -f mkinstalldirs missing install-sh COPYING @MAINT@ @-rm -fr @PACKAGE@-@VERSION@* *~ */*~ @MAINT@ @-rm -fr $(top_srcdir)/doc/api @MAINT@ @-rm -fr $(top_srcdir)/intl @MAINT@ @-rm -fr $(top_srcdir)/src/y.* @MAINT@ @-rm -fr $(top_srcdir)/src/rcfile.c* @MAINT@ @-rm -fr $(top_srcdir)/src/lex.* @MAINT@ @-rm -fr $(top_srcdir)/src/rfc822.cc @MAINT@ @-rm -fr $(top_srcdir)/src/rfc822scanner.* @MAINT@ @-rm -fr $(top_srcdir)/src/rfc822parser.* @MAINT@ @-rm -fr $(top_srcdir)/src/rcparser.* @MAINT@ @-rm -fr $(top_srcdir)/src/yy.tab.* @MAINT@ @-rm -fr $(top_srcdir)/src/lex.* @MAINT@ @echo "=================================================" @MAINT@ @echo "Don't forget your ChangeLog and NEWS entries ...." @MAINT@ @echo "=================================================" mailfilter-0.8.9/NEWS000066400000000000000000000365231430510321000143550ustar00rootroot00000000000000Mailfilter NEWS (Summary) -=-=-=-=-=-=-=-=-=-=-=-=- mailfilter 0.8.9 (So 4. Sep 13:04:45 CEST 2022) - Fix gentoo build issue: https://bugs.gentoo.org/859514 - Add support for TLS-SNI (which, for example, is required to use SSL encryption with gmail.com) mailfilter 0.8.8 (Sa 13. Aug 13:35:50 CEST 2022) - Fix github issue #1: ability to verify SSL certificates https://github.com/nondeterministic/mailfilter/issues/1 - New command line switch (-s) to skip SSL certification verification (e.g., for local mail server with self-signed certificate), which is disabled by default - Add timestamps to output (thanks @hhoffstaette) - Update configure.ac to reflect changes in the dev tools mailfilter 0.8.7 (Sun 09 Aug 2020 09:56:55 AM CEST) - Fix for build error w/ bison 3.7: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=966908 mailfilter 0.8.6 (Tue Oct 25 20:18:55 CEST 2016) - Rebuilt the tarball, using more up to date versions of flex and bison. It seems that older versions generated incompatible code (thanks to Elimar Riesebieter for helping me isolate this problem!) - Some minor spelling mistakes fixed in mailfilter output (thanks to Elimar Riesebieter!) mailfilter 0.8.5 (Tue Jul 26 18:22:15 CEST 2016) - Fix some compilation issues (thanks for Holger Hoffstaette and Felix Janda for the patches!). mailfilter 0.8.4 (Fri Mar 25 18:44:55 CET 2016) - Fix compilation issues stemming from flex >= 2.6.0, which no longer uses pointers for yyin, but references it seems. - Minor other code fixes that relate to the above. mailfilter 0.8.3 (Sat May 17 19:37:27 CEST 2014) - (Hopefully) fixed Debian Bug #716522: mailfilter crashes with invalid file name in rc file that cannot be expanded properly. - Fix build problems due to bison not supporting YYPARSE_PARAM any longer. - Minor fixes to allow compilation with recent GCC versions. - Due to popular demand: Added option -i to ignore invalid Message-ID time stamps. (Using this option is a potential security risk, so do not use unless you know better!) mailfilter 0.8.2 (Sat Aug 15 16:12:22 EST 2009) - Provide fix for APOP vulnerability (e.g., described in ticket #2846 on mutt mailing list) - Fix build problems such that mailfilter compiles with recent gcc and autotools (mainly for developers) mailfilter 0.8.1 (Sat Sep 15 17:14:49 EST 2007) [stable version] - Detection of getopt should now work when compiling the program from source (Thanks to Mike Clarke for helping me debug this) - Fixed logging error; no log files were created occasionally - Mailfilter now returns -1 if one or more accounts failed to be checked; 0 is only returned if the *entire* mailfilter session was successful (Thanks to Mike Clarke for pointing this out) mailfilter 0.8 (Mon Jan 1 16:09:52 CET 2007) [stable version] - Code overhaul to introduce a more object oriented design - Temporarily disabled gettext and the outdated translations - (Hopefully) fixed bugs #238273 and #238273 in Debian bug database mailfilter 0.7.2 (Sun Oct 1 10:17:41 CEST 2006) [development version] - Fixed a number of small build and dependency problems - Makefile clean-up: should now compile with old GNU flex 2.5.4 again (?) - New user contributed scripts in contrib/ mailfilter 0.7.1 (Sat Nov 27 14:24:08 CET 2004) [development version] - RUDIMENTARY IMAP support (not usable yet) - Preliminary support for SSL has been added (if OpenSSL is installed, it can be enabled by specifying protocol "pop3/ssl", or "apop/ssl" and by using port 995 in case of POP, instead of 110) - APOP support has been ported over to the 0.7.x development branch - MAXLENGTH keyword default is no longer ignored, or misinterpreted mailfilter 0.7 (Sat Feb 14 17:59:26 CET 2004) [development version] - Revised and faster networking code - New rcfile parsing and setup capabilities Note, the rcfile format has changed! Parameter strings have to be in quotes now, e.g. SERVER = "my.server" This also hits all your created rules. It is not necessary if your parameter is a number e.g. the port number. - New keyword MAXSCORE_SCORE (see man pages) - Keyword SHOW_HEADERS expects a path name now, indicating where to store the headers - Verbosity levels have been adjusted slightly mailfilter 0.6.2 (Sun Aug 8 14:17:18 CEST 2004) [stable version] - Fixed a crash which would occur if the Date field contains no ":" separator mailfilter 0.6.1 (Sat Feb 14 17:59:26 CET 2004) [stable version] - New keyword MAXSIZE_SCORE (see man pages) - New scripts in contrib/ - Mails which do not contain a valid Message-ID are no longer treated as being duplicates - Additional Polish rcfile example configurations in the doc/ directory mailfilter 0.6 (Sun Oct 26 17:20:59 CET 2003) [stable version] - Polish translation added mailfilter 0.5.2 (Sat Oct 11 12:00:05 CEST 2003) [development version] - (Buggy) Windows support has been removed - (Hopefully) resolved compile problems: since mailfilter does not compile with GNU-flex anymore, the code has been adjusted to depend on a flex version which is available from http://lex.sf.net/ - New user-contributions and scripts in contrib/ - Minor documentation changes in the FAQ mailfilter 0.5.1 (Sat Apr 12 08:46:25 CEST 2003) [development version] - Added '-r'/'--return-value' in order to make mailfilter return a positive integer if it scanned any messages in any POP account (see mailfilter (1) man page for details) - Added contrib directory with extra scripts and programs which can be used in combination with mailfilter (read its README file for further details) - Added a scoring mechanism (see man pages for further details) to allow more efficient filtering on mailing lists, for example - Fixed configuraton and compilation woes with various versions of gcc, flex, bison and the autotools (mainly relevant for developers) - Added `--test' as command-line switch to merely simulate deletes mailfilter 0.5.0 (Sun Aug 25 14:52:54 EST 2002) [development version] - Updated documentation and man pages - APOP support (courtesy Greg Louis) - Greek language translation (courtesy Dimitrios Kamenopoulos) - Fixed Makefile bug that caused recompilation upon make install (courtesy Joerg Jaspert) - Updated Windows-related configuration and installation files - Windows users can now use "_mailfilterrc" instead of ".mailfilterrc" mailfilter 0.4.0 (Wed May 29 10:10:18 CEST 2002) [stable version] - Updated documentation - Updated language translations (German, Spanish) mailfilter 0.3.3 (Mon Apr 22 17:38:10 CEST 2002) [development version] - Mailfilter now supports POP3 servers that make use of several streams/ connections/whatever to send back acknowledgements during the login period - Added Russian translation, courtesy Ilgiz Kalmetev - Fixed a bug that caused mailfilter to crash under certain conditions, upon syntax errors in the rcfile - The -L and -v command line switches override any rcfile directives (again), as it should be - Syntax errors in configuration files are reported correctly now - Headers are not logged twice anymore, if SHOW_HEADERS=yes and VERBOSE=6 - Nested rcfiles possible now (use INCLUDE as keyword) - Exotic POP3 servers that do not use "TOP %n 0" to show the message headers, can now be used by defining an alternative command in the config.h file (recompilation is necessary, however) mailfilter 0.3.2 (Wed Feb 20 09:38:41 CET 2002) [development version] - Improved rcfile parsing, trailing white space characters are possible now - Improved logging and verbosity capabilities (see mailfilterrc(5) for details) - Usernames and passwords may consist exclusively of digits now - Fixed a type conversion problem in signal handling code, such that compilation works again with FreeBSD 4.4-RELEASE - Minor documentation updates (faq, man pages, etc.) - Fixed a minor incompatibility with Windows configuration files, such that bison gets invoked correctly mailfilter 0.3.1 (Sun Dec 2 11:11:52 GMT 2001) [development version] - Improved rcfile parsing and added support for multi-case keywords and the like (If you run into problems compiling the program, please look into doc/FAQ, as a couple of Linux distributors use(d) a broken version of flex!) - Spanish translation (courtesy Carlos Valdivia Yage) - Updated and corrected the program's FAQ (e. g. thanks to Brian Hall we have now an example shell script that shows how Mailfilter can be tunneled via ssh) - Bug fix: Mailfilter now displays the correct filter and subject string of a mail if a (normalised) filter matched - Bug fix: mails that contain subject strings with only a white space character, are now handled correctly - Added time out signal handler for network connection code - Added signal handler to catch SIGINT, i.e. ctrl-c mailfilter 0.3.0 (Wed Nov 7 14:17:44 GMT 2001) [development version] - Program compiles and runs (again) under MS-Windows with Cygwin and the like (see doc/README.Windows) - rcfile must be in $HOME now and is not expected to be in /home/ anymore - Upon popular demand the default setting of MAXLENGTH is '0' now, i.e. the feature is disabled by default - Restructured the verbosity levels; see mailfilterrc(5) man page for details, please - Removed internal string handling bugs that confused the Regular Expression compilation mailfilter 0.2.4 (Thu Oct 11 18:32:48 GMT 2001) [stable version] - Added option to define a time span in seconds that Mailfilter waits for a server response, after a command was issued, keyword TIMEOUT - Added option to define maximum line lengths of header fields, keyword MAXLENGTH - Changed header parsing slightly, such that program output does not contain unwanted control characters anymore - Added Russian translation of an example rcfile (courtesy of Alex A. Puchow) mailfilter 0.2.3 (Wed Aug 15 17:13:17 CEST 2001) [stable version] - Updated and extended the FAQ and man pages - Bug fix: No more endless loops in the normalisation process if subject line ends with a whole bunch of white-space characters, ie more than the usual two - Bug fix: Normalisation handles multiple spaces/blanks correctly now - Bug fix: field-names may now start in lower case letters, ie parsing should be fully RFC822 compliant - Bug fix: the closing tags for e-mail headers are not parsed and processed anymore - Translations are now part of the RPM packages - Message size of deleted messages (MAXSIZE) appears in logs mailfilter 0.2.2 (Wed Jul 18 11:51:59 CEST 2001) [stable version] - Changed source code, so Mailfilter compiles with the new GCC 3.0.x (mainly a matter of missing namespace declarations) - Line numbers of the rcfile show up in case of a configuration error (courtesy Johannes Bauer) mailfilter 0.2.1 (Mon Jul 9 18:56:21 CEST 2001) [stable version] - Fixed a bug that caused normalisation to fail when message tags consisted of only capital letters - The different verbose levels are more consistent and useful now - Portuguese translations (courtesy Frederic Meunier) - New example rcfiles to make installation easier mailfilter 0.2.0 (Thu May 31 18:16:41 CEST 2001) [stable version] - Updated man pages - Added new keyword to delete duplicates of messages: DEL_DUPLICATES - New Italian translations (courtesy Matteo Merli) - Passwords don't show up in log files anymore if verbosity level is set sufficiently high mailfilter 0.1.3 (Sun May 6 10:59:36 CEST 2001) [development version] - Multi-line header fields like "To:", "Cc:", etc. are now handled correctly (especially in regard of the negative spam filters). That is, new lines are transformed into white-spaces. - Minor documentation updates mailfilter 0.1.2 (Wed Apr 25 17:24:11 CEST 2001) [development version] - Added internationalisation (so far for 'de', 'fr') - Added 'negative' DENY filters, e.g. DENY<>^To:.*my@address.com mailfilter 0.1.1 (Sat Jan 27 09:26:47 GMT+1 2001) [stable version] - New man pages: mailfilter(1), mailfilterrc(5), mailfilterex(5) - A 'normalised' subject string is now only checked if the message has passed all ordinary filters first (That's much more efficient.) - Replaced keyword ICASE with REG_CASE - less confusing that way (A list of deprecated keywords can be found in the mailfilterrc(5) man page.) - New keywords: TEST, SHOW_HEADER. See mailfilterrc(5) and mailfilterex(5) for details. - Small bug fixes that do not directly affect functionality mailfilter 0.1.0 (Sat Jan 20 10:01:44 GMT+1 2001) - Added support for extended Regular Expressions - Added 'normalisation' of subject strings for more effective filtering - Improved memory management: e-mails are being filtered on the fly now - All Regular Expressions of Mailfilter are only compiled once now, on program startup; much faster! - New keywords for more efficient filtering: DENY_CASE, DENY_NOCASE, ALLOW, MAXSIZE_DENY, MAXSIZE_ALLOW (Consult the README.mailfilterrc file for further information!) - Added multi-level verbose mode (and replaced keyword MODE with VERBOSE) - Added check for malformed keywords in .mailfilterrc - Changes to the documentation; added platform specific installation instructions (Windows and Slackware Linux) - Moved some of the READMEs and the FAQ to the doc/ directory - Small bug fixes that do not directly affect the functionality mailfilter 0.0.4 (Tue Dec 19 17:11:33 GMT+1 2000) A small but nasty bug made Mailfilter crash on certain versions of glibc. That's fixed now and also the reason why 0.0.4 was out so quickly after 0.0.3 has been shipped. Mailfilter now allows ',' in the passwords and reports if the password that was sent to the server was incorrect. mailfilter 0.0.3 (Thu Dec 14 16:31:46 GMT+1 2000): It doesn't hurt anymore having e-mails that match two or more filters at once. Added support for anal mail servers such as IMail. Various little bug fixes, mainly dealing with internal memory management, but also exception and error handling. Added a manual page. Added the ability to have case insensitive regular expression matching in the .mailfilterrc file (courtesy Ivan Vitjuk) Added api documentation in various formats mailfilter 0.0.2 (Fri Nov 24 22:38:11 GMT+1 2000): Mailfilter doesn't break anymore when the bandwidth gets low. Nonblocking I/O seems to work as well and provides a better performance when checking for e-mail headers on the server. Various other little bug fixes have found its way in this release: The --mailfilterrc switch works now, MAXSIZE can be set to zero and the parsing of the e-mail headers got fixed. This version also offers better support for other platforms due to automake and provides a better help and version info (thanks to Matthew R. MacIntyre for implementing this). Also changed from a shallow to a deep package structure. mailfilter 0.0.1 (Fri Nov 17 16:10:51 GMT+1 2000): Mailfilter's initial version has been released. See TODO for more information on this (yet) experimental release. mailfilter-0.8.9/README000066400000000000000000000024761430510321000145360ustar00rootroot00000000000000Mailfilter README -=-=-=-=-=-=-=-=- Mailfilter is a flexible utility for Unix-like operating systems to get rid of unwanted spam mails, before having to go through the trouble of downloading them into the local computer. It offers support for one or many POP accounts and is especially useful for dialup connections via modem, ISDN, etc. Mailfilter connects to any POP mail box and compares part of its content to a set of user defined filter rules. That way the spam gets deleted directly on the mail server. With Mailfilter you can define your own filters (rules) to determine which e-mails should be delivered and which are considered waste. Rules are regular expressions, so you can make use of familiar options from other mail delivery programs such as e.g. procmail. Mailfilter is released under the GPL with the additional exemption that compiling, linking, and/or using OpenSSL is allowed. For more information, see the COPYING file provided with the Mailfilter program. The latest releases of Mailfilter can be obtained from this web page: http://mailfilter.sourceforge.net/ For installation instructions please refer to the INSTALL document and read the platform specific information and the FAQ in the doc/ directory. Further information can be found in the mailfilter(1) man page. Enjoy Mailfilter! mailfilter-0.8.9/README.md000066400000000000000000000026731430510321000151340ustar00rootroot00000000000000# Mailfilter [![Build Status](https://travis-ci.org/nondeterministic/mailfilter.png?branch=master)](https://travis-ci.org/nondeterministic/mailfilter) Mailfilter is a flexible utility for Unix-like operating systems to get rid of unwanted spam mails, before having to go through the trouble of downloading them into the local computer. It offers support for one or many POP accounts and is especially useful for dialup connections via modem, ISDN, etc. Mailfilter connects to any POP mail box and compares part of its content to a set of user defined filter rules. That way the spam gets deleted directly on the mail server. With Mailfilter you can define your own filters (rules) to determine which e-mails should be delivered and which are considered waste. Rules are regular expressions, so you can make use of familiar options from other mail delivery programs such as e.g. procmail. Mailfilter is released under the GPL with the additional exemption that compiling, linking, and/or using OpenSSL is allowed. For more information, see the COPYING file provided with the Mailfilter program. The latest releases of Mailfilter can be obtained from this web page: [http://mailfilter.sf.net/](http://mailfilter.sourceforge.net/) For installation instructions please refer to the INSTALL document and read the platform specific information and the FAQ in the doc/ directory. Further information can be found in the mailfilter(1) man page. Enjoy Mailfilter! mailfilter-0.8.9/THANKS000066400000000000000000000046201430510321000145620ustar00rootroot00000000000000Mailfilter THANKS -=-=-=-=-=-=-=-=- The authors offer many thanks to all who have helped out in any way, shape, or form to the development of this project. Many of these contributors have helped out in ways they may not have been aware of, including answering newsgroup questions, writing web content that has been of useful, testing, suggestions on IRC, those who have provided feedback, and numerous other cases. No contribution is any less important than another! If you or someone you know has helped out with this project and doesn't have their name listed here, please contact the authors immediately in order to have this mistake rectified! A warm round of applause goes to ...... Bulia Byak Robert Bar Bracara Johannes Bauer Paul Bissex Frank Blome Jose Castejon-Amenedo Jon Combe Carsten Knodel Matt Cowger Florian Dejako Akim Demaille Alan Dunford Tobias Ebner Anton Filippov Scott Grigsby Jean-Serge Gagnon Peter T. Garner Gerrit P. Haase Brian Hall Frank Haun Holger Hoffsttte Felix Janda Carsten Knodel Don Kennedy Andreas Kretschmer Yan-Fa Li Greg Louis Matthew R. MacIntyre Fabian Melzow Klaus Muth Yong Chiew Ning Pat Parrinello Ville Ptsi Darryl Plank Plank, Darryl Mike Polniak Wendy Proctor Alex A. Puchkov Elimar Riesebieter Xavier Roche Julio Sardella Til Schubbe Kay Schulz Mel Sojka Robert Storey R. Taylor Leopold Toetsch Gary V. Vaughan Ivan Vitjuk mailfilter-0.8.9/autogen.sh000077500000000000000000000070351430510321000156530ustar00rootroot00000000000000#!/bin/sh # Run this to (re)generate all the initial makefiles, etc. srcdir=`dirname $0` test -z "$srcdir" && srcdir=. PKG_NAME="mailfilter" DIE=0 (test -f $srcdir/configure.ac \ ## put other tests here ) || { echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" echo " top-level $PKG_NAME directory" exit 1 } (autoconf --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`autoconf' installed to compile $PKG_NAME." echo "Download the appropriate package for your distribution," echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" DIE=1 } grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && { grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \ (gettext --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`gettext' installed to compile $PKG_NAME." echo "Download the appropriate package for your distribution," echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" DIE=1 } } (automake --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`automake' installed to compile $PKG_NAME." echo "Download the appropriate package for your distribution," echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" DIE=1 NO_AUTOMAKE=yes } # if no automake, don't bother testing for aclocal test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: Missing \`aclocal'. The version of \`automake'" echo "installed doesn't appear recent enough." echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.7.tar.gz" echo "(or a newer version if it is available)" DIE=1 } if test "$DIE" -eq 1; then exit 1 fi if test -z "$*"; then echo "**Warning**: I am going to run \`configure' with no arguments." echo "If you wish to pass any to it, please specify them on the" echo \`$0\'" command line." echo fi case $CC in xlc ) am_opt=--include-deps;; esac for coin in `find $srcdir -name configure.ac -print` do dr=`dirname $coin` if test -f $dr/NO-AUTO-GEN; then echo skipping $dr -- flagged as no auto-gen else echo processing $dr macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin` ( cd $dr aclocalinclude="$ACLOCAL_FLAGS" for k in $macrodirs; do if test -d $k; then aclocalinclude="$aclocalinclude -I $k" ##else ## echo "**Warning**: No such directory \`$k'. Ignored." fi done if grep "^AM_GNU_GETTEXT" configure.ac >/dev/null; then if grep "sed.*POTFILES" configure.ac >/dev/null; then : do nothing -- we still have an old unmodified configure.ac else echo "Creating $dr/aclocal.m4 ..." test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 echo "Running autopoint... Ignore non-fatal messages." echo "no" | autopoint --force echo "Making $dr/aclocal.m4 writable ..." test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 fi fi echo "Running aclocal $aclocalinclude ..." aclocal $aclocalinclude -I m4 if grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then echo "Running autoheader..." autoheader fi echo "Running automake --gnu $am_opt ..." automake --gnu --copy --add-missing $am_opt echo "Running autoconf ..." autoconf ) fi done conf_flags="--enable-maintainer-mode" #--enable-compile-warnings --enable-iso-c if test x$NOCONFIGURE = x; then echo Running $srcdir/configure $conf_flags "$@" ... $srcdir/configure $conf_flags "$@" else echo Skipping configure process. fi mailfilter-0.8.9/configure.ac000066400000000000000000000077021430510321000161410ustar00rootroot00000000000000# configure.in: Autoconfigure input file for mailfilter # # Copyright (c) 2000 - 2022 Andreas Bauer # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a configuration # script generated by Autoconf, you may include it under the same # distribution terms that you use for the rest of that program. # # Process this file with autoconf to produce a configure script. AC_PREREQ([2.71]) AC_INIT([mailfilter],[0.8.9],[baueran@gmail.com]) AC_REVISION($Revision: 1.1.2.4.2.12 $) AC_SUBST(PACKAGE_COPYRIGHT) AC_DEFINE(PACKAGE_COPYRIGHT, "Copyright (c) 2000 - 2022 Andreas Bauer ", [Copyright information.]) AC_COPYRIGHT(Copyright (c) 2000 - 2022 Andreas Bauer ) AC_CONFIG_SRCDIR([src/mailfilter.cc]) AC_CONFIG_HEADERS(config.h) AM_INIT_AUTOMAKE AM_MAINTAINER_MODE # Checks for programs. AC_PROG_AWK AC_PROG_CXX AC_PROG_CC AC_PROG_MAKE_SET AC_PROG_YACC AS_IF([test x"$YACC" == x"yacc"], [AC_MSG_ERROR([Please install bison or byacc before configuring.])]) AC_PROG_LEX(noyywrap) AS_IF([test x"$LEX" == x":"], [AC_MSG_ERROR([Please install flex before configuring.])]) # Checks for header files. AC_CHECK_HEADERS([arpa/inet.h \ wordexp.h \ fcntl.h \ inttypes.h \ libintl.h \ locale.h \ netdb.h \ netinet/in.h \ stdlib.h \ string.h \ sys/socket.h \ sys/time.h \ unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T AC_CHECK_FUNC(getopt_long, [AC_DEFINE(HAVE_GETOPT_H,1, [Define this if there is a system getopt.h header]) AM_CONDITIONAL([GETOPT], true)], [AC_MSG_RESULT(Using included getopt header) AM_CONDITIONAL([GETOPT], false)]) # Checks for library (functions). AC_CHECK_LIB(socket,connect) AC_CHECK_LIB(nsl,gethostbyname) AC_CHECK_LIB(regex,regcomp) AC_ARG_WITH(openssl, [ --with-openssl use OpenSSL (default="yes")]) if test "$with_openssl" != "no" ; then AC_CHECK_LIB(crypto,BIO_new) AC_CHECK_LIB(ssl,SSL_new) AC_DEFINE([USE_SSL],[1], [Is set if SSL encryption via OpenSSL is desired.]) fi AC_CHECK_FUNCS([alarm \ gethostbyname \ gettimeofday \ memset \ regcomp \ select \ setlocale \ socket \ strcasecmp \ strdup \ snprintf \ strerror]) # Usually this should not be changed. AC_DEFINE(PREVIEW_COMMAND, "TOP %d 0\r\n", [Define different only if you really know what you're doing!]) # File names for mailfilter's preferences AC_DEFINE(RC_FILE_NAME, "/.mailfilterrc", [.mailfilterrc is for Unix users.]) AC_DEFINE(RC_FILE_NAME_WIN, "/_mailfilterrc", [_mailfilterrc is for Windows users.]) AC_DEFINE(HOME_ENV, "HOME", [Most likely your home directory is stored in $HOME.]) AC_CONFIG_FILES([Makefile \ mailfilter.spec \ src/Makefile \ man/Makefile \ doc/Makefile \ contrib/Makefile \ doc/Doxyfile]) AC_OUTPUT cat < Purpose: Mails headers of undeleted mails Desc: This script mails headers of undeleted mails to preview mails and define new unwanted threads. Simple view of List-ID, size and subject of each mail. File: checkfilter.sh Author: Kay Schulz Purpose: Addon Desc: Checks for deleted mails and send the filter applied Good for crontab to see if mails you should get were deleted File: chrcformat_05-07 Author: Til Schubbe Purpose: Configuration helper Desc: Change the format of the mailfilterrc from version 0.5 to 0.7 File: deleted.sh Author: Kay Schulz Purpose: Addon Needs: runit.sh Desc: Calculates the amount of deleted mails by mailfilter File: examined.sh uthor: Kay Schulz Purpose: Addon Desc: Calculates the amount of emails examined by mailfilter This only makes sense if you examine mails only once. If you do not download and then delete the emails on the server, this script will give you the wrong number. File: getmailer.pl Author: Kay Schulz Purpose: Addon Needs: SHOW_HEADERS set to yes in mailfilter configuration Desc: Get's the mail client from the logfile by searching for /X-Mailer in the mailheader File: getstats.pl Author: Kay Schulz Purpose: Addon Needs: SHOW_HEADERS set to yes in mailfilter configuration Desc: Searches for the String Applied in the logfiles. File: prozente.pl Author: Kay Schulz Purpose: Addon Needs: runit.sh, deleted.sh, examined.sh Desc: Calculates the percentage of the filters' success File: mfdelete.stat Author: Tim Moore Purpose: Addon Desc: Determine which delete rules are used most Script reads mailfilter log and sorts by delete rule matches using common unix utilities. File: rmcrlf Author: Til Schubbe Purpose: Addon, Configuration helper Desc: remove carriagereturn- and linefeed-characters from a file containing mail-headers (like mailfilter.log) if a long headerline was split into multiple shorter headerlines ("folding whitespaces") - see skript for details File: runit.sh Author: Kay Schulz Purpose: Addon Needs: getstats.pl Desc: Checks the filters and how often they were active! Then sorts the ouput in ascending order. E.g. 32 Applied filter: '^Received:.*\.tw[[:space:]]'] 35 Applied filter: '^Received:.*\.br'] 81 Applied filter: 'Content-Type:.*text/html.*'] File: selectheader Author: Til Schubbe Purpose: Addon Desc: Whith this skript you can select mails from your mailfilter.log which match a certain regex. This can be useful 1. to check if the header you already received would match a (newly created) filter, 2. to create a reliable statistic. File: sort_de_do.sh Author: Kay Schulz Purpose: Addon Desc: Sorts a file which only contains filters for domains, such as DENY=^(From|To|Cc):.*@.*handmark\.net DENY=^(From|To|Cc):.*@.*homebets\.com DENY=^(From|To|Cc):.*@.*homestar\.us by the top level domain, then the first level domain etc. File: spam.tar.gz Author: Franck Pommereau Purpose: Addon, Configuration helper. Desc: Spam is a Perl script which should help in removing unsolicited mails (spams). It parses mails and produces rules suitable to Mailfilter, which makes it possible to remove them from your POP server. Spam will not do everything for you but it will help to quickly update your Mailfilter configuration. File: xmailer.sh Author: Kay Schulz Purpose: Addon Needs: getmailer.pl Desc: Calculates the amount how often a mailclient was used. E.g. 28 The Bat! (v1.33) 29 Internet Mail Service 29 The Bat! (v1.53d) 33 Wmx-0.3 36 Microsoft Outlook CWS, Is not perfect, because the naming of the mailclients, particularly for the different OE versions is not unique But it gives an overview. mailfilter-0.8.9/contrib/Makefile.am000066400000000000000000000002711430510321000173410ustar00rootroot00000000000000EXTRA_DIST = checkfilter.sh deleted.sh FILES getstats.pl prozente.pl runit.sh spam.tar.gz examined.sh getmailer.pl mfdelete.stat README sort_de_do.sh xmailer.sh chrcformat_05-07 rmcrlf mailfilter-0.8.9/contrib/README000066400000000000000000000014221430510321000161640ustar00rootroot00000000000000Mailfilter Contrib This ia a collection of bits and pieces people sent to extend mailfilter. We try our best to not include malicious stuff in here, but all files in this directory are not part of mailfilter. You should not complain to us if they crash your system or burn all your important data, you USE IT OWN YOUR OWN RISK. All files in this directory should be licensed under the same terms mailfilter is, GPL v2 or later. How to contribute a file: Include a line like # Licensed under the same terms as Mailfilter, GPL v2 or later. in your file, fill out the following form and send all that to Joerg Jaspert File: Author: Purpose: Desc: mailfilter-0.8.9/contrib/checkfilter.sh000066400000000000000000000004751430510321000201320ustar00rootroot00000000000000#!/bin/sh ##### # (C) Kay Schulz # Licensed under the same terms as Mailfilter, GPL v2 or later. # Use at your own risk! # Checks for deleted mails and send the filter applied # Good for crontab to see if mails you should # get were deleted ##### grep Deleted /home/kay/log/mailfilter.log | mail -s "Mailfilter" kay mailfilter-0.8.9/contrib/chrcformat_05-07000077500000000000000000000016771430510321000201260ustar00rootroot00000000000000#!/usr/bin/perl # # chrcformat_05-07: # Change the format of the mailfilterrc from version 0.5 to 0.7 # # Usage: # $ mv ~/.mailfilterrc ~/.mailfilterrc.05 # $ chmod u+x chrcformat_05-07 # $ cat ~/.mailfilterrc.05 | chrcformat_05-07 > ~/.mailfilterrc # # This is a perl-skript. Depending on your system you may have # to adjust the first line. # # --------------------- # Licensed under GPL v2 # --------------------- # # 13.11.2003 # Til Schubbe # $mf_number_keywords = ' VERBOSE PORT MAXSIZE_DENY MAXSIZE_ALLOW ' . 'MAXLENGTH TIMEOUT HIGHSCORE '; while (<>) { $l++; chomp; if (/^(#|\s*$)/) { # skip comment or empty line print "$_\n"; } elsif (/^(([A-Z_]+)(\s+[+-]?[0-9]+)?\s*(=|<>)\s*)(.*)/) { $keyword = $2; if ($mf_number_keywords =~ m/ $keyword /) { print "$_\n"; # let numbers unquoted } else { print "$1\"$5\"\n"; # quote the regex } } else { die "error in line $l: '$_'\n"; } } mailfilter-0.8.9/contrib/deleted.sh000066400000000000000000000003571430510321000172540ustar00rootroot00000000000000#!/bin/sh ##### # (C) Kay Schulz # Licensed under the same terms as Mailfilter, GPL v2 or later. # Use at your own risk! # Needs runit.sh # Calculates the amount of deleted mails by mailfilter ##### runit.sh | awk '{x=x+$1}; END{print x}' mailfilter-0.8.9/contrib/examined.sh000066400000000000000000000006461430510321000174410ustar00rootroot00000000000000#!/bin/sh ##### # (C) Kay Schulz # Licensed under the same terms as Mailfilter, GPL v2 or later. # Use at your own risk! # Calculates the amount of emails examined by mailfilter # This only makes sense if you examine mails only once. # If you do not download and then delete the emails on the # server, this script will give you the wrong number. ##### zgrep Examining log/mailfilter.log* | awk '{x=x+$3}; END {print x}' mailfilter-0.8.9/contrib/getmailer.pl000066400000000000000000000005661430510321000176220ustar00rootroot00000000000000#!/usr/bin/perl -w ##### # (C) Kay Schulz # Licensed under the same terms as Mailfilter, GPL v2 or later. # Use at your own risk! # Get's the mail client from the logfile # by searching for /X-Mailer in the mailheader # Needs SHOW_HEADERS set to yes ##### use strict; while (<>) { if (/X-Mailer(.*)$/) { print "X-Mailer $1\n"; } } mailfilter-0.8.9/contrib/getstats.pl000066400000000000000000000005171430510321000175030ustar00rootroot00000000000000#!/usr/bin/perl -w ##### # (C) Kay Schulz # Licensed under the same terms as Mailfilter, GPL v2 or later. # Use at your own risk! # Searches for the String Applied in the logfiles. # Needs SHOW_HEADERS set to yes ##### use strict; while (<>) { if (/Applied(.*)$/) { print "Applied $1\n"; } } mailfilter-0.8.9/contrib/mbox.sh000066400000000000000000000044771430510321000166220ustar00rootroot00000000000000#!/bin/bash #=============================================================================== #------ Written by Anton Filippov(sqrt@bluebootle.com) ------------------------- #------ Licensed under the same terms as Mailfilter, GPL v2 or later. ---------- # # This script mails headers of undeleted mails to $addrpre # to preview mails and define new unwanted threads . # Simple view of List-ID , size and subject of each mail . # # need verbosity=6 # #=============================================================================== # The algorithm: # grep nums of strings witn "Ok" # grep nums of strings with "Deleted" # grep nums of strings with "Quit" # for each nums "Ok" - find its corresponding end - in nums "Ok","Del" # or "Quit" #=============================================================================== p=$HOME/.mailfilter/denythreads . $p/denythreads.conf declare -i i in is ie ib prevmail() # $1-num of "Ok" line , $2 - num of "del" or "quit" string , $3 -logfile { is=$1-2 sz=$(sed -n "$is"p $3|sed -e "s|.* ||g") sz=$(echo "scale=0; $sz / 1024"|bc) echo size=$sz K ib=$1+1;ie=$2-3 t1=$(sed -n "$ib,$ie"p $3) sub=$(echo "$t1"|egrep ^Subject:|sed -e "s|Subject: ||") # sub=$(echo "[${sz1}K]" "$sub") list=$(echo "$t1"|egrep ^List-Post|sed -e "s|List-Post: " echo "script \"${0##*/}\" sent this letter to $addrpre" } takelog() # $1 - logfile { #we don't need egrep (search from the beginning) - it is only headers nok=$(grep -in "OK Message follows" $1|sed -e "s|:.*||g") ndel=$(grep -in "mailfilter: Deleted" $1|sed -e "s|:.*||g") #logfile is new - so there is only one string "quit" nq=$(grep -in "mailfilter: Sending QUIT" $1|sed -e "s|:.*||g") n=$(echo "$nok"|sed -n "$ =") for ((i=1;i <= n; i++)) do in=i+1 si=$(echo "$nok"|sed -n "$i"p) arg1=$(echo "$nok"|sed -n "$in"p) arg2=$(echo "$ndel"|sed -n "1"p) if [[ -z "$arg1" ]];then if [[ -z "$arg2" ]];then arg3=$(echo "$nq") prevmail $si $arg3 $1; fi else if [[ $arg1 -lt $arg2 ]];then prevmail $si $arg1 $1 else ndel=$(echo "$ndel"|sed -e "1 d") fi fi done } for f1 in $a;do dos2unix $f1.$log takelog $f1.$log done #EOF #=============================================================================== mailfilter-0.8.9/contrib/mfdelete.stat000066400000000000000000000004401430510321000177650ustar00rootroot00000000000000#!/bin/sh # mailfilter.delete.stat # timothymoore@nsr500.net # input: mailfilter.log from stdin # Licensed under the same terms as mailfilter, GPL v2 or later. grep '^mailfilter: Deleted ' - |\ awk '{print substr($0,index($0,"[Applied filter:"))}' |\ sort +2 |\ uniq -c |\ sort -nr +0 -1 mailfilter-0.8.9/contrib/prozente.pl000066400000000000000000000011601430510321000175060ustar00rootroot00000000000000#!/usr/bin/perl -w ##### # (C) Kay Schulz # Licensed under the same terms as Mailfilter, GPL v2 or later. # Use at your own risk! # Calculates the percentage of the filters' success # Needs runit.sh, deleted.sh and examined.sh ##### $deleted = `deleted.sh`; $examined = `examined.sh`; printf ("%2.2f%% (%d) of all mails (%d) deleted\n", $deleted*100/$examined, $deleted, $examined); print "The top mailfilters are:\n"; @teste = `runit.sh`; foreach(@teste) { $zahl = substr ($_, 0, 4); $rest = substr ($_, 22); if ($zahl > 9) { $prozent = $zahl * 100 / $deleted; printf ("% 6.2f%% for %s", $prozent, $rest); } } mailfilter-0.8.9/contrib/rmcrlf000077500000000000000000000031471430510321000165250ustar00rootroot00000000000000#!/usr/bin/perl # # rmcrlf - remove carriagereturn- and linefeed-characters from # a file containing mail-headers (like mailfilter.log) if a long # headerline was split into multiple shorter headerlines # ("folding whitespaces" - see RFC 2822, section # 2.2.3. Long Header Fields). Especially Received:-headers often # exceed the 78-character-limit. # # http://www.faqs.org/rfcs/rfc2822.html # ftp://ftp.rfc-editor.org/in-notes/rfc2822.txt # # After using rmcrlf you can egrep the new $out_file with your # regex_to_test to see if it would have matched the header of a # previously received e-mail. This prevents you from loosing # mail because of a buggy regex. # # This is a perl-skript. Depending on your system you may have # to adjust the first line. # # --------------------- # Licensed under GPL v2 # --------------------- # # Til Schubbe, 13.11.2003 # t.schubbe@gmx.de # use warnings; $out_file = "big_2003_07-"; # Output-file; MODIFY HERE $out_file_old = "$out_file" . ".old"; $mailfilter_log = "mailfilter.log"; # Input-file; MODIFY HERE # Delete the file unlink $out_file_old; rename "$out_file", "$out_file_old"; # Split $mailfilter_log into multiple smaller files # man split system "split", "-C", "10m", $mailfilter_log; open OUT, ">$out_file"; # This handles 26 files only (26*10MB=260MB) foreach $f ("a".."z") { unless (open FIL, "); s{\x0d\x0a(\x20|\x09)+} # This not exactly what RFC 2822 tells, but {\x20}gsx; # it increases the readability of the outfile close FIL; print OUT; unlink "xa$f"; } close OUT; mailfilter-0.8.9/contrib/runit.sh000066400000000000000000000007671430510321000170140ustar00rootroot00000000000000#!/bin/sh ##### # (C) Kay Schulz # Licensed under the same terms as Mailfilter, GPL v2 or later. # Use at your own risk! # Needs getstats.pl # Checks the filters and how often they were active! # Then sorts the ouput in ascending order. # E.g. # 32 Applied filter: '^Received:.*\.tw[[:space:]]'] # 35 Applied filter: '^Received:.*\.br'] # 81 Applied filter: 'Content-Type:.*text/html.*'] # Used also by prozente.pl ##### zgrep Deleted log/mailfilter.log* | getstats.pl | sort | uniq -c | sort -n mailfilter-0.8.9/contrib/selectheader000077500000000000000000000045501430510321000176670ustar00rootroot00000000000000#!/usr/bin/perl # # Whith this skript you can select mails from your mailfilter.log which # match a certain regex. This can be useful # 1. to check if the header you already received would match a (newly # created) filter, # 2. to create a reliable statistic. # # Input: # - mailfilter.log (STDIN) # - Regex (edit this skript) # # Output (STDOUT): # - Complete headers which match the given regex # # Usage: # 1. Put the regex to look for (e.g. from your .mailfilterrc) into $regex # 2a. $ selectheader < big.log | less # 2b. $ selectheader < big.log > selected_mails.log # # To handle long header-lines (with folding whitespaces) correctly, you will # have to convert your mailfilter.log into another file (e.g. big.log) # by using 'rmcrlf' from the Mailfilter /contrib dirctory before feeding # this skript. This is important especially when looking for # Received:-headers. # # This is a perl-skript. Depending on your system you may have # to adjust the first line. # # --------------------- # Licensed under GPL v2 # --------------------- # # ------------------------------ # Til Schubbe # 27.12.2003, Version 2 # ------------------------------ # use warnings; undef $/; # Read all in one line $logfile = ; &prepare_log; $mail_delimiter = "\n-\n"; $regex = '^Subject:.*Mailfilter'; # MODIFY HERE # Split logfile into headers @mails = split /$mail_delimiter/, $logfile; foreach $mail (@mails) { # m-Modifier: Multi-line-mode # Perhaps you want to add an 'i' to ignore the case of the regex print "$mail\n--\n" if ($mail =~ /$regex/m # Use the following lines if you want the mails to match another regex, # too. # && $mail =~ /another regex/m # && $mail !~ /another regex/m # || $mail =~ /another regex/m # || $mail !~ /another regex/m ); } sub prepare_log { # crlf -> lf $logfile =~ s/\x0d\x0a/\n/mg; # Remove additional mailfilter-messages $logfile =~ s/^mailfilter: (?!(?:Allow|Approved|Deleted|Deny).*$).*$//mg; # Remove '+OK'-lines (for old (~2001) versions of Mailfilter) $logfile =~ s/^\+OK.*\n//mg; # Insert '-' after every mailfilter-message $logfile =~ s/^(mailfilter: .*)/$1\n-\n/mg; # Insert '-' after every '.' not followed by 'mailfilter:' $logfile =~ s/^\.\n(?!\n*mailfilter:.*$)/.\n-\n/mg; # Remove empty lines $logfile =~ s/\n(?=\n)//mg; # Remove empty line at the beginning $logfile =~ s/^\n+//; } mailfilter-0.8.9/contrib/sort_de_do.sh000066400000000000000000000006471430510321000177710ustar00rootroot00000000000000#!/bin/sh ##### # (C) Kay Schulz # Licensed under the same terms as Mailfilter, GPL v2 or later. # Use at your own risk! # Sorts a file which only contains filters for # domains, such as # DENY=^(From|To|Cc):.*@.*handmark\.net # DENY=^(From|To|Cc):.*@.*homebets\.com # DENY=^(From|To|Cc):.*@.*homestar\.us # by the top level domain, then the first level domain etc. ##### cat deny_domain | sort -bdf -t . +3 +2.1 -3 | more mailfilter-0.8.9/contrib/spam.tar.gz000066400000000000000000000274631430510321000174100ustar00rootroot00000000000000I =spam-020916.tar\{WĢhٵd`1܃DN%MfyXV ~3=BdϞ:1TW׻{rzni4g4zg͵o<[} O'^$ă~zYZ7a 0G}Y*J"Y$e$T/Xx7Wjhq}:C?(DX~$~2"%fa*^ "$/D ?^Ыc=?4H$C)q,>_9:od #o$Nҋ~W^(&eO\x>hk*~Hҧ(Xѓ0"HG"``(ck~ 4$ąi,8Zpy{|Q-N!='#PcdF3w{oiLAG9khi`u*NNO{5!R3['l$ٓ MYyz%)+Dm2[%\[ L*bd4d74sVAЭUsё$')NF^NauQ8n4js!-q:ǯv;Gζq4D܍ swhGr~4Cb؇5!:\ oe%{/ҭ(ߘ.FG9. LjƱxfV|1+#>9>rk 腰hF'rh, *DKh& I[2^''4A&j,vuxغMuGpir ?=&0Jڀy =gL% !YC,?4G~xS}"ܘw{|#Ja;q0] %YdA0zN"a#\X'FaT1C"")?.ljR~h:o64fj_)j:Qj YuH) :#e7 ccLn: cVsQ3G]=m0kPA08+sq{3!Lq_J\KQǰdE@e< M4MҥtFY!A@bT>FQLbQH&"uY/k'Gdǔ5`ʂ0SLw f>T:g|ck$:(h!&BGrYN"#ŵ u9rQN)H;*-*"F?,`hxJHDB78L(qEJLgBr5([Ś1kȲGGo6gTL($fV>z#P^Bd݅Jj :8`ݲQLê?8s=X3Hp1<5\#\3N&5 .u D:٠Lᤲl&NRXj9R4TC7"(.QȌRd)7#Gl`<Hz8 Y#"}E"5jwodgC%EgtzaLDt,p5zi!{}E~X0bQ/c &W[Ki44T$Ed4#bɱ2^?f3MAE~ ]q<1.W2n\'NBkr.!ǧXiw +xvBtO05%-Q:@H]iYb 6(nVث^M6/U퓑7#f݆I^J@[MP`b-NMcjhʁ ^}# "6@?21KCM˭?Z}KMD&1SVE{7JU>CnD1'VS^$&´KEd{>hx412,Qtd30HoQ.5iv{ 1!6I~LP)sam2J| Re]1lHzrUDBT8WyB7B%WlSɖwMH9$N3 nge3SW%/\yƂElprV -,p^(tT Bӣ &@58tXk'nRѐ~'{b40z wDrmeha \UlCq6г'1͹t %6SѮa?հf[@26]"o9pK<;]I|T+MىC'Uv9$DdJ1ŧZZd2Blg)w'vfp~ݨ_4fpIt ^x@.*ъo6߽y0u9,][[|Z4x$Qi҄GssV_c.RN)T>X=@,'PNQQTtH#D =W@y7[Y|9 .XH ;4x;Ϟnlawhϣ4~P`P⪒PƓM;jh46gBIbq=1sǏamo=& c{Njc@ {4۷ ɽw߾uLHe瘆֦11P]7ؗfsL =_L`XFЎHM=~ЩrPT,>>%wQԎ<hx١uޗE5V\3eȄm" \FY҅OBW}-f9Cpǒ熛f߻b&o;tRn??]cH'2A2Ƶ_eB` *DbA{XrI{w0p;^a.,f͑51"C 8(w%)ZWV—VLu)cu:} ^p`Du喙?O>_ڢQgڷ|&߁~4(IGX4F pݝl{GńtB2(P]ఊihz^YWt|#%dމ= b heь]z䀚dw'r`uoI̲ {)us_V5htK c+m[ԓJW~w>N?Yga͵dBK|hvAK;<CŢcP?3W9Uʋtܬ=Fr,mΰY6 $u2eG!G F}OzȀA[iɆ`g0nip6쉒 ;$W׷&as4&Rn7nlRL)Oung6Ɖ' FXc)-^ЧCxVS6vWŋ~wHu_Md`CoOJ罧ox n4K³n{ ZKőlyiyͧc& I4*ņ|2p(AL$z>X(['d [j7֯u#X#G2Qm8m+*Df6E+#T)'_ 9,Xhrq.j*3S*&oWHE 3-c}ݍ}(`0?/7u^[ Fag|imQd'&i{1즚Ksb{Cr}Y%dDh.oX^MX~wkP[DQYH()o Ne_rFL$ CTd\Xl[\FۥļnU͵4_K\s!a4)Q"daœ|a  ,Y}dKUWW&SNw3"AIo eJ؛[ιY{?w:,0DAjgd*cGstP>mJj_r[BaCTP,a顛EvUؕή9M>e%Y"VTl7su7FޗߋoPb!My?:"AwQ)>DkiP"aAynZMl 8a:/5ĜX+ó{۷YRpc,xkћھW/ 5DB/3Z;BqjԿ++,!u hEPrw¾_KXMR|u>$({}9>u ,eu,kU0B B D~/q}wO~<8zo|m>XYyk{/ztc}hu(N^ ws>DCEoJ Mw,Äx4n="6sul]{8O[U! "fs>3 6Zߚ[;6q[" -%v)*D\(RH 7]4t,N*WW~#bw^zz{2;C̕Sߐ2Q`4es{k낽\L/`薫D\%7H1Nuhd-Zs_ClvfjeOWzs(WreAؼcR^aV'.խm K7_ R1aM:@݋lfkӴW9%;'dqad?fБoY5Jfj'y-v1eF6+ +VB<+4uxZJSUV+Ît-vFM27X/Z^,o9O Kq4Vbpf``Si3F_Y_bXك骸k^e/TqvÃB?&fuЈ ټmNz|Wyt5җ1폣YUY͉O|B2lp/\ 3ӒoM\ ˪M.2HT6َKMDzM2a%`ҢI9HkK["Q TIX=C%cEԥ aX3.PPUV0}URja;' iu˔j-ٛr+Oe+%}U tuIv,4#ꇔQs*uy_^k]Q5 N=Ci!9nj،WP!65)4[2yHqV6΋F($ DJ˪)/{9 #qR?U2CZPaIm$zPnsd j.i0z?'Ź,Y;kr4|sH[SؑĖP_L22ekB@v1Zs[͡\|c-JE'E`&LGJgt|rEk殜u3EP W+ 0 64<6C{ =aK,,nў$D?8j_}k8׫Ab:8fk1Uф풆mB ?W.Bn!zS#a}%nKuFB!(SU7y}X' @C,9=%aTDe(PmV!ukz+UG:UǛPRzuǙ!c;3RvP=777kgmkQ@_D<n =WmФvNŦ"vM)lGHUn<$T\_)o w ᥕJ=bD]WY ڴSU"HV9oP s ۵i㖠txSiZu @Hw NB(^ {"۝YM^vKmNh6鼢M)򚁚XAa3,e7iy0H>#% ӭl/-bN]}Cr%@ ~ "uy ߖK7z物h&LwТG{|pO<V̠EʥgX!C'0L.H =BK|1 eݦāqpp,Ԁmd@<.&XnukJ8%=8Mֱt 8}dq0opWm7k.=, Af;78~*-'#|@=}6n-9usi?7ngW4`ӌ8?lqc?ih~j|w61bL0dE3Etw}IP +GBa`ٺfpbg֩ʬq@|6^MXe,+[ҰMWZ|fgaz;c>,쿛왈z9Y]m䘰)Ne jVLébB,}?ߨ>ﳐyCҵO0K]0CEHJ+_pIg!0LnʂV^6ɦe=]/t8/LԠNIKIXb+s(B!av)de֦/IIӦU/1ug:uJc#f뛯vz2i0Z4Yb5{ѿFI*N3=QcJ J&¯Dvΐ!\ -$F4y^-[L{29Ӄ~ڜewղ[I(e|K1HqıZad+2<_ĠiBķUIrkפlʔ8 yYRڬv8Dȃk~,uKb'>PnSJMJ*[sd'RG3c%z~}~En ~wzgIҋ5q*=MWO;YX⯖*:֍u{Tpn\k"q`H"dυ+hIuN?JyE]ܗ#"p,== xF-mC||>4/`x} /qD"h2;8;v02Ó2gNZ^6F?H2L~#-_\ df2 e0~Eo@% !h8k#OWؐPWx??Bm-$}֐y/Pdvp|9(+oJ7:;2s6>A0|ȑYUe#,p#x  ~'b&> s.ga}&f6a.WSs 9,%:{!2d^608zgJE?]aH֗d؃s{{_}ob fN.G,}3ۣЋ۩||57f|%mxE /wpttgW/hęl|#d÷^ٵSY7yqɣ Z0:RT$#jTQ^R?Cf`ӌ@D95Q&mg*;wQ=¾7 p&'}#=NTBW;;I)h +%ZrjM[R/+Qla녿Q!ƔEX~ŢZ9b Yޘ&3MTܣEsܥ»' 0]kЁՍv%A1kMO1DL\]^Hl:&-9'c5\(?Eg+VX^otn5(I M/ rDZʄPLFΎK c$ɩ=^S7 d3Qޣh4WA%S[V۝|z6sw+|۴|f|q&h~M0nV￱pQ+Ax 9om*4:n<ȑfnpcMq kc_/t]U@H۟Ѝq9OLʘI?)¢&Ч(k!Xhbhw,PWQ|vE1پ^aeuhpzkc(OXR}-Rq㣜%-<$)g_kjjS]ooq(&vAC`Υ%|1Kh5//S0Ӥh|@Y$.Ne/P9aI`=u4w}2#R7X,hԺ7?ꭜIl:E]6Dh/3wϣ8R_U#:2ݻĩĔ`HƒgzEXs^<"k9V?}?__'kn^/UP4, -#w7k-1a^v]Gv0+)6^z p\ RW ^jpN rt(Vf7z=by_ 4{'BMn-5tDK֤h0[I,>=O<=O<=O<=O<=[kmailfilter-0.8.9/contrib/xmailer.sh000066400000000000000000000011161430510321000173010ustar00rootroot00000000000000#!/bin/sh ##### # (C) Kay Schulz # Licensed under the same terms as Mailfilter, GPL v2 or later. # Use at your own risk! # Needs getmailer.pl # Calculates the amount how often a mailclient # was used. # E.g. # 28 The Bat! (v1.33) # 29 Internet Mail Service # 29 The Bat! (v1.53d) # 33 Wmx-0.3 # 36 Microsoft Outlook CWS, # Is not perfect, because the naming of the mailclients, # particularly for the different OE versions is not unique # But it gives an overview. ##### zgrep -i X-Mailer log/mailfilter.log* | getmailer.pl | awk '{print $3 " " $4 " " $5}' | sort | uniq -c | sort -n mailfilter-0.8.9/doc/000077500000000000000000000000001430510321000144125ustar00rootroot00000000000000mailfilter-0.8.9/doc/Doxyfile.in000066400000000000000000000720561430510321000165370ustar00rootroot00000000000000# Doxyfile.in: create a Doxyfile (doxygen configuration file) from a template # $Id: Doxyfile.in,v 1.4.4.1 2003/07/20 20:41:45 baueran Exp $ # Doxyfile 1.2.3 # This file describes the settings to be used by doxygen for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # General configuration options #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = @PACKAGE@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = api # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese, # Korean, Hungarian, Spanish, Romanian, Russian, Croatian, Polish, # Portuguese and Slovene. OUTPUT_LANGUAGE = English # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these class will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. It is allowed to use relative paths in the argument list. STRIP_FROM_PATH = # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a class diagram (in Html and LaTeX) for classes with base or # super classes. Setting the tag to NO turns the diagrams off. CLASS_DIAGRAMS = YES # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower case letters. If set to YES upper case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # users are adviced to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like the Qt-style comments (thus requiring an # explict @brief command for a brief description. JAVADOC_AUTOBRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # reimplements. INHERIT_DOCS = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # The ENABLE_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. # please keep this list in sync with the mailfilter_SOURCES variable in ../src/Makefile.amx INPUT = ../src/mailfilter.cc \ ../src/mailfilter.hh \ ../src/feedback.cc \ ../src/feedback.hh \ ../src/preferences.cc \ ../src/preferences.hh \ ../src/connection.hh \ ../src/protocol.hh \ ../src/protocol.cc \ ../src/socket.hh \ ../src/socket.cc \ ../src/pop3.cc \ ../src/pop3.hh \ ../src/filter.hh \ ../src/filter.cc \ ../src/score.hh \ ../src/account.hh \ ../src/account.cc \ ../src/apop.hh \ ../src/apop.cc \ ../src/i18n.hh \ ../src/md5c.c \ ../src/md5.h \ ../src/getopt.c \ ../src/getopt.h \ ../src/getopt1.c # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. EXCLUDE_PATTERNS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. INPUT_FILTER = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse. FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = YES # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimised for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = YES # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using a WORD or other. # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assigments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = YES # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. Warning: This feature # is still experimental and very incomplete. GENERATE_XML = NO #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_PREDEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = #--------------------------------------------------------------------------- # Configuration::addtions related to external references #--------------------------------------------------------------------------- # The TAGFILES tag can be used to specify one or more tagfiles. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to # YES then doxygen will generate a graph for each documented file showing # the direct and indirect include dependencies of the file with other # documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to # YES then doxygen will generate a graph for each documented header file showing # the documented files that directly or indirectly include this file INCLUDED_BY_GRAPH = YES # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found on the path. DOT_PATH = # The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_WIDTH = 1024 # The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_HEIGHT = 1024 # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES #--------------------------------------------------------------------------- # Configuration::addtions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO # The CGI_NAME tag should be the name of the CGI script that # starts the search engine (doxysearch) with the correct parameters. # A script with this name will be generated by doxygen. CGI_NAME = search.cgi # The CGI_URL tag should be the absolute URL to the directory where the # cgi binaries are located. See the documentation of your http daemon for # details. CGI_URL = # The DOC_URL tag should be the absolute URL to the directory where the # documentation is located. If left blank the absolute path to the # documentation, with file:// prepended to it, will be used. DOC_URL = # The DOC_ABSPATH tag should be the absolute path to the directory where the # documentation is located. If left blank the directory on the local machine # will be used. DOC_ABSPATH = # The BIN_ABSPATH tag must point to the directory where the doxysearch binary # is installed. BIN_ABSPATH = /usr/bin/ # The EXT_DOC_PATHS tag can be used to specify one or more paths to # documentation generated for other projects. This allows doxysearch to search # the documentation for these projects as well. EXT_DOC_PATHS = mailfilter-0.8.9/doc/FAQ000066400000000000000000001076121430510321000147530ustar00rootroot00000000000000Mailfilter Frequently Asked Questions and Answers General Questions: * What is Mailfilter? * Who needs Mailfilter? * How does Mailfilter interact with my current e-mail environment? * Where do I find out more about Mailfilter? * I think, I found a bug in Mailfilter. Will you fix it? * I have good ideas for new features. Will you implement them? * Mailfilter is wonderful. How can I support this project? Installation: * What are the system's requirements to install and run Mailfilter? * What should I know to make Mailfilter run on Windows 9x/2000/NT/XP? * How do I install Mailfilter? * Running 'configure' doesn't work. * Running 'make' doesn't work. * Running 'make' was easy, but running 'make install' doesn't work. * Why doesn't the compiler like my flex output, or complains about wrong declarations? * Is there any way to decrease the size of the mailfilter binary? Configuration: * Mailfilter complains that its rcfile ($HOME/.mailfilterrc) is missing. * Mailfilter complains that its logfile can't be accessed. * Mailfilter complains about the syntax of my rcfile. * How do these filters work? What are Regular Expressions anyway? * Is it possible to define what should be delivered, rather than vice versa? * Can I override some filters? (How to define 'friends'/trusted lists) * Is it possible to split the rcfile into several smaller files? * How do I get rid of messages sent in exotic (e.g. Asian) languages (unknown to me)? * How do I fine tune other programs to work with Mailfilter? * I'm using multidrop mail collection with fetchmail and can't get Mailfilter to work. * Are there any sample rcfiles ($HOME/.mailfilterrc) ? * I am scared to try out Mailfilter, cause I might accidently delete everything! Run-time Errors: * Because of some missing libraries, Mailfilter won't start. * Mailfilter complains that a specific file couldn't be accessed. * I get DNS lookup errors. * Mailfilter says it sent a specific command to the server, but it responded with an error. * Mailfilter says that some keyword is deprecated. * The compilation of Regular Expressions failed. * I frequently get an error message saying that my mail server is not responding. * Help, Mailfilter hangs! Special Features: * Can Mailfilter check more than one account? * Does Mailfilter support any other protocols besides POP3? * Is there a way to send encrypted password information to the server? * Mailfilter logs are so plain; I'd like to have better spam-statistics! * How can I get Mailfilter to auto-reply to spam? Miscellaneous: * I think I accidently deleted an important e-mail with Mailfilter. Can I get it back somehow? * If I make changes to rcfile, does it affect immediately? * Sometimes a few (spam-) messages slip through. How come? * What's this cron business? * My question is not covered by this FAQ. Help!! _________________________________________________________________ General Questions: What is Mailfilter? Mailfilter is a flexible utility for UNIX (-like) operating systems to get rid of unwanted spam mails, before having to go through the trouble of downloading them into the local computer. It offers support for one or many POP accounts and is especially useful for dialup connections via modem, ISDN, etc. Mailfilter connects to any POP mail box and compares part of its content to a set of user defined filter rules. That way the spam gets deleted directly on the mail server. With Mailfilter you can define your own filters (rules) to determine which e-mails should be delivered and which are considered waste. Rules are Regular Expressions, so you can make use of familiar options from other mail delivery programs such as e.g. procmail. Mailfilter is released under the terms of the GNU General Public License. For more information, see the README and COPYING documents provided with the Mailfilter program. Who needs Mailfilter? If you do not pick up your e-mail from a POP server, then there is no need to install Mailfilter. But if you do get your e-mail from one or many POP accounts and if you are sick and tired of downloading megabytes of worthless spam (usually those are anonymous advertisements, chain mails, etc.), then you should give Mailfilter a try. It will help save you band width and time by deleting spam directly on your server, before you have to download and read those messages. By defining your own personal filter rules, you can tell Mailfilter which e-mails should be deleted. How does Mailfilter interact with my current e-mail environment? It doesn't matter which programs you use to fetch your mail with, because Mailfilter is an independent application. It will not interfere with your favourite e-mail client. You may just want to start Mailfilter every time you are about to download new e-mail from a POP server, or maybe just once a day. That's entirely up to you. However, if you are using highly configurable mail programs such as fetchmail, then there are some clever ways to get Mailfilter cooperate with them directly. Section "How do I fine tune other programs to work with Mailfilter?" describes this in more detail. Where do I find out more about Mailfilter? All relevant documentation for Mailfilter (including this FAQ) is provided with the Mailfilter distribution. Online versions of some of these documents are available on the official Mailfilter homepage: http://mailfilter.sourceforge.net/ On this homepage you may also find additional information on Regular Expressions and related links to other programs that work well with Mailfilter. If you have already installed the program, be sure to read the man pages mailfilter(1), mailfilterrc(5) and mailfilterex(5). I think, I found a bug in Mailfilter. Will you fix it? If it's really a bug that you found (and not a feature), then I will of course try to do something about it. Generally it's a good idea to report bugs to the mailing list mailfilter-dev@lists.sourceforge.net, but you can also directly contact the author of Mailfilter. When you report bugs, please provide as much additional information as possible on what may have caused the problems and what consequences you suffered. Such information always includes the name of your operating system and hardware platform, description of your network connection and excerpts from the Mailfilter log files. When creating a log file, please use the highest level of verbosity available. mailfilter --verbose=6 Older versions of Mailfilter do not hide your passwords in the logs. Remove these entries before posting anything to the mailing list! I have good ideas for new features. Will you implement them? Of course that depends on the feature you are asking for. There are some frequently requested features ('autoreply' ranks very high) that will most likely never make it into the source code, but at this point I am sure Mailfilter could be expanded with dozens of useful additions and I'm glad to hear about them (if they are not too far 'off the track'). I'm even more glad if you're able to help implement them. Mailfilter is wonderful. How can I support this project? There are many ways to express your appreciation: you could join forces and submit code, but even if you are not a programmer, you could still contribute by sending bug reports, suggestions or useful add-on scripts to our mailing list(s). Every contribution is welcome! Albeit, there is also a web page to donate money to the project. The money would help immensely in keeping the web pages up to date (i.e. cover ISP costs), in answering user feedback and questions via e-mail or mailing lists and in affording additional hardware for testing purposes (i.e. extra hard disks with alternative operating systems). Mailfilter is free software, which means it also depends on the support it gets from the community. _________________________________________________________________ Installation: What are the system's requirements to install and run Mailfilter? Here is an excerpt from the INSTALL file that is part of the source archive of Mailfilter: "To run Mailfilter it's best to have a UNIX (-like) operating system, but it also compiles fine with Windows 9x/NT/2000 if additional libraries and tools are installed (e.g. Cygwin or DJGPP). So far Mailfilter has been successfully compiled and tested with * Solaris 8 / SunOS 5.8 * Irix 6.5 * FreeBSD 4.1.1-RELEASE, 4.5-RELEASE * Mac OS X 10.0 * NetBSD 1.5 * Linux: Mandrake 7.0 - 8.2, Debian 2.1 - 3.0, RedHat 6.2 - 7.1, Slackware 3.9 (See doc/README.Slackware for further details), SuSE 6.2, LinuxPPC * Windows NT, 2000, XP (using Cygwin) but it may well work on other platforms, too. (Please report success if you have managed to compile it on any other system - thanks.) To compile/install Mailfilter you also need to have a fairly recent version of a (GNU) C++ compiler (e. g. GCC >= 2.95.2) and your system must support BSD-type sockets (in general all UNIX systems do meet this criterion). For compilation you will also need some of the GNU autotools (gettext, m4) and the programs flex (http://lex.sf.net/) and yacc (or the GNU substitute bison (http://www.gnu.org/software/bison/)). Attention: GNU flex is unlikely to work with recent compiler releases. So, if you experience compile problems, please use flex from http://lex.sf.net/. GNU flex is broken! What should I know to make Mailfilter run on Windows 9x/2000/NT/XP? Mailfilter was originally designed to only support UNIX (-like) operating systems. But if you have additional libraries such as the Cygwin environment, DJGPP or MinGW installed, then you should also be able to translate the program on your Windows 9x/2000/NT/XP platform. How do I install Mailfilter? If you have downloaded the compressed Mailfilter source code archive, then please refer to the INSTALL file provided by that archive. Binary packages (if available for a particular program version) should be installed as any other package of that kind. For example you could use the command 'rpm -U packagename.rpm' for the RedHat packages. Note: even if you did not encounter any problems installing the program, I strongly recommend reading the INSTALL file anyway in order to find out about the set-up of Mailfilter. The program does not work without spending a little bit of time on configuration first. Running 'configure' doesn't work. If your system lacks some of the requested features/libraries/compilers, then try installing them and run 'configure' again. But don't forget to remove the file config.cache first, or the new components can not be found. If it's a more serious problem that can't be fixed that way, consider reporting it as bug. Running 'make' doesn't work. On Linux systems the command 'make' typically refers to GNU's gmake. Various BSD- and Unix-systems ship with different (non-GNU) versions of make though. In that case you need to be sure that the right version of make is invoked by typing 'gmake', instead of just 'make' (and later 'gmake install' instead of 'make install'). Another common reason why 'make' might fail could be related to your system's C++ compiler and its libraries. It's easiest to use GNU CC (gcc), even though other C++ and C compilers should work as well. But keep in mind that GNU CC releases prior 2.95.x don't know C++ namespaces and therefore choke on Mailfilter's source code. So, be up to date. A not so obvious reason why compilation abords could be related to broken versions of the program flex. Please read section 2.7 of this document for further information on this issue. Running 'make' was easy, but running 'make install' doesn't work. The most common cause for this behaviour is that you are trying to install Mailfilter into a directory where you do not have the necessary permissions to write in. Either reconfigure your Makefile with these options make clean ./configure --prefix=/newdir where 'newdir' points to the new location for Mailfilter, or simply become 'root' and then run 'make install' again. By default this will install the software in /usr/local/bin. Why doesn't the compiler like my flex output, or complains about wrong declarations? Because most likely you are using a broken version of GNU flex. Basically, you have two choices to resolve the problem: a) you can stick with GNU flex and try using an outdated release of GCC, or b) you try replacing the (broken) GNU flex with a more compatible version available from http://lex.sf.net/. Is there any way to decrease the size of the Mailfilter binary? For users of UNIX-like systems, yes. When installing the program, running 'make install-strip' instead of 'make install' will strip the binary as it installs it, drastically decreasing its size. If you've already installed mailfilter, but still wish to strip the binary, become root, and use the strip command. See the manual page of strip(1) for more information. _________________________________________________________________ Configuration: Mailfilter complains that its rcfile ($HOME/.mailfilterrc) is missing. Read the INSTALL file provided with Mailfilter, in which you will find an example rcfile set-up. Copy and paste this example, modify it to suit your own needs and restart Mailfilter. (Alternatively you can also look up the official homepage to find a basic set-up that gets you started very conveniently.) If the program still complains, then try to start it with the '--mailfilterrc' switch, pointing directly to the new location of your rcfile. Note: you must have a rcfile file installed somewhere. Mailfilter complains that its logfile can't be accessed. Every rcfile must set the LOGFILE option. Check the given path of your logfile in the rcfile, or simply start Mailfilter with the '--logfile' switch pointing directly to the desired location. If that doesn't help, then check the permissions of the directory where you want Mailfilter to store its logs in. It has to be writable. Mailfilter complains about the syntax of my rcfile. Not to worry, you probably misspelled a word or two in the rcfile, or you have a couple of blanks hidden at the end of your command's parameters. Read through your settings carefully and check for redundant white space characters. Typically an entry in $HOME/.mailfilterrc looks like this COMMAND_NAME = MyParameter The command (not necessarily written in capitals) is followed by the '=' and there are no white space symbols (blanks, tabs, etc.) hidden after the parameter. Each command has to be in a separate line of the config file. How do these filters work? What are Regular Expressions anyway? With Mailfilter you can define your own filter rules to determine which e-mails are considered waste and what should be downloaded into your local computer. Such rules are defined by using Regular Expressions. It is very common for these kinds of programs to employ this technique because of its great flexibility. Consider this simple example: if you are not interested to get the 200th advertisement containing information about Viagra, you might want to add this to the end of your rcfile DENY = "^Subject:.*Viagra" Now every e-mail that contains anything about Viagra in the subject line gets deleted right away. You can create similar rules for all of the other header fields (cc, To, From, etc.), but be aware of the fact that Mailfilter does not allow more than one line per rule. So each new filter must be placed in its own line starting with 'DENY'. If you don't want the filter rules to be case-sensitive then you also have to add this line to your rcfile: REG_CASE = "no" A comprehensive list of all supported keywords can be found in the mailfilterrc(5) man page. More examples and real-life use cases can be looked up in the mailfilterex(5) man page. Study these documents carefully! If you're eager to know how Regular Expressions work in general, use your favourite UNIX book or have a look at the official Mailfilter homepage. There you will find some enlightening links on this subject. Is it possible to define what should be delivered, rather than vice versa? Yes, by creating a negative filter. Negative Filters are quite restrictive, so you should make sure that you have fully understood how these are set up and how they work. DENY<>"^(To|Cc):.*my-email@address\.com" Having a simple rule like this added to your rcfile, Mailfilter will delete every message which is not directly sent to your e-mail account. That is, if there is a message that can't be matched to the above, then it automatically qualifies as spam. Can I override some filters? (How to define 'friends'/trusted lists) Yes, using the keyword ALLOW you can define which messages should be delivered, regardless of any spam filters that might match. This way you can not only define 'friends' lists, but also create a very restrictive rule set. Consider this example: DENY = "^From:.*@spam_isp.org" ALLOW = "^From:.*my_friend@spam_isp.org" Adding these two lines to your rcfile will filter all messages coming from the domain 'spam_isp.org', except for those from your friend 'my_friend' (who should obviously change his ISP). A comprehensive list of all supported keywords can be found in the mailfilterrc(5) and mailfilterex(5) man pages. Study them carefully! Is it possible to split the rcfile into several smaller files? This is a feature, officially supported since version 0.3.3 of Mailfilter. Use the keyword INCLUDE in your main rcfile to load additional program configuration. However, the nesting may only be one level deep, i.e. the files included must not include further files. Consider this example: # From within $HOME/.mailfilterrc we load three # additional config files INCLUDE = "/home/myusername/.mailfilter/servers" INCLUDE = "/home/myusername/.mailfilter/filters" INCLUDE = "/home/myusername/.mailfilter/friends" How do I get rid of messages sent in exotic (e.g. Asian) languages (unknown to me)? Spam is not only a European or American illness. In fact a lot of it comes from Asia and a lot of that reaches people who can not read nor understand what arrives in their mail boxes. The following filters will help you to get rid of e-mails that contain 'unusual' subject tags. Consider some excerpts from a typical logfile: Subject: ·ADSL/CABLE/ISDN/PSTN/SWITCH Subject: ǿƼ(www.I_am_a_Spammer.com) Subject: 70ҵϢ All these subjects have one thing in common: They use characters which do not fit into the ordinary range of displayable ASCII symbols. A hexdump of the last subject line will help to illustrate this: 0000 53 75 62 6a 65 63 74 3a 20 37 30 cd f2 c6 f3 d2 0010 b5 d0 c5 cf a2 .. .. .. .. .. .. .. .. .. .. .. Even though it is possible to create filters matching these strings, it takes a bit of work, since most Regular Expression libraries that today's operating systems provide do not support octal or hex escapes (something like [\x80-\xfc]). In fact, the negative (and case sensitive) message filters are our weapon of choice here: DENY_CASE<>"^Subject: [][A-Za-z0-9 ^ ^^ ^^^^^^^ 1 23 4 :;.,!"$%&/()=?{}_<>#~'` |@*+^\-]+$" ^^ ^^^^ 5 6278 There are some important issues in this expression, numbered from 1 - 8: 1. See 8. 2. These brackets '[]' enclose a character class. 3. We want to allow these brackets, too. The only position where to put the closing bracket into a character class is the first one. 4. For those who want to allow German subjects. (Modify this to fit your own needs for Scandinavian languages, etc.) 5. Attention: There are two different single quotes from the upper right to the lower left. 6. Inside a character class the hyphen '-' is a meta symbol to set a range of characters (take a look at the beginning). In order to get the actual literal '-', it must be positioned at the end of the class. 7. Indicates that the preceding character or character class has to be present at least once. 8. In order to force the mail's originator to only use these characters in the subject line, there must not exist any preceding or following characters. That is the preceding character has to be the start of the line, the following character has to be the end of the line. On a UNIX-like system you usually need to switch off the locale first ('handling of different country characteristics'), so the internal Regular Expression compile-process does not get confused. If you are calling a script for filtering and getting messages, you could use something similar to this: #!/bin/sh # Remove locale L=$LANG unset LANG # Get mails /usr/local/bin/fetchmail $* # Restore locale LANG=$L Alternatively it is also possible to create a straight forward filter that matches non-ISO-8859-1 messages (or at least almost). The standard ISO-8859-1 is an extension to the ASCII character set (i.e. the first 128 characters are the same, greater numbers encode symbols, accents, etc.) and supports the following languages: Afrikaans, Basque, Catalan, Danish, Dutch, English, Faeroese, Finnish, French, Galician, German, Icelandic, Irish, Italian, Norwegian, Portuguese, Spanish and Swedish. There is a draw back though: the filter we're presenting here accepts only special German characters (umlauts) as extension and is therefore not fully ISO-8859-1 compliant. However, you might consider it useful anyway. Read the filter as one single line: # A filter that only accepts ASCII characters and also # German umlauts as extension DENY_NOCASE = "^Subject:.*=\?ISO-8859-1\?Q\?.*= ([0189][[:xdigit:]]|[7F]F|A[0189A-F]| B[1235-9A-F]|[CE][0-35-9A-F]|[DF][0-5789ABDE])" Needless to say, you need to have extended Regular Expressions enabled (Mailfilter's default are basic expressions) in order to create such complex rules. (This truly frequently asked question was patiently worked out and answered by Til Schubbe.) How do I fine tune other programs to work with Mailfilter? As always, there are various ways to achieve this. I have chosen the commonly used application fetchmail to explain how this works. (Similar options are available in other mail programs, such as KMail.) Fetchmail is a nifty program that downloads e-mail from POP accounts (it also supports other protocols). Therefore it's a very tempting idea to use the clean up services of Mailfilter before we're starting to receive huge amounts of junk in between our normal e-mail messages. Adding one single line to the fetchmail set-up file does the trick: poll my.mailserver.de via "my.mailserver.de" with proto POP3 localdomains mailserver.de user "username" there with password "pass" is tuxuser here options forcecr warnings 3600 preconnect "mailfilter" poll my2.mailserver.de via "my2.mailserver.de" with proto POP3 localdomains mailserver.de user "anotherusername" there with password "other_pass" is tuxuser here options forcecr warnings 3600 The line 'preconnect "mailfilter"' tells fetchmail to invoke Mailfilter each time the user requests the download of new e-mail messages. If Mailfilter is set up to check both of the given accounts then calling it merely once is sufficient. Another very good (and popular) way of using Mailfilter is to call it via cron, or just once upon login. That way you won't see much of it either and can work with your favourite e-mail program just as you are used to - except you won't be disturbed by spam anymore. I'm using multidrop mail collection with fetchmail and can't get Mailfilter to work. Peter T. Garner contributed this one: consider an environment in which six users collect mail via fetchmail's multidrop mechanism, but want their messages checked for spam first. That's no problem if you mind the right syntax and add something like this to your fetchmail set-up: set postmaster "root" set properties "" set bouncemail set syslog poll pop.something.net with proto POP3 envelope Envelope-to aka something.rather.co.uk user anything.anyone.co.uk there with password TOP_SECRET to peterg = peterg annie = annie gemma = gemma lizzy = lizzy bob = bob here options preconnect "mailfilter --mailfilterrc=/etc/mailfilter.rc" Are there any sample rcfiles ($HOME/.mailfilterrc) ? Yes, there are. You can find one in the INSTALL guide provided with Mailfilter, or check the rest of the documentation for additional 'rcfile.example' files. A comprehensive list of all supported keywords can be found in the mailfilterrc(5) and mailfilterex(5) man pages. Study them carefully! I am scared to try out Mailfilter, cause I might accidently delete everything! No, you won't. If you are new to Mailfilter, place this line in your rcfile before running the program for the very first time: TEST = "yes" This makes sure you are not losing any mail at all, including spam. When Mailfilter is in test mode it only simulates the deletion of e-mail and you can see how good your filters would work - in theory. Once you have come to a point where you are happy about their behaviour you can remove this command from your rcfile again and start to seriously kill the spam. _________________________________________________________________ Run-time Errors: Because of some missing libraries, Mailfilter won't start. So far I have only witnessed this behaviour on a poorly administered Solaris machine. If you get an error message similar to this ld.so.1: ./mailfilter: fatal: libstdc++.so.2.10.0: open failed: No such file or directory then your library path is not set properly. To fix the problem, simply type something like this in your shell (if it's bash - otherwise you may have to use 'set' instead of 'export') depending on the path of your libraries (sometimes they're also in /opt/lib) export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH Mailfilter complains that a specific file couldn't be accessed. Most likely you need to fix up your Mailfilter configuration. Please refer to the "Configuration" section in this FAQ. I get DNS lookup errors. Such errors occur when the Domain Name Server failed to resolve the name of your mail server. This either happens when you have misspelled the server name in your rcfile, or when you are trying to start Mailfilter even though you have not established a network connection first. Mailfilter says it sent a specific command to the server, but it responded with an error. Usually these errors occur when you are trying to get your mail from a server that does not fully support the POP3/APOP transfer protocol. But you can also get this behaviour if your network connection (or only the connection to the POP3 server) drops during a mail box examination. In this case, simply try to invoke Mailfilter again. If that doesn't fix it, consider reporting a bug. Mailfilter says that some keyword is deprecated. This may happen occasionally when updating from an old version of Mailfilter to a new one. Usually the program suggests a new keyword in its error message though. But you can also look up the proper definition in the documentation files that come with the Mailfilter distribution, or consult the mailfilterrc(5) man page. It contains a comprehensive list of all supported and deprecated keywords. The compilation of Regular Expressions failed. Extended Regular Expressions are not 100% compatible to the basic kind of expressions. Check if you have set Mailfilter to support extended expressions (keyword REG_TYPE) and adjust your filters if necessary. I frequently get an error message saying that my mail server is not responding. You have to use the keyword TIMEOUT in order to increase the response time out value. The default is set to 30 seconds, but in some occasions a higher value might be necessary, because some mail servers take longer to send a response, than others. This behaviour can also be experienced on slow or extremely busy network connections. Help, Mailfilter hangs! Depending on your machine's operating system and configuration you might run into trouble with the deployed Regular Expression library. Mailfilter depends on that component to match the user defined spam filters. It has been reported that certain library implementations do not like (very) large strings and therefore stop Mailfilter when it tries to process e-mails with big headers. The Internet standard RFC 822 explicitly forbids any header description to exceed the 998 byte limit. So, you should use MAXLENGTH in your rcfile to make sure no strings larger than 998 characters are being processed by Mailfilter. All the different Regular Expression libraries should be able to happily handle that size, too. Please note that MAXLENGTH also overrides your friendly ALLOW rules. So it's probably a good idea to deploy this feature only if you have experienced this peculiar program behaviour yourself! _________________________________________________________________ Special Features: Can Mailfilter check more than one account? Of course it can. Personally, I despise all e-mail programs that have such stupid limitations. How many users nowadays have only one account anyway? Does Mailfilter support any other protocols besides POP3? Yes, it does: POP3 and APOP (= encrypted POP3) are implemented. Support for the IMAP protocol is also planned. Is there a way to send encrypted password information to the server? It is possible to tunnel Mailfilter through ssh (Secure-Shell). Brian Hall has provided a shell script and some comments on this issue. This solution requires a password-less login to your server/shell account though. #!/bin/sh # Script to restart the ssh tunnel if tunneled ports are failed /usr/local/bin/mailfilter -M /home/hallb/.mailfilterrc | \ grep "timed out" > /dev/null 2>&1 || exit # Find pid of sleeping ssh tunnel process /bin/kill `/bin/ps wx | /bin/grep -v grep| /bin/grep \ "ssh -i /root/.ssh/script_id -g shell.pcisys.net -f" | \ /bin/awk '{print $1}'` > /dev/null 2>&1 # Start ssh tunnel process /usr/bin/ssh -i /root/.ssh/script_id -g shell.pcisys.net -f \ /bin/sleep 999999999 < /dev/null > /dev/null 2>&1 Mailfilter logs are so plain; I'd like to have better spam-statistics! Roland Smith has come up with a simple, yet efficient way to create nice monthly spam-statistics. This shell script summarises the main log file: #!/bin/sh # -*- shell-script -*- # Id: spamsort,v 1.3 2002/03/14 18:47:39 rsmith Exp rsmith # # 2003/10/03 12:46:28 extension from Simon Brandmair: now shows MAXSIZE_DENY hits LOG = "/var/log/mailfilter" cat $LOG |awk '/Deleted/ {print $NF}'|sed 's/]//g'| \ sed -e 's/^.*[/][0-9]*$/MAXSIZE_DENY exceeded/' | \ sort|uniq -c|sort -r The output of this script looks something like this: 384 '^Content-Type:.*text/html.*' 261 '<>^(To|Cc):.*rsmith@xs4all.nl' 189 '^(From|Received):.*hotmail.com.*' 110 '^(From|Received|Reply-To):.*yahoo.com.*' 51 '^(From|Received|Reply-To):.*hotmail.com.*' 40 '^Subject:.*adult.*' 36 '^(From|Received|Reply-To):.*yahoo.*' 26 '^(From|Received):.*aol.com.*' 21 duplicate 18 '^(From|Received):.*listmanpro.com.*' 17 '^From:.*e.*direct.com.*' 14 '^Mailing-List:.*double-optin.*' 12 '^(From|Received):.*investorsalley.com.*' 11 '.*hardcore.*sex.*' 10 '^From:.*optmailing.com.*' 10 '^From:.*freeoptinfo.com.*' 7 '^From:.*horny18.net.*' 5 '^Subject:.*rsmith@xs4all.nl.*' 5 '^Received:.*listbuilder.com.*' 5 '^From:.*msn.com.*' 2 '^From:.*thenewpornsite.com.*' 1 material.*' 1 '^From:.*insync-palm.com.*' 1 '^(From|Received):.*sexrave.com.*' 1 '<>^From:.*@.*' How can I get Mailfilter to auto-reply to spam? You can't and this is a feature that will never be implemented either. I started the Mailfilter project to prevent e-mail abuse in general not to give people a weapon to fight fire with fire. Apart from that it would be considered a criminal offense in most countries (including the one I'm living in) to answer a mail bomb with your own mail bomb. _________________________________________________________________ Miscellaneous: I think I accidently deleted an important e-mail with Mailfilter. Can I get it back somehow? Tough. Once Mailfilter deleted an e-mail, all you get to see of it is where it came from, what it was about and when it was sent. Have a look in your logfile and ask the author to send it again. If that's not an option for you, you may want to ask your ISP to recover this message for you, though I doubt this would be a very successful undertaking. If I make changes to the rcfile, does it affect immediately? If you are changing Mailfilter's settings while it's active, nothing special will happen. All changes you make in the rcfile will be considered next time you run the application. Sometimes a few (spam-) messages slip through. How come? This is not a bug in Mailfilter. Consider this a feature of every POP e-mail server. Once you start checking for spam or downloading messages, the server locks your mail box. If new messages arrive during the locked state, they will be queued and provided for further processing after the lock has been removed. So Mailfilter does not see incoming messages while it checks for spam and sometimes it happens that a message or two arrive just in time to be too late for filtering, but in time for download. That's life. What's this cron business? Cron. It's the way to run tasks on a schedule in Unix. Say, for example, I wanted to run mailfilter once every minute of every day. Well, we think of it this way: minute hour day month day_of_week command_here A quick explanation what it all means: * The first field specifies the minute (0 to 59). * The second field specifies the hour (0 to 23). * The third field specifies the day of the month (1 to 31). * The fourth field specifies the month of the year (1 to 12). * The fifth field specifies the day of the week (0 to 6 for Sunday to Saturday). * The sixth field specifies the command to be executed. So, for a quick example, if I wanted something to run every night at 3 AM, I would use the following (an asterisk is the same as saying "anything"). 0 3 * * * mailfilter Or, lets say I wanted every weekday (days 1-5) every hour at half past the hour: 30 * * * 1-5 mailfilter Or, every 10 minutes (which is what I use) 10,20,30,40,50 * * * * mailfilter (Thanks to Matt Cowger for answering this FAQ.) My question is not covered by this FAQ. Help!! This FAQ can never be a 100% complete guide, covering all possible aspects of the Mailfilter program. That is the reason why we have created a mailing list where we discuss the various aspects of spam killing and how to use Mailfilter. Feel free to subscribe and ask your questions. In urgent or very special cases, however, you can also contact me directly, the author of Mailfilter. Maybe the question will be just another candidate for the FAQ. mailfilter-0.8.9/doc/Makefile.am000066400000000000000000000030071430510321000164460ustar00rootroot00000000000000# Makefile.am: help build documentation files # $Id: Makefile.am,v 1.11.2.1.2.2 2004/01/25 12:56:37 baueran Exp $ # # Copyright (c) 2000 - 2004 Andreas Bauer # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. EXTRA_DIST = FAQ supported_servers @MAINT@doxygen: Doxyfile @MAINT@ doxygen Doxyfile dist-hook: if test -d $(srcdir)/api; then \ mkdir $(distdir)/api ;\ fi if test -d $(srcdir)/api/html; then \ mkdir $(distdir)/api/html ;\ cp $(srcdir)/api/html/* $(distdir)/api/html ;\ fi if test -d $(srcdir)/api/latex; then \ mkdir $(distdir)/api/latex ;\ cp $(srcdir)/api/latex/* $(distdir)/api/latex ;\ fi if test -d $(srcdir)/api/man; then \ mkdir $(distdir)/api/man ;\ cp -r $(srcdir)/api/man/* $(distdir)/api/man ;\ fi if test -d $(srcdir)/api/rtf; then \ mkdir $(distdir)/api/rtf ;\ cp $(srcdir)/api/rtf/* $(distdir)/api/rtf ;\ fi mailfilter-0.8.9/doc/supported_servers000066400000000000000000000012431430510321000201330ustar00rootroot00000000000000Mailfilter Supported Servers -=-=-=-=-=-=-=-=-=-=-=-=-=-= AGWPE v2000.70 Cyrus POP3 Server IMail 7.04 NT-POP3 Server Netscape iPlanet 4.1 POP3 v7.64 QPOP 3.1.2 Tiscali POP3 Proxy v1.0 UWASH POP3 Server 3.3(18) ---------------------------------------------------------------------------- This list is not complete. It contains servers that have been successfully tested with Mailfilter. Other POP3 servers not listed here should work just fine, too. You can help to expand this list by sending successfully tested, yet unlisted server names to . Thank you. ---------------------------------------------------------------------------- mailfilter-0.8.9/m4/000077500000000000000000000000001430510321000141655ustar00rootroot00000000000000mailfilter-0.8.9/m4/ChangeLog000066400000000000000000000015601430510321000157410ustar00rootroot000000000000002002-10-06 gettextize * codeset.m4: New file, from gettext-0.11.5. * gettext.m4: New file, from gettext-0.11.5. * glibc21.m4: New file, from gettext-0.11.5. * iconv.m4: New file, from gettext-0.11.5. * intdiv0.m4: New file, from gettext-0.11.5. * inttypes.m4: New file, from gettext-0.11.5. * inttypes_h.m4: New file, from gettext-0.11.5. * inttypes-pri.m4: New file, from gettext-0.11.5. * isc-posix.m4: New file, from gettext-0.11.5. * lcmessage.m4: New file, from gettext-0.11.5. * lib-ld.m4: New file, from gettext-0.11.5. * lib-link.m4: New file, from gettext-0.11.5. * lib-prefix.m4: New file, from gettext-0.11.5. * progtest.m4: New file, from gettext-0.11.5. * stdint_h.m4: New file, from gettext-0.11.5. * uintmax_t.m4: New file, from gettext-0.11.5. * ulonglong.m4: New file, from gettext-0.11.5. * Makefile.am: New file. mailfilter-0.8.9/m4/Makefile.am000066400000000000000000000003511430510321000162200ustar00rootroot00000000000000EXTRA_DIST = codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4 acinclude.m4 mailfilter-0.8.9/m4/acinclude.m4000066400000000000000000000006051430510321000163570ustar00rootroot00000000000000AC_DEFUN([PETI_ENABLED_DYNAMIC_LINKING], [ AC_MSG_CHECKING(whether what binaries we shall create) AC_ARG_ENABLE(dynamic-link, [ --enable-dynamic-link Create dynamically linked binaries (default)], if test "$enableval" = "yes"; then AC_MSG_RESULT(dynamically linked) else LDFLAGS="$LDFLAGS -static" AC_MSG_RESULT(statically linked) fi, AC_MSG_RESULT(dynamically linked)) ]) mailfilter-0.8.9/mailfilter.spec.in000066400000000000000000000065231430510321000172640ustar00rootroot00000000000000# mailfilter.spec: used for building rpms. # $Id: mailfilter.spec.in,v 1.18.2.4.2.1 2004/06/02 19:45:37 baueran Exp $ # -*- rpm-spec -*- %define name mailfilter %define version 0.7.1 %define release 1 Name: %{name} Version: %{version} Release: %{release} Summary: A program that filters your incoming e-mail to help remove spam. Copyright: GPL Group: Applications/Internet Source: %{name}-%{version}.tar.gz Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root URL: http://mailfilter.sourceforge.net/ Packager: Andreas Bauer %description Mailfilter is very flexible utility for UNIX (-like) operating systems to get rid of unwanted e-mail messages, before having to go through the trouble of downloading them to the local computer. It offers support for one or many POP accounts and is especially useful for dialup connections via modem, ISDN, etc. Install Mailfilter if you'd like to remove spam from your POP mail accounts. %prep %setup -q %build %configure make %install %makeinstall %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-, root, root) %doc contrib %doc AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS ABOUT-NLS %doc doc/FAQ doc/README.Slackware doc/README.Windows doc/rcfile.example1 doc/rcfile.example2 doc/rcfile.example2.ru doc/rcfile.example1.it doc/win_Makefile.am doc/win_configure.in doc/win_src_Makefile.am doc/supported_servers %{_bindir}/mailfilter %{_datadir}/locale/*/LC_MESSAGES/mailfilter.mo %{_mandir}/man1/mailfilter.1* %{_mandir}/man5/mailfilterrc.5* %{_mandir}/man5/mailfilterex.5* %changelog * Sat Oct 26 2002 Andreas Bauer - Added contrib/ to the list of files being packaged * Tue Feb 20 2002 Andreas Bauer - Added doc/supported_servers * Sat Dec 01 2001 Andreas Bauer - Chucked out the "misplaced" make install-strip * Sat Jul 28 2001 Andreas Bauer - Added translations * Mon Jul 09 2001 Andreas Bauer - Changed version number and added rcfile-examples * Thu May 31 2001 Andreas Bauer - Changed to %configure, make install-strip, %makeinstall * Wed Apr 25 2001 Andreas Bauer - Removed BUGS from the distribution and added ABOUT-NLS - Changed installation part to %make and %makeinstall * Fri Jan 26 2001 Andreas Bauer - Removed api/ from the doc/ directory - Added more man pages - Added INSTALL file - Added wildcards to man page file names * Wed Jan 24 2001 Andreas Bauer - Added new man path * Thu Jan 18 2001 Andreas Bauer - Changed to standard paths defined in /usr/lib/rpm/macros * Tue Jan 09 2001 Andreas Bauer - Adjusted to new version and moved location of doc files * Fri Dec 22 2000 Andreas Bauer - Adjusted to a new version and fixed a couple of small things * Sat Dec 09 2000 Matthew R. MacIntyre - Added api documentation to rpm * Wed Dec 06 2000 Matthew R. MacIntyre - Added missing THANKS file to documentation files list * Mon Dec 04 2000 Matthew R. MacIntyre - Initial creation of rpm package - Added manual page mailfilter-0.8.9/man/000077500000000000000000000000001430510321000144205ustar00rootroot00000000000000mailfilter-0.8.9/man/Makefile.am000066400000000000000000000023621430510321000164570ustar00rootroot00000000000000# Makefile.am: help build documentation files # $Id: Makefile.am,v 1.4.2.1.2.4 2007/01/01 15:32:29 baueran Exp $ # # Copyright (c) 2000 - 2009 Andreas Bauer # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. man_MANS = mailfilter.1 mailfilterrc.5 mailfilterex.5 mailfilter_manpages.ps: for i in $(man_MANS); \ do \ groff -t -e -mandoc -Tps $$i > $$i.ps; \ groff -t -e -mandoc -Tascii $$i > $$i.txt; \ groff -t -e -mandoc -Thtml $$i > $$i.html; \ done; pdf-am: mailfilter.1.ps for i in *.ps; do ps2pdf $$i; done; clean: rm -f *.pdf *.html *.ps *.txt EXTRA_DIST = $(man_MANS) mailfilter-0.8.9/man/mailfilter.1000066400000000000000000000055451430510321000166430ustar00rootroot00000000000000.TH MAILFILTER "1" "January 2009" Mailfilter "User Manuals" .SH NAME mailfilter \- Filters e-mail, gets rid of spam .SH SYNOPSIS .B mailfilter [\fIOPTION\fR]... .SH DESCRIPTION Mailfilter is a very flexible utility to get rid of unwanted spam mails, before having to go through the trouble of downloading them into the local computer. It offers support for one or many POP accounts and is especially useful for dialup connections via modem, ISDN, etc. .PP Mailfilter connects to any POP mail box and compares part of its content to a set of user defined filter rules. That way the spam gets deleted directly on the mail server. .PP With Mailfilter you can define your own filters (rules) to determine which e-mails should be delivered and which are considered waste. Rules are Regular Expressions, so you can make use of familiar options from other mail delivery programs such as .BR procmail (1) for example. .SH "RETURN VALUE" The mailfilter program normally returns 0 but -1 if an error occurs. However, if it has been invoked with the return-value command line switch, it gives back a positive integer in case there are messages on the POP server. Empty POP accounts would then result in a return value of 0. Using the switch, mailfilter can be embedded into a shell script more easily. .SH "CONFIGURATION" The behaviour of Mailfilter is controlled by command-line options and a configuration file. The program will not start without it. Example configurations can be looked up in the .BR mailfilterex (5) man page, in the INSTALL document or inside the doc/ directory of the Mailfilter distribution. .PP By default Mailfilter tries to read $HOME/.mailfilterrc to get all its settings from. This is the place where all changes should be made, unless it is explicitly specified otherwise. A comprehensive list of all supported options and keywords can be found in the .BR mailfilterrc (5) man page. .SH OPTIONS .TP \fB\-h\fR, \fB\-\-help\fR Display help information .TP \fB\-L\fR, \fB\-\-logfile\fR=\fIFILE\fR Specify logfile location .TP \fB\-M\fR, \fB\-\-mailfilterrc\fR=\fIFILE\fR Specify rcfile location .TP \fB\-r\fR, \fB\-\-return-value\fR Enable additional return values .TP \fB\-s\fR, \fB\-\-skip-ssl-verify\fR Skip verification of SSL certificates (Do not use unless you know better!) .TP \fB\-t\fR, \fB\-\-test\fR Simulate deletes .TP \fB\-i\fR, \fB\-\-ignore-time-stamps\fR Ignore invalid Message-ID time stamps (Do not use unless you know better!) .TP \fB\-v\fR, \fB\-\-verbose\fR=\fILEVEL\fR Specify level of verbosity .TP \fB\-V\fR, \fB\-\-version\fR Display version information .SH "SEE ALSO" .BR mailfilterrc (5), .BR mailfilterex (5), .BR procmail (1), .BR regex (7) .SH COPYRIGHT Copyright \(co 2000-2022 Andreas Bauer .PP This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. mailfilter-0.8.9/man/mailfilterex.5000066400000000000000000000215451430510321000172020ustar00rootroot00000000000000.TH MAILFILTEREX "5" "January 2009" Mailfilter "File Format Descriptions" .SH NAME mailfilterex \- Mailfilter configuration file examples .SH SYNOPSIS .B $HOME/.mailfilterrc examples .SH DESCRIPTION For a description of the rcfile format and its keywords see the .BR mailfilterrc (5) man page or get a basic set of options from either the INSTALL file or the doc/ directory of the Mailfilter distribution. .PP This man page contains several configuration examples and real-life use cases for the Mailfilter program. .SH "EXAMPLES" If not stated otherwise, the following examples assume you are using extended Regular Expressions, compared to Mailfilter's default, basic type. General information on Regular Expressions can be found in the .BR regex (7) man page or in any good book on UNIX/POSIX. You could also use slightly modified examples from .BR procmail (1) if it is available on your system. .SS Filtering Domains To create a very restrictive set of filter rules at least two keywords should be used: ALLOW and DENY. DENY could match all messages coming from an annoying public mail service, while ALLOW matches messages from a good friend who also uses this annoying public mailer. .PP .RS DENY = "^From:.*public-mail\e\.com" .br ALLOW = "^From:.*friend@public-mail\e\.com" .RE .PP These two lines are enough to block all but your friend's e-mail from the public-mail.com domain. .SS Case Sensivity In general case-sensivity is controlled by the REG_CASE keyword. Having Mailfilter treat expressions case-insensitive is almost always more efficient. .PP .RS REG_CASE = "no" .br DENY = "^Subject:.*win money" .RE .PP In this example Mailfilter would delete all messages with subject lines like `WIN MONEY', `Win Money' or any other mix of capital and non-capital characters. REG_CASE makes filters ignore the case. .PP A more complex set up can be achieved by additionally using the DENY_CASE keyword. .PP .RS DENY_CASE = "^Subject:.*BUSINESS" .RE .PP In this example only e-mails that have `BUSINESS' in their subject match the filter, even though in general Mailfilter ignores the case. So in this example all messages with `business' or `Business' in their subjects would not be affected by this filter. .PP Such an option is very useful if you are not interested in commercial bulk mail that offers amazing business opportunities, but in all your business partners who contact you by e-mail. .SS Defining Friends The keyword ALLOW can be used to override any spam filters. Similar to the earlier example ALLOW defines a `friend'. .PP .RS ALLOW = "^Subject:.*mailfilter" .RE .PP Adding this rule to the rcfile would mean all messages that contain anything about Mailfilter in their subject lines can pass the spam filters. But even friends tend to send large e-mails sometimes to share their joy about the latest joke that just made the round in their office. In such cases a limit can be defined that affects particularly `friends'. .PP .RS MAXSIZE_ALLOW = 500000 .RE .PP Setting MAXSIZE_ALLOW to 500000 means no message can be larger than 500 kBytes. (Scanned `office-jokes' are usually around that size.) .SS Negative Message Filters In order to create a very restrictive spam protection it can be more useful sometimes to define which e-mails should not be deleted instantly and consequently get rid of messages that can not be matched to this criterion - rather than vice versa. This can be achieved by using negation. The typical use case is looking at the message tags `To:' or `Cc:' of an e-mail. .PP .RS DENY <> "^(To|Cc):.*my-email@address\e\.com" .RE .PP Having added such a filter to your personal rule set keeps away a lot of spam that is not directly addressed to your e-mail account. Since this is a very aggressive way of filtering, you are well advised to keep your `friends list' up to date. Also note that the above example, using the logical OR operator, works only with extended Regular Expressions. .SS Scores Instead of setting up spam filters, it is also possible to define scores which can be accumulated until a certain threshold is reached. This is very useful to delete advertisements on mailing lists, for instance. Highscore marks the threshold: .PP .RS HIGHSCORE = 100 .br SCORE +100 = "^Subject:.*viagra" .br SCORE +100 = "^Content-Type:.*html" .br SCORE -100 = "^(To|From):.*my_mailing_list" .RE .PP This simple example is useful to delete mails with a score greater than 100, i.e. if someone sends an HTML mail to my_mailing_list, the message will reach score 0. However, should an HTML mail regarding Viagra reach the list, then the message will classify as spam, because it reached an overall score of 100. .PP The MAXSIZE_SCORE keyword can be used to add to the accumulated score for an e-mail. The following will cause all emails not directly addressed to the recipient and greater than 60000 bytes in size to be deleted (a useful way of rejecting many common MS targeted worms and trojans which can clog up your inbox). .PP .RS HIGHSCORE = 100 .br MAXSIZE_SCORE +50 = 60000 .br SCORE +50 <> "^(To|Cc):.*my-email@address\e\.com" .RE .PP This is a less aggressive way of dealing with e-mail sizes than the using the MAXSIZE_DENY keyword. Note that this example (by using the expression (To|Cc):.*my-email@address\e\.com) works only with extended Regular Expressions. .PP .SS General Message Size Limits It is always a good idea to define a very general size limit for e-mails. Mailfilter uses the keyword MAXSIZE_DENY for that purpose. .PP .RS MAXSIZE_DENY = 200000 .RE .PP Setting it to 200 kBytes can save you a couple of hours, depending on how much mail you get everyday. Messages bigger than that get deleted on the server, unless they match any of the ALLOW rules. To achieve maximum efficiency it makes sense to use both MAXSIZE_DENY and MAXSIZE_ALLOW. No one should block up your mail box, no `friends', no others. .PP A rule of thumb is to be twice as tolerant towards friends than you are towards anonymous people. .SS Dealing with Duplicates Most people want to download a message only once, even though it might have been sent to two or three of their accounts at the same time. The simple line .PP .RS DEL_DUPLICATES = "yes" .RE .PP will take care of duplicates and makes sure that only one copy of a message has to be delivered. .SS Normalisation of Message Subjects Every now and then some clever sales person comes up with the brilliant idea to wrap spam in funny little characters. If you get a message with a subject line similar to this one `,L.E-G,A.L; ,C.A-B`L`E, .B-O`X`', then ordinary filters would fail to detect the junk. .PP .RS NORMAL = "yes" .RE .PP Adding this directive to the rcfile tells Mailfilter to `normalise' subject strings, i.e. leave in only the alpha-numeric characters and delete the rest. `,L.E-G,A.L; ,C.A-B`L`E, .B-O`X`' would then become `LEGAL CABLE BOX' which can easily be matched to a spam filter. .PP Note that Mailfilter first tries to match the original subject string, before it checks on the normalised one. .SS Control Mechanism Since Mailfilter deletes e-mails remotely, before they have to be downloaded into the local machine, it is also important to know what is going on while the program is being executed. The least you should do is define a proper level of verbosity and a log file. .PP .RS LOGFILE = "$HOME/logs/mailfilter-`date +"%h%y"'" .br VERBOSE = 3 .RE .PP Level three is the default verbosity level. Using it, Mailfilter reports information on deleted messages, run-time errors and dates to the screen and the log file. .PP You can use `command' to embedd shell skripts into your path names. In the above example it is used to store log files separately for each month and year. .SS Extended Regular Expressions For advanced applications, the basic Regular Expressions are typically not sufficient. If you know the syntax and usage of the extended expressions, it is almost always a good idea to set REG_TYPE accordingly. .PP .RS REG_TYPE = "extended" .RE .PP Extended expressions are more flexible, but also more sensitive towards syntax errors and the like. Examples in this man page all use extended type. .SH "NOTES" If you are new to Regular Expressions and new to Mailfilter, you might want to experiment a bit, before you accidently delete messages for real. For such cases Mailfilter provides two keywords. TEST can be used to only simulate the deletion of messages and SHOW_HEADERS stores all the e-mail headers that get examined by the program. .PP .RS TEST = "yes" .br SHOW_HEADERS = "$HOME/logs/mailfilter-headers.txt" .RE .PP Use this setup if you are not yet comfortable with the concept of spam filtering. It may help to understand Regular Expressions better and how to use them. .SH SEE ALSO .BR mailfilter (1), .BR mailfilterrc (5), .BR procmailrc (5), .BR procmailex (5), .BR regex (7) .SH COPYRIGHT Copyright \(co 2000-2020 Andreas Bauer .PP This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. mailfilter-0.8.9/man/mailfilterrc.5000066400000000000000000000261071430510321000171710ustar00rootroot00000000000000.TH MAILFILTERRC "5" "January 2009" Mailfilter "File Format Descriptions" .SH NAME mailfilterrc \- Mailfilter configuration file .SH SYNOPSIS .B $HOME/.mailfilterrc .SH DESCRIPTION For a quick start read the INSTALL file provided with the Mailfilter distribution and copy its example configuration. This is enough to run the program with some basic features. .PP Generally the rcfile contains all of Mailfilter's settings and information on the mail accounts that should be checked for spam. It is possible to place remarks in that file by beginning a line with `#'. .PP It does not matter in which order keywords are inserted, except for the account set-up. To define an account you .B must use this whole block of commands: .PP .RS SERVER = "your.pop.server.com" .br USER = "your.username" .br PASS = "your.password" .br PROTOCOL = "pop3" .br PORT = 110 .RE .PP Currently Mailfilter supports the POP3, and APOP protocols which usually communicate over port 110. However, port 995 is required, if Mailfilter is instructed to communicate using the SSL layer as in: .PP .RS SERVER = "your.pop.ssl.server.com" .br USER = "your.username" .br PASS = "your.password" .br PROTOCOL = "pop3/ssl" .br PORT = 995 .RE .PP .SH "KEYWORDS" Generally the rcfile is not case-sensitive, which means it does not matter whether the keywords are spelled in capitals or not. You can place white space characters before and in between a command and its parameters. .PP .RS # This is a typical comment .br DENY = "^Subject:.*Get rich fast" .RE .PP To see some example applications of the engaged keywords, please refer to the .BR mailfilterex(5) man page. .PP .SM ALLOW = """\fBexpression\fR""" .RS This keyword can be used to override spam filters i.e. to define `friends'. A message that matches any ALLOW rules will not be filtered or deleted. ALLOW takes a Regular Expression as argument. .RE .PP .SM DEL_DUPLICATES = """\fB[yes|no]\fR""" .RS This keyword can be used to delete duplicates of messages sent to one or several accounts at once, i.e. it removes redundant e-mails. DEL_DUPLICATES takes either `yes' or `no' as argument. The default value is `no'. .RE .PP .SM DENY = """\fBexpression\fR""" .RS This keyword can be used to define spam filters. Messages that match spam filters (unless they match an ALLOW rule at the same time) are being deleted from the mail server. DENY takes a Regular Expression as argument. .RE .PP .SM DENY <> """\fBexpression\fR""" .RS This keyword can be used to define a negative spam filter. Messages that do not match the negative filters are being deleted from the server. DENY<> takes a Regular Expression as argument, e.g. `DENY<>^To:.*my_username'. .RE .PP .SM DENY_CASE = """\fBexpression\fR""" .RS This keyword can be used to define case-sensitive spam filters. It overrides the default settings for case-sensivity (see REG_CASE for details). DENY_CASE takes a Regular Expression as argument. .RE .PP .SM DENY_CASE <> """\fBexpression\fR""" .RS This keyword can be used to define negative case-sensitive spam filters. It overrides the default settings for case-sensivity (see REG_CASE for details). DENY_CASE<> takes a Regular Expression as argument. .RE .PP .SM DENY_NOCASE = """\fBexpression\fR""" .RS This keyword can be used to define case-insensitive spam filters. It overrides the default settings for case-sensivity (see REG_CASE for details). DENY_NOCASE takes a Regular Expression as argument. .RE .PP .SM DENY_NOCASE <> """\fBexpression\fR""" .RS This keyword can be used to define negative case-insensitive spam filters. It overrides the default settings for case-sensivity (see REG_CASE for details). DENY_NOCASE<> takes a Regular Expression as argument. .RE .PP .SM HIGHSCORE = \fBvalue\fR .RS This keyword can be used to define a discrete threshold upon which messages should be deleted. Individual scores are accumulated by assigning values and filters with the SCORE or MAXSIZE_SCORE keywords. Its default value is 100. .RE .PP .SM INCLUDE = """\fBpath\fR""" .RS This keyword can be used to include additional configuration files into the main Mailfilter rcfile. That is, the program settings may be conveniently split into several different files. INCLUDE expects a path and file name as argument. .RE .PP .SM LOGFILE = """\fBpath\fR""" .RS This keyword can be used to define a log file for Mailfilter. The log file is being used to store error messages and information on deleted messages. LOGFILE expects a path and file name as argument. .RE .PP .SM MAXLENGTH = \fBvalue\fR .RS This keyword can be used to define a maximum string length that must not be exceeded by any field of a message header. The according Internet standard RFC 822 suggests a limit of 998 characters per field. This option even overrides any `friendly' ALLOW rules, i.e. deletes them if they exceed the limit. Assigning a `0' disables the feature. .RE .PP .SM MAXSIZE_ALLOW = \fBvalue\fR .RS This keyword can be used to define a maximum message size that must not be exceeded by all messages that match any ALLOW rule. (One could say, this is the size limit `friends' should not exceed.) The limit does not affect other messages. To define a more general message size limit, use MAXSIZE_DENY instead. MAXSIZE_ALLOW takes the number of bytes as argument. Assigning a `0' disables this feature. .RE .PP .SM MAXSIZE_DENY = \fBvalue\fR .RS This keyword can be used to define a general message size limit that must not be exceeded. (Unless the incoming message matches an ALLOW rule. In that case MAXSIZE_ALLOW would apply.) MAXSIZE_DENY takes the number of bytes as argument. Assigning a `0' disables this feature. .RE .PP .SM MAXSIZE_SCORE \fBvalue\fR = \fBvalue\fR .RS This keyword can be used to attach a score to a size limit. If that limit is exceeded, then the score will be added to the accumulated score from applying other scored filters (see the SCORE keyword below). The first value (before `=') is the score, the second value (after `=') is the size limit. Assigning a `0' to either the score or the size limit disables this feature. .RE .PP .SM NORMAL = """\fB[yes|no]\fR""" .RS This keyword tells Mailfilter to `normalise' the subject strings in messages. A normalised string consists only of alpha-numeric characters. When normalisation is turned on, Mailfilter tries to apply its filters first to the original subject line, before it tries to match the normalised one. NORMAL takes either `yes' or `no' as argument. The default value is `no'. .RE .PP .SM REG_CASE = """\fB[yes|no]\fR""" .RS This keyword can be used to define how Mailfilter should treat its Regular Expressions, case-sensitive or case-insensitive. REG_CASE takes either `yes' as argument to enable case-sensivity or otherwise `no' to disable it. The default behaviour is to ignore the case. .RE .PP .SM REG_TYPE = """\fB[basic|extended]\fR""" .RS This keyword can be used to define which type of Regular Expression Mailfilter should use. REG_TYPE can either be switched to `extended' or `basic'. The default value is `basic'. .RE .PP .SM SCORE \fBvalue\fR = """\fBexpression\fR""" .RS This keyword can be used to assign a score to a filter. It expects a discrete number and a Regular Expression filter as input. If the filter matches a line of the message header, the score is being accumulated to previously matched filters. (See mailfilterex (5) for an example.) .RE .PP .SM SCORE \fBvalue\fR <> """\fBexpression\fR""" .RS This keyword can be used in the same fashion as SCORE, but it assigns the score only if the filter can not be matched to any line of the message header. .RE .PP .SM SCORE_CASE \fBvalue\fR = """\fBexpression\fR""" .RS This keyword is similar to SCORE, but it treats the Regular Expression as case sensitive filter, regardless of other program settings. .RE .PP .SM SCORE_CASE \fBvalue\fR <> """\fBexpression\fR""" .RS This keyword can be used in the same fashion as SCORE_CASE, but it assigns the score only if the filter can not be matched to any line of the message header. .RE .PP .SM SCORE_NOCASE \fBvalue\fR = """\fBexpression\fR""" .RS This keyword is similar to SCORE, but it treats the Regular Expression as case insensitive filter, regardless of other program settings. .RE .PP .SM SCORE_NOCASE \fBvalue\fR <> """\fBexpression\fR""" .RS This keyword can be used in the same fashion as SCORE_NOCASE, but it assigns the score only if the filter can not be matched to any line of the message header. .RE .PP .SM SERVER / USER / PASS / PROTOCOL / PORT .RS These keywords can only be used as a whole and in the given order. Such a block defines an e-mail account to be checked for spam by Mailfilter. A typical block looks like this: .PP .RS SERVER = "your.pop.server.com" .br USER = "your.username" .br PASS = "your.password" .br PROTOCOL = "protocol" .br PORT = 110 .RE .PP It is especially important to not change the arrangement of this block. At the moment, PROTOCOL supports either `pop3' (`pop3/ssl'), or `apop' (`apop/ssl'). The normal variant usually corresponds to port 110, while encrypted communication via SSL, typically, requires port 995. .RE .PP .SM SHOW_HEADERS = """\fBpath\fR""" .RS This keyword can be used to store the message headers of absolutely all filtered e-mails of an account. SHOW_HEADERS expects a path and a file name as argument indicating where to store the headers in. .RE .PP .SM TEST = """\fB[yes|no]\fR""" .RS This keyword prevents Mailfilter from deleting any messages on any e-mail accounts. It is useful to experiment with filters and Regular Expressions and to see how Mailfilter reacts to the user's changes. The option can be turned on by assigning `yes' to TEST. The default value is `no'. .RE .PP .SM TIMEOUT = \fBvalue\fR .RS This keyword can be used to define a server response time out in seconds. That is, the mail server has to respond to an issued command within a given time span, otherwise Mailfilter will drop the connection and issue an error. TIMEOUT takes an integer value as argument. The default is set to 30 (seconds). .RE .PP .SM VERBOSE = \fBvalue\fR .RS This keyword can be used to define the level of verbosity. It takes an integer as argument. .IP 0 Silent, show nothing at all .IP 1 Only show errors .IP 2 Only show "Deleted..." messages and errors .IP 3 Default; Show "Deleted..." messages, errors and "Examining..." messages .IP 4 Like (3), except this also shows the current account's username .IP 5 Like (4), except this also shows which filter matched which string of an e-mail header .IP 6 Debugging mode; prints out almost everything .RE .SH "DEPRECATED KEYWORDS" There are a few keywords from older versions of Mailfilter that are not supported anymore. The following list contains all these keywords and recommends substitutes. .IP ICASE Use REG_CASE instead. .IP MAXSIZE Use MAXSIZE_ALLOW and MAXSIZE_DENY instead. .IP MODE Use VERBOSE instead. .PP Even though Mailfilter still `silently' supports some of these words, you can not rely on that for future versions. It is highly recommended to update old configuration files. .SH SEE ALSO .BR mailfilter (1), .BR mailfilterex (5), .BR regex (7) .SH COPYRIGHT Copyright \(co 2000-2020 Andreas Bauer .PP This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. mailfilter-0.8.9/po/000077500000000000000000000000001430510321000142635ustar00rootroot00000000000000mailfilter-0.8.9/po/Makevars000066400000000000000000000020731430510321000157610ustar00rootroot00000000000000# Makefile variables for PO directory in any package using GNU gettext. # Usually the message domain is the same as the package name. DOMAIN = $(PACKAGE) # These two variables depend on the location of this directory. subdir = po top_builddir = .. # These options get passed to xgettext. XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding # package. (Note that the msgstr strings, extracted from the package's # sources, belong to the copyright holder of the package.) Translators are # expected to transfer the copyright for their translations to this person # or entity, or to disclaim their copyright. The empty string stands for # the public domain; in this case the translators are expected to disclaim # their copyright. COPYRIGHT_HOLDER = Free Software Foundation, Inc. # This is the list of locale categories, beyond LC_MESSAGES, for which the # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = mailfilter-0.8.9/po/POTFILES.in000066400000000000000000000002401430510321000160340ustar00rootroot00000000000000# List of files which contain translatable strings. # Copyright (c) 2000 - 2002 Andreas Bauer src/mailfilter.cc src/getopt.c mailfilter-0.8.9/po/README.Developer000066400000000000000000000027501430510321000170730ustar00rootroot00000000000000Mailfilter po/README.Developer -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Mailfilter still needs people doing translations of the program texts. If you are interested in providing help solving this task, be sure you are familiar with the GNU gettext package and DO NOT FORGET to set your LINGUAS environment variable to the proper country codes. This can be achieved, e.g. by invoking the following command: export LINGUAGS='en de fr' With LINGUAS not configured properly, gettext translations will not be installed during Mailfilter's compilation and installation so the program would remain English by default. If you invoke xgettext to get the initial candidates for translation, please be sure to add the keyword tag to it, e.g. 'xgettext mailfilter.cc --keyword=_'. You may have to alter the path to your source file(s) or use a mask like this, if you prefer that: '*.c*'. Extending existing translations -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- If you want to merely extend your already existing translation file (i.e. bring it up to date with the current version of Mailfilter), then you need to add two options to your xgettext call: xgettext *.c* --keyword=_ -o .po -j This command will add new terms to that file without deleting your existing work. If you invoke the command from within your po/ directory you need to adjust the path for the sources to ../src/*.c* of course. All you need to do now is carefully look through the new po-file and fill in the missing translation strings. mailfilter-0.8.9/po/de.po000066400000000000000000000314111430510321000152130ustar00rootroot00000000000000# Mailfilter German Language File. # Copyright (C) 2002 Andreas bauer # This file is distributed under the same license as the Mailfilter package. # Andreas Bauer # #, fuzzy msgid "" msgstr "" "Project-Id-Version: mailfilter 0.5.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-12-31 21:45+0100\n" "PO-Revision-Date: 2002-10-08 17:12+0200\n" "Last-Translator: Joerg Jaspert \n" "Language-Team: de \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" #: src/mailfilter.cc:94 msgid "The rcfile could not be opened." msgstr "" #: src/mailfilter.cc:107 msgid "Loading the rcfile failed." msgstr "" #: src/mailfilter.cc:113 src/mailfilter.cc:182 msgid "Runtime exception occured: " msgstr "" #: src/mailfilter.cc:124 msgid "Could not open log file '" msgstr "" #: src/mailfilter.cc:125 msgid "' for writing." msgstr "" #: src/mailfilter.cc:127 msgid "Could not locate log file." msgstr "" #: src/mailfilter.cc:138 #, fuzzy msgid "Signal handler could not be installed." msgstr ": Fehler: Signal-Handler konnte nicht initialisiert werden." #: src/mailfilter.cc:166 msgid " querying " msgstr " Anfrage an " #: src/mailfilter.cc:168 msgid " on " msgstr " am " #: src/mailfilter.cc:173 msgid "Skipping account " msgstr "" #: src/mailfilter.cc:176 msgid " due to earlier errors.\n" msgstr "" #: src/mailfilter.cc:226 #, fuzzy msgid "Mailfilter filters e-mail and removes spam in one " msgstr "" "Mailfilter filtert e-Mails und entfernt Spam in einem oder mehreren POP\n" "Accounts." #: src/mailfilter.cc:227 msgid "or many POP accounts." msgstr "" #: src/mailfilter.cc:229 msgid "Usage: " msgstr "Aufruf: " #: src/mailfilter.cc:229 msgid " [OPTION]..." msgstr " [OPTION]..." #: src/mailfilter.cc:231 #, fuzzy msgid "If a long option shows an argument as mandatory, " msgstr "" "Wenn eine lange Option ein Argument erfordert, ist es fr die entsprechende" #: src/mailfilter.cc:232 msgid "then " msgstr "" #: src/mailfilter.cc:233 #, fuzzy msgid "it is mandatory for the equivalent short option " msgstr "" "kurze Option auch erforderlich. Das gleiche gilt fr optionale Argumente." #: src/mailfilter.cc:234 msgid "also." msgstr "" #: src/mailfilter.cc:236 msgid "Options:" msgstr "Optionen:" #: src/mailfilter.cc:237 #, fuzzy msgid " -h, --help " msgstr " -h, --help Diesen Hilfetext anzeigen" #: src/mailfilter.cc:238 #, fuzzy msgid "Display this help information" msgstr " -h, --help Diesen Hilfetext anzeigen" #: src/mailfilter.cc:239 #, fuzzy msgid " -L, --logfile=FILE " msgstr " -L, --logfile=DATEI Festlegen des Logfile Pfades und Namens" #: src/mailfilter.cc:240 #, fuzzy msgid "Specify logfile location" msgstr " -L, --logfile=DATEI Festlegen des Logfile Pfades und Namens" #: src/mailfilter.cc:241 #, fuzzy msgid " -M, --mailfilterrc=FILE " msgstr " -M, --mailfilterrc=DATEI Festlegen des Rcfile Pfades und Namens" #: src/mailfilter.cc:242 #, fuzzy msgid "Specify rcfile location" msgstr " -M, --mailfilterrc=DATEI Festlegen des Rcfile Pfades und Namens" #: src/mailfilter.cc:243 msgid " -r, --return-value " msgstr "" #: src/mailfilter.cc:244 msgid "Enable additional return values" msgstr "" #: src/mailfilter.cc:245 #, fuzzy msgid " -t, --test " msgstr " -h, --help Diesen Hilfetext anzeigen" #: src/mailfilter.cc:246 msgid "Simulate deletes" msgstr "" #: src/mailfilter.cc:247 #, fuzzy msgid " -v, --verbose=LEVEL " msgstr "" " -v, --verbose=LEVEL Detail-Level der Programmausgabe festlegen" #: src/mailfilter.cc:248 #, fuzzy msgid "Specify level of verbosity" msgstr "" " -v, --verbose=LEVEL Detail-Level der Programmausgabe festlegen" #: src/mailfilter.cc:249 #, fuzzy msgid " -V, --version " msgstr " -V, --version Versionsnummer anzeigen" #: src/mailfilter.cc:250 #, fuzzy msgid "Display version information" msgstr " -V, --version Versionsnummer anzeigen" #: src/mailfilter.cc:252 msgid "Report bugs to " msgstr "" #: src/mailfilter.cc:263 #, fuzzy msgid "This is free software; see the source for copying " msgstr "" "Dieses Programm ist freie Software; die Quellen enthalten die Kopier-\n" "bedingungen." #: src/mailfilter.cc:264 msgid "conditions. There is NO warranty; not even for " msgstr "" #: src/mailfilter.cc:265 #, fuzzy msgid "MERCHANTABILITY or FITNESS FOR A PARTICULAR " msgstr "" "Es gibt KEINE Garantie, auch nicht hinsichtlich des Einsatzes fr einen\n" "bestimmten Zweck." #: src/mailfilter.cc:266 msgid "PURPOSE." msgstr "" #: src/mailfilter.cc:291 msgid "Try '" msgstr "Versuchen Sie '" #: src/mailfilter.cc:292 msgid " --help' for more information." msgstr " --help' fr weitere Informationen." #: src/mailfilter.cc:314 #, fuzzy msgid "Could not compile regular expression (allow)." msgstr ": Konnte diesen Regulren Ausdruck nicht bersetzen: '" #: src/mailfilter.cc:325 #, fuzzy msgid "Could not compile regular expression (deny)." msgstr ": Konnte diesen Regulren Ausdruck nicht bersetzen: '" #: src/mailfilter.cc:337 #, fuzzy msgid "Could not compile regular expression (score)." msgstr ": Konnte diesen Regulren Ausdruck nicht bersetzen: '" #: src/mailfilter.cc:388 #, fuzzy msgid "popen failed." msgstr ". Login abgebrochen.\n" #: src/mailfilter.cc:398 #, fuzzy msgid "pclose failed." msgstr ". Login abgebrochen.\n" #: src/getopt.c:688 src/getopt.c:698 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: Option '%s' ist mehrdeutig\n" #: src/getopt.c:730 src/getopt.c:734 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: Option '--%s' braucht keine Aufrufparameter\n" #: src/getopt.c:743 src/getopt.c:748 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: Option '%c%s' braucht keine Aufrufparameter\n" #: src/getopt.c:782 src/getopt.c:793 src/getopt.c:1070 src/getopt.c:1082 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: Option '%s' bentigt einen Aufrufparameter\n" #: src/getopt.c:830 src/getopt.c:833 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: Unbekannte Option '--%s'\n" #: src/getopt.c:841 src/getopt.c:844 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: Unbekannte Option '%c%s'\n" #: src/getopt.c:887 src/getopt.c:890 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: Falsche Option -- %c\n" #: src/getopt.c:896 src/getopt.c:899 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: Falsche Option -- %c\n" #: src/getopt.c:942 src/getopt.c:952 src/getopt.c:1136 src/getopt.c:1147 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: Option bentigt einen Aufrufparameter -- %c\n" #: src/getopt.c:1004 src/getopt.c:1014 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: Option `-W %s' ist mehrdeutig\n" #: src/getopt.c:1038 src/getopt.c:1049 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s: Option `-W %s' erlaubt keine Argumente\n" #, fuzzy #~ msgid " -H FILE " #~ msgstr " -h, --help Diesen Hilfetext anzeigen" #~ msgid "Report bugs to ." #~ msgstr "Fehlerberichte an ." #, fuzzy #~ msgid "" #~ "Copyright (c) 2000 - 2003 Andreas Bauer " #~ msgstr "" #~ "Copyright (c) 2000 - 2002 Andreas Bauer " #~ msgid ": Error: The level of verbosity must contain values between " #~ msgstr ": Fehler: Der Ausgabe-Level liegt nur zwischen " #~ msgid " and " #~ msgstr " und " #~ msgid ": Error: Could not login to server " #~ msgstr ": Fehler: Konnte mich nicht einloggen bei Server " #~ msgid ". Unknown error.\n" #~ msgstr ". Unbekannter Fehler.\n" #~ msgid ": Error: DNS lookup failure for " #~ msgstr ": Fehler: DNS Fehler fr " #~ msgid ": Error: Network connection could not be established.\n" #~ msgstr ": Fehler: Netzwerkverbindung konnte nicht hergestellt werden.\n" #~ msgid ": Error: Authentication failed. Login canceled.\n" #~ msgstr ": Fehler: Anmeldung fehlgeschlagen. Login abgebrochen.\n" #~ msgid ": Error: Mail server not responding. Login canceled.\n" #~ msgstr ": Fehler: Mail Server antwortet nicht. Login abgebrochen.\n" #~ msgid ": Error: Could not establish mail server connection.\n" #~ msgstr "" #~ ": Fehler: Verbindung zum Mail Server konnte nicht hergestellt werden.\n" #~ msgid ": Error: Sent STAT, but server responded with an error.\n" #~ msgstr "" #~ ": Fehler: Habe STAT geschickt, doch der Server hat die Operation " #~ "abgebrochen.\n" #~ msgid ": Error: Sent TOP, but server responded with an error.\n" #~ msgstr "" #~ ": Fehler: Habe TOP geschickt, doch der Server hat die Operation " #~ "abgebrochen.\n" #~ msgid ": Error: Sent LIST, but server responded with an error.\n" #~ msgstr "" #~ ": Fehler: Habe LIST geschickt, doch der Server hat die Operation " #~ "abgebrochen.\n" #~ msgid "" #~ ": Error: Sent DELE, but server responded with an error. Delete failed.\n" #~ msgstr "" #~ ": Fehler: Habe DELE geschickt, doch der Server hat die Operation " #~ "abgebrochen.\n" #~ msgid "" #~ ": Error: Encountered a malformed e-mail header which could not be handled " #~ "by Mailfilter. " #~ msgstr "" #~ ": Fehler: Ungltiger e-Mail Message Header entdeckt. Mailfilter musste " #~ "die Operation abbrechen. " #~ msgid "Program aborted.\n" #~ msgstr "Programm abgebrochen.\n" #~ msgid ": Error: Operation timed out.\n" #~ msgstr ": Fehler: Operation hat das Zeitlimit berschritten.\n" #~ msgid ": Error: Signal handler could not be installed.\n" #~ msgstr ": Fehler: Signal-Handler konnte nicht initialisiert werden.\n" #~ msgid "" #~ ": Error: The rcfile for preferences has wrong number of arguments or " #~ "malformed syntax." #~ msgstr "" #~ ": Fehler: Das Rcfile fr die Einstellungen enthlt entweder ungltige " #~ "Parameter oder die falsche Syntax." #~ msgid "" #~ ": Error: The rcfile for preferences (usually $HOME/.mailfilterrc) could " #~ "not be read." #~ msgstr "" #~ ": Fehler: Das Rcfile fr die Einstellungen (normalerweise $HOME/." #~ "mailfilterrc) konnte nicht geladen werden." #~ msgid "" #~ ": Error: Aborted pre-compilation of Regular Expressions. Check the syntax " #~ "of your filters and rules." #~ msgstr "" #~ ": Fehler: Die Vorbersetzung der Regulren Ausdrcke wurde abgebrochen. " #~ "berprfen Sie die Syntax der Filter und Regeln." #~ msgid "" #~ ": Error: Could not access the logfile. Check the file permissions of your " #~ "logfile and make sure the rcfile contains the correct path." #~ msgstr "" #~ ": Fehler: Konnte nicht auf das Logfile zugreifen. berprfen Sie den Pfad " #~ "in Ihrem Rcfile und ggf. die Dateirechte." #~ msgid "" #~ ": Error: Communication failure. Either the server closed the connection " #~ "due to a time-out problem, or the entire network connection has dropped." #~ msgstr "" #~ ": Fehler: Kommunikationsfehler. Entweder hat der Server die Session wegen " #~ "Zeitberschreitung beendet, oder die gesamte Netzwerkverbindung wurde " #~ "abgebrochen." #~ msgid ": Error: Connection to the mail server has timed out." #~ msgstr "" #~ ": Fehler: Verbindungsaufbau zum Mail Server wurde wegen " #~ "Zeitberschreitung beendet." #~ msgid "" #~ ": Error: Unknown communication error occured. Please consider reporting a " #~ "bug. Thank you." #~ msgstr "" #~ ": Fehler: Unbekannter Kommunikationsfehler trat auf. Bitte schicken Sie " #~ "einen Fehlerbericht. Danke." #~ msgid ": Error: Malformed e-mail header." #~ msgstr ": Fehler: Ungltiger e-Mail Message Header." #~ msgid ": Error: " #~ msgstr ": Fehler: " #~ msgid "" #~ ": Error: This is an unknown error. Please consider reporting a bug. Thank " #~ "you." #~ msgstr "" #~ ": Fehler: Dies ist ein unbekannter Fehler. Bitte schicken Sie einen " #~ "Fehlerbericht. Danke." #~ msgid ": Signal SIGINT caught. Terminating with signal " #~ msgstr ": Signal SIGINT wurde abgefangen. Verlasse Programm mit Signal " #~ msgid ": Internal error code from the Regular Expression library: " #~ msgstr ": Interner Fehlercode der RE-Library: " #~ msgid ": Deprecated keyword '" #~ msgstr ": Veraltetes Schlsselwort '" #~ msgid "' in '" #~ msgstr "' in '" #~ msgid ": Instead use the keyword 'REG_CASE' from now on." #~ msgstr ": Bitte benutzen Sie ab jetzt die 'REG_CASE' Direktive." #~ msgid ": Instead use the keyword 'VERBOSE' from now on." #~ msgstr ": Bitte benutzen Sie ab jetzt die 'VERBOSE' Direktive." #~ msgid ": Consult the mailfilterrc(5) man page for further details." #~ msgstr ": Fr weitere Informaitonen lesen Sie die Man-Page mailfilterrc(5)" #~ msgid ": A keyword in '" #~ msgstr ": Ein Schlsselwort in '" #~ msgid "' contains invalid parameters." #~ msgstr "' enthlt ungltige Parameter." #~ msgid "%s: Examining %d message(s).\n" #~ msgstr "%s: Untersuche %d Nachricht(en).\n" mailfilter-0.8.9/po/el.po000066400000000000000000000312141430510321000152240ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR Free Software Foundation, Inc. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: mailfilter 0.3.3\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-12-31 21:45+0100\n" "PO-Revision-Date: 2002-10-08 17:14+0200\n" "Last-Translator: Dimitris Kamenopoulos \n" "Language-Team: Greek \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-7\n" "Content-Transfer-Encoding: 8bit\n" #: src/mailfilter.cc:94 msgid "The rcfile could not be opened." msgstr "" #: src/mailfilter.cc:107 msgid "Loading the rcfile failed." msgstr "" #: src/mailfilter.cc:113 src/mailfilter.cc:182 msgid "Runtime exception occured: " msgstr "" #: src/mailfilter.cc:124 msgid "Could not open log file '" msgstr "" #: src/mailfilter.cc:125 msgid "' for writing." msgstr "" #: src/mailfilter.cc:127 msgid "Could not locate log file." msgstr "" #: src/mailfilter.cc:138 #, fuzzy msgid "Signal handler could not be installed." msgstr ": : Signal handler could not be installed." #: src/mailfilter.cc:166 msgid " querying " msgstr " " #: src/mailfilter.cc:168 msgid " on " msgstr " " #: src/mailfilter.cc:173 msgid "Skipping account " msgstr "" #: src/mailfilter.cc:176 msgid " due to earlier errors.\n" msgstr "" #: src/mailfilter.cc:226 #, fuzzy msgid "Mailfilter filters e-mail and removes spam in one " msgstr "" " mailfilter spam " " POP" #: src/mailfilter.cc:227 msgid "or many POP accounts." msgstr "" #: src/mailfilter.cc:229 msgid "Usage: " msgstr ": " #: src/mailfilter.cc:229 msgid " [OPTION]..." msgstr " []..." #: src/mailfilter.cc:231 #, fuzzy msgid "If a long option shows an argument as mandatory, " msgstr "" " , " "" #: src/mailfilter.cc:232 msgid "then " msgstr "" #: src/mailfilter.cc:233 #, fuzzy msgid "it is mandatory for the equivalent short option " msgstr " " #: src/mailfilter.cc:234 msgid "also." msgstr "" #: src/mailfilter.cc:236 msgid "Options:" msgstr ":" #: src/mailfilter.cc:237 #, fuzzy msgid " -h, --help " msgstr " -h, --help " #: src/mailfilter.cc:238 #, fuzzy msgid "Display this help information" msgstr " -h, --help " #: src/mailfilter.cc:239 #, fuzzy msgid " -L, --logfile=FILE " msgstr " -L, --logfile= " #: src/mailfilter.cc:240 #, fuzzy msgid "Specify logfile location" msgstr " -L, --logfile= " #: src/mailfilter.cc:241 #, fuzzy msgid " -M, --mailfilterrc=FILE " msgstr " -M, --mailfilterrc= " #: src/mailfilter.cc:242 #, fuzzy msgid "Specify rcfile location" msgstr " -M, --mailfilterrc= " #: src/mailfilter.cc:243 msgid " -r, --return-value " msgstr "" #: src/mailfilter.cc:244 msgid "Enable additional return values" msgstr "" #: src/mailfilter.cc:245 #, fuzzy msgid " -t, --test " msgstr " -h, --help " #: src/mailfilter.cc:246 msgid "Simulate deletes" msgstr "" #: src/mailfilter.cc:247 #, fuzzy msgid " -v, --verbose=LEVEL " msgstr "" " -v, --verbose=LEVEL " #: src/mailfilter.cc:248 #, fuzzy msgid "Specify level of verbosity" msgstr "" " -v, --verbose=LEVEL " #: src/mailfilter.cc:249 #, fuzzy msgid " -V, --version " msgstr " -V, --version " #: src/mailfilter.cc:250 #, fuzzy msgid "Display version information" msgstr " -V, --version " #: src/mailfilter.cc:252 msgid "Report bugs to " msgstr "" #: src/mailfilter.cc:263 #, fuzzy msgid "This is free software; see the source for copying " msgstr "" " " " . " #: src/mailfilter.cc:264 msgid "conditions. There is NO warranty; not even for " msgstr "" #: src/mailfilter.cc:265 #, fuzzy msgid "MERCHANTABILITY or FITNESS FOR A PARTICULAR " msgstr "" " " "" #: src/mailfilter.cc:266 msgid "PURPOSE." msgstr "" #: src/mailfilter.cc:291 msgid "Try '" msgstr " '" #: src/mailfilter.cc:292 msgid " --help' for more information." msgstr " --help' ." #: src/mailfilter.cc:314 #, fuzzy msgid "Could not compile regular expression (allow)." msgstr ": Could not pre-compile this Regular Expression '" #: src/mailfilter.cc:325 #, fuzzy msgid "Could not compile regular expression (deny)." msgstr ": Could not pre-compile this Regular Expression '" #: src/mailfilter.cc:337 #, fuzzy msgid "Could not compile regular expression (score)." msgstr ": Could not pre-compile this Regular Expression '" #: src/mailfilter.cc:388 #, fuzzy msgid "popen failed." msgstr ". login .\n" #: src/mailfilter.cc:398 #, fuzzy msgid "pclose failed." msgstr ". login .\n" #: src/getopt.c:688 src/getopt.c:698 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: '%s' \n" #: src/getopt.c:730 src/getopt.c:734 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: '--%s' \n" #: src/getopt.c:743 src/getopt.c:748 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: '%c%s' \n" #: src/getopt.c:782 src/getopt.c:793 src/getopt.c:1070 src/getopt.c:1082 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: ''%s \n" #: src/getopt.c:830 src/getopt.c:833 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: '--%s'\n" #: src/getopt.c:841 src/getopt.c:844 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: '%c%s'\n" #: src/getopt.c:887 src/getopt.c:890 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: -- %c\n" #: src/getopt.c:896 src/getopt.c:899 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: -- %c\n" #: src/getopt.c:942 src/getopt.c:952 src/getopt.c:1136 src/getopt.c:1147 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: -- %c\n" #: src/getopt.c:1004 src/getopt.c:1014 #, fuzzy, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: '%s' \n" #: src/getopt.c:1038 src/getopt.c:1049 #, fuzzy, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s: '--%s' \n" #, fuzzy #~ msgid " -H FILE " #~ msgstr " -h, --help " #~ msgid "Report bugs to ." #~ msgstr " " #~ msgstr "" #~ "Copyright (c) 2000 - 2002 Andreas Bauer " #~ msgid ": Error: The level of verbosity must contain values between " #~ msgstr ": : " #~ msgid " and " #~ msgstr " " #~ msgid ": Error: Could not login to server " #~ msgstr ": : login " #~ msgid ". Unknown error.\n" #~ msgstr ". .\n" #~ msgid ": Error: DNS lookup failure for " #~ msgstr ": Error: DNS lookup failure " #~ msgid ": Error: Network connection could not be established.\n" #~ msgstr ": : .\n" #~ msgid ": Error: Authentication failed. Login canceled.\n" #~ msgstr ": : . login .\n" #~ msgid ": Error: Mail server not responding. Login canceled.\n" #~ msgstr ": : mail . login .\n" #~ msgid ": Error: Could not establish mail server connection.\n" #~ msgstr "" #~ ": : mail.\n" #~ msgid ": Error: Sent STAT, but server responded with an error.\n" #~ msgstr ": : STAT, .\n" #~ msgid ": Error: Sent TOP, but server responded with an error.\n" #~ msgstr ": : TOP, .\n" #~ msgid ": Error: Sent LIST, but server responded with an error.\n" #~ msgstr ": : LIST, .\n" #~ msgid "" #~ ": Error: Sent DELE, but server responded with an error. Delete failed.\n" #~ msgstr ": : DELE, .\n" #~ msgid "" #~ ": Error: Encountered a malformed e-mail header which could not be handled " #~ "by Mailfilter. " #~ msgstr "" #~ ": : e-mail Mailfilter " #~ " " #~ msgid "Program aborted.\n" #~ msgstr " .\n" #~ msgid ": Error: Operation timed out.\n" #~ msgstr ": : .\n" #~ msgid ": Error: Signal handler could not be installed.\n" #~ msgstr ": : Signal handler could not be installed.\n" #~ msgid "" #~ ": Error: The rcfile for preferences has wrong number of arguments or " #~ "malformed syntax." #~ msgstr "" #~ ": : " #~ " ." #~ msgid "" #~ ": Error: The rcfile for preferences (usually $HOME/.mailfilterrc) could " #~ "not be read." #~ msgstr "" #~ ": : " #~ " ( $HOME/.mailfilterrc)." #~ msgid "" #~ ": Error: Aborted pre-compilation of Regular Expressions. Check the syntax " #~ "of your filters and rules." #~ msgstr "" #~ ": Error: Aborted pre-compilation of Regular Expressions. " #~ " ." #~ msgid "" #~ ": Error: Could not access the logfile. Check the file permissions of your " #~ "logfile and make sure the rcfile contains the correct path." #~ msgstr "" #~ ": : . " #~ " " #~ " ." #~ msgid "" #~ ": Error: Communication failure. Either the server closed the connection " #~ "due to a time-out problem, or the entire network connection has dropped." #~ msgstr "" #~ ": : . " #~ " , ." #~ msgid ": Error: Connection to the mail server has timed out." #~ msgstr "" #~ ": : email." #~ msgid "" #~ ": Error: Unknown communication error occured. Please consider reporting a " #~ "bug. Thank you." #~ msgstr "" #~ ": : . " #~ " . ." #~ msgid ": Error: Malformed e-mail header." #~ msgstr ": : e-mail" #~ msgid ": Error: " #~ msgstr ": : " #~ msgid "" #~ ": Error: This is an unknown error. Please consider reporting a bug. Thank " #~ "you." #~ msgstr "" #~ ": : . " #~ " . ." #~ msgid ": Signal SIGINT caught. Terminating with signal " #~ msgstr ": SIGINT. " #~ msgid ": Internal error code from the Regular Expression library: " #~ msgstr ": Regular Expression: " #~ msgid ": Deprecated keyword '" #~ msgstr ": - '" #~ msgid "' in '" #~ msgstr "' " #~ msgid ": Instead use the keyword 'REG_CASE' from now on." #~ msgstr ": - 'REG_CASE' ." #~ msgid ": Instead use the keyword 'VERBOSE' from now on." #~ msgstr ": - 'VERBOSE' ." #~ msgid ": Consult the mailfilterrc(5) man page for further details." #~ msgstr ": man mailfilter(5) ." #~ msgid ": A keyword in '" #~ msgstr ": - '" #~ msgid "' contains invalid parameters." #~ msgstr "' ." #~ msgid "%s: Examining %d message(s).\n" #~ msgstr "%s: %d /.\n" mailfilter-0.8.9/po/es.po000066400000000000000000000327711430510321000152440ustar00rootroot00000000000000# Spanish translations for Mailfilter # Copyright (C) 2002 Free Software Foundation, Inc. # Carlos Valdivia Yage , 2002. # msgid "" msgstr "" "Project-Id-Version: Mailfilter 0.3.3\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-12-31 21:45+0100\n" "PO-Revision-Date: 20002-05-12 16:51+0200\n" "Last-Translator: Carlos Valdivia Yage \n" "Language-Team: Spanish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" #: src/mailfilter.cc:94 #, fuzzy msgid "The rcfile could not be opened." msgstr "' no se pudo abrir." #: src/mailfilter.cc:107 msgid "Loading the rcfile failed." msgstr "" #: src/mailfilter.cc:113 src/mailfilter.cc:182 msgid "Runtime exception occured: " msgstr "" #: src/mailfilter.cc:124 msgid "Could not open log file '" msgstr "" #: src/mailfilter.cc:125 msgid "' for writing." msgstr "" #: src/mailfilter.cc:127 #, fuzzy msgid "Could not locate log file." msgstr "' no se pudo abrir." #: src/mailfilter.cc:138 #, fuzzy msgid "Signal handler could not be installed." msgstr ": Error: no se puede instalar el gestor de seales." #: src/mailfilter.cc:166 msgid " querying " msgstr " interrogando " #: src/mailfilter.cc:168 msgid " on " msgstr " en " #: src/mailfilter.cc:173 msgid "Skipping account " msgstr "" #: src/mailfilter.cc:176 msgid " due to earlier errors.\n" msgstr "" #: src/mailfilter.cc:226 #, fuzzy msgid "Mailfilter filters e-mail and removes spam in one " msgstr "" "Mailfilter filtra el correo electrnico y borra el spam en una o varias " "cuentas POP." #: src/mailfilter.cc:227 msgid "or many POP accounts." msgstr "" #: src/mailfilter.cc:229 msgid "Usage: " msgstr "Forma de uso: " #: src/mailfilter.cc:229 msgid " [OPTION]..." msgstr " [OPCIN]..." #: src/mailfilter.cc:231 #, fuzzy msgid "If a long option shows an argument as mandatory, " msgstr "" "Si una opcin larga muestra un argumento como obligatorio, entonces es " "obligatorio" #: src/mailfilter.cc:232 msgid "then " msgstr "" #: src/mailfilter.cc:233 #, fuzzy msgid "it is mandatory for the equivalent short option " msgstr "tambin para la opcin corta equivalente." #: src/mailfilter.cc:234 msgid "also." msgstr "" #: src/mailfilter.cc:236 msgid "Options:" msgstr "Opciones:" #: src/mailfilter.cc:237 #, fuzzy msgid " -h, --help " msgstr " -h, --help Mostrar esta ayuda" #: src/mailfilter.cc:238 #, fuzzy msgid "Display this help information" msgstr " -h, --help Mostrar esta ayuda" #: src/mailfilter.cc:239 #, fuzzy msgid " -L, --logfile=FILE " msgstr "" " -L, --logfile=FICHERO Especificar la ubicacin del fichero de registro" #: src/mailfilter.cc:240 #, fuzzy msgid "Specify logfile location" msgstr "" " -L, --logfile=FICHERO Especificar la ubicacin del fichero de registro" #: src/mailfilter.cc:241 #, fuzzy msgid " -M, --mailfilterrc=FILE " msgstr "" " -M, --mailfilterrc=FICHERO Especificar la ubicacin del fichero de " "configuracin" #: src/mailfilter.cc:242 #, fuzzy msgid "Specify rcfile location" msgstr "" " -M, --mailfilterrc=FICHERO Especificar la ubicacin del fichero de " "configuracin" #: src/mailfilter.cc:243 msgid " -r, --return-value " msgstr "" #: src/mailfilter.cc:244 msgid "Enable additional return values" msgstr "" #: src/mailfilter.cc:245 #, fuzzy msgid " -t, --test " msgstr " -h, --help Mostrar esta ayuda" #: src/mailfilter.cc:246 msgid "Simulate deletes" msgstr "" #: src/mailfilter.cc:247 #, fuzzy msgid " -v, --verbose=LEVEL " msgstr " -v, --verbose=NIVEL Especificar nivel de locuacidad" #: src/mailfilter.cc:248 #, fuzzy msgid "Specify level of verbosity" msgstr " -v, --verbose=NIVEL Especificar nivel de locuacidad" #: src/mailfilter.cc:249 #, fuzzy msgid " -V, --version " msgstr " -V, --version Mostrar informacin de la versin" #: src/mailfilter.cc:250 #, fuzzy msgid "Display version information" msgstr " -V, --version Mostrar informacin de la versin" #: src/mailfilter.cc:252 msgid "Report bugs to " msgstr "" #: src/mailfilter.cc:263 #, fuzzy msgid "This is free software; see the source for copying " msgstr "" "Este programa es software libre; lea en las fuentes las condiciones de " "copia. No hay" #: src/mailfilter.cc:264 msgid "conditions. There is NO warranty; not even for " msgstr "" #: src/mailfilter.cc:265 #, fuzzy msgid "MERCHANTABILITY or FITNESS FOR A PARTICULAR " msgstr "" "garanta: ni la MERCANTIL implcita ni la de CONVENIENCIA PARA UN PROPSITO " "CONCRETO." #: src/mailfilter.cc:266 msgid "PURPOSE." msgstr "" #: src/mailfilter.cc:291 msgid "Try '" msgstr "Pruebe '" #: src/mailfilter.cc:292 msgid " --help' for more information." msgstr " --help' para ms informacin." #: src/mailfilter.cc:314 #, fuzzy msgid "Could not compile regular expression (allow)." msgstr ": No se pudo precompilar esta expresin regular '" #: src/mailfilter.cc:325 #, fuzzy msgid "Could not compile regular expression (deny)." msgstr ": No se pudo precompilar esta expresin regular '" #: src/mailfilter.cc:337 #, fuzzy msgid "Could not compile regular expression (score)." msgstr ": No se pudo precompilar esta expresin regular '" #: src/mailfilter.cc:388 #, fuzzy msgid "popen failed." msgstr ". Login fallido.\n" #: src/mailfilter.cc:398 #, fuzzy msgid "pclose failed." msgstr ". Login fallido.\n" #: src/getopt.c:688 src/getopt.c:698 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: la opcin `%s' es ambigua\n" #: src/getopt.c:730 src/getopt.c:734 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: la opcin `--%s' no permite ningn argumento\n" #: src/getopt.c:743 src/getopt.c:748 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: la opcin `%c%s' no permite ningn argumento\n" #: src/getopt.c:782 src/getopt.c:793 src/getopt.c:1070 src/getopt.c:1082 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: la opcin `%s' necesita un argumento\n" #: src/getopt.c:830 src/getopt.c:833 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: opcin desconocida `--%s'\n" #: src/getopt.c:841 src/getopt.c:844 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: opcin desconocida `%c%s'\n" #: src/getopt.c:887 src/getopt.c:890 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: opcin ilegal -- %c\n" #: src/getopt.c:896 src/getopt.c:899 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: opcin no vlida -- %c\n" #: src/getopt.c:942 src/getopt.c:952 src/getopt.c:1136 src/getopt.c:1147 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: esta opcin requiere un argumento -- %c\n" #: src/getopt.c:1004 src/getopt.c:1014 #, fuzzy, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: la opcin `%s' es ambigua\n" #: src/getopt.c:1038 src/getopt.c:1049 #, fuzzy, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s: la opcin `--%s' no permite ningn argumento\n" #, fuzzy #~ msgid "Could not open HTML log file \"" #~ msgstr "' no se pudo abrir." #, fuzzy #~ msgid " -H FILE " #~ msgstr " -h, --help Mostrar esta ayuda" #~ msgid "Report bugs to ." #~ msgstr "Informe de erratas a ." #, fuzzy #~ msgid "" #~ "Copyright (c) 2000 - 2003 Andreas Bauer " #~ msgstr "" #~ "Copyright (c) 2000 - 2002 Andreas Bauer " #~ msgid ": Error: The level of verbosity must contain values between " #~ msgstr ": Error: el nivel de locuacidad debe tener valores entre " #~ msgid " and " #~ msgstr " en " #~ msgid ": Error: Could not login to server " #~ msgstr " : Error: no se puede entrar en el servidor " #~ msgid ". Unknown error.\n" #~ msgstr ". Error desconocido.\n" #~ msgid ": Error: DNS lookup failure for " #~ msgstr ": Error: error de resolucin DNS para " #~ msgid ": Error: Network connection could not be established.\n" #~ msgstr ": Error: no se puede establecer conexin de red.\n" #~ msgid ": Error: Authentication failed. Login canceled.\n" #~ msgstr ": Error: autentificacin fallida. Login cancelado.\n" #~ msgid ": Error: Mail server not responding. Login canceled.\n" #~ msgstr ": Error: El servidor de correo no responde. Login cancelado.\n" #~ msgid ": Error: Could not establish mail server connection.\n" #~ msgstr "" #~ ": Error: no se puede establecer conexin con el servidor de correo.\n" #~ msgid ": Error: Sent STAT, but server responded with an error.\n" #~ msgstr ": Error: se envi STAT, pero el servidor respondi con un error.\n" #~ msgid ": Error: Sent TOP, but server responded with an error.\n" #~ msgstr ": Error: se envi TOP, pero el servidor respondi con un error.\n" #~ msgid ": Error: Sent LIST, but server responded with an error.\n" #~ msgstr ": Error: se envi LIST, pero el servidor respondi con un error.\n" #~ msgid "" #~ ": Error: Sent DELE, but server responded with an error. Delete failed.\n" #~ msgstr "" #~ ": Error: se envi DELE, pero el servidor respondi con un error. Borrado " #~ "fallido.\n" #~ msgid "" #~ ": Error: Encountered a malformed e-mail header which could not be handled " #~ "by Mailfilter. " #~ msgstr "" #~ ": Error: se encontr una cabecer de correo electrnico mal construida " #~ "que Mailfilter no puede manejar." #~ msgid "Program aborted.\n" #~ msgstr "Programa abortado.\n" #~ msgid ": Error: Operation timed out.\n" #~ msgstr ": Error: la operacin ha sobrepasado el tiempo mximo de espera.\n" #~ msgid ": Error: Signal handler could not be installed.\n" #~ msgstr ": Error: no se puede instalar el gestor de seales.\n" #~ msgid "" #~ ": Error: The rcfile for preferences has wrong number of arguments or " #~ "malformed syntax." #~ msgstr "" #~ ": Error: el fichero de configuracin tiene opciones con un nmero de " #~ "argumentos errneo o errores de sintaxis." #~ msgid "" #~ ": Error: The rcfile for preferences (usually $HOME/.mailfilterrc) could " #~ "not be read." #~ msgstr "" #~ ": Error: no se puede leer el fichero de configuracin (normalmente $HOME/." #~ "mailfilterrc)." #~ msgid "" #~ ": Error: Aborted pre-compilation of Regular Expressions. Check the syntax " #~ "of your filters and rules." #~ msgstr "" #~ ": Error: se abort la precompilacin de las expresiones regulares. " #~ "Compruebe la sintaxis de sus filtros y reglas." #~ msgid "" #~ ": Error: Could not access the logfile. Check the file permissions of your " #~ "logfile and make sure the rcfile contains the correct path." #~ msgstr "" #~ ": Error: no se puede acceder al fichero de registro. Compruebe los " #~ "permisos del fichero de registro y asegrese de que el fichero de " #~ "configuracin contiene la ruta correcta." #~ msgid "" #~ ": Error: Communication failure. Either the server closed the connection " #~ "due to a time-out problem, or the entire network connection has dropped." #~ msgstr "" #~ ": Error: fallo en la comunicacin. El servidor ha cerrado la conexin por " #~ "sobrepasar el tiempo mximo de espera o la red completa ha fallado." #~ msgid ": Error: Connection to the mail server has timed out." #~ msgstr "" #~ ": Error: la conexin con el servidor de correo ha sobrepasado el tiempo " #~ "mximo de espera." #~ msgid "" #~ ": Error: Unknown communication error occured. Please consider reporting a " #~ "bug. Thank you." #~ msgstr "" #~ ": Error: se produjo un error de comunicacin desconocido. Por favor, " #~ "informe de esta errata. Gracias." #~ msgid ": Error: Malformed e-mail header." #~ msgstr ": Error: cabecera de correo electrnico mal construida." #~ msgid ": Error: " #~ msgstr ": Error: " #~ msgid "" #~ ": Error: This is an unknown error. Please consider reporting a bug. Thank " #~ "you." #~ msgstr "" #~ ": Error: se ha producido un error desconocido. Por favor, informe de esta " #~ "errata. Gracias." #~ msgid ": Signal SIGINT caught. Terminating with signal " #~ msgstr ": Capturada seal SIGINT. Terminando con seal " #~ msgid ": Internal error code from the Regular Expression library: " #~ msgstr ": Error interno de la biblioteca de expresiones regulares: " #~ msgid ": Deprecated keyword '" #~ msgstr ": Palabra clave en desuso '" #~ msgid "' in '" #~ msgstr "' en '" #~ msgid ": Instead use the keyword 'REG_CASE' from now on." #~ msgstr "" #~ ": Utilice en su lugar la palabra clave 'REG_CASE' a partir de ahora." #~ msgid ": Instead use the keyword 'VERBOSE' from now on." #~ msgstr ": Utilice en su lugar la palabra clave 'VERBOSE' a partir de ahora." #~ msgid ": Consult the mailfilterrc(5) man page for further details." #~ msgstr "" #~ ": Consulte la pgina de manual de mailfilterrc(5) para conocer ms " #~ "detalles" #~ msgid ": A keyword in '" #~ msgstr ": Una palabra clave en '" #~ msgid "' contains invalid parameters." #~ msgstr "' contiene parmetros no vlidos." #~ msgid "%s: Examining %d message(s).\n" #~ msgstr "%s: Examinando %d mensaje(s).\n" #~ msgid ": Error: Rcfiles nested too deeply." #~ msgstr ": Error: ficheros de configuracin demasiado anidados." #~ msgid ": Error: Nested rcfile '" #~ msgstr ": Error: fichero de configuracin anidado '" #~ msgid ": Error: Syntax error in line " #~ msgstr ": Error: sintaxis errnea en la lnea " #~ msgid " of your rcfile '" #~ msgstr " de su fichero de configuracin '" #~ msgid " of your rcfile." #~ msgstr " de su fichero de configuracin." #~ msgid ": The term '" #~ msgstr ": El trmino '" #~ msgid "' could not be interpreted." #~ msgstr "' no se pudo interpretar." #~ msgid " in line " #~ msgstr " en la lnea " mailfilter-0.8.9/po/fr.po000066400000000000000000000302541430510321000152360ustar00rootroot00000000000000# French translations for Mailfilter. # Copyright (C) 2001 Free Software Foundation, Inc. # Etienne Herlent , 2001. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: mailfilter 0.3.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-12-31 21:45+0100\n" "PO-Revision-Date: 2001-02-27 09:13-100\n" "Last-Translator: Etienne Herlent \n" "Language-Team: French \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" #: src/mailfilter.cc:94 msgid "The rcfile could not be opened." msgstr "" #: src/mailfilter.cc:107 msgid "Loading the rcfile failed." msgstr "" #: src/mailfilter.cc:113 src/mailfilter.cc:182 msgid "Runtime exception occured: " msgstr "" #: src/mailfilter.cc:124 msgid "Could not open log file '" msgstr "" #: src/mailfilter.cc:125 msgid "' for writing." msgstr "" #: src/mailfilter.cc:127 msgid "Could not locate log file." msgstr "" #: src/mailfilter.cc:138 #, fuzzy msgid "Signal handler could not be installed." msgstr ": Erreur : le gestionnaire de signal ne peut pas tre install." #: src/mailfilter.cc:166 msgid " querying " msgstr " recherche de " #: src/mailfilter.cc:168 msgid " on " msgstr " sur " #: src/mailfilter.cc:173 msgid "Skipping account " msgstr "" #: src/mailfilter.cc:176 msgid " due to earlier errors.\n" msgstr "" #: src/mailfilter.cc:226 #, fuzzy msgid "Mailfilter filters e-mail and removes spam in one " msgstr "" "Mailfilter filtre les messages et limine le spam dans un ou plusieurs " "compte de messagerie POP." #: src/mailfilter.cc:227 msgid "or many POP accounts." msgstr "" #: src/mailfilter.cc:229 msgid "Usage: " msgstr "Utilisation: " #: src/mailfilter.cc:229 msgid " [OPTION]..." msgstr " [OPTION]..." #: src/mailfilter.cc:231 #, fuzzy msgid "If a long option shows an argument as mandatory, " msgstr "" "Si une option longue indique qu'un argument est obligatoire, c'est qu'il est " "obligatoire" #: src/mailfilter.cc:232 msgid "then " msgstr "" #: src/mailfilter.cc:233 #, fuzzy msgid "it is mandatory for the equivalent short option " msgstr "pour les options courtes quivalentes aussi." #: src/mailfilter.cc:234 msgid "also." msgstr "" #: src/mailfilter.cc:236 msgid "Options:" msgstr "Options:" #: src/mailfilter.cc:237 #, fuzzy msgid " -h, --help " msgstr " -h, --help affiche ce message d'aide" #: src/mailfilter.cc:238 #, fuzzy msgid "Display this help information" msgstr " -h, --help affiche ce message d'aide" #: src/mailfilter.cc:239 #, fuzzy msgid " -L, --logfile=FILE " msgstr "" " -L, --logfile=FICHIER indique le chemin d'accs et le nom du fichier " "de log" #: src/mailfilter.cc:240 #, fuzzy msgid "Specify logfile location" msgstr "" " -L, --logfile=FICHIER indique le chemin d'accs et le nom du fichier " "de log" #: src/mailfilter.cc:241 #, fuzzy msgid " -M, --mailfilterrc=FILE " msgstr "" " -M, --mailfilterrc=FICHIER indique le chemin et le nom du fichier de " "configuration" #: src/mailfilter.cc:242 #, fuzzy msgid "Specify rcfile location" msgstr "" " -M, --mailfilterrc=FICHIER indique le chemin et le nom du fichier de " "configuration" #: src/mailfilter.cc:243 msgid " -r, --return-value " msgstr "" #: src/mailfilter.cc:244 msgid "Enable additional return values" msgstr "" #: src/mailfilter.cc:245 #, fuzzy msgid " -t, --test " msgstr " -h, --help affiche ce message d'aide" #: src/mailfilter.cc:246 msgid "Simulate deletes" msgstr "" #: src/mailfilter.cc:247 #, fuzzy msgid " -v, --verbose=LEVEL " msgstr " -v, --verbose=NIVEAU indique le niveau de verbosit" #: src/mailfilter.cc:248 #, fuzzy msgid "Specify level of verbosity" msgstr " -v, --verbose=NIVEAU indique le niveau de verbosit" #: src/mailfilter.cc:249 #, fuzzy msgid " -V, --version " msgstr " -V, --version affiche le numro de version" #: src/mailfilter.cc:250 #, fuzzy msgid "Display version information" msgstr " -V, --version affiche le numro de version" #: src/mailfilter.cc:252 msgid "Report bugs to " msgstr "" #: src/mailfilter.cc:263 #, fuzzy msgid "This is free software; see the source for copying " msgstr "" "Ce programme est un logiciel libre; voyez son source pour les conditions de " "copie." #: src/mailfilter.cc:264 msgid "conditions. There is NO warranty; not even for " msgstr "" #: src/mailfilter.cc:265 #, fuzzy msgid "MERCHANTABILITY or FITNESS FOR A PARTICULAR " msgstr "" "Il n'y a aucune garantie, y compris les garanties de commercialisation ou " "d'adaptation dans un but particulier." #: src/mailfilter.cc:266 msgid "PURPOSE." msgstr "" #: src/mailfilter.cc:291 msgid "Try '" msgstr "Essayez '" #: src/mailfilter.cc:292 msgid " --help' for more information." msgstr " --help' pour plus d'informations." #: src/mailfilter.cc:314 #, fuzzy msgid "Could not compile regular expression (allow)." msgstr ": Impossible de pr-compiler cette expression rationnelle '" #: src/mailfilter.cc:325 #, fuzzy msgid "Could not compile regular expression (deny)." msgstr ": Impossible de pr-compiler cette expression rationnelle '" #: src/mailfilter.cc:337 #, fuzzy msgid "Could not compile regular expression (score)." msgstr ": Impossible de pr-compiler cette expression rationnelle '" #: src/mailfilter.cc:388 #, fuzzy msgid "popen failed." msgstr ". chec au login.\n" #: src/mailfilter.cc:398 #, fuzzy msgid "pclose failed." msgstr ". chec au login.\n" #: src/getopt.c:688 src/getopt.c:698 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "" #: src/getopt.c:730 src/getopt.c:734 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "" #: src/getopt.c:743 src/getopt.c:748 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "" #: src/getopt.c:782 src/getopt.c:793 src/getopt.c:1070 src/getopt.c:1082 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "" #: src/getopt.c:830 src/getopt.c:833 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "" #: src/getopt.c:841 src/getopt.c:844 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "" #: src/getopt.c:887 src/getopt.c:890 #, c-format msgid "%s: illegal option -- %c\n" msgstr "" #: src/getopt.c:896 src/getopt.c:899 #, c-format msgid "%s: invalid option -- %c\n" msgstr "" #: src/getopt.c:942 src/getopt.c:952 src/getopt.c:1136 src/getopt.c:1147 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "" #: src/getopt.c:1004 src/getopt.c:1014 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "" #: src/getopt.c:1038 src/getopt.c:1049 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "" #, fuzzy #~ msgid " -H FILE " #~ msgstr " -h, --help affiche ce message d'aide" #~ msgid "Report bugs to ." #~ msgstr "Les bugs sont reporter ." #, fuzzy #~ msgid "" #~ "Copyright (c) 2000 - 2003 Andreas Bauer " #~ msgstr "" #~ "Copyright (c) 2000 - 2001 Andreas Bauer " #, fuzzy #~ msgid " and " #~ msgstr " sur " #~ msgid ": Error: Could not login to server " #~ msgstr ": Erreur: impossible de se logger au serveur " #~ msgid ". Unknown error.\n" #~ msgstr ". Erreur inconnue.\n" #~ msgid ": Error: DNS lookup failure for " #~ msgstr ": Erreur: chec de DNS pour " #~ msgid ": Error: Network connection could not be established.\n" #~ msgstr ": Erreur: la connexion au rseau ne peut pas tre tablie.\n" #~ msgid ": Error: Authentication failed. Login canceled.\n" #~ msgstr ": Erreur: l'authentification a chou. Login annul.\n" #~ msgid ": Error: Mail server not responding. Login canceled.\n" #~ msgstr ": Erreur: le serveur de messagerie ne rpond pas. Login annul.\n" #~ msgid ": Error: Could not establish mail server connection.\n" #~ msgstr "" #~ ": Erreur: impossible d'tablir une connexion avec le serveur de " #~ "messagerie.\n" #~ msgid ": Error: Sent STAT, but server responded with an error.\n" #~ msgstr "" #~ ": Erreur: commande STAT mise, mais le serveur rpond avec une erreur.\n" #~ msgid ": Error: Sent TOP, but server responded with an error.\n" #~ msgstr "" #~ ": Erreur: commande TOP mise, mais le serveur rpond avec une erreur.\n" #~ msgid ": Error: Sent LIST, but server responded with an error.\n" #~ msgstr "" #~ ": Erreur: commande LIST mise, mais le serveur rpond avec une erreur.\n" #~ msgid "" #~ ": Error: Sent DELE, but server responded with an error. Delete failed.\n" #~ msgstr "" #~ ": Erreur: commande DELE mise, mais le serveur rpond avec une erreur.\n" #~ msgid "" #~ ": Error: Encountered a malformed e-mail header which could not be handled " #~ "by Mailfilter. " #~ msgstr "" #~ ": Erreur: un entte de message incorrect a t rencontr et ne peut pas " #~ "tre trait par Mailfilter. " #~ msgid "Program aborted.\n" #~ msgstr "Programme avort.\n" #~ msgid ": Error: Operation timed out.\n" #~ msgstr ": Erreur: dlai dpass sur une opration\n" #~ msgid ": Error: Signal handler could not be installed.\n" #~ msgstr ": Erreur: le gestionnaire de signal ne peut pas tre install.\n" #~ msgid "" #~ ": Error: The rcfile for preferences has wrong number of arguments or " #~ "malformed syntax." #~ msgstr "" #~ ": Erreur: le fichier de prfrences contient un mauvais nombre " #~ "d'arguments ou une syntaxe incorrecte." #~ msgid "" #~ ": Error: The rcfile for preferences (usually $HOME/.mailfilterrc) could " #~ "not be read." #~ msgstr "" #~ ": Erreur: le fichier de prfrences (normalement $HOME/.mailfilterrc) ne " #~ "peut pas tre lu." #~ msgid "" #~ ": Error: Aborted pre-compilation of Regular Expressions. Check the syntax " #~ "of your filters and rules." #~ msgstr "" #~ ": Erreur: la pr-compilation d'une expression rationnelle a t arrte. " #~ "Vrifiez la syntaxe de vos filtres et de vos rgles." #~ msgid "" #~ ": Error: Could not access the logfile. Check the file permissions of your " #~ "logfile and make sure the rcfile contains the correct path." #~ msgstr "" #~ ": Erreur: impossible d'accder au fichier de log. Vrifiez les " #~ "autorisations d'accs ce fichier et son chemin d'accs dans le fichier " #~ "de prfrences." #~ msgid "" #~ ": Error: Communication failure. Either the server closed the connection " #~ "due to a time-out problem, or the entire network connection has dropped." #~ msgstr "" #~ ": Erreur: chec de communication. Soit le serveur a ferm la connexion " #~ "cause d'un dlai dpass, soit la connexion au rseau est tombe." #~ msgid ": Error: Connection to the mail server has timed out." #~ msgstr ": Erreur: dlai dpass sur la connexion au serveur de messagerie." #~ msgid "" #~ ": Error: Unknown communication error occured. Please consider reporting a " #~ "bug. Thank you." #~ msgstr "" #~ ": Erreur: une erreur inconnue de communication s'est produite. Merci de " #~ "rapporter le problme." #~ msgid ": Error: Malformed e-mail header." #~ msgstr ": Erreur: entte de message malform." #~ msgid "" #~ ": Error: This is an unknown error. Please consider reporting a bug. Thank " #~ "you." #~ msgstr ": Erreur: Erreur inconnue. Merci de rapporter le problme." #~ msgid ": Signal SIGINT caught. Terminating with signal " #~ msgstr ": Signal SIGINT dtect. Arrt avec le signal " #~ msgid ": Internal error code from the Regular Expression library: " #~ msgstr "" #~ ": erreur interne de la bibliothque de traitement des expressions " #~ "rationnelles: " #~ msgid ": Deprecated keyword '" #~ msgstr ": mot clef obsolte '" #~ msgid "' in '" #~ msgstr "' dans '" #~ msgid ": Instead use the keyword 'REG_CASE' from now on." #~ msgstr ": utilisez plutt 'REG_CASE'." #~ msgid ": Instead use the keyword 'VERBOSE' from now on." #~ msgstr ": utilisez plutt 'VERBOSE'." #~ msgid ": Consult the mailfilterrc(5) man page for further details." #~ msgstr ": voyez le manuel de mailfilterrc(5) pour les dtails" #~ msgid ": A keyword in '" #~ msgstr " un mot-clef dans '" #~ msgid "' contains invalid parameters." #~ msgstr "' contient un paramtre incorrect." #~ msgid "%s: Examining %d message(s).\n" #~ msgstr "%s: Analyse de %d message(s).\n" #~ msgid ": Invalid keyword in '" #~ msgstr ": mot clef invalide dans '" mailfilter-0.8.9/po/it.po000066400000000000000000000302761430510321000152470ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR Free Software Foundation, Inc. # FIRST Matteo Merli , 2001. # msgid "" msgstr "" "Project-Id-Version: mailfilter 0.3.3\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-12-31 21:45+0100\n" "PO-Revision-Date: 2002-10-08 17:14+0200\n" "Last-Translator: Matteo Merli \n" "Language-Team: Italian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 0.8\n" #: src/mailfilter.cc:94 msgid "The rcfile could not be opened." msgstr "" #: src/mailfilter.cc:107 msgid "Loading the rcfile failed." msgstr "" #: src/mailfilter.cc:113 src/mailfilter.cc:182 msgid "Runtime exception occured: " msgstr "" #: src/mailfilter.cc:124 msgid "Could not open log file '" msgstr "" #: src/mailfilter.cc:125 msgid "' for writing." msgstr "" #: src/mailfilter.cc:127 msgid "Could not locate log file." msgstr "" #: src/mailfilter.cc:138 #, fuzzy msgid "Signal handler could not be installed." msgstr ": Errore: Impossibile stabilire la connessione.\n" #: src/mailfilter.cc:166 msgid " querying " msgstr " interrogando " #: src/mailfilter.cc:168 msgid " on " msgstr " su " #: src/mailfilter.cc:173 msgid "Skipping account " msgstr "" #: src/mailfilter.cc:176 msgid " due to earlier errors.\n" msgstr "" #: src/mailfilter.cc:226 #, fuzzy msgid "Mailfilter filters e-mail and removes spam in one " msgstr "" "Mailfilter controlla le e-mail e rimuove i messaggi indesiderati da uno o " "pi account POP." #: src/mailfilter.cc:227 msgid "or many POP accounts." msgstr "" #: src/mailfilter.cc:229 msgid "Usage: " msgstr "Utilizzo: " #: src/mailfilter.cc:229 msgid " [OPTION]..." msgstr " [OPZIONI]..." #: src/mailfilter.cc:231 #, fuzzy msgid "If a long option shows an argument as mandatory, " msgstr "" "Se un'opzione lunga mostra un'argomento come obbligatorio, allora " "obbligatorio " #: src/mailfilter.cc:232 msgid "then " msgstr "" #: src/mailfilter.cc:233 #, fuzzy msgid "it is mandatory for the equivalent short option " msgstr "anche per l'opzione corta equivalente." #: src/mailfilter.cc:234 msgid "also." msgstr "" #: src/mailfilter.cc:236 msgid "Options:" msgstr "Opzioni:" #: src/mailfilter.cc:237 #, fuzzy msgid " -h, --help " msgstr " -h, --help Mostra questa schermata di aiuto" #: src/mailfilter.cc:238 #, fuzzy msgid "Display this help information" msgstr " -h, --help Mostra questa schermata di aiuto" #: src/mailfilter.cc:239 #, fuzzy msgid " -L, --logfile=FILE " msgstr " -L, --logfile=FILE Specifica la posizione del file di Log" #: src/mailfilter.cc:240 #, fuzzy msgid "Specify logfile location" msgstr " -L, --logfile=FILE Specifica la posizione del file di Log" #: src/mailfilter.cc:241 #, fuzzy msgid " -M, --mailfilterrc=FILE " msgstr " -M, --mailfilterrc=FILE Specifica la posizione del filerc" #: src/mailfilter.cc:242 #, fuzzy msgid "Specify rcfile location" msgstr " -M, --mailfilterrc=FILE Specifica la posizione del filerc" #: src/mailfilter.cc:243 msgid " -r, --return-value " msgstr "" #: src/mailfilter.cc:244 msgid "Enable additional return values" msgstr "" #: src/mailfilter.cc:245 #, fuzzy msgid " -t, --test " msgstr " -h, --help Mostra questa schermata di aiuto" #: src/mailfilter.cc:246 msgid "Simulate deletes" msgstr "" #: src/mailfilter.cc:247 #, fuzzy msgid " -v, --verbose=LEVEL " msgstr " -v, --verbose=LEVEL Specifica il livello di prolissit" #: src/mailfilter.cc:248 #, fuzzy msgid "Specify level of verbosity" msgstr " -v, --verbose=LEVEL Specifica il livello di prolissit" #: src/mailfilter.cc:249 #, fuzzy msgid " -V, --version " msgstr " -V, --version Mostra le informazioni sulla versione" #: src/mailfilter.cc:250 #, fuzzy msgid "Display version information" msgstr " -V, --version Mostra le informazioni sulla versione" #: src/mailfilter.cc:252 msgid "Report bugs to " msgstr "" #: src/mailfilter.cc:263 msgid "This is free software; see the source for copying " msgstr "" #: src/mailfilter.cc:264 msgid "conditions. There is NO warranty; not even for " msgstr "" #: src/mailfilter.cc:265 msgid "MERCHANTABILITY or FITNESS FOR A PARTICULAR " msgstr "" #: src/mailfilter.cc:266 msgid "PURPOSE." msgstr "" #: src/mailfilter.cc:291 msgid "Try '" msgstr "Prova '" #: src/mailfilter.cc:292 msgid " --help' for more information." msgstr " --help' per pi informazioni." #: src/mailfilter.cc:314 #, fuzzy msgid "Could not compile regular expression (allow)." msgstr ": Impossibile pre-compilare questa espressione regolare '" #: src/mailfilter.cc:325 #, fuzzy msgid "Could not compile regular expression (deny)." msgstr ": Impossibile pre-compilare questa espressione regolare '" #: src/mailfilter.cc:337 #, fuzzy msgid "Could not compile regular expression (score)." msgstr ": Impossibile pre-compilare questa espressione regolare '" #: src/mailfilter.cc:388 #, fuzzy msgid "popen failed." msgstr ". Accesso (login) fallito.\n" #: src/mailfilter.cc:398 #, fuzzy msgid "pclose failed." msgstr ". Accesso (login) fallito.\n" #: src/getopt.c:688 src/getopt.c:698 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: l'opzione `%s' ambigua\n" #: src/getopt.c:730 src/getopt.c:734 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: l'opzione `--%s' non prevede un argomento\n" #: src/getopt.c:743 src/getopt.c:748 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: l'opzione `%c%s' non prevede un argomento\n" #: src/getopt.c:782 src/getopt.c:793 src/getopt.c:1070 src/getopt.c:1082 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: l'opzione `%s' richiede un argomento\n" #: src/getopt.c:830 src/getopt.c:833 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: opzione sconosciuta `--%s'\n" #: src/getopt.c:841 src/getopt.c:844 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: opzione sconosciuta `%c%s'\n" #: src/getopt.c:887 src/getopt.c:890 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: opzione illegale -- %c\n" #: src/getopt.c:896 src/getopt.c:899 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: opzione invalida -- %c\n" #: src/getopt.c:942 src/getopt.c:952 src/getopt.c:1136 src/getopt.c:1147 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: l'opzione richiede un argomento -- %c\n" #: src/getopt.c:1004 src/getopt.c:1014 #, fuzzy, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: l'opzione `%s' ambigua\n" #: src/getopt.c:1038 src/getopt.c:1049 #, fuzzy, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s: l'opzione `--%s' non prevede un argomento\n" #, fuzzy #~ msgid " -H FILE " #~ msgstr " -h, --help Mostra questa schermata di aiuto" #~ msgid "Report bugs to ." #~ msgstr "Segnala i bug a ." #, fuzzy #~ msgid "" #~ "Copyright (c) 2000 - 2003 Andreas Bauer " #~ msgstr "Segnala i bug a ." #, fuzzy #~ msgid " and " #~ msgstr " su " #~ msgid ": Error: Could not login to server " #~ msgstr ": Errore: Impossibile fare il login sul server " #~ msgid ". Unknown error.\n" #~ msgstr ". Errore sconosciuto.\n" #~ msgid ": Error: DNS lookup failure for " #~ msgstr ": Errore: impossibile trovare il DNS " #~ msgid ": Error: Network connection could not be established.\n" #~ msgstr ": Errore: Impossibile stabilire la connessione.\n" #~ msgid ": Error: Authentication failed. Login canceled.\n" #~ msgstr ": Errore: Autentificazione fallita. Login annullato.\n" #~ msgid ": Error: Mail server not responding. Login canceled.\n" #~ msgstr ": Errore: Il server di posta non risponde. Login annullato.\n" #~ msgid ": Error: Could not establish mail server connection.\n" #~ msgstr "" #~ ": Errore: Impossibile stabilire una connessione con il server di posta.\n" #~ msgid ": Error: Sent STAT, but server responded with an error.\n" #~ msgstr ": Errore: Inviato STAT, ma il server ha risposto con un errore.\n" #~ msgid ": Error: Sent TOP, but server responded with an error.\n" #~ msgstr ": Errore: Inviato TOP, ma il server ha risposto con un errore.\n" #~ msgid ": Error: Sent LIST, but server responded with an error.\n" #~ msgstr ": Errore: Inviato LIST, ma il server ha risposto con un errore.\n" #~ msgid "" #~ ": Error: Sent DELE, but server responded with an error. Delete failed.\n" #~ msgstr "" #~ ": Errore: Inviato DELE, ma il server ha risposto con un errore. " #~ "Eliminazione fallita.\n" #~ msgid "" #~ ": Error: Encountered a malformed e-mail header which could not be handled " #~ "by Mailfilter. " #~ msgstr "" #~ ": Errore: E' stato trovato un header e-mail malformato e non pu essere " #~ "processato da Mailfilter. " #~ msgid "Program aborted.\n" #~ msgstr "Programma interrotto.\n" #, fuzzy #~ msgid ": Error: Operation timed out.\n" #~ msgstr "" #~ ": Errore: La connessione con il server di posta andata in time-out." #, fuzzy #~ msgid ": Error: Signal handler could not be installed.\n" #~ msgstr ": Errore: Impossibile stabilire la connessione.\n" #~ msgid "" #~ ": Error: The rcfile for preferences has wrong number of arguments or " #~ "malformed syntax." #~ msgstr "" #~ ": Errore: Il filerc per le preferenze ha un numero errato di argomenti " #~ "oppure una sintassi errata." #~ msgid "" #~ ": Error: The rcfile for preferences (usually $HOME/.mailfilterrc) could " #~ "not be read." #~ msgstr "" #~ ": Errore: Il filerc per le preferenze (di solito $HOME/.mailfilterrc) non " #~ "pu essere letto." #~ msgid "" #~ ": Error: Aborted pre-compilation of Regular Expressions. Check the syntax " #~ "of your filters and rules." #~ msgstr "" #~ ": Errore: Interrotta la pre-compilazione delle espressioni regolari. " #~ "Controlla la sintassi delle tue regole e dei tuoi filtri." #~ msgid "" #~ ": Error: Could not access the logfile. Check the file permissions of your " #~ "logfile and make sure the rcfile contains the correct path." #~ msgstr "" #~ ": Errore: Impossibile accedere al file Log. Controlla i permessi del tuo " #~ "file di Log e assicurati che il filerc contenga l'esatto percorso." #~ msgid "" #~ ": Error: Communication failure. Either the server closed the connection " #~ "due to a time-out problem, or the entire network connection has dropped." #~ msgstr "" #~ ": Errore: Comunicazione fallita. O il server ha chiuso la connessione per " #~ "un problema di time-out, oppure caduta la connessione di rete." #~ msgid ": Error: Connection to the mail server has timed out." #~ msgstr "" #~ ": Errore: La connessione con il server di posta andata in time-out." #~ msgid "" #~ ": Error: Unknown communication error occured. Please consider reporting a " #~ "bug. Thank you." #~ msgstr "" #~ ": Errore: Errore sconociuto di comunicazione. Per favore segnala il bug. " #~ "Grazie." #~ msgid ": Error: Malformed e-mail header." #~ msgstr ": Errore: Header e-mail malformato." #~ msgid "" #~ ": Error: This is an unknown error. Please consider reporting a bug. Thank " #~ "you." #~ msgstr "" #~ ": Errore: Questo un errore sconosciuto. Per favore segnala il bug. " #~ "Grazie." #~ msgid ": Internal error code from the Regular Expression library: " #~ msgstr "" #~ ": Errore interno nel codice della libreria per le espressioni regolari: " #~ msgid ": Deprecated keyword '" #~ msgstr ": Parola chiave deprecata '" #~ msgid "' in '" #~ msgstr "' in '" #~ msgid ": Instead use the keyword 'REG_CASE' from now on." #~ msgstr ": D'ora in poi utilizza 'REG_CASE'." #~ msgid ": Instead use the keyword 'VERBOSE' from now on." #~ msgstr ": D'ora in poi utilizza 'VERBOSE'." #~ msgid ": Consult the mailfilterrc(5) man page for further details." #~ msgstr "" #~ ": Consulta la pagina di manuale (man) di mailfilterrc(5) per ulteriori " #~ "dettagli." #~ msgid ": A keyword in '" #~ msgstr ": Una parola chiave in '" #~ msgid "' contains invalid parameters." #~ msgstr "' contiene parametri non validi." #~ msgid "%s: Examining %d message(s).\n" #~ msgstr "%s: Esaminando %d messaggio(i).\n" #~ msgid ": Invalid keyword in '" #~ msgstr ": Parola chiave non valida in '" mailfilter-0.8.9/po/pt_BR.po000066400000000000000000000307311430510321000156350ustar00rootroot00000000000000# Brazilian Portuguese translation of mailfilter. # Copyright (C) 2001 Free Software Foundation, Inc. # Frdric L. W. Meunier <0 @ pervalidus.net>, 2001. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: mailfilter 0.2.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-12-31 21:45+0100\n" "PO-Revision-Date: 2001-07-07 01:53-0300\n" "Last-Translator: Frdric L. W. Meunier <0 @ pervalidus.net>\n" "Language-Team: LDP-BR (http://ldp-br.conectiva.com.br/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" #: src/mailfilter.cc:94 msgid "The rcfile could not be opened." msgstr "" #: src/mailfilter.cc:107 msgid "Loading the rcfile failed." msgstr "" #: src/mailfilter.cc:113 src/mailfilter.cc:182 msgid "Runtime exception occured: " msgstr "" #: src/mailfilter.cc:124 msgid "Could not open log file '" msgstr "" #: src/mailfilter.cc:125 msgid "' for writing." msgstr "" #: src/mailfilter.cc:127 msgid "Could not locate log file." msgstr "" #: src/mailfilter.cc:138 #, fuzzy msgid "Signal handler could not be installed." msgstr ": Erro: A conexo de rede no pde ser estabelecida.\n" #: src/mailfilter.cc:166 msgid " querying " msgstr " consultando " #: src/mailfilter.cc:168 msgid " on " msgstr " em " #: src/mailfilter.cc:173 msgid "Skipping account " msgstr "" #: src/mailfilter.cc:176 msgid " due to earlier errors.\n" msgstr "" #: src/mailfilter.cc:226 #, fuzzy msgid "Mailfilter filters e-mail and removes spam in one " msgstr "" "Mailfilter filtra as mensagens e remove o SPAM em uma ou vrias contas POP." #: src/mailfilter.cc:227 msgid "or many POP accounts." msgstr "" #: src/mailfilter.cc:229 msgid "Usage: " msgstr "Utilizao: " #: src/mailfilter.cc:229 msgid " [OPTION]..." msgstr " [OPO]..." #: src/mailfilter.cc:231 #, fuzzy msgid "If a long option shows an argument as mandatory, " msgstr "" "Se uma opo longa indica que um argumento obrigatrio, ento ele " "obrigatrio" #: src/mailfilter.cc:232 msgid "then " msgstr "" #: src/mailfilter.cc:233 #, fuzzy msgid "it is mandatory for the equivalent short option " msgstr "tambm para as opes curtas equivalentes." #: src/mailfilter.cc:234 msgid "also." msgstr "" #: src/mailfilter.cc:236 msgid "Options:" msgstr "Opes:" #: src/mailfilter.cc:237 #, fuzzy msgid " -h, --help " msgstr " -h, --help Indica esta mensagem de ajuda" #: src/mailfilter.cc:238 #, fuzzy msgid "Display this help information" msgstr " -h, --help Indica esta mensagem de ajuda" #: src/mailfilter.cc:239 #, fuzzy msgid " -L, --logfile=FILE " msgstr "" " -L, --logfile=FILE Especifica a localizao do arquivo de log" #: src/mailfilter.cc:240 #, fuzzy msgid "Specify logfile location" msgstr "" " -L, --logfile=FILE Especifica a localizao do arquivo de log" #: src/mailfilter.cc:241 #, fuzzy msgid " -M, --mailfilterrc=FILE " msgstr "" " -M, --mailfilterrc=FILE Especifica a localizao do arquivo de " "configurao" #: src/mailfilter.cc:242 #, fuzzy msgid "Specify rcfile location" msgstr "" " -M, --mailfilterrc=FILE Especifica a localizao do arquivo de " "configurao" #: src/mailfilter.cc:243 msgid " -r, --return-value " msgstr "" #: src/mailfilter.cc:244 msgid "Enable additional return values" msgstr "" #: src/mailfilter.cc:245 #, fuzzy msgid " -t, --test " msgstr " -h, --help Indica esta mensagem de ajuda" #: src/mailfilter.cc:246 msgid "Simulate deletes" msgstr "" #: src/mailfilter.cc:247 #, fuzzy msgid " -v, --verbose=LEVEL " msgstr " -v, --verbose=LEVEL Especifica o nvel de verbosidade" #: src/mailfilter.cc:248 #, fuzzy msgid "Specify level of verbosity" msgstr " -v, --verbose=LEVEL Especifica o nvel de verbosidade" #: src/mailfilter.cc:249 #, fuzzy msgid " -V, --version " msgstr " -V, --version Indica o nmero da verso" #: src/mailfilter.cc:250 #, fuzzy msgid "Display version information" msgstr " -V, --version Indica o nmero da verso" #: src/mailfilter.cc:252 msgid "Report bugs to " msgstr "" #: src/mailfilter.cc:263 #, fuzzy msgid "This is free software; see the source for copying " msgstr "" "Este programa software livre; veja seu cdigo fonte para condies de " "cpia. NO h" #: src/mailfilter.cc:264 msgid "conditions. There is NO warranty; not even for " msgstr "" #: src/mailfilter.cc:265 #, fuzzy msgid "MERCHANTABILITY or FITNESS FOR A PARTICULAR " msgstr "" "garantia; nem mesmo para COMERCIABILIDADE ou APTIDO PARA UMA FINALIDADE " "PARTICULAR." #: src/mailfilter.cc:266 msgid "PURPOSE." msgstr "" #: src/mailfilter.cc:291 msgid "Try '" msgstr "Tente '" #: src/mailfilter.cc:292 msgid " --help' for more information." msgstr "--help' para maiores informaes." #: src/mailfilter.cc:314 #, fuzzy msgid "Could not compile regular expression (allow)." msgstr ": No pde prcompilar essa expresso racional '" #: src/mailfilter.cc:325 #, fuzzy msgid "Could not compile regular expression (deny)." msgstr ": No pde prcompilar essa expresso racional '" #: src/mailfilter.cc:337 #, fuzzy msgid "Could not compile regular expression (score)." msgstr ": No pde prcompilar essa expresso racional '" #: src/mailfilter.cc:388 #, fuzzy msgid "popen failed." msgstr ". Falha no login.\n" #: src/mailfilter.cc:398 #, fuzzy msgid "pclose failed." msgstr ". Falha no login.\n" #: src/getopt.c:688 src/getopt.c:698 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: oo `%s' ambgua\n" #: src/getopt.c:730 src/getopt.c:734 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: opo `--%s' no permite um argumento\n" #: src/getopt.c:743 src/getopt.c:748 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: opo `%c%s' no permite um argumento\n" #: src/getopt.c:782 src/getopt.c:793 src/getopt.c:1070 src/getopt.c:1082 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: opo `%s' requer um argumento\n" #: src/getopt.c:830 src/getopt.c:833 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: opo desconhecida `--%s'\n" #: src/getopt.c:841 src/getopt.c:844 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: opo desconhecida `%c%s'\n" #: src/getopt.c:887 src/getopt.c:890 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: opo ilegal -- %c\n" #: src/getopt.c:896 src/getopt.c:899 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: opo invlida -- %c\n" #: src/getopt.c:942 src/getopt.c:952 src/getopt.c:1136 src/getopt.c:1147 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: opo requer um argumento -- %c\n" #: src/getopt.c:1004 src/getopt.c:1014 #, fuzzy, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: oo `%s' ambgua\n" #: src/getopt.c:1038 src/getopt.c:1049 #, fuzzy, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s: opo `--%s' no permite um argumento\n" #, fuzzy #~ msgid " -H FILE " #~ msgstr " -h, --help Indica esta mensagem de ajuda" #~ msgid "Report bugs to ." #~ msgstr "Reporte bugs para ." #, fuzzy #~ msgid "" #~ "Copyright (c) 2000 - 2003 Andreas Bauer " #~ msgstr "Reporte bugs para ." #, fuzzy #~ msgid " and " #~ msgstr " em " #~ msgid ": Error: Could not login to server " #~ msgstr ": Erro: No pde logar no servidor " #~ msgid ". Unknown error.\n" #~ msgstr ". Erro desconhecido.\n" #~ msgid ": Error: DNS lookup failure for " #~ msgstr ": Erro: Falha de consulta de DNS para " #~ msgid ": Error: Network connection could not be established.\n" #~ msgstr ": Erro: A conexo de rede no pde ser estabelecida.\n" #~ msgid ": Error: Authentication failed. Login canceled.\n" #~ msgstr ": Erro: A autenticao falhou. Login cancelado.\n" #~ msgid ": Error: Mail server not responding. Login canceled.\n" #~ msgstr ": Erro: O servidor de correio no responde. Login cancelado.\n" #~ msgid ": Error: Could not establish mail server connection.\n" #~ msgstr ": Erro: No pde estabelecer conexo com o servidor de correio.\n" #~ msgid ": Error: Sent STAT, but server responded with an error.\n" #~ msgstr ": Erro: STAT enviado, mas o servidor respondeu com um erro.\n" #~ msgid ": Error: Sent TOP, but server responded with an error.\n" #~ msgstr ": Erro: TOP enviado, mas o servidor respondeu com um erro.\n" #~ msgid ": Error: Sent LIST, but server responded with an error.\n" #~ msgstr ": Erro: LIST enviado, mas o servidor respondeu com um erro.\n" #~ msgid "" #~ ": Error: Sent DELE, but server responded with an error. Delete failed.\n" #~ msgstr "" #~ ": Erro: DELE enviado, mas o servidor respondeu com um erro. Remoo " #~ "falhou.\n" #~ msgid "" #~ ": Error: Encountered a malformed e-mail header which could not be handled " #~ "by Mailfilter. " #~ msgstr "" #~ ": Erro: Encontrado um cabealho de mensagem mal-formado que no pde ser " #~ "tratado pelo Mailfilter. " #~ msgid "Program aborted.\n" #~ msgstr "Programa abortado.\n" #, fuzzy #~ msgid ": Error: Operation timed out.\n" #~ msgstr "" #~ ": Erro: Limite de tempo excedido para conexo no servidor de correio." #, fuzzy #~ msgid ": Error: Signal handler could not be installed.\n" #~ msgstr ": Erro: A conexo de rede no pde ser estabelecida.\n" #~ msgid "" #~ ": Error: The rcfile for preferences has wrong number of arguments or " #~ "malformed syntax." #~ msgstr "" #~ ": Erro: O arquivo de configurao para preferncias contm um nmero " #~ "errado de argumentos ou uma sintaxe mal-formada." #~ msgid "" #~ ": Error: The rcfile for preferences (usually $HOME/.mailfilterrc) could " #~ "not be read." #~ msgstr "" #~ ": Erro: O arquivo de configurao para preferncias (geralmente $HOME/." #~ "mailfilterrc) no pde ser lido." #~ msgid "" #~ ": Error: Aborted pre-compilation of Regular Expressions. Check the syntax " #~ "of your filters and rules." #~ msgstr "" #~ ": Erro: A prcompilao das expresses racionais foi abortada. Verifique " #~ "a sintaxe de seus filtros e de suas regras." #~ msgid "" #~ ": Error: Could not access the logfile. Check the file permissions of your " #~ "logfile and make sure the rcfile contains the correct path." #~ msgstr "" #~ ": Erro: No pde acessar o arquivo de log. Verifique as permisses do seu " #~ "arquivo de log e certifique-se que o arquivo de configurao contm o " #~ "caminho correto." #~ msgid "" #~ ": Error: Communication failure. Either the server closed the connection " #~ "due to a time-out problem, or the entire network connection has dropped." #~ msgstr "" #~ ": Erro: Falha de comunicao. Ou o servidor encerrou a conexo por causa " #~ "de um problema de limite de tempo excedido, ou toda a conexo de rede " #~ "caiu. " #~ msgid ": Error: Connection to the mail server has timed out." #~ msgstr "" #~ ": Erro: Limite de tempo excedido para conexo no servidor de correio." #~ msgid "" #~ ": Error: Unknown communication error occured. Please consider reporting a " #~ "bug. Thank you." #~ msgstr "" #~ "Erro: Um erro desconhecido de comunicao ocorreu. Por favor, considere " #~ "reportar um bug. Obrigado." #~ msgid ": Error: Malformed e-mail header." #~ msgstr ": Erro: Cabealho de mensagem mal-formado." #~ msgid "" #~ ": Error: This is an unknown error. Please consider reporting a bug. Thank " #~ "you." #~ msgstr "" #~ ": Erro: Esse um erro desconhecido. Por favor, considere reportar um " #~ "bug. Obrigado." #~ msgid ": Internal error code from the Regular Expression library: " #~ msgstr "" #~ ": Erro interno do cdigo da biblioteca de tratamento das expresses " #~ "racionais: " #~ msgid ": Deprecated keyword '" #~ msgstr ": Palavra chave depreciada '" #~ msgid "' in '" #~ msgstr "' em '" #~ msgid ": Instead use the keyword 'REG_CASE' from now on." #~ msgstr ": Ao invs, utilize a palavra chave 'REG_CASE' de agora em diante." #~ msgid ": Instead use the keyword 'VERBOSE' from now on." #~ msgstr ": Ao invs, utilize a palavra chave 'VERBOSE' de agora em diante." #~ msgid ": Consult the mailfilterrc(5) man page for further details." #~ msgstr "" #~ ": Consulte a pgina de manual mailfilterrc(5) para detalhes adicionais." #~ msgid ": A keyword in '" #~ msgstr ": Uma palavra chave em '" #~ msgid "' contains invalid parameters." #~ msgstr "' contm parmetros invlidos." #~ msgid "%s: Examining %d message(s).\n" #~ msgstr "%s: Examinando %d mensagem(ns).\n" #~ msgid ": Invalid keyword in '" #~ msgstr ": Palavra chave invlida em '" mailfilter-0.8.9/po/ru.po000066400000000000000000000302061430510321000152520ustar00rootroot00000000000000# Russian translations for Mailfilter. # Copyright (C) 2001 Free Software Foundation, Inc. # Ilgiz Kalmetev , 2001. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: mailfilter 0.3.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-12-31 21:45+0100\n" "PO-Revision-Date: 2002-10-08 17:16+0200\n" "Last-Translator: Ilgiz Kalmetev \n" "Language-Team: Russian\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=koi8-r\n" "Content-Transfer-Encoding: 8bit\n" #: src/mailfilter.cc:94 msgid "The rcfile could not be opened." msgstr "" #: src/mailfilter.cc:107 msgid "Loading the rcfile failed." msgstr "" #: src/mailfilter.cc:113 src/mailfilter.cc:182 msgid "Runtime exception occured: " msgstr "" #: src/mailfilter.cc:124 msgid "Could not open log file '" msgstr "" #: src/mailfilter.cc:125 msgid "' for writing." msgstr "" #: src/mailfilter.cc:127 msgid "Could not locate log file." msgstr "" #: src/mailfilter.cc:138 #, fuzzy msgid "Signal handler could not be installed." msgstr ": : ." #: src/mailfilter.cc:166 msgid " querying " msgstr " " #: src/mailfilter.cc:168 msgid " on " msgstr " " #: src/mailfilter.cc:173 msgid "Skipping account " msgstr "" #: src/mailfilter.cc:176 msgid " due to earlier errors.\n" msgstr "" #: src/mailfilter.cc:226 #, fuzzy msgid "Mailfilter filters e-mail and removes spam in one " msgstr "" "Mailfilter POP." #: src/mailfilter.cc:227 msgid "or many POP accounts." msgstr "" #: src/mailfilter.cc:229 msgid "Usage: " msgstr ": " #: src/mailfilter.cc:229 msgid " [OPTION]..." msgstr " []..." #: src/mailfilter.cc:231 #, fuzzy msgid "If a long option shows an argument as mandatory, " msgstr "" " , ." #: src/mailfilter.cc:232 msgid "then " msgstr "" #: src/mailfilter.cc:233 #, fuzzy msgid "it is mandatory for the equivalent short option " msgstr " ." #: src/mailfilter.cc:234 msgid "also." msgstr "" #: src/mailfilter.cc:236 msgid "Options:" msgstr ":" #: src/mailfilter.cc:237 #, fuzzy msgid " -h, --help " msgstr " -h, --help " #: src/mailfilter.cc:238 #, fuzzy msgid "Display this help information" msgstr " -h, --help " #: src/mailfilter.cc:239 #, fuzzy msgid " -L, --logfile=FILE " msgstr " -L, --logfile=DATEI " #: src/mailfilter.cc:240 #, fuzzy msgid "Specify logfile location" msgstr " -L, --logfile=DATEI " #: src/mailfilter.cc:241 #, fuzzy msgid " -M, --mailfilterrc=FILE " msgstr " -M, --mailfilterrc=DATEI rc-" #: src/mailfilter.cc:242 #, fuzzy msgid "Specify rcfile location" msgstr " -M, --mailfilterrc=DATEI rc-" #: src/mailfilter.cc:243 msgid " -r, --return-value " msgstr "" #: src/mailfilter.cc:244 msgid "Enable additional return values" msgstr "" #: src/mailfilter.cc:245 #, fuzzy msgid " -t, --test " msgstr " -h, --help " #: src/mailfilter.cc:246 msgid "Simulate deletes" msgstr "" #: src/mailfilter.cc:247 #, fuzzy msgid " -v, --verbose=LEVEL " msgstr " -v, --verbose=LEVEL " #: src/mailfilter.cc:248 #, fuzzy msgid "Specify level of verbosity" msgstr " -v, --verbose=LEVEL " #: src/mailfilter.cc:249 #, fuzzy msgid " -V, --version " msgstr " -V, --version " #: src/mailfilter.cc:250 #, fuzzy msgid "Display version information" msgstr " -V, --version " #: src/mailfilter.cc:252 msgid "Report bugs to " msgstr "" #: src/mailfilter.cc:263 #, fuzzy msgid "This is free software; see the source for copying " msgstr "" " ; . . " #: src/mailfilter.cc:264 msgid "conditions. There is NO warranty; not even for " msgstr "" #: src/mailfilter.cc:265 #, fuzzy msgid "MERCHANTABILITY or FITNESS FOR A PARTICULAR " msgstr "" " ; " "." #: src/mailfilter.cc:266 msgid "PURPOSE." msgstr "" #: src/mailfilter.cc:291 msgid "Try '" msgstr " '" #: src/mailfilter.cc:292 msgid " --help' for more information." msgstr " --help' ." #: src/mailfilter.cc:314 #, fuzzy msgid "Could not compile regular expression (allow)." msgstr ": - : '" #: src/mailfilter.cc:325 #, fuzzy msgid "Could not compile regular expression (deny)." msgstr ": - : '" #: src/mailfilter.cc:337 #, fuzzy msgid "Could not compile regular expression (score)." msgstr ": - : '" #: src/mailfilter.cc:388 #, fuzzy msgid "popen failed." msgstr ". .\n" #: src/mailfilter.cc:398 #, fuzzy msgid "pclose failed." msgstr ". .\n" #: src/getopt.c:688 src/getopt.c:698 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: '%s' \n" #: src/getopt.c:730 src/getopt.c:734 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: '--%s' \n" #: src/getopt.c:743 src/getopt.c:748 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: '%c%s' \n" #: src/getopt.c:782 src/getopt.c:793 src/getopt.c:1070 src/getopt.c:1082 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: '%s' \n" #: src/getopt.c:830 src/getopt.c:833 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: '--%s'\n" #: src/getopt.c:841 src/getopt.c:844 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: '%c%s'\n" #: src/getopt.c:887 src/getopt.c:890 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: -- %c\n" #: src/getopt.c:896 src/getopt.c:899 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: -- %c\n" #: src/getopt.c:942 src/getopt.c:952 src/getopt.c:1136 src/getopt.c:1147 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: -- %c\n" #: src/getopt.c:1004 src/getopt.c:1014 #, fuzzy, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: '%s' \n" #: src/getopt.c:1038 src/getopt.c:1049 #, fuzzy, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s: '--%s' \n" #, fuzzy #~ msgid " -H FILE " #~ msgstr " -h, --help " #~ msgid "Report bugs to ." #~ msgstr " ." #, fuzzy #~ msgid "" #~ "Copyright (c) 2000 - 2003 Andreas Bauer " #~ msgstr "" #~ "Copyright (c) 2000 - 2001 Andreas Bauer " #, fuzzy #~ msgid " and " #~ msgstr " " #~ msgid ": Error: Could not login to server " #~ msgstr ": : " #~ msgid ". Unknown error.\n" #~ msgstr ". .\n" #~ msgid ": Error: DNS lookup failure for " #~ msgstr ": : DNS " #~ msgid ": Error: Network connection could not be established.\n" #~ msgstr ": : .\n" #~ msgid ": Error: Authentication failed. Login canceled.\n" #~ msgstr ": : . .\n" #~ msgid ": Error: Mail server not responding. Login canceled.\n" #~ msgstr ": : . .\n" #~ msgid ": Error: Could not establish mail server connection.\n" #~ msgstr ": : .\n" #~ msgid ": Error: Sent STAT, but server responded with an error.\n" #~ msgstr ": : STAT, .\n" #~ msgid ": Error: Sent TOP, but server responded with an error.\n" #~ msgstr ": : TOP, .\n" #~ msgid ": Error: Sent LIST, but server responded with an error.\n" #~ msgstr ": : LIST, .\n" #~ msgid "" #~ ": Error: Sent DELE, but server responded with an error. Delete failed.\n" #~ msgstr ": : DELE, . .\n" #~ msgid "" #~ ": Error: Encountered a malformed e-mail header which could not be handled " #~ "by Mailfilter. " #~ msgstr "" #~ ": : , Mailfilter " #~ " ." #~ msgid "Program aborted.\n" #~ msgstr " .\n" #~ msgid ": Error: Operation timed out.\n" #~ msgstr ": : .\n" #~ msgid ": Error: Signal handler could not be installed.\n" #~ msgstr ": : .\n" #~ msgid "" #~ ": Error: The rcfile for preferences has wrong number of arguments or " #~ "malformed syntax." #~ msgstr "" #~ ": : rc- " #~ " ." #~ msgid "" #~ ": Error: The rcfile for preferences (usually $HOME/.mailfilterrc) could " #~ "not be read." #~ msgstr "" #~ ": : rc- ( $HOME/.mailfilterrc) ." #~ msgid "" #~ ": Error: Aborted pre-compilation of Regular Expressions. Check the syntax " #~ "of your filters and rules." #~ msgstr "" #~ ": : . " #~ " ." #~ msgid "" #~ ": Error: Could not access the logfile. Check the file permissions of your " #~ "logfile and make sure the rcfile contains the correct path." #~ msgstr "" #~ ": : Log-. " #~ ", rc- Log-." #~ msgid "" #~ ": Error: Communication failure. Either the server closed the connection " #~ "due to a time-out problem, or the entire network connection has dropped." #~ msgstr "" #~ ": : . - , " #~ " , ." #~ msgid ": Error: Connection to the mail server has timed out." #~ msgstr ": : ." #~ msgid "" #~ ": Error: Unknown communication error occured. Please consider reporting a " #~ "bug. Thank you." #~ msgstr "" #~ ": : . , " #~ " . ." #~ msgid ": Error: Malformed e-mail header." #~ msgstr ": : ." #~ msgid "" #~ ": Error: This is an unknown error. Please consider reporting a bug. Thank " #~ "you." #~ msgstr "" #~ ": : . , . " #~ " . " #~ msgid ": Signal SIGINT caught. Terminating with signal " #~ msgstr ": SIGINT. " #~ msgid ": Internal error code from the Regular Expression library: " #~ msgstr ": : " #~ msgid ": Deprecated keyword '" #~ msgstr ": '" #~ msgid "' in '" #~ msgstr "' '" #~ msgid ": Instead use the keyword 'REG_CASE' from now on." #~ msgstr ": 'REG_CASE'." #~ msgid ": Instead use the keyword 'VERBOSE' from now on." #~ msgstr ": 'VERBOSE'." #~ msgid ": Consult the mailfilterrc(5) man page for further details." #~ msgstr ": mailfilterrc(5)" #~ msgid ": A keyword in '" #~ msgstr ": '" #~ msgid "' contains invalid parameters." #~ msgstr "' ." #~ msgid "%s: Examining %d message(s).\n" #~ msgstr "%s: %d ().\n" #~ msgid ": Invalid keyword in '" #~ msgstr ": '" mailfilter-0.8.9/src/000077500000000000000000000000001430510321000144345ustar00rootroot00000000000000mailfilter-0.8.9/src/Makefile.am000066400000000000000000000060751430510321000165000ustar00rootroot00000000000000# Makefile.am: help build program sources # $Id: Makefile.am,v 1.9.2.6.2.22 2006/12/31 21:44:18 baueran Exp $ # Copyright (c) 2000 - 2020 Andreas Bauer # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. EXTRA_DIST = rcfile.yy rfc822.yy AM_CXXFLAGS = -Wall YFLAGS = -d -v AM_LFLAGS = -+ -i bin_PROGRAMS = mailfilter # Some dependencies to invoke flex + bison before compilation of lex output starts: rcfile.cc: rcfile.ll rcparser.hh $(LEX) $(AM_LFLAGS) --prefix=rc -o$@ $< rcparser.hh: rcparser.cc rcparser.cc: rcfile.yy $(YACC) $(YFLAGS) --file-prefix=rc -Dapi.prefix=rc --defines=rcparser.hh $<; \ mv rc.tab.c rcparser.cc # Almost the same as above, but this time for the RFC 822 parser: rfc822.cc: rfc822.ll rfc822parser.hh $(LEX) $(AM_LFLAGS) --prefix=rfc -o$@ $< rfc822parser.hh: rfc822parser.cc rfc822parser.cc: rfc822.yy $(YACC) $(YFLAGS) --file-prefix=rfc -Dapi.prefix=rfc --defines=rfc822parser.hh $<; \ mv rfc.tab.c rfc822parser.cc CLEANFILES = *.output Makefile.in rcfile.cc rcfile.ll.bak rcparser.cc rcparser.hh rfc822.cc rfc822parser.cc rfc822parser.hh # If this gets updated, remember to update the doxygen.in config file! mailfilter_SOURCES = md5c.c md5.h \ defines.hh \ rcfile.ll rcfile.hh \ rcparser.hh rcparser.cc \ rfc822.ll rfc822parser.hh rfc822parser.cc \ mailfilter.hh mailfilter.cc \ header.hh header.cc \ weeder.hh weeder.cc \ preferences.hh preferences.cc \ feedback.hh feedback.cc \ filter.hh filter.cc \ score.hh score.cc \ account.hh account.cc \ protocol.hh protocol.cc \ connection.hh \ socket.hh socket.cc \ pop3.hh pop3.cc \ apop.hh apop.cc \ imap.hh imap.cc if !GETOPT mailfilter_SOURCES += getopt.c getopt1.c getopt.h endif AM_CPPFLAGS = -I$(includedir) \ -I$(srcdir) -I$(top_srcdir)/include -I$(top_srcdir) \ -DLOCALEDIR=\"$(datadir)/locale\" \ -I$(top_srcdir)/intl \ -I$(top_builddir) -I$(top_builddir)/include -I. LIBS = @LEXLIB@ @LIBS@ mailfilter-0.8.9/src/account.cc000066400000000000000000000113311430510321000163760ustar00rootroot00000000000000// account.cc - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include #include #include "account.hh" #include "pop3.hh" #include "apop.hh" #include "preferences.hh" #include "feedback.hh" #include "mailfilter.hh" #include "connection.hh" #include "socket.hh" #include "defines.hh" using namespace std; extern int mailbox_status; extern string int_to_string (int); void Account :: clear (void) { if (proto) delete proto; if (conn) { if (typeid (*conn) == typeid (Socket)) ((Socket*)conn)->clear (); delete conn; } } string Account :: server (void) { return serv; } void Account :: set_server (const char* s) { serv = s; } string Account :: usr (void) { return user; } void Account :: set_usr (const char* s) { user = s; } string Account :: passwd (void) { return pass; } void Account :: set_passwd (const char* s) { pass = s; } void Account :: set_protocol (unsigned int prot) { try { switch (prot) { case PROTOCOL_APOP: proto = new APOP (); proto->set_ident (PROTOCOL_APOP); break; case (PROTOCOL_APOP | SSL_C): proto = new APOP (); proto->set_ident (PROTOCOL_APOP | SSL_C); break; case (PROTOCOL_POP3 | SSL_C): proto = new POP3 (); proto->set_ident (PROTOCOL_POP3 | SSL_C); break; default: proto = new POP3 (); proto->set_ident (PROTOCOL_POP3); break; } } catch (...) { throw; } } // TODO: // This function sets the connection type, but currently only // POSIX Sockets are available. Therefore, the_connection_type // gets ignored and a new Socket object is being instantiated // per default. Right now, the rcfile parser invokes it together // with set_protocol (), but once other connection types are // implemented, it should be handled via a separate keyword and // action of the parser; not implicitly as it happens now. void Account :: set_connection (unsigned int the_connection_type) { try { // Pass a reference to the connection object to the protocol // implementing class, so that it can communicate directly with // the server e.g. via Unix Sockets. conn = new Socket (); proto->set_connection (conn); } catch (...) { throw; } } unsigned int Account :: protocol (void) { return proto->ident (); } void Account :: set_port (unsigned int p) { the_port = p; } unsigned int Account :: port (void) { return the_port; } int Account :: check (void) { Feedback* logger = Feedback :: Instance (); int messages = 0; try { // Open connection to host. if (conn->c_open (server ().c_str (), port (), Preferences :: Instance ().time_out (), proto->ident ()) != 0) { logger->print_err ("Could not establish network connection.", 1); return GEN_FAILURE_FLAG; } // Login. if (!proto->login (usr ().c_str (), passwd ().c_str (), proto->ident ())) { logger->print_err ("Server login failure.", 1); conn->c_close (); return GEN_FAILURE_FLAG; } if ((messages = proto->status ()) < 0) { logger->print_err ("Could not determine mailbox status.", 1); proto->logout (); conn->c_close (); return GEN_FAILURE_FLAG; } logger->print_msg ("Examining " + int_to_string (messages) + " message(s).", 3); // Scan mailbox for spam and unwanted bulk. if (proto->scan () < 0) { logger->print_err ("Scanning of mail account failed.", 1); proto->logout (); conn->c_close (); return GEN_FAILURE_FLAG; } // Determine number of messages in the mailbox for program // return value. if (Preferences :: Instance ().return_status () && (messages = proto->status ()) < 0) { logger->print_err ("Could not determine mailbox status.", 1); proto->logout (); conn->c_close (); return GEN_FAILURE_FLAG; } else mailbox_status += messages; } catch (...) { throw; } // Logout and close the connection. return ((proto->logout () && conn->c_close() == 0) ? 0 : GEN_FAILURE_FLAG); } mailfilter-0.8.9/src/account.hh000066400000000000000000000035731430510321000164210ustar00rootroot00000000000000// account.hh - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef ACCOUNT_HH #define ACCOUNT_HH #include #include #include "defines.hh" #include "protocol.hh" #include "pop3.hh" #include "apop.hh" #include "connection.hh" using namespace std; class Account { protected: string serv; string user; string pass; int the_port; vector msg_ids; Protocol* proto; Connection* conn; public: void clear (void); string server (void); void set_server (const char*); string usr (void); void set_usr (const char*); string passwd (void); void set_passwd (const char*); unsigned int port (void); void set_port (unsigned int); void set_protocol (unsigned int); unsigned int protocol (void); void set_connection (unsigned int = POSIX_SOCKETS) __attribute__ ((unused)); int check (void); }; #endif mailfilter-0.8.9/src/apop.cc000066400000000000000000000050601430510321000157030ustar00rootroot00000000000000// apop.cc - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include #include "apop.hh" #include "feedback.hh" #include "defines.hh" #include "mailfilter.hh" extern "C" { #include #include "md5.h" } using namespace std; bool APOP :: login (const char* usr, const char* pass, const unsigned int enc) const { Feedback* logger = Feedback :: Instance (); string usr_name = (string)"USER " + usr + (string)"\r\n"; string pass_wd = (string)"PASS " + pass + (string)"\r\n"; string greet, command; char *ts,*p, md5hash[33]; // Get server welcome string first. if (conn->c_read () == -1) return false; // Attempt to extract the timestamp from the saved input. // If the server response does not include , // i.e. the comparison with NULL, it does not support the // APOP protocol. greet = *conn->c_reply (); if ( ((ts = index (&greet[0], '<')) == NULL) || ((p = index (ts, '>')) == NULL) ) return false; p[1] = '\0'; // Calculate the hash. get_hash (md5hash, ts, pass); // Send the APOP command as in the username/password code below. command = "APOP " + (string)usr + " " + (string)md5hash + "\r\n"; if (conn->c_write (command.c_str ()) == -1 || !REPLY_OK) { logger->print_err ("APOP protocol initialisation error."); return false; } return true; } void APOP :: get_hash (char* hash, const char* stamp, const char* pass) const { MD5_CTX mdContext; unsigned char digest[16]; MD5Init (&mdContext); MD5Update (&mdContext, (unsigned char*)stamp, strlen (stamp)); MD5Update (&mdContext, (unsigned char*)pass, strlen (pass)); MD5Final (digest, &mdContext); for (unsigned int i = 0; i < sizeof (digest); i++) sprintf (hash + 2 * i, "%02x", digest[i]); } mailfilter-0.8.9/src/apop.hh000066400000000000000000000021211430510321000157100ustar00rootroot00000000000000// apop.hh - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef APOP_HH #define APOP_HH #include "pop3.hh" using namespace std; class APOP : public POP3 { public: bool login (const char* usr, const char* pass, const unsigned int enc) const; private: void get_hash (char*, const char*, const char*) const; }; #endif mailfilter-0.8.9/src/connection.hh000066400000000000000000000027541430510321000171240ustar00rootroot00000000000000// connection.hh - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef CONNECTION_HH #define CONNECTION_HH #include // Right now this class is only a dummy, but later it can be useful to // derive, e.g. a Windoze Socks connection class from it. using namespace std; class Connection { public: virtual ~Connection (void) { } virtual int c_open (const char* host_name, int port, int time_out, int protocol) = 0; virtual int c_close (void) const = 0; virtual int c_read (bool = false) = 0; virtual int c_write (const char* msg) = 0; virtual const string* c_reply (void) const = 0; }; #endif mailfilter-0.8.9/src/defines.hh000066400000000000000000000021071430510321000163720ustar00rootroot00000000000000// defines.hh - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef DEFINES_HH #define DEFINES_HH #define GEN_FAILURE_FLAG -1 #define MEM_FAILURE_FLAG -2 #define POSIX_SOCKETS 1 #define WIN_SOCKS 2 // TODO: Currently not supported. #endif mailfilter-0.8.9/src/feedback.cc000066400000000000000000000062071430510321000164740ustar00rootroot00000000000000// feedback.cc - source file for the mailfilter program // Copyright (c) 2000 - 2022 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include #include #include #include "feedback.hh" #include "preferences.hh" using namespace std; Feedback* Feedback :: _instance = 0; Feedback* Feedback :: Instance () { if (_instance == 0) _instance = new Feedback; return _instance; } Feedback :: ~Feedback () { log_file.close (); if (header_file.is_open ()) header_file.close (); } // This function tries to open a user specified log file for write // access and returns true upon success, false otherwise. bool Feedback :: open (const char* name) { if (strlen (name)) { log_file.open (name, ios :: app); if (!log_file.is_open ()) return false; return true; } return false; } string Feedback::timestamp() { char timestamp[64]; time_t timer = time(NULL); struct tm* tm_info = localtime(&timer); strftime (timestamp, sizeof(timestamp), "%b %d %H:%M:%S", tm_info); return string(timestamp); } // The following two functions attempt to append program messages to // the end of the log file and returns false, if the file is not // accessable. True is returned otherwise. // // min_verbose_level is the minimum value of verbosity that is // necessary, in order to display a message. If nothing is // specified, errors are usually always shown (0). bool Feedback :: print_msg (const string msg, int min_verbose_level) { if (Preferences :: Instance ().verbose_level () >= min_verbose_level) { string ts = timestamp(); cout << ts << " mailfilter: " << msg << endl; if (log_file.is_open ()) log_file << ts << " mailfilter: " << msg << endl; else return false; } return true; } bool Feedback :: print_err (const string msg, int min_verbose_level) { if (Preferences :: Instance ().verbose_level () >= min_verbose_level) { string ts = timestamp(); cerr << ts << " mailfilter: Error: " << msg << endl; if (log_file.is_open ()) log_file << ts << " mailfilter: Error: " << msg << endl; else return false; } return true; } bool Feedback :: print_header (const string msg) { if (!header_file.is_open ()) header_file.open (Preferences :: Instance ().headers_file ().c_str (), ios :: app); if (header_file.is_open ()) { header_file << msg << endl; return true; } return false; } mailfilter-0.8.9/src/feedback.hh000066400000000000000000000026421430510321000165050ustar00rootroot00000000000000// feedback.hh - source file for the mailfilter program // Copyright (c) 2000 - 2022 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef FEEDBACK_HH #define FEEDBACK_HH #include #include using namespace std; class Feedback { private: ofstream log_file; ofstream header_file; static Feedback* _instance; string timestamp (void); public: static Feedback* Instance (void); ~Feedback (void); bool open (const char*); bool print_msg (const string, int); bool print_err (const string, int = 1); bool print_header (const string); }; #endif mailfilter-0.8.9/src/filter.cc000066400000000000000000000041721430510321000162340ustar00rootroot00000000000000// filter.cc - source file for the mailfilter program // Copyright (c) 2000 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include extern "C" { #include #include } #include "filter.hh" #include "mailfilter.hh" #include "preferences.hh" using namespace std; Filter :: Filter (void) { compiled = false; } Filter :: ~Filter (void) { if (compiled) regfree (&comp_expr); } string Filter :: expression (void) const { return expr; } void Filter :: set_expression (const char* exp) { expr = exp; } int Filter :: compile (void) { int comp_err; if ((comp_err = regcomp (&comp_expr, expr.c_str (), Preferences :: Instance ().reg_type () | ccase ())) != 0) { try { char* err_buf = new char[regerror (comp_err, &comp_expr, (char*)NULL, (size_t)0) + 1]; regerror (comp_err, &comp_expr, err_buf, sizeof *err_buf); ERROR_MSG(err_buf); delete[] (err_buf); } catch (...) { throw; } } else compiled = true; return comp_err; } void Filter :: set_negativity (bool t) { negativity = t; } bool Filter :: is_negative (void) const { return negativity; } int Filter :: ccase (void) const { return case_sensitivity; } void Filter :: set_case (int c) { case_sensitivity = c; } const regex_t* Filter :: comp_exp (void) const { return &comp_expr; } mailfilter-0.8.9/src/filter.hh000066400000000000000000000033771430510321000162540ustar00rootroot00000000000000// filter.hh - source file for the mailfilter program // Copyright (c) 2000 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef FILTER_HH #define FILTER_HH #include extern "C" { #include #include } // Filter modes #define CASE_DEFAULT REG_ICASE #define CASE_SENSITIVE 0 #define CASE_INSENSITIVE REG_ICASE using namespace std; class Filter { private: string expr; regex_t comp_expr; // Values can be CASE_SENSITIVE, CASE_INSENSITIVE, or CASE_DEFAULT: int case_sensitivity; bool negativity; bool compiled; public: Filter (void); ~Filter (void); string expression (void) const; void set_expression (const char*); int compile (void); void set_negativity (bool); bool is_negative (void) const; int ccase (void) const; void set_case (int); const regex_t* comp_exp (void) const; }; #endif mailfilter-0.8.9/src/getopt.c000066400000000000000000001024521430510321000161060ustar00rootroot00000000000000/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO # define _NO_PROTO #endif #ifdef HAVE_CONFIG_H # include #endif #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ # ifndef const # define const # endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 # include # if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION # define ELIDE_CODE # endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ # include # include #endif /* GNU C library. */ #ifdef VMS # include # if HAVE_STRING_H - 0 # include # endif #endif #ifndef _ /* This is for other GNU distributions with internationalized messages. */ # if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC # include # ifndef _ # define _(msgid) gettext (msgid) # endif # else # define _(msgid) (msgid) # endif # if defined _LIBC && defined USE_IN_LIBIO # include # endif #endif /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Formerly, initialization of getopt depended on optind==0, which causes problems with re-calling getopt as programs generally don't know that. */ int __getopt_initialized; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; /* Value of POSIXLY_CORRECT environment variable. */ static char *posixly_correct; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ # include # define my_index strchr #else # if HAVE_STRING_H # include # else # include # endif /* Avoid depending on library functions or files whose names are inconsistent. */ #ifndef getenv extern char *getenv (); #endif static char * my_index (str, chr) const char *str; int chr; { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } /* If using GCC, we can safely declare strlen this way. If not using GCC, it is ok not to declare it. */ #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ # if (!defined __STDC__ || !__STDC__) && !defined strlen /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); # endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; #ifdef _LIBC /* Stored original parameters. XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ extern int __libc_argc; extern char **__libc_argv; /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ # ifdef USE_NONOPTION_FLAGS /* Defined in getopt_init.c */ extern char *__getopt_nonoption_flags; static int nonoption_flags_max_len; static int nonoption_flags_len; # endif # ifdef USE_NONOPTION_FLAGS # define SWAP_FLAGS(ch1, ch2) \ if (nonoption_flags_len > 0) \ { \ char __tmp = __getopt_nonoption_flags[ch1]; \ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ __getopt_nonoption_flags[ch2] = __tmp; \ } # else # define SWAP_FLAGS(ch1, ch2) # endif #else /* !_LIBC */ # define SWAP_FLAGS(ch1, ch2) #endif /* _LIBC */ /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ #if defined __STDC__ && __STDC__ static void exchange (char **); #endif static void exchange (argv) char **argv; { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS /* First make sure the handling of the `__getopt_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) { /* We must extend the array. The user plays games with us and presents new arguments. */ char *new_str = malloc (top + 1); if (new_str == NULL) nonoption_flags_len = nonoption_flags_max_len = 0; else { memset (__mempcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len), '\0', top + 1 - nonoption_flags_max_len); nonoption_flags_max_len = top + 1; __getopt_nonoption_flags = new_str; } } #endif while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; SWAP_FLAGS (bottom + i, middle + i); } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ #if defined __STDC__ && __STDC__ static const char *_getopt_initialize (int, char *const *, const char *); #endif static const char * _getopt_initialize (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind; nextchar = NULL; posixly_correct = getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; #if defined _LIBC && defined USE_NONOPTION_FLAGS if (posixly_correct == NULL && argc == __libc_argc && argv == __libc_argv) { if (nonoption_flags_max_len == 0) { if (__getopt_nonoption_flags == NULL || __getopt_nonoption_flags[0] == '\0') nonoption_flags_max_len = -1; else { const char *orig_str = __getopt_nonoption_flags; int len = nonoption_flags_max_len = strlen (orig_str); if (nonoption_flags_max_len < argc) nonoption_flags_max_len = argc; __getopt_nonoption_flags = (char *) malloc (nonoption_flags_max_len); if (__getopt_nonoption_flags == NULL) nonoption_flags_max_len = -1; else memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), '\0', nonoption_flags_max_len - len); } } nonoption_flags_len = nonoption_flags_max_len; } else nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int argc; char *const *argv; const char *optstring; const struct option *longopts; int *longind; int long_only; { int print_errors = opterr; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return -1; optarg = NULL; if (optind == 0 || !__getopt_initialized) { if (optind == 0) optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize (argc, argv, optstring); __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ || (optind < nonoption_flags_len \ && __getopt_nonoption_flags[optind] == '1')) #else # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') #endif if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) last_nonopt = optind; if (first_nonopt > optind) first_nonopt = optind; if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return -1; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); #endif } nextchar += strlen (nextchar); optind++; optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; #endif if (argv[optind - 1][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #else fprintf (stderr, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); #else fprintf (stderr, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #endif } nextchar += strlen (nextchar); optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); #endif } nextchar += strlen (nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index (optstring, *nextchar) == NULL) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; #endif if (argv[optind][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); #else fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); #else fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #endif } nextchar = (char *) ""; optind++; optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; #endif if (posixly_correct) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("%s: illegal option -- %c\n"), argv[0], c); #else fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); #endif } else { #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("%s: invalid option -- %c\n"), argv[0], c); #else fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #endif } optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option requires an argument -- %c\n"), argv[0], c); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); #endif } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); #endif } nextchar += strlen (nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("\ %s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); #endif } nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option requires an argument -- %c\n"), argv[0], c); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); #endif } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* Not ELIDE_CODE. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ mailfilter-0.8.9/src/getopt.h000066400000000000000000000144721430510321000161170ustar00rootroot00000000000000/* Declarations for getopt. Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _GETOPT_H #ifndef __need_getopt # define _GETOPT_H 1 #endif /* If __GNU_LIBRARY__ is not already defined, either we are being used standalone, or this is the first header included in the source file. If we are being used with glibc, we need to include , but that does not exist if we are standalone. So: if __GNU_LIBRARY__ is not defined, include , which will pull in for us if it's from glibc. (Why ctype.h? It's guaranteed to exist and it doesn't flood the namespace with stuff the way some other headers do.) */ #if !defined __GNU_LIBRARY__ # include #endif #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; #ifndef __need_getopt /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { # if (defined __STDC__ && __STDC__) || defined __cplusplus const char *name; # else char *name; # endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ # define no_argument 0 # define required_argument 1 # define optional_argument 2 #endif /* need getopt */ /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, `optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in `optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU `getopt'. The argument `--' causes premature termination of argument scanning, explicitly telling `getopt' that there are no more options. If OPTS begins with `--', then non-option arguments are treated as arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ #if (defined __STDC__ && __STDC__) || defined __cplusplus # ifdef __GNU_LIBRARY__ /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts); # else /* not __GNU_LIBRARY__ */ extern int getopt (); # endif /* __GNU_LIBRARY__ */ # ifndef __need_getopt extern int getopt_long (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind); extern int getopt_long_only (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only); # endif #else /* not __STDC__ */ extern int getopt (); # ifndef __need_getopt extern int getopt_long (); extern int getopt_long_only (); extern int _getopt_internal (); # endif #endif /* __STDC__ */ #ifdef __cplusplus } #endif /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt #endif /* getopt.h */ mailfilter-0.8.9/src/getopt1.c000066400000000000000000000106501430510321000161650ustar00rootroot00000000000000/* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifdef HAVE_CONFIG_H #include #endif #include "getopt.h" #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 #include #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION #define ELIDE_CODE #endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #endif #ifndef NULL #define NULL 0 #endif int getopt_long (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 1); } #endif /* Not ELIDE_CODE. */ #ifdef TEST #include int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == -1) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ mailfilter-0.8.9/src/header.cc000066400000000000000000000123401430510321000161730ustar00rootroot00000000000000// header.cc - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include #include #include #include "header.hh" #include "preferences.hh" #include "mailfilter.hh" #include "defines.hh" #include "feedback.hh" extern "C" { #include } using namespace std; extern int cmp_no_case (const string&, const string&); vector* Header :: entries (void) { return &msg_entries; } // Taken from mutt in response to APOP security vulnerability. /* incomplete. Only used to thwart the APOP MD5 attack (#2846). */ int Header :: rfc822_valid_msgid (const char* msgid) { /* msg-id = "<" addr-spec ">" * addr-spec = local-part "@" domain * local-part = word *("." word) * word = atom / quoted-string * atom = 1* * CHAR = ( 0.-127. ) * specials = "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "\" / <"> / "." / "[" / "]" * SPACE = ( 32. ) * CTLS = ( 0.-31., 127.) * quoted-string = <"> *(qtext/quoted-pair) <"> * qtext = , "\" and CR> * CR = ( 13. ) * quoted-pair = "\" CHAR * domain = sub-domain *("." sub-domain) * sub-domain = domain-ref / domain-literal * domain-ref = atom * domain-literal = "[" *(dtext / quoted-pair) "]" */ unsigned int l, i; if (!msgid || !*msgid) return -1; l = strlen (msgid); if (l < 5) /* */ return -1; if (msgid[0] != '<' || msgid[l-1] != '>') return -1; if (!strrchr (msgid, '@')) return -1; /* TODO: complete parser */ for (i = 0; i < l; i++) if (msgid[i] > 127) return -1; return 0; } void Header :: add_entry (const char* tag, const char* body) { struct entry tmp_entry; tmp_entry.tag = tag; tmp_entry.body = body; msg_entries.push_back (tmp_entry); if (cmp_no_case (tag, "Message-Id") == 0) { if (!Preferences :: Instance ().ignore_time_stamp() && rfc822_valid_msgid (body) < 0) { Feedback* logger = Feedback :: Instance (); logger->print_err ("POP timestamp in message-ID invalid."); throw WrongMessageIDException(); } set_ID (body); return; } if (cmp_no_case (tag, "From") == 0) { set_from (body); return; } if (cmp_no_case (tag, "To") == 0) { set_to (body); return; } if (cmp_no_case (tag, "Subject") == 0) { set_subject (body); try { // set_normal_subject may be throwing out of boundary // exceptions. if (Preferences :: Instance ().normal ()) set_normal_subject (body); } catch (const exception& r_err) { ERROR_MSG("Runtime exception occurred while parsing rcfile: " + (string)r_err.what ()); exit (-1); } return; } if (cmp_no_case (tag, "Date") == 0) { set_date (body); return; } } const string* Header :: ID (void) const { return &msg_ID; } void Header :: set_ID (const char* tid) { msg_ID = tid; } const string* Header :: from (void) const { return &msg_from; } void Header :: set_from (const char* tfrom) { msg_from = tfrom; } const string* Header :: to (void) const { return &msg_to; } void Header :: set_to (const char* tto) { msg_to = tto; } const string* Header :: subject (void) const { return &msg_subject; } void Header :: set_subject (const char* tsubject) { msg_subject = tsubject; } const string* Header :: normal_subject (void) const { return &msg_normal_subject; } void Header :: set_normal_subject (string ssubject) { try { unsigned int i = 0; while (i < ssubject.length ()) { // Delete multiple spaces. while (isspace (ssubject[i]) && isspace (ssubject[i+1]) && i < ssubject.length ()) ssubject.erase (i, 1); // Delete all non-alphanumeric characters, except spaces and '@'. if (!isalpha (ssubject[i]) && !isspace (ssubject[i]) && ssubject[i] != '@' && !isdigit (ssubject[i])) { ssubject.erase (i, 1); i -= (i > 0 ? 1 : 0); } else i++; } msg_normal_subject = "Subject: " + ssubject; } catch (...) { // Out-of-Range-Exception could be thrown. throw; } } const string* Header :: date (void) const { return &msg_date; } void Header :: set_date (const char* tdate) { msg_date = tdate; } int Header :: size (void) const { return msg_size; } void Header :: set_size (int tsize) { msg_size = tsize; } mailfilter-0.8.9/src/header.hh000066400000000000000000000045611430510321000162130ustar00rootroot00000000000000// header.hh - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef HEADER_HH #define HEADER_HH #include #include #include using namespace std; struct entry { string tag; string body; }; class WrongMessageIDException : public runtime_error { public: WrongMessageIDException () : runtime_error ("POP timestamp in message-ID invalid.") { } }; class Header { private: vector msg_entries; string msg_ID; string msg_from; string msg_to; string msg_subject; string msg_normal_subject; string msg_date; int msg_size; public: vector* entries (void); int rfc822_valid_msgid (const char*); void add_entry (const char*, const char*); const string* ID (void) const; void set_ID (const char*); const string* from (void) const; void set_from (const char*); const string* to (void) const; void set_to (const char*); const string* subject (void) const; void set_subject (const char*); const string* normal_subject (void) const; void set_normal_subject (string); const string* date (void) const; void set_date (const char*); int size (void) const; void set_size (int); }; #endif mailfilter-0.8.9/src/imap.cc000066400000000000000000000015311430510321000156710ustar00rootroot00000000000000// imap.cc - source file for the mailfilter program // Copyright (c) 2004 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include "imap.hh" mailfilter-0.8.9/src/imap.hh000066400000000000000000000040601430510321000157030ustar00rootroot00000000000000// imap.hh - source file for the mailfilter program // Copyright (c) 2004 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef IMAP_HH #define IMAP_HH #include "header.hh" #include "protocol.hh" using namespace std; // True, if the server replied and its status message was anything, // but an error. #define REPLY_OK ((conn->c_read () > 0 && conn->c_reply ()) ? \ (((conn->c_reply ()->find_first_of ("a OK", 0))) ? true : false) \ : false) // This macro is similar to REPLY_OK, except it sets a flag for c_read // in order to tell the function that an entire message header is // about to be received. Further comments inside socket.cc:c_read(). #define HEADER_OK ((conn->c_read (true) > 0 && conn->c_reply ())? \ (((conn->c_reply ()->find_first_of ("a OK", 0))) ? true : false) \ : false) class IMAP : public Protocol { private: int invoke_msg_parser (const string*, const Header*); public: bool login (const char* usr, const char* pass, const unsigned int enc) const; bool logout (void) const; int remove_msg (unsigned int num) const; int status (void) const; int scan (void) const; }; #endif mailfilter-0.8.9/src/mailfilter.cc000066400000000000000000000276671430510321000171150ustar00rootroot00000000000000// mailfilter.cc - source file for the mailfilter program // Copyright (c) 2000 - 2012 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include #include #include #include #include #include #include #include #include "mailfilter.hh" #include "preferences.hh" #include "feedback.hh" #include "weeder.hh" #ifdef HAVE_CONFIG_H #include "config.h" #endif extern "C" { #include "time.h" #if HAVE_SYS_TIME_H #include #endif #ifdef HAVE_GETOPT_H #include #else #include "getopt.h" #endif } using namespace std; static struct option long_options[] = { {"help", 0, NULL, VALUE_HELP}, {"verbose", 1, NULL, VALUE_VERBOSE}, {"mailfilterrc", 1, NULL, VALUE_MAILFILTERRC}, {"logfile", 1, NULL, VALUE_LOGFILE}, {"ignore-time-stamps", 0, NULL, VALUE_TIMESTAMP}, {"version", 0, NULL, VALUE_VERSION}, {"test", 0, NULL, VALUE_TEST}, {"return-value", 0, NULL, VALUE_RETURN}, {"skip-ssl-verify", 0, NULL, VALUE_SKIP_SSL_VERIFY}, {0, 0, 0, 0} }; struct sigaction sigact; Weeder weeder; int mailbox_status; void init_app (void); bool open_prefs (string); void get_opts (int argc, char* argv[]); void override_prefs (string); int cmp_no_case (const string&, const string&); int precompile_expressions (void); void connect_sigint (int); string int_to_string (int); int main (int argc, char* argv[]) { Feedback* logger = Feedback :: Instance (); string options_set; int return_val = 0; init_app (); // Read the user's command line options. if (argc > 1) get_opts (argc, argv); // Try to open the program's configuration file. if (!(Preferences :: Instance (). open (Preferences :: Instance ().rc_file ().c_str ()))) { ERROR_MSG("The rcfile could not be opened."); return -1; } // If an rcfile was located, try to read it. The error handling, // however, is done inside the Preferences class. Should something // go wrong, we merely need to exit here. There's no point in // logging to external files, since they may not yet be defined, or // even be writeable. try { if (!Preferences :: Instance ().load ()) { ERROR_MSG("Loading the rcfile failed."); return -1; } } catch (const exception& r_err) { ERROR_MSG("Runtime exception occurred: " + (string)r_err.what ()); return -1; } // Now that the log file should be specified, try to open it and // spit out an error in case it can't be located, or the file // permissions don't allow writing to it. if (!logger->open (Preferences :: Instance ().log_file ().c_str ())) { if (Preferences :: Instance ().log_file ().length ()) ERROR_MSG("Could not open log file '" + Preferences :: Instance ().log_file () + "' for writing."); else ERROR_MSG("Could not locate log file."); return -1; } // Set sigint signal handler sigact.sa_handler = connect_sigint; sigemptyset (&sigact.sa_mask); sigact.sa_flags = 0; if (sigaction (SIGINT, &sigact, NULL) < 0) { ERROR_MSG("Signal handler could not be installed."); exit (-1); } try { // Try to precompile all filters. if (precompile_expressions () != 0) return -1; // Start checking for spam mails in the user defined accounts. vector :: iterator cur_account = Preferences :: Instance ().accounts ()->begin (); while (cur_account != Preferences :: Instance ().accounts ()->end ()) { logger->print_msg ((string)PACKAGE_VERSION + " querying " + cur_account->usr () + "@" + cur_account->server () + ".", 3); if (cur_account->check () != 0) { logger->print_err ("Skipping account " + cur_account->usr () + "@" + cur_account->server () + " due to earlier errors."); return_val = -1; } cur_account++; } } catch (const exception& r_err) { logger->print_err ("Runtime exception occurred: " + (string)r_err.what ()); return -1; } // Mailfilter can return the number of pending mails to be // downloaded, e.g., when embeddeding it into a script. if (Preferences :: Instance ().return_status ()) return mailbox_status; return return_val; } // This function is being run before Mailfilter starts to read the // configuration files and establishes any sort of network connection. // All initialisation stuff should go in here. void init_app (void) { mailbox_status = 0; #ifdef USE_NLS setlocale (LC_ALL, ""); bindtextdomain (PACKAGE_NAME, LOCALEDIR); textdomain (PACKAGE_NAME); #endif } // The funciton getopts can be used to retrieve user specific command // line options like '--help', for instance. The rcfile file path is // retrieve via get_opts_rcfile as we need to first read the rcfile, // and then later use this function to override its settings. void get_opts (int argc, char* argv[]) { int option = 0; int option_index = 0; while ((option = getopt_long (argc, argv, "hL:M:Vv:tirs", long_options, &option_index)) != -1) { switch (option) { case 'h': case VALUE_HELP: cout << "Mailfilter filters e-mail and removes spam in one "; cout << "or many POP accounts." << endl; cout << endl; cout << "Usage: " << PACKAGE_NAME << " [OPTION]..." << endl; cout << endl; cout << "If a long option shows an argument as mandatory, "; cout << "then " << endl; cout << "it is mandatory for the equivalent short option "; cout << "also." << endl; cout << endl; cout << "Options:" << endl; cout << " -h, --help "; cout << "Display this help information" << endl; cout << " -L, --logfile=FILE "; cout << "Specify logfile location" << endl; cout << " -M, --mailfilterrc=FILE "; cout << "Specify rcfile location" << endl; cout << " -r, --return-value "; cout << "Enable additional return values" << endl; cout << " -s, --skip-ssl-verify "; cout << "Skip verification of SSL certificates (Do not use unless you know better!)" << endl; cout << " -t, --test "; cout << "Simulate deletes" << endl; cout << " -i, --ignore-time-stamps "; cout << "Ignore invalid Message-ID time stamps (Do not use unless you know better!)" << endl; cout << " -v, --verbose=LEVEL "; cout << "Specify level of verbosity" << endl; cout << " -V, --version "; cout << "Display version information" << endl; cout << endl; cout << "Report bugs to "; cout << "." << endl; exit (0); break; case 'V': case VALUE_VERSION: cout << PACKAGE_NAME << " " << PACKAGE_VERSION << endl; cout << endl; cout << PACKAGE_COPYRIGHT << endl; cout << endl; cout << "This is free software; see the source for copying "; cout << "conditions. There is NO warranty; not even for "; cout << "MERCHANTABILITY or FITNESS FOR A PARTICULAR "; cout << "PURPOSE." << endl; exit (0); break; case 'L': case VALUE_LOGFILE: Preferences :: Instance ().set_log_file (optarg); break; case 'v': case VALUE_VERBOSE: Preferences :: Instance ().set_verbose_level (atoi (optarg)); break; case 't': case VALUE_TEST: Preferences :: Instance ().set_test_mode ("yes"); break; case 'i': case VALUE_TIMESTAMP: Preferences :: Instance().set_ignore_time_stamp(); break; case 'r': case VALUE_RETURN: Preferences :: Instance ().set_return_status (true); break; case 's': case VALUE_SKIP_SSL_VERIFY: Preferences :: Instance ().set_skip_ssl_verify (true); break; case 'M': case VALUE_MAILFILTERRC: Preferences :: Instance ().set_rc_file (optarg); break; default: // Command line option not recognised. cerr << "Try '" << argv[0] << " --help' for more information." << endl; exit (-1); } } } // This function precompiles the allow, deny, and score expressions // of the user's rcfile. It returns a value different to 0 upon error. int precompile_expressions (void) { int comp_err = 0; try { vector :: iterator cur_filter = Preferences :: Instance ().allow_filters ()->begin (); while (cur_filter != Preferences :: Instance ().allow_filters ()->end ()) { if ((comp_err = cur_filter->compile ()) != 0) { ERROR_MSG("Could not compile regular expression (allow)."); return comp_err; } cur_filter++; } cur_filter = Preferences :: Instance ().deny_filters ()->begin (); while (cur_filter != Preferences :: Instance ().deny_filters ()->end ()) { if ((comp_err = cur_filter->compile ()) != 0) { ERROR_MSG("Could not compile regular expression (deny)."); return comp_err; } cur_filter++; } vector :: iterator cur_score = Preferences :: Instance ().score_filters ()->begin (); while (cur_score != Preferences :: Instance ().score_filters ()->end ()) { if ((comp_err = cur_score->compile ()) != 0) { ERROR_MSG("Could not compile regular expression (score)."); return comp_err; } cur_score++; } } catch (...) { throw; } return comp_err; } // Comapre two strings, but disregard case-sensitivity. Returns 0, if // no differences could be determined, a negative integer if s is // lexicographically before s2, and a positive integer otherwise. // (See also Stroustrup 20.3.8.) int cmp_no_case (const string& s, const string& s2) { string :: const_iterator p = s.begin (); string :: const_iterator p2 = s2.begin (); while (p != s.end () && p2 != s2.end ()) { if (toupper (*p) != toupper (*p2)) return (toupper (*p) < toupper (*p2))? -1 : 1; ++p; ++p2; } return (s2.size () == s.size ())? 0 : (s.size () < s2.size ())? -1 : 1; } // This function executes the string given in command through a // POSIX shell. It returns the first string of the shell's // output without the trailing '\n'; instead it terminates with // '\0'. string exec_shell (const char* command) { FILE *fp; const int SIZEBUF = 256; static char buf [SIZEBUF]; string cur_string; if ((fp = popen (command, "r")) != NULL) { if (fgets (buf, sizeof (buf), fp) == NULL) { ERROR_MSG("popen failed."); exit (-1); } cur_string = buf; if (cur_string[cur_string.size () - 1] != '\n') { ERROR_MSG("popen failed."); exit (-1); } else // Remove the trailing new line, or it messes up // the file paths in the config files. cur_string[cur_string.size () - 1] = '\0'; if (pclose(fp) == -1) { ERROR_MSG("pclose failed."); exit (-1); } } return cur_string; } string int_to_string (int val) { string tmp; ostringstream ostr; ostr << val; tmp = ostr.str (); return tmp; } void connect_sigint (int signo) { sigset_t mask_set; sigset_t old_set; // Mask other signals while we prompt to cerr and finally quit signal (SIGINT, connect_sigint); sigfillset (&mask_set); sigprocmask (SIG_SETMASK, &mask_set, &old_set); cout << PACKAGE_NAME \ << ": Error: Program abort due to signal " << signo << "." << endl; exit (-1); } mailfilter-0.8.9/src/mailfilter.hh000066400000000000000000000030031430510321000171010ustar00rootroot00000000000000// mailfilter.hh - source file for the mailfilter program // Copyright (c) 2000 - 2012 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef MAILFILTER_HH #define MAILFILTER_HH #include #ifdef HAVE_CONFIG_H #include "config.h" #endif using namespace std; // Mailfilter's command line options and arguments. #define VALUE_HELP 1 #define VALUE_VERBOSE 2 #define VALUE_MAILFILTERRC 3 #define VALUE_LOGFILE 4 #define VALUE_VERSION 5 #define VALUE_TEST 6 #define VALUE_RETURN 7 #define VALUE_TIMESTAMP 8 #define VALUE_SKIP_SSL_VERIFY 9 #define ERROR_MSG(msg) \ cerr << PACKAGE_NAME \ << ": Error: " \ << msg \ << endl #endif mailfilter-0.8.9/src/md5.h000066400000000000000000000032671430510321000153020ustar00rootroot00000000000000/* MD5.H - header file for MD5C.C */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ #ifndef MD5_H #define MD5_H 1 #include #include /* POINTER defines a generic pointer type */ typedef unsigned char *POINTER; #ifndef HAVE_UINT32_T # if SIZEOF_INT == 4 typedef unsigned int uint32_t; # elif SIZEOF_LONG == 4 typedef unsigned long int uint32_t; # endif #endif /* MD5 context. */ typedef struct { uint32_t state[4]; /* state (ABCD) */ uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64]; /* input buffer */ } MD5_CTX; void MD5Init (MD5_CTX *); void MD5Update (MD5_CTX *, unsigned char *, unsigned int); void MD5Final (unsigned char [16], MD5_CTX *); /* added to define the conversion wrapper */ void gethash (char [33], char *, char *); #endif mailfilter-0.8.9/src/md5c.c000066400000000000000000000242341430510321000154350ustar00rootroot00000000000000/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ #include "md5.h" /* Constants for MD5Transform routine. */ #define S11 7 #define S12 12 #define S13 17 #define S14 22 #define S21 5 #define S22 9 #define S23 14 #define S24 20 #define S31 4 #define S32 11 #define S33 16 #define S34 23 #define S41 6 #define S42 10 #define S43 15 #define S44 21 static void MD5Transform (uint32_t [4], unsigned char [64]); static void Encode (unsigned char *, uint32_t *, unsigned int); static void Decode (uint32_t *, unsigned char *, unsigned int); static void MD5_memcpy (POINTER, POINTER, unsigned int); static void MD5_memset (POINTER, int, unsigned int); static unsigned char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* F, G, H and I are basic MD5 functions. */ #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) #define G(x, y, z) (((x) & (z)) | ((y) & (~z))) #define H(x, y, z) ((x) ^ (y) ^ (z)) #define I(x, y, z) ((y) ^ ((x) | (~z))) /* ROTATE_LEFT rotates x left n bits. */ #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. Rotation is separate from addition to prevent recomputation. */ #define FF(a, b, c, d, x, s, ac) { \ (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define GG(a, b, c, d, x, s, ac) { \ (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define HH(a, b, c, d, x, s, ac) { \ (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define II(a, b, c, d, x, s, ac) { \ (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } /* MD5 initialization. Begins an MD5 operation, writing a new context. */ void MD5Init (context) MD5_CTX *context; /* context */ { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. */ context->state[0] = 0x67452301; context->state[1] = 0xefcdab89; context->state[2] = 0x98badcfe; context->state[3] = 0x10325476; } /* MD5 block update operation. Continues an MD5 message-digest operation, processing another message block, and updating the context. */ void MD5Update (context, input, inputLen) MD5_CTX *context; /* context */ unsigned char *input; /* input block */ unsigned int inputLen; /* length of input block */ { unsigned int i, index, partLen; /* Compute number of bytes mod 64 */ index = (unsigned int)((context->count[0] >> 3) & 0x3F); /* Update number of bits */ if ((context->count[0] += ((uint32_t)inputLen << 3)) < ((uint32_t)inputLen << 3)) context->count[1]++; context->count[1] += ((uint32_t)inputLen >> 29); partLen = 64 - index; /* Transform as many times as possible. */ if (inputLen >= partLen) { MD5_memcpy ((POINTER)&context->buffer[index], (POINTER)input, partLen); MD5Transform (context->state, context->buffer); for (i = partLen; i + 63 < inputLen; i += 64) MD5Transform (context->state, &input[i]); index = 0; } else i = 0; /* Buffer remaining input */ MD5_memcpy ((POINTER)&context->buffer[index], (POINTER)&input[i], inputLen-i); } /* MD5 finalization. Ends an MD5 message-digest operation, writing the the message digest and zeroizing the context. */ void MD5Final (digest, context) unsigned char digest[16]; /* message digest */ MD5_CTX *context; /* context */ { unsigned char bits[8]; unsigned int index, padLen; /* Save number of bits */ Encode (bits, context->count, 8); /* Pad out to 56 mod 64. */ index = (unsigned int)((context->count[0] >> 3) & 0x3f); padLen = (index < 56) ? (56 - index) : (120 - index); MD5Update (context, PADDING, padLen); /* Append length (before padding) */ MD5Update (context, bits, 8); /* Store state in digest */ Encode (digest, context->state, 16); /* Zeroize sensitive information. */ MD5_memset ((POINTER)context, 0, sizeof (*context)); } /* MD5 basic transformation. Transforms state based on block. */ static void MD5Transform (state, block) uint32_t state[4]; unsigned char block[64]; { uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; Decode (x, block, 64); /* Round 1 */ FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ /* Round 2 */ GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ /* Round 3 */ HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ /* Round 4 */ II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; /* Zeroize sensitive information. */ MD5_memset ((POINTER)x, 0, sizeof (x)); } /* Encodes input (uint32_t) into output (unsigned char). Assumes len is a multiple of 4. */ static void Encode (output, input, len) unsigned char *output; uint32_t *input; unsigned int len; { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) { output[j] = (unsigned char)(input[i] & 0xff); output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); } } /* Decodes input (unsigned char) into output (uint32_t). Assumes len is a multiple of 4. */ static void Decode (output, input, len) uint32_t *output; unsigned char *input; unsigned int len; { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) output[i] = ((uint32_t)input[j]) | (((uint32_t)input[j+1]) << 8) | (((uint32_t)input[j+2]) << 16) | (((uint32_t)input[j+3]) << 24); } /* Note: Replace "for loop" with standard memcpy if possible. */ static void MD5_memcpy (output, input, len) POINTER output; POINTER input; unsigned int len; { unsigned int i; for (i = 0; i < len; i++) output[i] = input[i]; } /* Note: Replace "for loop" with standard memset if possible. */ static void MD5_memset (output, value, len) POINTER output; int value; unsigned int len; { unsigned int i; for (i = 0; i < len; i++) ((char *)output)[i] = (char)value; } mailfilter-0.8.9/src/pop3.cc000066400000000000000000000154211430510321000156270ustar00rootroot00000000000000// pop3.cc - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include #include #include #include "socket.hh" #include "pop3.hh" #include "feedback.hh" #include "preferences.hh" #include "mailfilter.hh" #include "header.hh" #include "weeder.hh" #include "defines.hh" #include "protocol.hh" #include "rfc822parser.hh" // This is necessary to use multiple lexer classes. See the flex man // page for further information. #undef yyFlexLexer #define yyFlexLexer rfcFlexLexer #include extern "C" { int rfcparse (void*); } using namespace std; // Declare lexer globally, so the parser can find it. FlexLexer* rfclexer; extern Weeder weeder; bool POP3 :: login (const char* usr, const char* pass, const unsigned int enc) const { string usr_name = (string)"USER " + usr + (string)"\r\n"; string pass_wd = (string)"PASS " + pass + (string)"\r\n"; if (conn->c_read () == -1) return false; Feedback* logger = Feedback :: Instance (); // Send user name and read server reply. if (conn->c_write (usr_name.c_str ()) == -1 || !REPLY_OK) { logger->print_err("Error occurred while sending username to server."); return false; } // Send password and read server reply. if (conn->c_write (pass_wd.c_str ()) == -1 || !REPLY_OK) { logger->print_err("Error occurred while sending password to server."); return false; } return true; } int POP3 :: status (void) const { // Send user name and read server reply. if (conn->c_write ("STAT\r\n") == -1) return GEN_FAILURE_FLAG; if (!REPLY_OK) return GEN_FAILURE_FLAG; istringstream response (conn->c_reply ()->c_str ()); string no_msgs; // The second word in the server's output string contains the number // of unread messages in a POP3 mailbox. Hence we shift the reply // string twice. for (int i = 1; i <= 2; i++) response >> no_msgs; return atoi (no_msgs.c_str ()); } // The function scans the headers inside a POP3 account for spam. It // will delete all spam messages in the account and return 0 when all // the hard work is done. A negative integer is returned if an error // occurred. int POP3 :: scan (void) const { Feedback* logger = Feedback :: Instance (); Header* msg_header; int num_messages; stringstream msg_no; string cmd; // Determine number of messages waiting to be examined. if ((num_messages = status ()) < 0) { logger->print_err ("Error occurred while sending STAT to server."); return GEN_FAILURE_FLAG; } try { for (int i = 1; i <= num_messages; i++) { // Reserve heap for the message to be stored, parsed, and // processed. msg_header = new Header; // Convert current message number to string. msg_no << i; // Determine message size. cmd = "LIST " + msg_no.str () + "\r\n"; if (conn->c_write (cmd.c_str ()) == -1 || !REPLY_OK) { logger->print_err ("Error occurred while sending LIST to server."); return GEN_FAILURE_FLAG; } msg_header->set_size (atoi ((conn->c_reply ()-> substr (conn->c_reply ()-> find_last_of (" ") + 1)).c_str ())); // Read the header of the current message. cmd = "TOP " + msg_no.str () + " 0\r\n"; if (conn->c_write (cmd.c_str ()) == -1 || !HEADER_OK) { logger->print_err ("Error occurred while sending TOP to server."); return GEN_FAILURE_FLAG; } // Store the header in a separate file, if the user has given // a path definition via SHOW_HEADERS. if (Preferences :: Instance ().headers_file ().length ()) if (!logger->print_header (conn->c_reply ()->c_str ())) logger->print_err ("Could not write headers to separate file."); // Strip topmost status line of server reply, e.g. "+OK Message // follows." The +1 in the end is necessary to skip the actual // first newline itself. string message = conn->c_reply ()->substr (conn->c_reply ()->find_first_of ("\n") + 1); // Now parse the header of the current message and store it in // the msg_header object. if (invoke_msg_parser (&message, msg_header) < 0) { logger->print_err ("Parsing the header of message " + msg_no.str () + " failed."); return GEN_FAILURE_FLAG; } // Now pass msg_header on to the weeder in order to determine // whether it stores a spam mail. if (weeder.is_weed (msg_header) == 1) remove_msg (i); // Delete memory occupied by the current message header. delete msg_header; // Reset stringstream for next int to string conversion. msg_no.clear (); msg_no.str (string ()); } } catch (...) { throw; } return 0; } // This function accepts a string pointer as argument which contains // the entire header of an email message. It is used to parse that // header and store it in a Header-class, msg_header, in order to // determine whether that particular message qualifies as Spam. The // function returns a positive integer upon success, and a negative // one otherwise. Failure is usually related to out-of-memory errors. int POP3 :: invoke_msg_parser (const string* header, const Header* msg_header) const { if (header && msg_header) { try { stringstream cur_header; cur_header << *header; rfclexer = new rfcFlexLexer; rfclexer->switch_streams (&cur_header, NULL); int error = rfcparse ((void*) msg_header); delete rfclexer; return error; } catch (...) { return MEM_FAILURE_FLAG; } } else return GEN_FAILURE_FLAG; } bool POP3 :: logout (void) const { return (conn->c_write ("QUIT\r\n") == -1) ? false : true; } int POP3 :: remove_msg (const unsigned int num) const { if (Preferences :: Instance ().test_mode ()) { Feedback* logger = Feedback :: Instance (); logger->print_msg ("Debugging: Simulating DELE command.", 6); return 0; } ostringstream ostr; ostr << num; string cmd = (string)"DELE " + ostr.str () + (string)"\r\n"; return (conn->c_write (cmd.c_str ()) == -1) ? GEN_FAILURE_FLAG : 0; } mailfilter-0.8.9/src/pop3.hh000066400000000000000000000040701430510321000156370ustar00rootroot00000000000000// pop3.hh - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef POP3_HH #define POP3_HH #include "header.hh" #include "protocol.hh" using namespace std; // True, if the server replied and its status message was anything, // but an error. #define REPLY_OK ((conn->c_read () > 0 && conn->c_reply ()) ? \ (((conn->c_reply ()->c_str ())[0] == '+') ? true : false) \ : false) // This macro is similar to REPLY_OK, except it sets a flag for c_read // in order to tell the function that an entire message header is // about to be received. Further comments inside socket.cc:c_read(). #define HEADER_OK ((conn->c_read (true) > 0 && conn->c_reply ())? \ (((conn->c_reply ()->c_str ())[0] == '+') ? true : false) \ : false) class POP3 : public Protocol { private: int invoke_msg_parser (const string*, const Header*) const; public: bool login (const char*, const char*, const unsigned int) const; bool logout (void) const; int remove_msg (const unsigned int) const; int status (void) const; int scan (void) const; }; #endif mailfilter-0.8.9/src/preferences.cc000066400000000000000000000271641430510321000172560ustar00rootroot00000000000000// preferences.cc - source file for the mailfilter program // Copyright (c) 2000 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include #include #include #include #include #include #include #include "preferences.hh" #include "filter.hh" #include "mailfilter.hh" #include "account.hh" #include "protocol.hh" #include "score.hh" #include "rcfile.hh" extern "C" { #include #include #include } #ifdef HAVE_CONFIG_H #include "config.h" #endif using namespace std; extern "C" { int rcparse (void*); } extern int cmp_no_case (const string&, const string&); Preferences :: Preferences () { icase = CASE_DEFAULT; norm = false; test = false; show_headers = false; del_duplicates = false; ret_status = false; _ignore_time_stamp= false; _skip_ssl_verify = false; high_score = 100; time_out_val = 30; negative_allows = 0; negative_denies = 0; negative_scores = 0; max_size = 0; max_size_friends = 0; max_line_length = 0; rreg_type = 0; verbosity = 3; // Flags indicate whether a value was touched before. See comments // inside preferences.hh for further details. verbosity_changed = false; test_changed = false; } Preferences& Preferences :: Instance () { static Preferences* instance = new Preferences; return *instance; } void Preferences :: init (void) { size_score.score = 0; size_score.size = 0; } void Preferences :: kill (void) { vector :: iterator die_account = (Preferences :: accnts).begin (); while (die_account != (Preferences :: accnts).end ()) { die_account->clear (); die_account++; } } void Preferences :: set_ignore_time_stamp(bool new_ts) { _ignore_time_stamp = new_ts; } bool Preferences :: ignore_time_stamp() { return _ignore_time_stamp; } // This function tries to locate a preferences file and, upon success, // stores the file path in prefs_file. However, no data is loaded by // the open() function. bool Preferences :: open (const char* name) { prefs_file_name = name; if (!prefs_file_name.length ()) { char* home_env; if ((home_env = getenv ("HOME"))) { string home_dir = home_env; prefs_file_name = home_dir + (string)RC_FILE_NAME; prefs_stream.open (prefs_file_name.c_str ()); // Windoze people have trouble with the leading dot so // here's an extra check, in case .mailfilterrc can't be // located in the user's home directory. if (!prefs_stream.is_open ()) prefs_file_name = home_dir + (string)RC_FILE_NAME_WIN; } else return false; } else prefs_stream.open (prefs_file_name.c_str ()); if (!prefs_stream.is_open ()) return false; return true; } // This function loads the user's preferences file which is specified // in prefs_file. This string, containing the path, must not be empty // at this point. bool Preferences :: load (void) { if (!prefs_stream.is_open ()) return false; try { RCParser rcparser(&prefs_stream); rcparser.parse(); } catch (...) { throw; } return true; } void Preferences :: add_deny_rule (const char* keyword, const char* operat, const char* id) { Filter cur_filter; if (strcmp (operat, "=") == 0) cur_filter.set_negativity (false); else { negative_denies++; cur_filter.set_negativity (true); } cur_filter.set_expression (id); if (cmp_no_case (keyword, "deny_case") == 0) cur_filter.set_case (CASE_SENSITIVE); else if (cmp_no_case (keyword, "deny_nocase") == 0) cur_filter.set_case (CASE_INSENSITIVE); else cur_filter.set_case (default_case ()); denies.push_back (cur_filter); } void Preferences :: add_allow_rule (const char* keyword, const char* operat, const char* id) { Filter cur_filter; if (strcmp (operat, "=") == 0) cur_filter.set_negativity (false); else { negative_allows++; cur_filter.set_negativity (true); } cur_filter.set_expression (id); if (cmp_no_case (keyword, "allow_case") == 0) cur_filter.set_case (CASE_SENSITIVE); else if (cmp_no_case (keyword, "allow_nocase") == 0) cur_filter.set_case (CASE_INSENSITIVE); else cur_filter.set_case (default_case ()); allows.push_back (cur_filter); } void Preferences :: add_score (const char* keyword, int given_score, const char* operat, const char* id) { Score cur_score; if (strcmp (operat, "=") == 0) cur_score.set_negativity (false); else { negative_scores++; cur_score.set_negativity (true); } cur_score.set_expression (id); cur_score.set_score (given_score); if (cmp_no_case (keyword, "score_case") == 0) cur_score.set_case (CASE_SENSITIVE); else if (cmp_no_case (keyword, "score_nocase") == 0) cur_score.set_case (CASE_INSENSITIVE); else cur_score.set_case (default_case ()); scores.push_back (cur_score); } void Preferences :: set_headers_file (const char* name) { // Expand the given file name. wordexp_t result; if (wordexp (name, &result, 0) == 0 && result.we_wordc > 0) { headers_file_name = result.we_wordv[0]; } else { ERROR_MSG("Invalid headers store-file name: `" + (string)name + "'."); exit(-1); } wordfree (&result); } string Preferences :: headers_file (void) { return headers_file_name; } void Preferences :: set_rc_file (const char* name) { prefs_file_name = name; } string Preferences :: rc_file (void) { return prefs_file_name; } void Preferences :: set_log_file (const char* name) { // Only expand logfile name if none was already specified, eg on the // command line. if (log_file_name.length() == 0) { wordexp_t result; if (wordexp(name, &result, 0) == 0 && result.we_wordc > 0) { log_file_name = result.we_wordv[0]; } else { ERROR_MSG("Invalid logfile name: `" + (string)name + "'."); exit(-1); } wordfree (&result); } } string Preferences :: log_file (void) { return log_file_name; } void Preferences :: set_verbose_level (int level) { if (!verbosity_changed) { verbosity = level; verbosity_changed = true; } } int Preferences :: verbose_level (void) { return verbosity; } void Preferences :: set_default_case (const char* new_case) { icase = ((cmp_no_case (new_case, "yes") == 0) ? 0 : REG_ICASE); } int Preferences :: default_case (void) { return icase; } void Preferences :: set_reg_type (const char* new_type) { if (cmp_no_case (new_type, "extended") == 0) rreg_type = REG_EXTENDED; else if (cmp_no_case (new_type, "basic") == 0) rreg_type = 0; else { ERROR_MSG((string)"Regular expressions must either be of type " + (string)"'extended', or 'basic'."); exit (-1); } } int Preferences :: reg_type (void) { return rreg_type; } void Preferences :: set_server (const char* server) { cur_account.set_server (server); } void Preferences :: set_usr (const char* user) { cur_account.set_usr (user); } void Preferences :: set_passwd (const char* pass) { cur_account.set_passwd (pass); } void Preferences :: set_protocol (const char* prot) { try { if (cmp_no_case (prot, "POP3") == 0) cur_account.set_protocol (PROTOCOL_POP3); else if (cmp_no_case (prot, "APOP") == 0) cur_account.set_protocol (PROTOCOL_APOP); #ifdef USE_SSL else if (cmp_no_case (prot, "POP3/SSL") == 0) cur_account.set_protocol (PROTOCOL_POP3 | SSL_C); else if (cmp_no_case (prot, "APOP/SSL") == 0) cur_account.set_protocol (PROTOCOL_APOP | SSL_C); #endif else { ERROR_MSG ((string)"Only supported protocols are POP3 and " + (string)"APOP (SSL only if OpenSSL is available)."); exit (-1); } } catch (const exception& r_err) { // Most likely an error is the result of insufficient memory; // set_protocol tries to reserve space for a protocol object. // // The error cannot be passed on here, cause it would have to // pass the parser which is not exception-save. (Maybe, this // can be fixed in the future?) ERROR_MSG (r_err.what ()); exit (-1); } } // This function is pretty much a dummy wrapper. See comments // inside account.cc for further information about it. void Preferences :: set_connection (unsigned int p) { try { cur_account.set_connection (); } catch (const exception& r_err) { ERROR_MSG (r_err.what ()); exit (-1); } } void Preferences :: set_port (unsigned int p) { // Port is the last instruction in the server-defining block from // the rcfile, hence, we have to push the current server data onto // the stack of stored accounts. // TODO: shift this functionality into the rcfile parser! cur_account.set_port (p); accnts.push_back (cur_account); } bool Preferences :: delete_duplicates (void) { return del_duplicates; } void Preferences :: set_del_duplicates (const char* del) { del_duplicates = (cmp_no_case (del, "yes") == 0 ? true : false); } vector* Preferences :: accounts (void) { return &accnts; } vector* Preferences :: allow_filters (void) { return &allows; } vector* Preferences :: deny_filters (void) { return &denies; } vector* Preferences :: score_filters (void) { return &scores; } void Preferences :: set_time_out (unsigned int val) { time_out_val = val; } unsigned int Preferences :: time_out (void) { return time_out_val; } int Preferences :: max_size_allow (void) { return max_size_friends; } void Preferences :: set_max_size_allow (int val) { max_size_friends = val; } int Preferences :: max_size_deny (void) { return max_size; } void Preferences :: set_max_size_deny (int val) { max_size = val; } Size_score Preferences :: max_size_score (void) { return size_score; } void Preferences :: set_max_size_score (int score, int size) { size_score.score = score; size_score.size = size; } int Preferences :: neg_allows (void) { return negative_allows; } int Preferences :: neg_denies (void) { return negative_denies; } int Preferences :: highscore (void) { return high_score; } void Preferences :: set_highscore (int val) { high_score = val; } void Preferences :: set_normal (const char* par) { norm = (cmp_no_case (par, "yes") == 0 ? true : false); } bool Preferences :: normal (void) { return norm; } bool Preferences :: test_mode (void) { return test; } void Preferences :: set_test_mode (const char* par) { if (!test_changed) { test = (cmp_no_case (par, "yes") == 0 ? true : false); test_changed = true; } } void Preferences :: set_maxlength (int val) { max_line_length = val; } int Preferences :: maxlength (void) { return max_line_length; } bool Preferences :: return_status (void) { return ret_status; } void Preferences :: set_return_status (bool st) { ret_status = st; } void Preferences :: set_skip_ssl_verify (bool skip) { _skip_ssl_verify = skip; } bool Preferences :: skip_ssl_verify (void) { return _skip_ssl_verify; } mailfilter-0.8.9/src/preferences.hh000066400000000000000000000121471430510321000172630ustar00rootroot00000000000000// preferences.hh - source file for the mailfilter program // Copyright (c) 2000 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef PREFERENCES_HH #define PREFERENCES_HH #include #include #include #include "defines.hh" #include "socket.hh" #include "filter.hh" #include "score.hh" #include "account.hh" using namespace std; class Preferences { protected: ifstream prefs_stream; vector allows; vector denies; vector scores; vector accnts; Account cur_account; string prefs_file_name; string log_file_name; string headers_file_name; int icase; bool norm; bool test; bool show_headers; bool del_duplicates; bool ret_status; bool _ignore_time_stamp; bool _skip_ssl_verify; int high_score; unsigned time_out_val; int max_size; Size_score size_score; int max_size_friends; int max_line_length; int rreg_type; int verbosity; int conn_type; int negative_allows; int negative_denies; int negative_scores; // These flags indicate whether a value was already set, or // whether it's still set to the default values defined by the // constructor. bool verbosity_changed; bool test_changed; public: Preferences (); static Preferences& Instance (); void init (void); void kill (void); bool open (const char*); bool load (void); void add_deny_rule (const char*, const char*, const char*); void add_allow_rule (const char*, const char*, const char*); void add_score (const char*, int, const char*, const char*); int neg_allows (void); int neg_denies (void); void set_rc_file (const char*); string rc_file (void); void set_log_file (const char*); string log_file (void); void set_verbose_level (int); int verbose_level (void); void set_headers_file (const char*); string headers_file (void); void set_default_case (const char*); int default_case (void); void set_reg_type (const char*); int reg_type (void); void set_server (const char*); void set_usr (const char*); void set_passwd (const char*); void set_protocol (const char*); void set_connection (unsigned int = POSIX_SOCKETS) __attribute__ ((unused)); void set_port (unsigned int); unsigned int time_out (void); void set_time_out (unsigned int); bool delete_duplicates (void); void set_del_duplicates(const char*); int max_size_allow (void); void set_max_size_allow(int); int max_size_deny (void); void set_max_size_deny (int); Size_score max_size_score (void); void set_max_size_score(int, int); int highscore (void); void set_highscore (int); bool normal (void); void set_normal (const char*); bool test_mode (void); void set_test_mode (const char*); int maxlength (void); void set_maxlength (int); bool ignore_time_stamp (); void set_ignore_time_stamp (bool = true); bool return_status (void); void set_return_status (bool); void set_skip_ssl_verify (bool); bool skip_ssl_verify (void); vector* accounts (void); vector* allow_filters (void); vector* deny_filters (void); vector* score_filters (void); }; #endif mailfilter-0.8.9/src/protocol.cc000066400000000000000000000022231430510321000166030ustar00rootroot00000000000000// protocol.cc - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include "connection.hh" #include "protocol.hh" using namespace std; void Protocol :: set_ident (unsigned int i) { prot_ident = i; } unsigned int Protocol :: ident (void) const { return prot_ident; } void Protocol :: set_connection (Connection* currently_established_connection) { conn = currently_established_connection; } mailfilter-0.8.9/src/protocol.hh000066400000000000000000000036151430510321000166230ustar00rootroot00000000000000// protocol.hh - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef PROTOCOL_HH #define PROTOCOL_HH #include "connection.hh" // This is useful to specify a combination of protocol and encryption, // e.g. PROTOCOL_POP3 | SSL. #define PROTOCOL_POP3 2 #define PROTOCOL_APOP 4 #define SSL_C 4096 using namespace std; class Protocol { protected: Connection* conn; unsigned int prot_ident; unsigned int connect_type; public: virtual ~Protocol (void) { }; virtual bool login (const char* usr, const char* pass, const unsigned int) const = 0; virtual bool logout (void) const = 0; virtual int remove_msg (const unsigned int num) const = 0; virtual int status (void) const = 0; virtual int scan (void) const = 0; void set_connection (Connection*); void set_ident (unsigned int); unsigned int ident (void) const; }; #endif mailfilter-0.8.9/src/rcfile.hh000066400000000000000000000024601430510321000162230ustar00rootroot00000000000000// rcfile.hh - source file for the mailfilter program // Copyright (c) 2000 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef RCFILE_HH #define RCFILE_HH // This is necessary to use multiple lexer classes. See the flex man // page for further information. #undef yyFlexLexer #define yyFlexLexer rcFlexLexer #include #include using namespace std; // Note: Bodies of the functions are defined inside rcfile.yy. class RCParser { private: istream* isp; ostream* osp; public: RCParser(istream* ip = 0, ostream* = 0); ~RCParser(); void parse(void* = 0); }; #endif mailfilter-0.8.9/src/rcfile.ll000066400000000000000000000255251430510321000162420ustar00rootroot00000000000000/* *********************************************************************** */ /* A scanner definition for Mailfilter's config files */ /* Copyright (c) 2000 - 2009 Andreas Bauer */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /* *********************************************************************** */ /* The states are numbered from 1...n and are stored in YY_START. */ %s CTRL %x INCL %x PARAM %s PARAM_NUM %s PARAM_BOOL %option noyywrap %{ #include #include #include #include #include #include #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "rcparser.hh" extern "C" { #include } using namespace std; /* Only allow 'recursion depth' of 1 when including files. */ #define MAX_INCLUDE_DEPTH 1 /* Define L_DEBUG_MODE to get extra output from the scanner. */ #ifdef L_DEBUG_MODE #undef L_DEBUG_MSG #define L_DEBUG_MSG(msg) \ cout << "Lexer: " \ << msg \ << endl #else #define L_DEBUG_MSG(msg) \ ; #endif YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; int include_stack_ptr; extern string expand_path (const string&); extern string int_to_string (int val); %} ALLOW allow ALLOW_CASE allow_case ALLOW_NOCASE allow_nocase DEL_DUPLICATES del_duplicates DENY_NOCASE deny_nocase DENY_CASE deny_case DENY deny HIGHSCORE highscore INCLUDE include[ \t]*= LOGFILE logfile MAXLENGTH maxlength MAXSIZE_ALLOW maxsize_allow MAXSIZE_DENY maxsize_deny MAXSIZE_SCORE maxsize_score NORMAL normal REG_CASE reg_case REG_TYPE reg_type SERVER server USER user PASS pass PROTOCOL protocol PORT port SHOW_HEADERS show_headers SCORE score SCORE_CASE score_case SCORE_NOCASE score_nocase TEST test TIMEOUT timeout VERBOSE verbose REM ^[[:blank:]]*#.* NOT_EQUAL <> EXP \"([[:graph:]]+)|([[:graph:]]+.*[[:graph:]]+)\" TEXT_ID [[:alnum:]]+ YES_NO_ID (yes|no) SHELL_CMD \`([[:graph:]]|[[:blank:]])+\' ENV_VAR [\$]([[:alnum:]]|_)+ NUM_ID (\+|\-|[0-9])[0-9]* CTRL_CHAR . int num_lines = 0; int temp_num_lines = 0; string sub_file; %% {INCLUDE} { BEGIN(INCL); temp_num_lines = num_lines; num_lines = 0; } [ \t]* {; /* Eat the whitespace. */ } [^ \t\n]+ { /* Include further rcfiles: */ wordexp_t result; if (include_stack_ptr >= MAX_INCLUDE_DEPTH) { cerr << PACKAGE_NAME << ": Error: Files nested too deep." << endl; exit (-1); } include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; try { if (wordexp (yytext, &result, 0) == 0) { sub_file = result.we_wordv[0]; wordfree (&result); } else { cerr << PACKAGE_NAME << ": Error: Nested rcfile '"; cerr << yytext << "' could not be found." << endl; exit (-1); } // yyin is now a std::istream& it seems. So the following no longer works: // yyin = new ifstream (sub_file.c_str ()); std::ifstream* infile = new ifstream (sub_file.c_str ()); // if (!((std::ifstream*) yyin)->is_open ()) if (!infile->is_open ()) { cerr << PACKAGE_NAME << ": Error: Nested rcfile '"; cerr << sub_file << "' could not be opened." << endl; exit (-1); } yy_switch_to_buffer (yy_create_buffer (infile, YY_BUF_SIZE)); // yy_switch_to_buffer (yy_create_buffer (yyin, YY_BUF_SIZE)); } catch (...) { cerr << PACKAGE_NAME << ": Error: Exception was thrown when " << "trying to read '" << yytext << "'." << endl; exit (-1); } BEGIN(INITIAL); } <> { if (--include_stack_ptr < 0) yyterminate (); else { yy_delete_buffer (YY_CURRENT_BUFFER); yy_switch_to_buffer (include_stack[include_stack_ptr]); } num_lines = temp_num_lines; sub_file = ""; } {REM} {; /* Do nothing with remarks. */ } {ALLOW} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Allow."); return ALLOW; } {ALLOW_CASE} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Allow_Case."); return ALLOW_CASE; } {ALLOW_NOCASE} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Allow_Nocase."); return ALLOW_NOCASE; } {DEL_DUPLICATES} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Del_Duplicates."); BEGIN(PARAM_BOOL); return DEL_DUPLICATES; } {DENY} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Deny."); return DENY; } {DENY_CASE} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Deny_Case."); return DENY_CASE; } {DENY_NOCASE} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Deny_Nocase."); return DENY_NOCASE; } {HIGHSCORE} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Highscore."); BEGIN(PARAM_NUM); return HIGHSCORE; } {LOGFILE} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Logfile."); return LOGFILE; } {MAXLENGTH} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Maxlength."); BEGIN(PARAM_NUM); return MAXLENGTH; } {MAXSIZE_ALLOW} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Maxsize_Allow."); BEGIN(PARAM_NUM); return MAXSIZE_ALLOW; } {MAXSIZE_DENY} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Maxsize_Deny."); BEGIN(PARAM_NUM); return MAXSIZE_DENY; } {MAXSIZE_SCORE} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Maxsize_Score."); BEGIN(PARAM_NUM); return MAXSIZE_SCORE; } {NORMAL} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Normal."); BEGIN(PARAM_BOOL); return NORMAL; } {SERVER} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Server."); return SERVER; } {USER} { rclval.sval = strdup (yytext); L_DEBUG_MSG("User."); return USER; } {PASS} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Pass."); return PASS; } {PROTOCOL} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Protocol."); return PROTOCOL; } {PORT} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Port."); BEGIN(PARAM_NUM); return PORT; } {REG_CASE} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Reg_Case."); BEGIN(PARAM_BOOL); return REG_CASE; } {REG_TYPE} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Reg_Type."); return REG_TYPE; } {SHOW_HEADERS} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Show_Headers."); return SHOW_HEADERS; } {SCORE} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Score."); BEGIN(PARAM_NUM); return SCORE; } {SCORE_CASE} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Score_Case."); BEGIN(PARAM_NUM); return SCORE_CASE; } {SCORE_NOCASE} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Score_Nocase."); BEGIN(PARAM_NUM); return SCORE_NOCASE; } {TEST} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Test."); BEGIN(PARAM_BOOL); return TEST; } {TIMEOUT} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Timeout."); BEGIN(PARAM_NUM); return TIMEOUT; } {VERBOSE} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Verbose."); BEGIN(PARAM_NUM); return VERBOSE; } "=" { rclval.sval = strdup (yytext); L_DEBUG_MSG((string)rclval.sval + " (" + int_to_string (YY_START) + ")"); return '='; } "<>" { rclval.sval = strdup (yytext); L_DEBUG_MSG((string)rclval.sval + " (" + int_to_string (YY_START) + ")"); return NOT_EQUAL; } "\"" { /* Beginning of an argument: */ rclval.sval = strdup (yytext); if (YY_START != PARAM_BOOL) BEGIN(PARAM); L_DEBUG_MSG((string)"Opening \"" + " (" + int_to_string (YY_START) + ")"); return '"'; } {NUM_ID} { rclval.ival = atoi (yytext); L_DEBUG_MSG("Num_Id: " + (string)yytext + " (" + int_to_string (YY_START) + ")"); return NUM_ID; } {SHELL_CMD} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Shell_Cmd: " + (string)rclval.sval + " (" + int_to_string (YY_START) + ")"); return SHELL_CMD; } {ENV_VAR} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Env_Var: " + (string)rclval.sval + " (" + int_to_string (YY_START) + ")"); return ENV_VAR; } {YES_NO_ID} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Yes_No_Id: " + (string)rclval.sval + " (" + int_to_string (YY_START) + ")"); return YES_NO_ID; } {TEXT_ID} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Text_Id: " + (string)rclval.sval + " (" + int_to_string (YY_START) + ")"); return TEXT_ID; } \"[[:blank:]]*$ { /* Ending of an argument: */ rclval.sval = strdup (yytext); L_DEBUG_MSG((string)"Closing \"" + " (" + int_to_string (YY_START) + ")"); return '"'; } {CTRL_CHAR} { rclval.sval = strdup (yytext); L_DEBUG_MSG("Ctrl_Char: " + (string)rclval.sval + " (" + int_to_string (YY_START) + ")"); return CTRL_CHAR; } <*>[ \t] {; /* Do nothing with tabs and spaces. */ } <*>"\n" { ++num_lines; BEGIN(0); } <*>. { if (sub_file != "") { cerr << PACKAGE_NAME << ": Error: Lexicographical error in line "; cerr << (num_lines + 1) << " of your rcfile '" << sub_file; cerr << "'." << endl; } else { cerr << PACKAGE_NAME << ": Error: Lexicographical error in line "; cerr << (num_lines + 1) << " of your main rcfile." << endl; } cerr << PACKAGE_NAME << ": The term '" << yytext; cerr << "' could not be interpreted." << endl; exit (-1); } %% mailfilter-0.8.9/src/rcfile.yy000066400000000000000000000312341430510321000162660ustar00rootroot00000000000000/* *********************************************************************** */ /* A parser definition for Mailfilter's config files */ /* Copyright (c) 2000 - 2009 Andreas Bauer */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /* *********************************************************************** */ %{ #include #include #include #include #include #include #ifdef yyalloc #define rcalloc_ALREADY_DEFINED #else #define yyalloc rcalloc #endif #ifdef yysymbol_kind_t #define rcsymbol_kind_t_ALREADY_DEFINED #else #define yysymbol_kind_t rcsymbol_kind_t #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "mailfilter.hh" #include "preferences.hh" #include "rcfile.hh" // We want to give the Preferences object as parameter for yyparse. // #undef YYPARSE_PARAM // #define YYPARSE_PARAM param // Define P_DEBUG_MODE to get extra output from the parser. #ifdef P_DEBUG_MODE #undef P_DEBUG_MSG #define P_DEBUG_MSG(msg) \ cout << "Parser: " \ << msg \ << endl \ << endl #else #define P_DEBUG_MSG(msg) \ ; #endif using namespace std; FlexLexer* rclexer; extern int num_lines; extern string sub_file; extern string int_to_string (int); extern string exec_shell (const char*); void strip_shell (char[]); inline int yylex() { return rclexer->rclex(); } extern "C" { int rcparse(void*); // int rcparse(const char*); int rcwrap(void) { return 1; } void rcerror (const void* str, const void* NOT_USED) { cerr << PACKAGE_NAME << ": Error: " << str; if (sub_file.length ()) cerr << " in file " << sub_file; else cerr << " in main rcfile"; cerr << " in line " << (num_lines + 1); cerr << "." << endl; exit (-1); } } %} %union rc { int ival; char* sval; } %parse-param {void* param} %token ALLOW %token ALLOW_CASE %token ALLOW_NOCASE %token DEL_DUPLICATES %token DENY_NOCASE %token DENY_CASE %token DENY %token HIGHSCORE %token LOGFILE %token MAXLENGTH %token MAXSIZE_ALLOW %token MAXSIZE_DENY %token MAXSIZE_SCORE %token NORMAL %token SERVER %token USER %token PASS %token PROTOCOL %token PORT %token REG_CASE %token REG_TYPE %token SHOW_HEADERS %token SCORE %token SCORE_CASE %token SCORE_NOCASE %token TIMEOUT %token TEST %token VERBOSE %token EXP %token YES_NO_ID %token TEXT_ID %token NUM_ID %token SHELL_CMD %token ENV_VAR %token CTRL_CHAR %type exp %type exps %type str_arg %type yes_no_arg %type num_arg %left NOT_EQUAL %left '=' %% commands: /* empty */ | commands command ; command: allow_rule | del_duplicates | deny_rule | highscore | logfile | maxlength | maxsize_allow | maxsize_deny | maxsize_score | normal | server | user | pass | protocol | port | reg_case | reg_type | show_headers | score | test | timeout | verbose ; exps: exp { $$ = $1; } | exps exp { char* tmp = (char*)malloc ((strlen ($1) + strlen ($2) + 2) * sizeof (char)); if (tmp) { strcpy (tmp, $1); $$ = strcat (tmp, $2); free ($1); free ($2); } else { cerr << "Out of memory error in rcparser." << endl; exit (-1); } } ; exp: SHELL_CMD { strip_shell ($1); $$ = strdup (exec_shell ($1).c_str ()); free ($1); } | ENV_VAR { $$ = $1; } | TEXT_ID { $$ = $1; } | CTRL_CHAR { $$ = $1; } ; str_arg: '"' exps '"' { $$ = $2; } ; yes_no_arg: '"' YES_NO_ID '"' { $$ = $2; } ; num_arg: NUM_ID { $$ = $1; } ; allow_rule: ALLOW '=' str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().add_allow_rule ($1, $2, $3); free ($1); free ($2); free ($3); } | ALLOW NOT_EQUAL str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().add_allow_rule ($1, $2, $3); free ($1); free ($2); free ($3); } | ALLOW_CASE '=' str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().add_allow_rule ($1, $2, $3); free ($1); free ($2); free ($3); } | ALLOW_CASE NOT_EQUAL str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().add_allow_rule ($1, $2, $3); free ($1); free ($2); free ($3); } | ALLOW_NOCASE '=' str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().add_allow_rule ($1, $2, $3); free ($1); free ($2); free ($3); } | ALLOW_NOCASE NOT_EQUAL str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().add_allow_rule ($1, $2, $3); free ($1); free ($2); free ($3); } ; del_duplicates: DEL_DUPLICATES '=' yes_no_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().set_del_duplicates ($3); free ($1); free ($2); free ($3); } ; deny_rule: DENY '=' str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().add_deny_rule ($1, $2, $3); free ($1); free ($2); free ($3); } | DENY NOT_EQUAL str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().add_deny_rule ($1, $2, $3); free ($1); free ($2); free ($3); } | DENY_CASE '=' str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().add_deny_rule ($1, $2, $3); free ($1); free ($2); free ($3); } | DENY_CASE NOT_EQUAL str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().add_deny_rule ($1, $2, $3); free ($1); free ($2); free ($3); } | DENY_NOCASE '=' str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().add_deny_rule ($1, $2, $3); free ($1); free ($2); free ($3); } | DENY_NOCASE NOT_EQUAL str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().add_deny_rule ($1, $2, $3); free ($1); free ($2); free ($3); } ; highscore: HIGHSCORE '=' num_arg { P_DEBUG_MSG($1 + (string)$2 + int_to_string (rclval.ival)); Preferences :: Instance ().set_highscore ($3); free ($1); free ($2); } ; logfile: LOGFILE '=' str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().set_log_file ($3); free ($1); free ($2); free ($3); } ; maxlength: MAXLENGTH '=' num_arg { P_DEBUG_MSG($1 + (string)$2 + int_to_string (rclval.ival)); Preferences :: Instance ().set_maxlength ($3); free ($1); free ($2); } ; maxsize_allow: MAXSIZE_ALLOW '=' num_arg { P_DEBUG_MSG($1 + (string)$2 + int_to_string (rclval.ival)); Preferences :: Instance ().set_max_size_allow ($3); free ($1); free ($2); } ; maxsize_deny: MAXSIZE_DENY '=' num_arg { P_DEBUG_MSG($1 + (string)$2 + int_to_string (rclval.ival)); Preferences :: Instance ().set_max_size_deny ($3); free ($1); free ($2); } ; maxsize_score: MAXSIZE_SCORE num_arg '=' num_arg { P_DEBUG_MSG($1 + int_to_string (rclval.ival) + (string)$3 + int_to_string (rclval.ival)); Preferences :: Instance ().set_max_size_score ($2, $4); free ($1); free ($3); } ; normal: NORMAL '=' yes_no_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().set_normal ($3); free ($1); free ($2); free ($3); } ; server: SERVER '=' str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().set_server ($3); free ($1); free ($2); free ($3); } ; user: USER '=' str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().set_usr ($3); free ($1); free ($2); free ($3); } ; pass: PASS '=' str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().set_passwd ($3); free ($1); free ($2); free ($3); } ; protocol: PROTOCOL '=' str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().set_protocol ($3); /* See account.cc for further information about the following (rather misplaced) call: */ Preferences :: Instance ().set_connection (); free ($1); free ($2); free ($3); } ; port: PORT '=' num_arg { P_DEBUG_MSG($1 + (string)$2 + int_to_string (rclval.ival)); Preferences :: Instance ().set_port ((unsigned int)$3); free ($1); free ($2); } ; reg_case: REG_CASE '=' yes_no_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().set_default_case ($3); free ($1); free ($2); free ($3); } ; reg_type: REG_TYPE '=' str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().set_reg_type ($3); free ($1); free ($2); free ($3); } ; show_headers: SHOW_HEADERS '=' str_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().set_headers_file ($3); free ($1); free ($2); free ($3); } ; score: SCORE num_arg '=' str_arg { P_DEBUG_MSG($1 + int_to_string (rclval.ival) + (string)$3 + $4); Preferences :: Instance ().add_score ($1, $2, $3, $4); free ($1); free ($3); free ($4); } | SCORE num_arg NOT_EQUAL str_arg { P_DEBUG_MSG($1 + int_to_string (rclval.ival) + (string)$3 + $4); Preferences :: Instance ().add_score ($1, $2, $3, $4); free ($1); free ($3); free ($4); } | SCORE_CASE num_arg '=' str_arg { P_DEBUG_MSG($1 + int_to_string (rclval.ival) + (string)$3 + $4); Preferences :: Instance ().add_score ($1, $2, $3, $4); free ($1); free ($3); free ($4); } | SCORE_CASE num_arg NOT_EQUAL str_arg { P_DEBUG_MSG($1 + int_to_string (rclval.ival) + (string)$3 + $4); Preferences :: Instance ().add_score ($1, $2, $3, $4); free ($1); free ($3); free ($4); } | SCORE_NOCASE num_arg '=' str_arg { P_DEBUG_MSG($1 + int_to_string (rclval.ival) + (string)$3 + $4); Preferences :: Instance ().add_score ($1, $2, $3, $4); free ($1); free ($3); free ($4); } | SCORE_NOCASE num_arg NOT_EQUAL str_arg { P_DEBUG_MSG($1 + int_to_string (rclval.ival) + (string)$3 + $4); Preferences :: Instance ().add_score ($1, $2, $3, $4); free ($1); free ($3); free ($4); } ; test: TEST '=' yes_no_arg { P_DEBUG_MSG($1 + (string)$2 + $3); Preferences :: Instance ().set_test_mode ($3); free ($1); free ($2); free ($3); } ; timeout: TIMEOUT '=' num_arg { P_DEBUG_MSG($1 + (string)$2 + int_to_string (rclval.ival)); Preferences :: Instance ().set_time_out ((unsigned int)$3); free ($1); free ($2); } ; verbose: VERBOSE '=' num_arg { P_DEBUG_MSG($1 + (string)$2 + int_to_string (rclval.ival)); Preferences :: Instance ().set_verbose_level ($3); free ($1); free ($2); } ; %% /* This function strips the leading, and trailing quotation marks around a shell `command' to be executed by the POSIX shell. */ void strip_shell(char s[]) { string buf = s; for (unsigned int i = 1; i < buf.length () - 1; i++) { s[i-1] = buf[i]; s[i] = '\0'; } } /* The class declarations can be found in rcfile.hh. */ RCParser :: RCParser(istream* ip, ostream* op) : isp(ip), osp(op) { try { rclexer = new rcFlexLexer(isp, osp); } catch (...) { throw; } } RCParser :: ~RCParser() { delete rclexer; } void RCParser :: parse(void* val) { rclexer->yyrestart(isp); rcparse(val); } mailfilter-0.8.9/src/rfc822.ll000066400000000000000000000103331430510321000157730ustar00rootroot00000000000000/* *********************************************************************** */ /* An oversimplified scanner definition for Mailfilter's RFC822 scanner */ /* Copyright (c) 2000 - 2009 Andreas Bauer */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /* *********************************************************************** */ %x BODY_READY %s TAG_READY %option noyywrap %{ #include #include #include #include #include "rfc822parser.hh" using namespace std; /* Define L_DEBUG_MODE to get extra output from the scanner and to avoid returning too early. Early return is useless if there is no parser which keeps calling the scanners. */ #undef L_DEBUG_MODE /* Return should be defined to a nop-operation, if the programmer really only debugs a single message offline. */ #define RETURN(x) return(x) #ifdef L_DEBUG_MODE #undef L_DEBUG_MSG #define L_DEBUG_MSG(msg) \ cout << "Lexer: " \ << msg #else #undef L_DEBUG_MSG #define L_DEBUG_MSG(msg) \ ; #endif %} NL (\r\n) TOPLINE ^From[[:space:]].* TAG ^[[:alpha:]]+([[:alnum:]]|\-)*\: BODY (.*|[[:space:]]) HEADER_END \. %% {TOPLINE}{NL} { rfclval.sval = strdup (yytext); L_DEBUG_MSG("Topline: " + (string)yytext); RETURN(TOPLINE); } {TAG}[[:space:]]* { string the_tag = yytext; the_tag = the_tag.substr (0, the_tag.find_last_of (":")); rfclval.sval = strdup (the_tag.c_str ()); L_DEBUG_MSG(" Tag: " + the_tag + "\n"); BEGIN(BODY_READY); RETURN(TAG); } {BODY}{NL} { /* Remove trailing newline if it exists. */ if (yytext[strlen(yytext) - 1] == '\n') { char* the_tag = (char*)malloc (sizeof (char) * strlen (yytext)); snprintf (the_tag, strlen (yytext) - 1, "%s", yytext); rfclval.sval = the_tag; } else rfclval.sval = strdup (yytext); L_DEBUG_MSG(" Body: " + (string)yytext); BEGIN(0); RETURN(BODY); } ^[[:space:]].* { /* This is to scan multiple lines of a header body field, e.g. the Received fields are usually spread over multiple lines. In order to handle the leading white spaces, we need to replace them with ordinary blanks. */ char* the_tag = yytext; for (unsigned int i = 0; i <= strlen (the_tag); i++) if (isspace (the_tag[i])) the_tag[i] = ' '; rfclval.sval = strdup (the_tag); L_DEBUG_MSG("M-Body: " + (string)the_tag); BEGIN(TAG_READY); RETURN(BODY); } {NL}{HEADER_END}{NL} { rfclval.sval = strdup (yytext); L_DEBUG_MSG("EOF.\n"); RETURN(HEADER_END); } <*>[ \t] {; /* Do nothing with tabs and spaces. */ } <*>"\n" { BEGIN(0); } %% /* In order to test the following code and to create a standalone scanner, read the comments inside Makefile.am and compile only the Makefile target `rfc_test'. */ int rfcwrap (); #ifdef SCANNER_STANDALONE #include int main (int argc, char** argv) { FlexLexer* lexer = new rfcFlexLexer; ++argv, --argc; /* Skip over program name. */ lexer->switch_streams (new ifstream (argv[0])); lexer->rfclex (); delete lexer; return 0; } #endif int rfcwrap () { return 1; } mailfilter-0.8.9/src/rfc822.yy000066400000000000000000000072501430510321000160310ustar00rootroot00000000000000/* *********************************************************************** */ /* A parser definition for Mailfilter's RFC 822 parser */ /* Copyright (c) 2000 - 2009 Andreas Bauer */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /* *********************************************************************** */ %{ #include #include #include #include #include #ifdef yyalloc #define rfcalloc_ALREADY_DEFINED #else #define yyalloc rfcalloc #endif #ifdef yysymbol_kind_t #define rfcsymbol_kind_t_ALREADY_DEFINED #else #define yysymbol_kind_t rfcsymbol_kind_t #endif #include "header.hh" // This is necessary to use multiple lexer classes. See the flex man // page for further information. #undef yyFlexLexer #define yyFlexLexer rfcFlexLexer #include #ifdef HAVE_CONFIG_H #include "config.h" #endif // We want to give the Preferences object as parameter for yyparse // #define YYPARSE_PARAM param using namespace std; extern FlexLexer* rfclexer; inline int yylex () { return rfclexer->rfclex (); } extern "C" { #include "header.hh" // int rfcparse (void*); int rfcparse (const char*); void rfcerror (const char* str, const char* tmp) { cerr << PACKAGE_NAME << ": Error: Parser reported " << str; cerr << "." << endl; exit (-1); } } %} %union rfc { char* sval; }; %token HEADER_END %token TOPLINE %token TAG %token BODY %token BODY_MULTI_LINE %type bodies %right BODY // %lex-param {Header* param} %parse-param {const char* param} // %define parse.error verbose %% header: /* empty */ | header entry ; entry: the_end | TAG bodies { try { ((Header*)param)->add_entry ($1, $2); free ($1); free ($2); } catch (const std::exception &e) { throw e; } } ; bodies: BODY { $$ = $1; } | bodies BODY { char* tmp = (char*)malloc ((strlen ($1) + strlen ($2) + 2) * sizeof (char)); if (tmp) { strcpy (tmp, $1); $$ = strcat (tmp, $2); free ($1); free ($2); } else { std::cerr << "Out of memory error in rfcparser." << std::endl; exit (-1); } } ; the_end: HEADER_END { ; } ; %% mailfilter-0.8.9/src/score.cc000066400000000000000000000017111430510321000160560ustar00rootroot00000000000000// score.cc - source file for the mailfilter program // Copyright (c) 2000 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include "score.hh" int Score :: score (void) const { return scr; } void Score :: set_score (int new_score) { scr = new_score; } mailfilter-0.8.9/src/score.hh000066400000000000000000000021061430510321000160670ustar00rootroot00000000000000// score.hh - source file for the mailfilter program // Copyright (c) 2000 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef SCORE_HH #define SCORE_HH #include "filter.hh" class Score; class Size_score { public: int score; int size; }; class Score : public Filter { protected: int scr; public: int score (void) const; void set_score (int); }; #endif mailfilter-0.8.9/src/socket.cc000066400000000000000000000320321430510321000162330ustar00rootroot00000000000000// socket.cc - source file for the mailfilter program // Copyright (c) 2003 - 2022 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. // // Note that this program is released under the GPL with the additional // exemption that compiling, linking, and/or using OpenSSL is allowed. #include #include #include #include #include #include #ifdef USE_SSL extern "C" { #include #include #include #include } #endif extern "C" { #if HAVE_SYS_TIME_H #include #endif #include #include #include #include #include #include #include #include #include } #include "defines.hh" #include "mailfilter.hh" #include "feedback.hh" #include "socket.hh" #include "protocol.hh" #include "preferences.hh" using namespace std; static sigjmp_buf curr_env; // TODO: these variables should not "just" be global; maybe static members or something? #ifdef USE_SSL SSL* ssl; BIO* sbio; SSL_METHOD* ssl_meth; SSL_CTX* ssl_ctx; int Socket :: verify_callback (int preverify_ok, X509_STORE_CTX* ctx) { Feedback* logger = Feedback :: Instance (); // X509* err_cert = X509_STORE_CTX_get_current_cert(ctx); // TODO: use me! int err = X509_STORE_CTX_get_error(ctx); // int depth = X509_STORE_CTX_get_error_depth(ctx); // TODO: use me! if (!preverify_ok) { std::string err_msg("SSL connection could not be established: "); logger->print_err(err_msg += X509_verify_cert_error_string(err)); if (Preferences :: Instance().skip_ssl_verify()) { logger->print_msg("Debugging: SSL certificate verification failed, but continuing anyway.", 6); return 1; // We pretend, SSL certification was successful as user wanted to skip it } else { logger->print_msg("Debugging: SSL certificate verification failed.", 6); return 0; // Verification not successful } } else { logger->print_msg("Debugging: SSL certificate verification successful.", 6); return 1; // Verification successful } } #endif Socket :: Socket (void) { set_ssl (false); } void Socket :: clear (void) { // TODO: the following crashes the program at the end; why? // if (read_buffer) // delete read_buffer; } int Socket :: c_open (const char* host_name, int port, int new_time_out, int the_protocol) { struct sockaddr_in s_address; struct hostent *host; struct sigaction sig_action; Feedback* logger = Feedback :: Instance (); // Install alarm signal handler for interrupts and connnection // time out handling. time_out = new_time_out; sig_action.sa_handler = connect_alarm; sigemptyset (&sig_action.sa_mask); sig_action.sa_flags = 0; // Try to initialise signal handler and save stack context. if (sigaction (SIGALRM, &sig_action, NULL) < 0) { logger->print_err ("Installation of signal handler failed."); return GEN_FAILURE_FLAG; } if (sigsetjmp (curr_env, 1) == 0) { // Set time out. alarm (time_out); #ifdef USE_SSL // Should SSL encryption be desired, establish a CTX object first. if (the_protocol == (PROTOCOL_POP3 | SSL_C) || the_protocol == (PROTOCOL_APOP | SSL_C)) { logger->print_msg ("Debugging: Using SSL encrypted communication.", 6); set_ssl (true); SSL_library_init (); SSL_load_error_strings(); // Here should be some key verification stuff... ssl_meth = (SSL_METHOD*)(SSLv23_client_method ()); ssl_ctx = (SSL_CTX*)(SSL_CTX_new (ssl_meth)); SSL_CTX_set_default_verify_paths(ssl_ctx); SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, verify_callback); } else logger->print_msg ("Debugging: Client-server communication is not encrypted.", 6); #endif // Try to establish a socket communication endpoint and then // try to look up the hostname. if (! host_name || ((sd = socket (PF_INET, SOCK_STREAM, 0)) < 0) || (!(host = gethostbyname (host_name)))) { logger->print_err ("DNS look up error; is the hostname correct?"); alarm (0); return GEN_FAILURE_FLAG; } memset ((char*) &s_address, 0, sizeof (struct sockaddr_in)); s_address.sin_family = AF_INET; memcpy (&(s_address.sin_addr.s_addr), host->h_addr, host->h_length); s_address.sin_port = htons (port); if (connect (sd, (struct sockaddr*) &s_address, sizeof (struct sockaddr)) < 0) { logger->print_err ("Server connection could not be established."); alarm (0); return GEN_FAILURE_FLAG; } #ifdef USE_SSL // Now, we have a TCP connection; start SSL negotiation, if desired. if (use_ssl ()) { if ((ssl = SSL_new (ssl_ctx)) == NULL) { logger->print_err ("SSL connection structure could not be created."); exit (-1); } // Either the following line, or BIO connection object? // SSL_set_fd (ssl, sd); // Create BIO object and attach ssl object to it if ((sbio = BIO_new_socket (sd, BIO_NOCLOSE)) == NULL) { logger->print_err ("Socket-BIO could not be created."); return GEN_FAILURE_FLAG; } SSL_set_bio (ssl, sbio, sbio); // Do this before initiating the SSL connection... SSL_set_tlsext_host_name(ssl, host_name); if (SSL_connect (ssl) <= 0) { logger->print_err ("SSL connection could not be established."); return GEN_FAILURE_FLAG; } } #endif } else { logger->print_err ("Timeout occurred."); return GEN_FAILURE_FLAG; } // Reset alarm again. alarm (0); return 0; } // Like close(2), this function returns 0 on success, and -1 // otherwise. Its purpose is to close the socket connection. int Socket :: c_close (void) const { #ifdef USE_SSL if (use_ssl ()) { SSL_shutdown (ssl); int close_err = close (sd); SSL_free (ssl); SSL_CTX_free (ssl_ctx); return close_err; } else return close (sd); #else return close (sd); #endif } int Socket :: c_write (const char* msg) { if (msg) { Feedback* logger = Feedback :: Instance (); string tmp_msg = msg; ssize_t bytes; #ifdef USE_SSL if (use_ssl ()) bytes = SSL_write (ssl, msg, strlen (msg)); else bytes = write (sd, msg, strlen (msg)); #else bytes = write (sd, msg, strlen (msg)); #endif if (bytes < 0) logger->print_err (strerror (errno)); // Debugging. if (tmp_msg.find ("PASS ") != 0) logger->print_msg ("Debugging: Wrote: " + tmp_msg, 6); else logger->print_msg ("Debugging: Wrote: PASS *****", 6); return bytes; } return GEN_FAILURE_FLAG; } // This function can be used to receive a server's response via the // socket connection. It returns the number of bytes read upon // success, and a negative integer otherwise. The reply string itself // can then be obtained by calling the member function c_reply (). If // read_header is true, the c_read function will not stop reading when // the host stops transmitting data. Instead, it expects an entire // header to be sent and thus, will receive data until \r\n.\r\n is // encountered, i.e. the end of the header according to RFC822. int Socket :: c_read (bool read_header) { Feedback* logger = Feedback :: Instance (); char buffer[MAX_BYTES + 10]; struct timeval tv; string input; int flags; int bytes; int error; fd_set rfds; // Empty the current read_buffer which may contain previous server // responses. // if (read_buffer) // delete read_buffer; // First, try to read the current socket descriptor's flags and // store a copy in 'flags', and then change the communication of // that descriptor to nonblocking I/O. if (((flags = fcntl (sd, F_GETFL, 0)) == -1) || (fcntl (sd, F_SETFL, flags | O_NONBLOCK) == -1)) { logger->print_err (strerror (errno)); return GEN_FAILURE_FLAG; } // Set connection time out. tv.tv_sec = time_out; tv.tv_usec = 0; FD_ZERO (&rfds); FD_SET (sd, &rfds); // Only read if the socket is ready and able to send data. error = select (sd + 1, &rfds, NULL, NULL, &tv); // An error occurred while trying to poll server. We did not get a // file descriptor. if (error < 0) { logger->print_err (strerror (errno)); return GEN_FAILURE_FLAG; } // One (or many) file descriptors are ready for message exchange. else if (error > 0) { // Check the status of the file descriptor. if (!FD_ISSET (sd, &rfds)) return GEN_FAILURE_FLAG; // Start receiving messages from the server. do { memset (buffer, 0, sizeof buffer); #ifdef USE_SSL if (use_ssl ()) { if (ssl) { bytes = SSL_read (ssl, buffer, MAX_BYTES); int i = SSL_get_error (ssl, bytes); switch (i) { case SSL_ERROR_NONE: break; case SSL_ERROR_WANT_READ: logger->print_msg ("Debugging: Warning: Received SSL_ERROR_WANT_READ.", 6); break; case SSL_ERROR_WANT_WRITE: logger->print_msg ("Debugging: Warning: Received SSL_ERROR_WANT_WRITE.", 6); break; case SSL_ERROR_ZERO_RETURN: logger->print_msg ("Debugging: Warning: Received SSL_ERROR_ZERO_RETURN.", 6); break; default: logger->print_err ("SSL_read returned unknown error."); return GEN_FAILURE_FLAG; } } else { logger->print_err ("For unknown reason the SSL connection was closed."); return GEN_FAILURE_FLAG; } } else bytes = recv (sd, buffer, MAX_BYTES, 0); #else bytes = recv (sd, buffer, MAX_BYTES, 0); #endif if (bytes > 0) { if (input.length ()) input.append (buffer, bytes); else { input = buffer; input += "\0"; } } // The end condition for reading is as follows: keep reading // as long as there was something to read previously, or, if // there hasn't been (and we've surpassed the MTU), then see // whether we encountered the end of the message header yet, // which has to be ".\r\n". } while (bytes > 0 || (read_header // The following finishes a POP3 server reply. && ( (input[input.length () - 1] != '\n' || input[input.length () - 2] != '\r' || input[input.length () - 3] != '.') // The following finishes an IMAP server reply. && input.find (")\r\na OK FETCH completed\r\n") == string :: npos ) )); } else { logger->print_err ("Connection has timed out."); return GEN_FAILURE_FLAG; } // Put line ending behind the buffer, if needed. Do not use '\0' // instead of "\0" because, somehow this crashes the string append // function! (Why? If it's illegal, the type system should // choke...) Alternatively, one could probably write // input[counter] = '\0'; // TODO: Verify that and chose best code! if (input.length () && input.find_last_of ('\0', input.length ()) == string :: npos) input.append ("\0"); // Debugging. logger->print_msg ("Debugging: Read: " + (input[input.length () - 1] != '\n'? input + "\n" : input), 6); // Reset socket communication to good old blocking mode. if ((fcntl (sd, F_SETFL, flags)) == -1) { logger->print_err (strerror (errno)); return GEN_FAILURE_FLAG; } // Return the length of the server response and catch out of memory // exceptions. I do not want to pass the exception though, in order // to keep the calling code simple. That is, in case of the memory // error, MEM_FAILURE_FLAG is returned. This could be used to react // especially to this case, if necessary at all. Most likely, the // calling code is only interested in the distinction between a // positive and a negative return value anway; the failure flags // are, of course, both negative. try { read_buffer = new string (input); return read_buffer->length (); } catch (const exception& r_err) { logger->print_err (r_err.what ()); return MEM_FAILURE_FLAG; } } const string* Socket :: c_reply (void) const { return read_buffer; } // Alarm signal call back function. void Socket :: connect_alarm (int signo) { // No need to explicitly mask signals in a one-liner, // is there? siglongjmp (curr_env, signo); } bool Socket :: use_ssl (void) const { return ssl_used; } void Socket :: set_ssl (bool the_ssl) { ssl_used = the_ssl; } mailfilter-0.8.9/src/socket.hh000066400000000000000000000041661430510321000162540ustar00rootroot00000000000000// socket.hh - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef SOCKET_HH #define SOCKET_HH #include #include #if USE_SSL extern "C" { #include #include #include } #endif #include "connection.hh" using namespace std; #ifndef MAX_BYTES #define MAX_BYTES 512 #endif class Socket : public Connection { private: int sd; // Socket descriptor. int time_out; // Time out. static void connect_alarm (int); // Alarm handler. string* read_buffer; // Server replies after read (). bool ssl_used; // True if SSL encryption is used. bool use_ssl (void) const; void set_ssl (bool); public: Socket (void); void clear (void); int c_open (const char* host, int port, int time_out, int protocol); int c_close (void) const; int c_write (const char* command); int c_read (bool = false); const string* c_reply (void) const; #if USE_SSL static int verify_callback (int, X509_STORE_CTX*); #endif }; #endif mailfilter-0.8.9/src/weeder.cc000066400000000000000000000332101430510321000162150ustar00rootroot00000000000000// weeder.cc - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include #include #include #include "weeder.hh" #include "header.hh" #include "preferences.hh" #include "mailfilter.hh" #include "feedback.hh" #include "defines.hh" using namespace std; extern string int_to_string (int); // The function takes a pointer to a Header class which contains a // message header. It then determines whether this header is spam, a // duplicate, or "good" mail. It returns 1 if the mail qualifies as // spam, 0 if it should not be deleted, and a negative integer upon // error. int Weeder :: is_weed (Header* the_header) { int status; status = check_duplicates (the_header); if (status == 1) return 1; // Spam. else if (status < 0) return status; // Error. status = check_allow_rules (the_header); if (status == 1) return 1; // Spam. else if (status == 0) return 0; // Friend. else if (status < 0) return status; // Error. status = check_maxlength (the_header); if (status == 1) return 1; // Spam. status = check_deny_rules (the_header); if (status == 1) return 1; // Spam. else if (status < 0) return status; // Error. status = check_scores (the_header); if (status == 1) return 1; // Spam. return 0; // Leave message alone. } // This function returns 1 if the message was considered being a // duplicate, and 0 otherwise. A negative integer is returned upon // error. int Weeder :: check_duplicates (Header* the_header) { Feedback* logger = Feedback :: Instance (); if (!the_header) return GEN_FAILURE_FLAG; // If the mailer didn't attach a valid message-ID, give up scanning // for duplicated messages immediately. if (the_header->ID ()->length() <= 0) return 0; string cur_line; if (Preferences :: Instance ().delete_duplicates ()) { for (vector :: iterator cur_ID = msg_ids.begin (); cur_ID != msg_ids.end (); cur_ID++) if (*(the_header->ID ()) == *cur_ID) { logger->print_msg ("Deny: " + *(the_header->from ()) + ": " + *(the_header->subject ()) + ", " + *(the_header->date ()) + " [Duplicate].", 2); return 1; } msg_ids.push_back (*(the_header->ID ())); } return 0; } // This function returns 1 if the message was considered being spam, 0 // if it is a friend. A negative integer is returned upon error. int Weeder :: check_allow_rules (Header* the_header) const { Feedback* logger = Feedback :: Instance (); if (!the_header) return GEN_FAILURE_FLAG; string cur_line; for (vector :: iterator cur_entry = the_header->entries ()->begin (); cur_entry != the_header->entries ()->end (); cur_entry++) { cur_line = cur_entry->tag + ": " + cur_entry->body; for (vector :: iterator cur_allow = Preferences :: Instance ().allow_filters ()->begin (); cur_allow != Preferences :: Instance ().allow_filters ()->end (); cur_allow++) { if (!cur_allow->is_negative () && regexec (cur_allow->comp_exp (), cur_line.c_str (), 0, NULL, 0) == 0) { logger->print_msg ("Allow: " + *(the_header->from ()) + ": " + *(the_header->subject ()) + ", " + *(the_header->date ()) + " [\"" + cur_allow->expression () + "\" matches \"" + cur_line + "\"].", 4); // OK, friendly message detected. Now check, whether // MAXSIZE_ALLOW applies. if (Preferences :: Instance ().max_size_allow () > 0 && the_header->size () > Preferences :: Instance ().max_size_allow ()) { logger->print_msg ("Deny: " + *(the_header->from ()) + ": " + *(the_header->subject ()) + ", " + *(the_header->date ()) + " [Maxsize_Allow exceeded].", 2); return 1; } return 0; } } } // Evaluate the negative allow rules which works slightly different // to the above algorithm: instead of going through each line and // each filter, we go through each negative filter and then through // all lines of the header. if (Preferences :: Instance ().neg_allows () > 0) { for (vector :: iterator cur_allow = Preferences :: Instance ().allow_filters ()->begin (); cur_allow != Preferences :: Instance ().allow_filters ()->end (); cur_allow++) { if (cur_allow->is_negative ()) { for (vector :: iterator cur_entry = the_header->entries ()->begin (); cur_entry != the_header->entries ()->end (); cur_entry++) { cur_line = cur_entry->tag + ": " + cur_entry->body; if (regexec (cur_allow->comp_exp (), cur_line.c_str (), 0, NULL, 0) == 0) break; if (cur_entry + 1 == the_header->entries ()->end ()) { logger->print_msg ("Allow: " + *(the_header->from ()) + ": " + *(the_header->subject ()) + ", " + *(the_header->date ()) + " [Negative allow rule \"" + cur_allow->expression () + "\" did not match].", 4); return 0; } } } } } return 2; } int Weeder :: check_maxlength (Header* the_header) const { Feedback* logger = Feedback :: Instance (); string cur_line; if (Preferences :: Instance ().maxlength () == 0) return 0; for (vector :: iterator cur_entry = the_header->entries ()->begin (); cur_entry != the_header->entries ()->end (); cur_entry++) { cur_line = cur_entry->tag + ": " + cur_entry->body; if (cur_line.length () > (unsigned int)Preferences :: Instance ().maxlength ()) { logger->print_msg ("Deny: " + *(the_header->from ()) + ": " + *(the_header->subject ()) + ", " + *(the_header->date ()) + " [\"" + cur_entry->tag + "\" exceeded maxlength].", 2); return 1; } } return 0; } // This function returns 1 if the message was considered being spam, 0 // otherwise. A negative integer is returned upon error. int Weeder :: check_deny_rules (Header* the_header) const { Feedback* logger = Feedback :: Instance (); if (!the_header) return GEN_FAILURE_FLAG; string cur_line; if (Preferences :: Instance ().max_size_deny () > 0 && the_header->size () > Preferences :: Instance ().max_size_deny ()) { logger->print_msg ("Deny: " + *(the_header->from ()) + ": " + *(the_header->subject ()) + ", " + *(the_header->date ()) + " [Maxsize_Deny exceeded].", 2); return 1; } for (vector :: iterator cur_entry = the_header->entries ()->begin (); cur_entry != the_header->entries ()->end (); cur_entry++) { cur_line = cur_entry->tag + ": " + cur_entry->body; for (vector :: iterator cur_deny = Preferences :: Instance ().deny_filters ()->begin (); cur_deny != Preferences :: Instance ().deny_filters ()->end (); cur_deny++) { if (!cur_deny->is_negative () && regexec (cur_deny->comp_exp (), cur_line.c_str (), 0, NULL, 0) == 0) { logger->print_msg ("Deny: " + *(the_header->from ()) + ": " + *(the_header->subject ()) + ", " + *(the_header->date ()) + " [\"" + cur_deny->expression () + + "\" matches \"" + cur_line + "\"].", 2); return 1; } // Check normalised subject, if necessary. if (Preferences :: Instance ().normal () && !cur_deny->is_negative () && strcmp (cur_entry->tag.c_str (), "Subject") == 0 && regexec (cur_deny->comp_exp (), (the_header->normal_subject ())->c_str (), 0, NULL, 0) == 0) { logger->print_msg ("Deny: " + *(the_header->from ()) + ": " + *(the_header->subject ()) + ", " + *(the_header->date ()) + " [\"" + cur_deny->expression () + + "\" matches \"" + cur_line + "\" (normalised)].", 2); return 1; } } } // Evaluate the negative deny rules in a similar fashion as negative // allow rules (see above, for comments). if (Preferences :: Instance ().neg_denies () > 0) { for (vector :: iterator cur_deny = Preferences :: Instance ().deny_filters ()->begin (); cur_deny != Preferences :: Instance ().deny_filters ()->end (); cur_deny++) { if (cur_deny->is_negative ()) { for (vector :: iterator cur_entry = the_header->entries ()->begin (); cur_entry != the_header->entries ()->end (); cur_entry++) { cur_line = cur_entry->tag + ": " + cur_entry->body; if (regexec (cur_deny->comp_exp (), cur_line.c_str (), 0, NULL, 0) == 0) break; // Check for normalised subject, if applicable. if (Preferences :: Instance ().normal () && strcmp (cur_entry->tag.c_str (), "Subject") == 0 && regexec (cur_deny->comp_exp (), (the_header->normal_subject ())->c_str (), 0, NULL, 0) == 0) break; if (cur_entry + 1 == the_header->entries ()->end ()) { logger->print_msg ("Deny: " + *(the_header->from ()) + ": " + *(the_header->subject ()) + ", " + *(the_header->date ()) + " [Negative deny rule \"" + cur_deny->expression () + "\" did not match].", 4); return 1; } } } } } return 0; } // This function returns the score the message achieved. int Weeder :: check_scores (Header* the_header) const { Feedback* logger = Feedback :: Instance (); string cur_line; int msg_score = 0; // First test against the MAXSIZE_SCORE setting if (Preferences :: Instance ().max_size_score().score != 0 && Preferences :: Instance ().max_size_score().size > 0 && the_header->size() > Preferences :: Instance ().max_size_score().size) msg_score = Preferences :: Instance ().max_size_score().score; // Now check ordinary score rules. for (vector :: iterator cur_entry = the_header->entries ()->begin (); cur_entry != the_header->entries ()->end (); cur_entry++) { cur_line = cur_entry->tag + ": " + cur_entry->body; for (vector :: iterator cur_score = Preferences :: Instance ().score_filters ()->begin (); cur_score != Preferences :: Instance ().score_filters ()->end (); cur_score++) { if (!cur_score->is_negative () // Check ordinary score rules... && ((regexec (cur_score->comp_exp (), cur_line.c_str (), 0, NULL, 0) == 0) || // ...or, if that doesn't match, ... // ...check normalised subject, if applicable. (Preferences :: Instance ().normal () && strcmp (cur_entry->tag.c_str (), "Subject") == 0 && regexec (cur_score->comp_exp (), (the_header->normal_subject ())->c_str (), 0, NULL, 0) == 0))) { msg_score += cur_score->score (); logger->print_msg ("Score: \"" + cur_score->expression () + "\" matches \"" + cur_line + "\" [" + int_to_string (cur_score->score ()) + "].", 5); } } } // Check negative scores now. for (vector :: iterator cur_score = Preferences :: Instance ().score_filters ()->begin (); cur_score != Preferences :: Instance ().score_filters ()->end (); cur_score++) { if (cur_score->is_negative ()) { for (vector :: iterator cur_entry = the_header->entries ()->begin (); cur_entry != the_header->entries ()->end (); cur_entry++) { cur_line = cur_entry->tag + ": " + cur_entry->body; if (regexec (cur_score->comp_exp (), cur_line.c_str (), 0, NULL, 0) == 0) break; // Check normalised subject, if applicable. if (Preferences :: Instance ().normal () && strcmp (cur_entry->tag.c_str (), "Subject") == 0 && regexec (cur_score->comp_exp (), (the_header->normal_subject ())->c_str (), 0, NULL, 0) == 0) break; if (cur_entry + 1 == the_header->entries ()->end ()) { msg_score += cur_score->score (); logger->print_msg ("Score: <> \"" + cur_score->expression () + "\" did not match " + "[" + int_to_string (cur_score->score ()) + "].", 5); } } } } if (msg_score >= Preferences :: Instance ().highscore ()) { logger->print_msg ("Deny: " + *(the_header->from ()) + ": " + *(the_header->subject ()) + ", " + *(the_header->date ()) + " [Score: " + int_to_string (msg_score) + "].", 2); return 1; } logger->print_msg ("Pass: " + *(the_header->from ()) + ": " + *(the_header->subject ()) + ", " + *(the_header->date ()) + " [Score: " + int_to_string (msg_score) + "].", 5); return 0; } mailfilter-0.8.9/src/weeder.hh000066400000000000000000000025061430510321000162330ustar00rootroot00000000000000// weeder.hh - source file for the mailfilter program // Copyright (c) 2003 - 2009 Andreas Bauer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef WEEDER_HH #define WEEDER_HH #include #include #include "header.hh" using namespace std; class Weeder { private: vector msg_ids; int check_duplicates (Header*); int check_maxlength (Header*) const; int check_allow_rules (Header*) const; int check_deny_rules (Header*) const; int check_scores (Header*) const; public: int is_weed (Header*); }; #endif