mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-24 19:20:12 +01:00
add a global extractor enable/disable option to piler.conf
This commit is contained in:
parent
abf656d102
commit
c01f0afc18
5
configure
vendored
5
configure
vendored
@ -3489,7 +3489,7 @@ fi
|
||||
echo "\"Configure command: ./configure $PARAMS\"" >> $CONFIGURE_PARAMS_FILE
|
||||
|
||||
|
||||
SUBDIRS="src etc util init.d test contrib/reload"
|
||||
SUBDIRS="src etc util init.d test"
|
||||
|
||||
|
||||
|
||||
@ -4866,7 +4866,7 @@ CFLAGS="$static -O2 -Wall -g"
|
||||
LIBS="$antispam_libs $sunos_libs "
|
||||
OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o hash.o parser.o parser_utils.o rules.o session.o message.o attachment.o digest.o store.o archive.o tai.o import.o imap.o pop3.o extract.o mydomains.o retr.o $objs"
|
||||
|
||||
ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile contrib/reload/Makefile"
|
||||
ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile"
|
||||
|
||||
cat >confcache <<\_ACEOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
@ -5566,7 +5566,6 @@ do
|
||||
"init.d/Makefile") CONFIG_FILES="$CONFIG_FILES init.d/Makefile" ;;
|
||||
"test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
|
||||
"contrib/imap/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/imap/Makefile" ;;
|
||||
"contrib/reload/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/reload/Makefile" ;;
|
||||
|
||||
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
|
||||
esac
|
||||
|
@ -86,7 +86,7 @@ fi
|
||||
echo "\"Configure command: ./configure $PARAMS\"" >> $CONFIGURE_PARAMS_FILE
|
||||
|
||||
|
||||
SUBDIRS="src etc util init.d test contrib/reload"
|
||||
SUBDIRS="src etc util init.d test"
|
||||
|
||||
|
||||
dnl static build
|
||||
@ -537,7 +537,7 @@ CFLAGS="$static -O2 -Wall -g"
|
||||
LIBS="$antispam_libs $sunos_libs "
|
||||
OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o hash.o parser.o parser_utils.o rules.o session.o message.o attachment.o digest.o store.o archive.o tai.o import.o imap.o pop3.o extract.o mydomains.o retr.o $objs"
|
||||
|
||||
AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile contrib/reload/Makefile])
|
||||
AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
|
||||
|
@ -1,38 +0,0 @@
|
||||
SHELL = @SHELL@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
includedir = @includedir@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
mandir = @mandir@
|
||||
datarootdir = @datarootdir@
|
||||
localstatedir = @localstatedir@
|
||||
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@ @CPPFLAGS@
|
||||
DEFS = @defs@
|
||||
INCDIR = -I. -I.. -I../.. -I../../src -I../src @INCDIR@ @sql_includes@
|
||||
LIBDIR = -L. @LIBDIR@ @LDFLAGS@ -L../../src
|
||||
LIBS = @LIBS@ @sql_libs@
|
||||
RUNNING_USER = @RUNNING_USER@
|
||||
RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)`
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
all: pilerreload
|
||||
|
||||
pilerreload: pilerreload.c ../../src/libpiler.a
|
||||
$(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $< -lpiler $(LIBS) $(LIBDIR)
|
||||
|
||||
install:
|
||||
|
||||
clean:
|
||||
rm -f pilerreload
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* pilerreload.c, SJ
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <piler.h>
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
char *configfile = CONFIG_FILE;
|
||||
struct __config cfg;
|
||||
|
||||
|
||||
void fatal(char *s){
|
||||
syslog(LOG_PRIORITY, "fatal: %s", s);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv){
|
||||
char buf[SMALLBUFSIZE];
|
||||
int pid;
|
||||
FILE *f;
|
||||
|
||||
(void) openlog("pilerreload", LOG_PID, LOG_MAIL);
|
||||
|
||||
cfg = read_config(CONFIG_FILE);
|
||||
|
||||
f = fopen(cfg.pidfile, "r");
|
||||
if(!f) fatal("cannot open pidfile");
|
||||
|
||||
if(fgets(buf, sizeof(buf)-2, f) == NULL) fatal("cannot read pidfile");
|
||||
|
||||
fclose(f);
|
||||
|
||||
pid = atoi(buf);
|
||||
|
||||
if(pid > 1){
|
||||
if(kill(pid, SIGHUP) == 0) syslog(LOG_PRIORITY, "reloaded");
|
||||
else syslog(LOG_PRIORITY, "failed to reload");
|
||||
}
|
||||
else fatal("invalid pid");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ all:
|
||||
-e 's%workdir=.*%workdir=$(localstatedir)/piler/tmp%g' < $(srcdir)/example.conf | grep -v ^\; | grep '=' | sort > $(srcdir)/piler.conf
|
||||
|
||||
install:
|
||||
$(INSTALL) -m 0640 -g $(RUNNING_GROUP) $(srcdir)/piler.conf $(DESTDIR)$(sysconfdir)/piler.conf.dist
|
||||
if [ ! -f "$(DESTDIR)$(sysconfdir)/piler.conf" ]; then $(INSTALL) -m 0640 -g $(RUNNING_GROUP) $(srcdir)/piler.conf $(DESTDIR)$(sysconfdir)/piler.conf; fi
|
||||
sed -e 's%LOCALSTATEDIR%$(localstatedir)%g' $(srcdir)/sphinx.conf.in > sphinx.conf.dist
|
||||
$(INSTALL) -m 0644 -g $(RUNNING_GROUP) $(srcdir)/sphinx.conf.dist $(DESTDIR)$(sysconfdir)/sphinx.conf.dist
|
||||
|
@ -52,9 +52,11 @@ listen_port=25
|
||||
|
||||
clamd_socket=/tmp/clamd
|
||||
|
||||
session_timeout=420
|
||||
helper_timeout=20
|
||||
|
||||
; whether to run external attachment extractors (1) or not (0)
|
||||
extract_attachments=1
|
||||
|
||||
; the 2nd parameter of the listen() system call. Please note that this is set
|
||||
; when piler starts up and you should restart piler if you change this variable.
|
||||
; Please also note that the meaning of this variable depends on your Unix implementation
|
||||
|
@ -289,8 +289,9 @@ int retrieve_email_from_archive(struct session_data *sdata, struct __data *data,
|
||||
int i, attachments;
|
||||
char *buffer=NULL, *saved_buffer, *p, filename[SMALLBUFSIZE], pointer[SMALLBUFSIZE];
|
||||
struct ptr_array ptr_arr[MAX_ATTACHMENTS];
|
||||
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
|
||||
struct stat st;
|
||||
|
||||
#endif
|
||||
|
||||
if(strlen(sdata->ttmpfile) != RND_STR_LEN){
|
||||
printf("invalid piler-id: %s\n", sdata->ttmpfile);
|
||||
|
@ -71,6 +71,7 @@ struct _parse_rule config_parse_rules[] =
|
||||
{ "enable_cjk", "integer", (void*) int_parser, offsetof(struct __config, enable_cjk), "0", sizeof(int)},
|
||||
{ "encrypt_messages", "integer", (void*) int_parser, offsetof(struct __config, encrypt_messages), "1", sizeof(int)},
|
||||
{ "extra_to_field", "string", (void*) string_parser, offsetof(struct __config, extra_to_field), "", MAXVAL-1},
|
||||
{ "extract_attachments", "integer", (void*) int_parser, offsetof(struct __config, extract_attachments), "1", sizeof(int)},
|
||||
{ "helper_timeout", "integer", (void*) int_parser, offsetof(struct __config, helper_timeout), "20", sizeof(int)},
|
||||
{ "hostid", "string", (void*) string_parser, offsetof(struct __config, hostid), HOSTID, MAXVAL-1},
|
||||
{ "iv", "string", (void*) string_parser, offsetof(struct __config, iv), "", MAXVAL-1},
|
||||
@ -99,7 +100,6 @@ struct _parse_rule config_parse_rules[] =
|
||||
{ "pilergetd_pidfile", "string", (void*) string_parser, offsetof(struct __config, pilergetd_pidfile), PILERGETD_PIDFILE, MAXVAL-1},
|
||||
{ "queuedir", "string", (void*) string_parser, offsetof(struct __config, queuedir), QUEUE_DIR, MAXVAL-1},
|
||||
{ "server_id", "integer", (void*) int_parser, offsetof(struct __config, server_id), "0", sizeof(int)},
|
||||
{ "session_timeout", "integer", (void*) int_parser, offsetof(struct __config, session_timeout), "420", sizeof(int)},
|
||||
{ "spam_header_line", "string", (void*) string_parser, offsetof(struct __config, spam_header_line), "", MAXVAL-1},
|
||||
{ "syslog_recipients", "integer", (void*) int_parser, offsetof(struct __config, syslog_recipients), "0", sizeof(int)},
|
||||
{ "tls_enable", "integer", (void*) int_parser, offsetof(struct __config, tls_enable), "0", sizeof(int)},
|
||||
|
@ -51,8 +51,8 @@ struct __config {
|
||||
int verbosity;
|
||||
char locale[MAXVAL];
|
||||
|
||||
int session_timeout;
|
||||
int helper_timeout;
|
||||
int extract_attachments;
|
||||
|
||||
char piler_header_field[MAXVAL];
|
||||
char extra_to_field[MAXVAL];
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#define VERSION "1.1.1"
|
||||
|
||||
#define BUILD 902
|
||||
#define BUILD 903
|
||||
|
||||
#define HOSTID "mailarchiver"
|
||||
|
||||
|
@ -130,7 +130,7 @@ void post_parse(struct session_data *sdata, struct _state *state, struct __confi
|
||||
|
||||
if(state->attachments[i].dumped == 1){
|
||||
rec = 0;
|
||||
if(state->bodylen < BIGBUFSIZE-1024) extract_attachment_content(sdata, state, state->attachments[i].aname, get_attachment_extractor_by_filename(state->attachments[i].filename), &rec, cfg);
|
||||
if(cfg->extract_attachments == 1 && state->bodylen < BIGBUFSIZE-1024) extract_attachment_content(sdata, state, state->attachments[i].aname, get_attachment_extractor_by_filename(state->attachments[i].filename), &rec, cfg);
|
||||
|
||||
unlink(state->attachments[i].aname);
|
||||
}
|
||||
|
@ -19,7 +19,9 @@
|
||||
int main(int argc, char **argv){
|
||||
int readkey=1;
|
||||
char filename[SMALLBUFSIZE];
|
||||
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
|
||||
struct stat st;
|
||||
#endif
|
||||
struct __config cfg;
|
||||
|
||||
|
||||
|
@ -60,7 +60,9 @@ ENDE:
|
||||
int remove_message_frame_files(char *s, char *update_meta_sql, struct session_data *sdata, struct __config *cfg){
|
||||
char *p, puf[SMALLBUFSIZE], filename[SMALLBUFSIZE];
|
||||
int n=0, result;
|
||||
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
|
||||
struct stat st;
|
||||
#endif
|
||||
|
||||
p = s;
|
||||
do {
|
||||
@ -105,8 +107,9 @@ int remove_attachments(char *in, struct session_data *sdata, struct __data *data
|
||||
char *a, buf[BIGBUFSIZE-300], update_meta_sql[BIGBUFSIZE], delete_attachment_stmt[BIGBUFSIZE];
|
||||
char piler_id[SMALLBUFSIZE], i[BUFLEN];
|
||||
int n=0, len, attachment_id;
|
||||
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
|
||||
struct stat st;
|
||||
|
||||
#endif
|
||||
|
||||
if(strlen(in) < 10) return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user