From: Vsevolod Stakhov Date: Fri, 27 Feb 2009 09:44:18 +0000 (+0300) Subject: * Fix dependencies on perlxs target (do not rebuild it constantly) X-Git-Tag: 0.2.7~293 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=749503560ef72d7b20f935487a77ee4fbc8a9e3f;p=thirdparty%2Frspamd.git * Fix dependencies on perlxs target (do not rebuild it constantly) * Fix rspamc to understand lmtp and delivery sections in config * Fix parser's states when reading module options * Add sample config for surbl module with comments --HG-- rename : rspamc.pl => rspamc.pl.in --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 9928c1757b..275562b63d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -270,14 +270,18 @@ ADD_CUSTOM_COMMAND(OUTPUT src/modules.c COMMAND ../utils/gen-modules.sh ${PLUGINSSRC} WORKING_DIRECTORY src) -ADD_CUSTOM_TARGET(perlxs ALL +ADD_CUSTOM_COMMAND(OUTPUT perl/Makefile COMMAND ${PERL_EXECUTABLE} ./Makefile.PL + WORKING_DIRECTORY perl) +ADD_CUSTOM_TARGET(perlxs COMMAND make + DEPENDS perl/Makefile WORKING_DIRECTORY perl VERBATIM) CONFIGURE_FILE(config.h.in src/config.h) CONFIGURE_FILE(perl/Makefile.PL.in perl/Makefile.PL) +CONFIGURE_FILE(rspamc.pl.in rspamc.pl @ONLY) ADD_EXECUTABLE(rspamd ${RSPAMDSRC} ${CONTRIBSRC} ${TOKENIZERSSRC} ${CLASSIFIERSSRC} ${PLUGINSSRC} ${YACC_OUTPUT} @@ -292,6 +296,7 @@ IF(PERL_DYNALOADER) TARGET_LINK_LIBRARIES(rspamd dynaloader) ENDIF(PERL_DYNALOADER) TARGET_LINK_LIBRARIES(rspamd ${GMIME2_LIBRARIES}) +ADD_DEPENDENCIES(rspamd perlxs) ADD_EXECUTABLE(test/rspamd-test ${TESTDEPENDS} ${CONTRIBSRC} ${TESTSRC}) SET_TARGET_PROPERTIES(test/rspamd-test PROPERTIES LINKER_LANGUAGE C) diff --git a/rspamc.pl b/rspamc.pl.in similarity index 97% rename from rspamc.pl rename to rspamc.pl.in index e04a5bfcec..8caeb28a38 100755 --- a/rspamc.pl +++ b/rspamc.pl.in @@ -10,7 +10,7 @@ use Socket qw(:DEFAULT :crlf); my %cfg = ( - 'conf_file' => './rspamd.conf', + 'conf_file' => '@CMAKE_INSTALL_PREFIX@/etc/rspamd.conf', 'command' => 'SYMBOLS', 'host' => 'localhost', 'port' => '11333', @@ -33,7 +33,7 @@ sub parse_config { my $ctrl = 0; while () { - if ($_ =~ /control\s*{/i) { + if ($_ =~ /control\s*{/i || $_ =~ /lmtp\s*{/i || $_ =~ /delivery\s*{/i) { $ctrl = 1; } if ($ctrl && $_ =~ /}/) { diff --git a/rspamd.conf.sample b/rspamd.conf.sample index 41b44ccdda..b440a33254 100644 --- a/rspamd.conf.sample +++ b/rspamd.conf.sample @@ -76,14 +76,45 @@ factors { "winnow" = 5.5; }; +# Options for lmtp worker lmtp { enabled = yes; + # Bind socket for lmtp interface bind_socket = localhost:11335; + # Metric that is considered as main. If we have spam result on + # this metric, lmtp delivery would be failed + metric = "default"; }; delivery { enabled = yes; + # Path to delivery agent, %f is expanded as mail from address and %r + # is expanded as recipient address + # Expample: agent = "/usr/local/bin/procmail -f %f -d %r" agent = "/dev/null"; + # Bind socket for lmtp interface + # Example: bind_socket = localhost:25 + + # Whether we should use lmtp for MTA delivery + lmtp = no; +}; + +# SURBL module params, note that single quotes are mandatory here +.module 'surbl' { + # Address to redirector in host:port format + redirector = "localhost:8080"; + # Connect timeout for redirector + redirector_connect_timeout = "1s"; + # IO timeout for redirector (may be usefull to set this value rather big) + redirector_read_timeout = "10s"; + # This is suffix for surbl dns requests + suffix = "multi.surbl.org"; + # Metric for surbl module + metric = "default"; + # List of public known hostings (for which we should use 3 components of domain name instead of 2) + hostings = "narod.ru,pp.ru,org.ru,net.ru"; + # Whitelisted urls + whitelist = "highsecure.ru,freebsd.org"; }; url_filters = "surbl"; diff --git a/src/cfg_file.l b/src/cfg_file.l index d2810c5bb1..b28bbd2636 100644 --- a/src/cfg_file.l +++ b/src/cfg_file.l @@ -133,11 +133,13 @@ yes|YES|no|NO|[yY]|[nN] yylval.flag=parse_flag(yytext); return FLAG; \n /* ignore EOL */; [ \t]+ /* ignore whitespace */; -\'[a-zA-Z0-9_-]\' yylval.string=strdup(yytext + 1); yylval.string[strlen(yylval.string) - 1] = '\0'; return MODULE_OPT; +^[ \t]*#.* /* ignore comments */; +\'[a-zA-Z0-9_-]+\' yylval.string=strdup(yytext + 1); yylval.string[strlen(yylval.string) - 1] = '\0'; return MODULE_OPT; \{ return OBRACE; -\} return EBRACE; +\} BEGIN(INITIAL); return EBRACE; \; return SEMICOLON; -[a-zA-Z0-9_-] yylval.string=strdup(yytext); return PARAM; += return EQSIGN; +[a-zA-Z0-9_-]+ yylval.string=strdup(yytext); return PARAM; \$[a-zA-Z_][a-zA-Z0-9_]+ yylval.string=strdup(yytext + 1); return VARIABLE; \"[^"]+\" yylval.string=strdup(yytext + 1); yylval.string[strlen(yylval.string) - 1] = '\0'; return QUOTEDSTRING;