mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 08:00:12 +01:00
code cleanup
This commit is contained in:
parent
35816852f5
commit
6bbfe1e734
2
configure
vendored
2
configure
vendored
@ -4595,7 +4595,7 @@ echo; echo
|
|||||||
|
|
||||||
CFLAGS="$static -O2 -Wall -g"
|
CFLAGS="$static -O2 -Wall -g"
|
||||||
LIBS="$antispam_libs $sunos_libs "
|
LIBS="$antispam_libs $sunos_libs "
|
||||||
OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o list.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 $objs"
|
OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o list.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 mysql.o $objs"
|
||||||
|
|
||||||
ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile"
|
ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile"
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ echo; echo
|
|||||||
|
|
||||||
CFLAGS="$static -O2 -Wall -g"
|
CFLAGS="$static -O2 -Wall -g"
|
||||||
LIBS="$antispam_libs $sunos_libs "
|
LIBS="$antispam_libs $sunos_libs "
|
||||||
OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o list.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 $objs"
|
OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o list.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 mysql.o $objs"
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile])
|
AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
@ -17,23 +17,6 @@
|
|||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
|
|
||||||
int prepare_a_mysql_statement(struct session_data *sdata, MYSQL_STMT **stmt, char *s){
|
|
||||||
|
|
||||||
*stmt = mysql_stmt_init(&(sdata->mysql));
|
|
||||||
if(!*stmt){
|
|
||||||
syslog(LOG_PRIORITY, "%s: mysql_stmt_init() error", sdata->ttmpfile);
|
|
||||||
return ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mysql_stmt_prepare(*stmt, s, strlen(s))){
|
|
||||||
syslog(LOG_PRIORITY, "%s: mysql_stmt_prepare() error: %s => sql: %s", sdata->ttmpfile, mysql_stmt_error(*stmt), s);
|
|
||||||
return ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int store_index_data(struct session_data *sdata, struct _state *state, struct __data *data, uint64 id, struct __config *cfg){
|
int store_index_data(struct session_data *sdata, struct _state *state, struct __data *data, uint64 id, struct __config *cfg){
|
||||||
int rc=ERR;
|
int rc=ERR;
|
||||||
char *subj;
|
char *subj;
|
||||||
|
38
src/mysql.c
Normal file
38
src/mysql.c
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* mysql.c, SJ
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
#include <piler.h>
|
||||||
|
|
||||||
|
|
||||||
|
int prepare_a_mysql_statement(struct session_data *sdata, MYSQL_STMT **stmt, char *s){
|
||||||
|
|
||||||
|
*stmt = mysql_stmt_init(&(sdata->mysql));
|
||||||
|
if(!*stmt){
|
||||||
|
syslog(LOG_PRIORITY, "%s: mysql_stmt_init() error", sdata->ttmpfile);
|
||||||
|
return ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mysql_stmt_prepare(*stmt, s, strlen(s))){
|
||||||
|
syslog(LOG_PRIORITY, "%s: mysql_stmt_prepare() error: %s => sql: %s", sdata->ttmpfile, mysql_stmt_error(*stmt), s);
|
||||||
|
return ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void insert_offset(struct session_data *sdata, int server_id){
|
||||||
|
char s[SMALLBUFSIZE];
|
||||||
|
uint64 id = server_id * 1000000000000ULL;
|
||||||
|
|
||||||
|
snprintf(s, sizeof(s)-1, "INSERT INTO %s (`id`) VALUES (%llu)", SQL_METADATA_TABLE, id);
|
||||||
|
|
||||||
|
mysql_real_query(&(sdata->mysql), s, strlen(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int read_key(struct __config *cfg);
|
int read_key(struct __config *cfg);
|
||||||
|
void insert_offset(struct session_data *sdata, int server_id);
|
||||||
|
|
||||||
int do_av_check(struct session_data *sdata, char *rcpttoemail, char *virusinfo, struct __data *data, struct __config *cfg);
|
int do_av_check(struct session_data *sdata, char *rcpttoemail, char *virusinfo, struct __data *data, struct __config *cfg);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user