diff --git a/Makefile.in b/Makefile.in index 3a68d238..0c1d9e1d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -75,7 +75,9 @@ installdirs: mkinstalldirs $(DESTDIR)$(sysconfdir)/piler \ $(DESTDIR)/etc/init.d \ $(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 $(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 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/error $(INSTALL) -d -m 0755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/sphinx diff --git a/src/config.h b/src/config.h index 4964c467..4b80e0c8 100644 --- a/src/config.h +++ b/src/config.h @@ -11,13 +11,14 @@ #define VERSION "1.3.2" -#define BUILD 982 +#define BUILD 983 #define HOSTID "mailarchiver" #define CONFIG_FILE CONFDIR "/piler/piler.conf" #define WORK_DIR DATADIR "/piler/tmp" #define QUEUE_DIR DATADIR "/piler/store" +#define ERROR_DIR DATADIR "/piler/error" #define CLAMD_SOCKET "/tmp/clamd" diff --git a/src/piler.c b/src/piler.c index 9bf265a3..f07ff608 100644 --- a/src/piler.c +++ b/src/piler.c @@ -93,6 +93,7 @@ int process_email(char *filename, struct session_data *sdata, struct data *data, char *status=S_STATUS_UNDEF; char *arule; char *rcpt; + char *p; struct timezone tz; struct timeval tv1, tv2; struct parser_state parser_state; @@ -169,6 +170,15 @@ int process_email(char *filename, struct session_data *sdata, struct data *data, } else { 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);