src: move problematic messages to error directory

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2017-11-07 15:07:56 +01:00
parent 6af77bf0f1
commit 36b1e03939
3 changed files with 16 additions and 2 deletions

View File

@ -75,7 +75,9 @@ installdirs: mkinstalldirs
$(DESTDIR)$(sysconfdir)/piler \ $(DESTDIR)$(sysconfdir)/piler \
$(DESTDIR)/etc/init.d \ $(DESTDIR)/etc/init.d \
$(DESTDIR)$(localstatedir)/piler/store \ $(DESTDIR)$(localstatedir)/piler/store \
$(DESTDIR)$(localstatedir)/piler/stat $(DESTDIR)$(localstatedir)/piler/tmp \ $(DESTDIR)$(localstatedir)/piler/stat \
$(DESTDIR)$(localstatedir)/piler/tmp \
$(DESTDIR)$(localstatedir)/piler/error \
$(DESTDIR)$(localstatedir)/piler/sphinx $(DESTDIR)$(localstatedir)/piler/sphinx
$(INSTALL) -d -m 0755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/run/piler $(INSTALL) -d -m 0755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/run/piler
@ -83,6 +85,7 @@ installdirs: mkinstalldirs
$(INSTALL) -d -m 0700 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/imap $(INSTALL) -d -m 0700 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/imap
$(INSTALL) -d -m 0755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/stat $(INSTALL) -d -m 0755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/stat
$(INSTALL) -d -m 0711 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/tmp $(INSTALL) -d -m 0711 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/tmp
$(INSTALL) -d -m 0711 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/error
$(INSTALL) -d -m 0755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/sphinx $(INSTALL) -d -m 0755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/sphinx

View File

@ -11,13 +11,14 @@
#define VERSION "1.3.2" #define VERSION "1.3.2"
#define BUILD 982 #define BUILD 983
#define HOSTID "mailarchiver" #define HOSTID "mailarchiver"
#define CONFIG_FILE CONFDIR "/piler/piler.conf" #define CONFIG_FILE CONFDIR "/piler/piler.conf"
#define WORK_DIR DATADIR "/piler/tmp" #define WORK_DIR DATADIR "/piler/tmp"
#define QUEUE_DIR DATADIR "/piler/store" #define QUEUE_DIR DATADIR "/piler/store"
#define ERROR_DIR DATADIR "/piler/error"
#define CLAMD_SOCKET "/tmp/clamd" #define CLAMD_SOCKET "/tmp/clamd"

View File

@ -93,6 +93,7 @@ int process_email(char *filename, struct session_data *sdata, struct data *data,
char *status=S_STATUS_UNDEF; char *status=S_STATUS_UNDEF;
char *arule; char *arule;
char *rcpt; char *rcpt;
char *p;
struct timezone tz; struct timezone tz;
struct timeval tv1, tv2; struct timeval tv1, tv2;
struct parser_state parser_state; struct parser_state parser_state;
@ -169,6 +170,15 @@ int process_email(char *filename, struct session_data *sdata, struct data *data,
} }
else { else {
status = S_STATUS_ERROR; status = S_STATUS_ERROR;
// move the file from piler/tmp/[0-xxx] dir to piler/error directory
p = strchr(filename, '/');
if(p)
p++;
else
p = filename;
snprintf(tmpbuf, sizeof(tmpbuf)-1, "%s/%s", ERROR_DIR, p);
rename(filename, tmpbuf);
} }
if(rc != ERR) unlink(filename); if(rc != ERR) unlink(filename);