aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-29 17:35:18 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-29 17:35:18 +0000
commitee49822dc4ab2373f0cc006b6179def30c976c2e (patch)
tree15ccaf8c20f59c33873fafc35784d827a4587e95
parenta37cb2b4abfaf7ee21ceeb2ad131c70c7a462dca (diff)
downloadrspamd-ee49822dc4ab2373f0cc006b6179def30c976c2e.tar.gz
rspamd-ee49822dc4ab2373f0cc006b6179def30c976c2e.zip
Cleanup.
-rw-r--r--Makefile.in41
-rw-r--r--freebsd/rspamd.plist29
-rw-r--r--utils/.depends4
-rw-r--r--utils/CMakeLists.txt7
-rw-r--r--utils/Makefile.in12
-rwxr-xr-xutils/gen-modules.sh29
-rw-r--r--utils/statshow/CMakeLists.txt27
-rw-r--r--utils/statshow/statshow.c271
8 files changed, 0 insertions, 420 deletions
diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644
index 1448d4377..000000000
--- a/Makefile.in
+++ /dev/null
@@ -1,41 +0,0 @@
-.PHONY: perl clean $(SUBDIRS)
-
-all: $(OBJDIR) perl $(TARGETS)
-
-$(OBJDIR):
- mkdir -p $(OBJDIR)
-
-perl: perl/Makefile
- cd perl && make && cd ..
-
-perl/Makefile:
- cd perl && perl Makefile.PL && cd ..
-
-install: $(EXEC)
- cd perl && make install && cd ..
- $(INSTALL) -b $(EXEC) $(PREFIX)/sbin/$(EXEC)
- $(INSTALL) -b rspamc.pl $(PREFIX)/bin/rspamc
- $(INSTALL) -v $(EXEC).sh $(PREFIX)/etc/rc.d
- #$(INSTALL) -m0644 rspamd.8 $(MANPATH)/man8
- #$(INSTALL) -m0644 rspamd.conf.sample $(PREFIX)/etc
- $(MKDIR) -o $(RSPAMD_USER) -g $(RSPAMD_GROUP) /var/run/rspamd
-
-clean: clean-subdirs perl/Makefile
- rm -f $(OBJDIR)/*.o $(EXEC) *core
- rm -fr $(OBJDIR)
- rm -f $(SRCDIR)/cfg_lex.c $(SRCDIR)/cfg_yacc.c $(SRCDIR)/cfg_yacc.h
- rm -f config.cache
- cd perl && make clean && cd ..
-
-dist-clean: clean dist-clean-subdirs
- rm -f Makefile
- rm -f test/Makefile
- rm -f config.log
- rm -f $(SRCDIR)/md5.h $(SRCDIR)/md5.c $(SRCDIR)/queue.h $(SRCDIR)/config.h $(SRCDIR)/modules.c $(SRCDIR)/modules.h
- cd perl && rm -f Makefile.old && rm -f Makefile.PL && cd ..
-
-creategroup:
- @echo "Create group $(RSPAMD_GROUP) before installing!"
-
-createuser:
- @echo "Create user $(RSPAMD_USER) before installing!"
diff --git a/freebsd/rspamd.plist b/freebsd/rspamd.plist
deleted file mode 100644
index 9aa563522..000000000
--- a/freebsd/rspamd.plist
+++ /dev/null
@@ -1,29 +0,0 @@
-etc/rspamd/plugins/lua/maillist.lua
-etc/rspamd/plugins/lua/trie.lua
-etc/rspamd/plugins/lua/received_rbl.lua
-etc/rspamd/plugins/lua/multimap.lua
-etc/rspamd/plugins/lua/phishing.lua
-etc/rspamd/plugins/lua/once_received.lua
-etc/rspamd/plugins/lua/whitelist.lua
-etc/rspamd/plugins/lua/forged_recipients.lua
-etc/rspamd/2tld.inc.orig
-etc/rspamd/lua/rspamd.lua
-etc/rspamd/lua/regexp/lotto.lua
-etc/rspamd/lua/regexp/headers.lua
-etc/rspamd/lua/regexp/drugs.lua
-etc/rspamd/lua/regexp/fraud.lua
-@unexec if cmp -s %D/etc/rspamd.xml.sample %D/etc/rspamd.xml; then rm -f %D/etc/rspamd.xml; fi
-etc/rspamd.xml.sample
-bin/rspamc
-bin/rspamd
-lib/librspamd_ipmark.so
-lib/librspamd_regmark.so
-@dirrm etc/rspamd/plugins/lua
-@dirrm etc/rspamd/plugins
-@dirrm etc/rspamd/lua/regexp
-@dirrm etc/rspamd/lua
-@dirrm etc/rspamd
-
-@unexec rmdir %D/etc/rspamd 2>/dev/null || true
-@unexec rmdir /var/run/rspamd 2>/dev/null || true
-@unexec %D/etc/rc.d/rspamd.sh forcestop 2>/dev/null || true
diff --git a/utils/.depends b/utils/.depends
deleted file mode 100644
index 47b5279fc..000000000
--- a/utils/.depends
+++ /dev/null
@@ -1,4 +0,0 @@
-../src/mem_pool.c
-../src/url.c
-../src/util.c
-../src/memcached.c
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
deleted file mode 100644
index 8b9e5dca6..000000000
--- a/utils/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-ADD_SUBDIRECTORY(statshow)
-
-# Redirector
-IF(ENABLE_REDIRECTOR MATCHES "ON")
- CONFIGURE_FILE(redirector.pl.in redirector.pl @ONLY)
- INSTALL(PROGRAMS redirector.pl DESTINATION bin RENAME rspamd-redirector)
-ENDIF(ENABLE_REDIRECTOR MATCHES "ON") \ No newline at end of file
diff --git a/utils/Makefile.in b/utils/Makefile.in
deleted file mode 100644
index 3b9aa8e07..000000000
--- a/utils/Makefile.in
+++ /dev/null
@@ -1,12 +0,0 @@
-.PHONY: clean
-
-all: url_extracter
-
-url_extracter: $(OBJECTS) $(OBJ_DEPENDS)
- $(CC) $(PTHREAD_LDFLAGS) $(LDFLAGS) $(OBJECTS) $(OBJ_DEPENDS) $(LIBS) -o url_extracter
-
-clean:
- rm -f *.o url_extracter *.core
-
-dist-clean: clean
- rm -f Makefile
diff --git a/utils/gen-modules.sh b/utils/gen-modules.sh
deleted file mode 100755
index ec8191c66..000000000
--- a/utils/gen-modules.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-#
-# This script generate modules.c and modules.h for rspamd
-# Used by build system
-
-echo "#ifndef MODULES_H" > modules.h
-echo "#include \"config.h\"" >> modules.h
-echo "#include \"modules.h\"" > modules.c
-echo "module_t modules[] = {" >> modules.c;
-
-for arg in $@ ; do
- IFS=/
- for comp in ${arg} ; do
- echo $comp | egrep '^[^/]+.c$' > /dev/null 2>&1
- if [ $? -eq 0 ] ; then
- mod=`echo $comp | sed -e 's/.c$//'`
- fi
- done
- if [ "F${mod}" != "F" ] ; then
- echo "{\"${mod}\", ${mod}_module_init, ${mod}_module_config, ${mod}_module_reconfig}," >> modules.c
- echo "int ${mod}_module_init(struct config_file *cfg, struct module_ctx **ctx);" >> modules.h
- echo "int ${mod}_module_config(struct config_file *cfg);" >> modules.h
- echo "int ${mod}_module_reconfig(struct config_file *cfg);" >> modules.h
- fi
- IFS=" "
-done
-
-echo "};" >> modules.c
-echo "#endif" >> modules.h
diff --git a/utils/statshow/CMakeLists.txt b/utils/statshow/CMakeLists.txt
deleted file mode 100644
index c6a4fd75d..000000000
--- a/utils/statshow/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-SET(STATSHOWSRC statshow.c)
-
-FOREACH(_rs ${CLASSIFIERSSRC} ${TOKENIZERSSRC})
- LIST(APPEND STATSHOWSRC "../../${_rs}")
-ENDFOREACH(_rs)
-
-ADD_EXECUTABLE(statshow EXCLUDE_FROM_ALL ${STATSHOWSRC})
-SET_TARGET_PROPERTIES(statshow PROPERTIES LINKER_LANGUAGE C)
-SET_TARGET_PROPERTIES(statshow PROPERTIES COMPILE_FLAGS "-I../../src -DRSPAMD_MAIN")
-TARGET_LINK_LIBRARIES(statshow rspamd_lua)
-TARGET_LINK_LIBRARIES(statshow rspamdserver)
-TARGET_LINK_LIBRARIES(statshow event)
-IF(ENABLE_LUAJIT MATCHES "ON")
- TARGET_LINK_LIBRARIES(statshow "${LUAJIT_LIBRARY}")
-ELSE(ENABLE_LUAJIT MATCHES "ON")
- TARGET_LINK_LIBRARIES(statshow "${LUA_LIBRARY}")
-ENDIF(ENABLE_LUAJIT MATCHES "ON")
-TARGET_LINK_LIBRARIES(statshow ${GLIB2_LIBRARIES})
-TARGET_LINK_LIBRARIES(statshow ${CMAKE_REQUIRED_LIBRARIES})
-IF(GMIME24)
- TARGET_LINK_LIBRARIES(statshow ${GMIME24_LIBRARIES})
-ELSE(GMIME24)
- TARGET_LINK_LIBRARIES(statshow ${GMIME2_LIBRARIES})
-ENDIF(GMIME24)
-IF(ENABLE_STATIC MATCHES "ON")
- TARGET_LINK_LIBRARIES(statshow ${PCRE_LIBRARIES})
-ENDIF(ENABLE_STATIC MATCHES "ON") \ No newline at end of file
diff --git a/utils/statshow/statshow.c b/utils/statshow/statshow.c
deleted file mode 100644
index 9a574b80a..000000000
--- a/utils/statshow/statshow.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/* Copyright (c) 2010, Vsevolod Stakhov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL Rambler BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "main.h"
-#include "cfg_file.h"
-#include "util.h"
-#include "map.h"
-#include "cfg_xml.h"
-#include "classifiers/classifiers.h"
-#include "tokenizers/tokenizers.h"
-#include "message.h"
-#include "lua/lua_common.h"
-
-module_t modules[] = { {NULL, NULL, NULL, NULL} };
-struct rspamd_main *rspamd_main = NULL;
-static gchar *cfg_name;
-extern rspamd_hash_t *counters;
-
-static GOptionEntry entries[] =
-{
- { "config", 'c', 0, G_OPTION_ARG_STRING, &cfg_name, "Specify config file", NULL },
- { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
-};
-
-static void
-read_cmd_line (gint *argc, gchar ***argv, struct config_file *cfg)
-{
- GError *error = NULL;
- GOptionContext *context;
-
- context = g_option_context_new ("- run statshow utility");
- g_option_context_set_summary (context, "Summary:\n Statshow utility version " RVERSION "\n Release id: " RID);
- g_option_context_add_main_entries (context, entries, NULL);
- if (!g_option_context_parse (context, argc, argv, &error)) {
- fprintf (stderr, "option parsing failed: %s\n", error->message);
- exit (1);
- }
- cfg->cfg_name = cfg_name;
-}
-
-static gboolean
-load_rspamd_config (struct config_file *cfg)
-{
- if (! read_xml_config (cfg, cfg->cfg_name)) {
- return FALSE;
- }
-
- /* Do post-load actions */
- post_load_config (cfg);
-
- return TRUE;
-}
-
-static void
-classifiers_callback (gpointer value, void *arg)
-{
- struct worker_task *task = arg;
- struct classifier_config *cl = value;
- struct classifier_ctx *ctx;
- struct mime_text_part *text_part;
- GTree *tokens = NULL;
- GList *cur;
- f_str_t c;
- gchar *header = NULL;
-
- ctx = cl->classifier->init_func (task->task_pool, cl);
- ctx->debug = TRUE;
-
- cur = g_list_first (task->text_parts);
- if ((tokens = g_hash_table_lookup (task->tokens, cl->tokenizer)) == NULL) {
- while (cur != NULL) {
- if (header) {
- c.len = strlen (cur->data);
- if (c.len > 0) {
- c.begin = cur->data;
- if (!cl->tokenizer->tokenize_func (cl->tokenizer, task->task_pool, &c, &tokens, TRUE, FALSE, NULL)) {
- msg_info ("cannot tokenize input");
- return;
- }
- }
- }
- else {
- text_part = (struct mime_text_part *)cur->data;
- if (text_part->is_empty) {
- cur = g_list_next (cur);
- continue;
- }
- c.begin = text_part->content->data;
- c.len = text_part->content->len;
- /* Tree would be freed at task pool freeing */
- if (!cl->tokenizer->tokenize_func (cl->tokenizer, task->task_pool, &c, &tokens, TRUE,
- text_part->is_utf, text_part->urls_offset)) {
- msg_info ("cannot tokenize input");
- return;
- }
- }
- cur = g_list_next (cur);
- }
- g_hash_table_insert (task->tokens, cl->tokenizer, tokens);
- }
-
- if (tokens == NULL) {
- return;
- }
-
- /* Take care of subject */
- tokenize_subject (task, &tokens);
- cl->classifier->classify_func (ctx, task->worker->srv->statfile_pool, tokens, task);
-}
-
-static void
-process_buffer (gchar *buf, gsize len, struct rspamd_main *rspamd)
-{
- struct worker_task *task;
- struct rspamd_worker *fake_worker;
-
-
- /* Make fake worker for task */
- fake_worker = g_malloc (sizeof (struct rspamd_worker));
- fake_worker->srv = rspamd;
-
- /* Make task */
- task = construct_task (fake_worker);
- /* Copy message */
- task->msg = memory_pool_alloc (task->task_pool, sizeof (f_str_t));
- task->msg->begin = buf;
- task->msg->len = len;
-
- /* Process message */
- if (process_message (task) != 0) {
- return;
- }
-
- g_list_foreach (task->cfg->classifiers, classifiers_callback, task);
-
- g_free (fake_worker);
-}
-
-static void
-process_stdin (struct rspamd_main *rspamd)
-{
- gchar *in_buf;
- gint r = 0, len;
-
- /* Allocate input buffer */
- len = BUFSIZ;
- in_buf = g_malloc (len);
-
- /* Read stdin */
- while (!feof (stdin)) {
- r += fread (in_buf + r, 1, len - r, stdin);
- if (len - r < len / 2) {
- /* Grow buffer */
- len *= 2;
- in_buf = g_realloc (in_buf, len);
- }
- }
-
- process_buffer (in_buf, r, rspamd);
- g_free (in_buf);
-}
-
-static void
-process_file (const gchar *filename, struct rspamd_main *rspamd)
-{
- struct stat st;
- char *in_buf;
- gsize r = 0;
- gint fd;
-
- if (stat (filename, &st) == -1) {
- msg_err ("stat failed: %s", strerror (errno));
- return;
- }
-
- if ((fd = open (filename, O_RDONLY)) == -1) {
- msg_err ("stat failed: %s", strerror (errno));
- return;
- }
-
- in_buf = g_malloc (st.st_size);
-
- while (r < st.st_size) {
- r += read (fd, in_buf + r, r - st.st_size);
- }
-
- process_buffer (in_buf, r, rspamd);
- g_free (in_buf);
-}
-
-gint
-main (gint argc, gchar **argv, gchar **env)
-{
- gchar **arg;
-
- rspamd_main = (struct rspamd_main *)g_malloc (sizeof (struct rspamd_main));
- memset (rspamd_main, 0, sizeof (struct rspamd_main));
- rspamd_main->server_pool = memory_pool_new (memory_pool_get_size ());
- rspamd_main->cfg = (struct config_file *)g_malloc (sizeof (struct config_file));
- if (!rspamd_main || !rspamd_main->cfg) {
- fprintf (stderr, "Cannot allocate memory\n");
- exit (-errno);
- }
- rspamd_main->cfg->modules_num = 0;
-
- memset (rspamd_main->cfg, 0, sizeof (struct config_file));
- rspamd_main->cfg->cfg_pool = memory_pool_new (memory_pool_get_size ());
- init_defaults (rspamd_main->cfg);
-
- read_cmd_line (&argc, &argv, rspamd_main->cfg);
- if (rspamd_main->cfg->cfg_name == NULL) {
- rspamd_main->cfg->cfg_name = FIXED_CONFIG_FILE;
- }
-
- /* First set logger to console logger */
- rspamd_set_logger (RSPAMD_LOG_CONSOLE, TYPE_MAIN, rspamd_main);
- (void)open_log (rspamd_main->logger);
- g_log_set_default_handler (rspamd_glib_log_function, rspamd_main);
- init_lua (rspamd_main->cfg);
- /* Init counters */
- counters = rspamd_hash_new_shared (rspamd_main->server_pool, g_str_hash, g_str_equal, 64);
-
- /* Init classifiers options */
- register_classifier_opt ("bayes", "min_tokens");
- register_classifier_opt ("winnow", "min_tokens");
- register_classifier_opt ("winnow", "learn_threshold");
- /* Load config */
- if (! load_rspamd_config (rspamd_main->cfg)) {
- exit (EXIT_FAILURE);
- }
-
- /* Init statfile pool */
- rspamd_main->statfile_pool = statfile_pool_new (rspamd_main->server_pool, rspamd_main->cfg->max_statfile_size);
- g_mime_init (0);
- rspamd_main->cfg->log_extended = FALSE;
-
- /* Check argc */
- if (argc > 1) {
- arg = &argv[1];
- while (*arg) {
- process_file (*arg, rspamd_main);
- arg ++;
- }
- }
- else {
- process_stdin (rspamd_main);
- }
-
- return 0;
-}