Skip to content

Commit

Permalink
src: refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: Janos SUTO <sj@acts.hu>
  • Loading branch information
jsuto committed Aug 8, 2017
1 parent 5bb52be commit 9502116
Show file tree
Hide file tree
Showing 56 changed files with 917 additions and 1,402 deletions.
16 changes: 14 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
Expand Down Expand Up @@ -751,6 +752,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE}'
Expand Down Expand Up @@ -1003,6 +1005,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;

-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;

-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
Expand Down Expand Up @@ -1140,7 +1151,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
Expand Down Expand Up @@ -1293,6 +1304,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
Expand Down Expand Up @@ -4866,7 +4878,7 @@ echo; echo
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 smtp.o session.o bdat.o message.o attachment.o digest.o store.o archive.o tai.o import.o import_maildir.o import_mailbox.o import_pop3.o import_imap.o import_gui.o imap.o pop3.o extract.o mydomains.o $objs"
OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o hash.o parser.o parser_utils.o rules.o smtp.o session.o bdat.o message.o attachment.o digest.o store.o archive.o tai.o import.o import_maildir.o import_mailbox.o import_pop3.o import_imap.o imap.o pop3.o extract.o mydomains.o $objs"
ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile unit_tests/Makefile contrib/imap/Makefile"
Expand Down
2 changes: 1 addition & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ echo; echo

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 smtp.o session.o bdat.o message.o attachment.o digest.o store.o archive.o tai.o import.o import_maildir.o import_mailbox.o import_pop3.o import_imap.o import_gui.o imap.o pop3.o extract.o mydomains.o $objs"
OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o hash.o parser.o parser_utils.o rules.o smtp.o session.o bdat.o message.o attachment.o digest.o store.o archive.o tai.o import.o import_maildir.o import_mailbox.o import_pop3.o import_imap.o imap.o pop3.o extract.o mydomains.o $objs"

AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile unit_tests/Makefile contrib/imap/Makefile])
AC_OUTPUT
Expand Down
4 changes: 2 additions & 2 deletions src/archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ int inf(unsigned char *in, int len, int mode, char **buffer, FILE *dest){
}


int retrieve_file_from_archive(char *filename, int mode, char **buffer, FILE *dest, struct __config *cfg){
int retrieve_file_from_archive(char *filename, int mode, char **buffer, FILE *dest, struct config *cfg){
int rc=0, n, olen, tlen, len, fd=-1;
unsigned char *s=NULL, *addr=NULL, inbuf[REALLYBIGBUFSIZE];
struct stat st;
Expand Down Expand Up @@ -234,7 +234,7 @@ int retrieve_file_from_archive(char *filename, int mode, char **buffer, FILE *de
}


int retrieve_email_from_archive(struct session_data *sdata, struct __data *data, FILE *dest, struct __config *cfg){
int retrieve_email_from_archive(struct session_data *sdata, struct data *data, FILE *dest, struct config *cfg){
int i, attachments;
char *buffer=NULL, *saved_buffer, *p, filename[SMALLBUFSIZE], pointer[SMALLBUFSIZE];
struct ptr_array ptr_arr[MAX_ATTACHMENTS];
Expand Down
6 changes: 3 additions & 3 deletions src/attachment.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <piler.h>


int store_attachments(struct session_data *sdata, struct parser_state *state, struct __data *data, struct __config *cfg){
int store_attachments(struct session_data *sdata, struct parser_state *state, struct data *data, struct config *cfg){
uint64 id=0;
int i, rc=1, found, affected_rows;

Expand Down Expand Up @@ -91,7 +91,7 @@ int store_attachments(struct session_data *sdata, struct parser_state *state, st
}


int query_attachment_pointers(struct session_data *sdata, struct __data *data, uint64 ptr, char *piler_id, int *id){
int query_attachment_pointers(struct session_data *sdata, struct data *data, uint64 ptr, char *piler_id, int *id){
int rc=0;

if(prepare_sql_statement(sdata, &(data->stmt_get_attachment_pointer), SQL_PREPARED_STMT_GET_ATTACHMENT_POINTER) == ERR) return rc;
Expand Down Expand Up @@ -120,7 +120,7 @@ int query_attachment_pointers(struct session_data *sdata, struct __data *data, u
}


int query_attachments(struct session_data *sdata, struct __data *data, struct ptr_array *ptr_arr){
int query_attachments(struct session_data *sdata, struct data *data, struct ptr_array *ptr_arr){
int i, rc, id, attachments=0;
uint64 ptr;

Expand Down
2 changes: 1 addition & 1 deletion src/av.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
#define CLAMD_RESP_INFECTED "FOUND"
#define CLAMD_RESP_ERROR "ERROR"

int clamd_scan(char *tmpfile, struct __config *cfg);
int clamd_scan(char *tmpfile, struct config *cfg);

#endif /* _AV_H */
2 changes: 1 addition & 1 deletion src/avir.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <piler.h>


int do_av_check(char *filename, struct __config *cfg){
int do_av_check(char *filename, struct config *cfg){
int rav = AVIR_OK;

if(clamd_scan(filename, cfg) == AV_VIRUS) rav = AVIR_VIRUS;
Expand Down
2 changes: 1 addition & 1 deletion src/bdat.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void process_bdat(struct smtp_session *session, char *readbuf, int readlen){
session->bdat_bytes_to_read -= readlen;

if(session->fd != -1){
write(session->fd, readbuf, readlen);
if(write(session->fd, readbuf, readlen) == -1) syslog(LOG_PRIORITY, "ERROR: write(), %s, %d, %s", __func__, __LINE__, __FILE__);
session->tot_len += readlen;

if(session->cfg->verbosity >= _LOG_DEBUG) syslog(LOG_INFO, "%s: wrote %d bytes, %d bytes to go", session->ttmpfile, readlen, session->bdat_bytes_to_read);
Expand Down
Loading

0 comments on commit 9502116

Please sign in to comment.