logging option to the prepared statement

This commit is contained in:
SJ 2015-07-24 14:28:31 +02:00
parent 0a4120a64a
commit ed0a8bafd5
16 changed files with 47 additions and 45 deletions

View File

@ -21,8 +21,8 @@ int store_attachments(struct session_data *sdata, struct _state *state, struct _
int i, rc=1, found, affected_rows; int i, rc=1, found, affected_rows;
if(prepare_sql_statement(sdata, &(data->stmt_insert_into_attachment_table), SQL_PREPARED_STMT_INSERT_INTO_ATTACHMENT_TABLE) == ERR) return rc; if(prepare_sql_statement(sdata, &(data->stmt_insert_into_attachment_table), SQL_PREPARED_STMT_INSERT_INTO_ATTACHMENT_TABLE, cfg) == ERR) return rc;
if(prepare_sql_statement(sdata, &(data->stmt_get_attachment_id_by_signature), SQL_PREPARED_STMT_GET_ATTACHMENT_ID_BY_SIGNATURE) == ERR) return rc; if(prepare_sql_statement(sdata, &(data->stmt_get_attachment_id_by_signature), SQL_PREPARED_STMT_GET_ATTACHMENT_ID_BY_SIGNATURE, cfg) == ERR) return rc;
for(i=1; i<=state->n_attachments; i++){ for(i=1; i<=state->n_attachments; i++){
@ -96,7 +96,7 @@ CLOSE:
int query_attachment_pointers(struct session_data *sdata, struct __data *data, uint64 ptr, char *piler_id, int *id, struct __config *cfg){ int query_attachment_pointers(struct session_data *sdata, struct __data *data, uint64 ptr, char *piler_id, int *id, struct __config *cfg){
int rc=0; int rc=0;
if(prepare_sql_statement(sdata, &(data->stmt_get_attachment_pointer), SQL_PREPARED_STMT_GET_ATTACHMENT_POINTER) == ERR) return rc; if(prepare_sql_statement(sdata, &(data->stmt_get_attachment_pointer), SQL_PREPARED_STMT_GET_ATTACHMENT_POINTER, cfg) == ERR) return rc;
p_bind_init(data); p_bind_init(data);
@ -130,7 +130,7 @@ int query_attachments(struct session_data *sdata, struct __data *data, struct pt
for(i=0; i<MAX_ATTACHMENTS; i++) memset((char*)&ptr_arr[i], 0, sizeof(struct ptr_array)); for(i=0; i<MAX_ATTACHMENTS; i++) memset((char*)&ptr_arr[i], 0, sizeof(struct ptr_array));
if(prepare_sql_statement(sdata, &(data->stmt_query_attachment), SQL_PREPARED_STMT_QUERY_ATTACHMENT) == ERR) goto ENDE; if(prepare_sql_statement(sdata, &(data->stmt_query_attachment), SQL_PREPARED_STMT_QUERY_ATTACHMENT, cfg) == ERR) goto ENDE;
p_bind_init(data); p_bind_init(data);

View File

@ -20,7 +20,7 @@ struct __counters load_counters(struct session_data *sdata, struct __data *data,
snprintf(buf, SMALLBUFSIZE-1, "SELECT `rcvd`, `virus`, `duplicate`, `ignore`, `size`, `stored_size` FROM `%s`", SQL_COUNTER_TABLE); snprintf(buf, SMALLBUFSIZE-1, "SELECT `rcvd`, `virus`, `duplicate`, `ignore`, `size`, `stored_size` FROM `%s`", SQL_COUNTER_TABLE);
if(prepare_sql_statement(sdata, &(data->stmt_generic), buf) == ERR) return counters; if(prepare_sql_statement(sdata, &(data->stmt_generic), buf, cfg) == ERR) return counters;
p_bind_init(data); p_bind_init(data);

View File

@ -142,10 +142,10 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da
} }
int get_folder_id(struct session_data *sdata, struct __data *data, char *foldername, int parent_id){ int get_folder_id(struct session_data *sdata, struct __data *data, char *foldername, int parent_id, struct __config *cfg){
int id=ERR_FOLDER; int id=ERR_FOLDER;
if(prepare_sql_statement(sdata, &(data->stmt_get_folder_id), SQL_PREPARED_STMT_GET_FOLDER_ID) == ERR) return id; if(prepare_sql_statement(sdata, &(data->stmt_get_folder_id), SQL_PREPARED_STMT_GET_FOLDER_ID, cfg) == ERR) return id;
p_bind_init(data); p_bind_init(data);
data->sql[data->pos] = foldername; data->type[data->pos] = TYPE_STRING; data->pos++; data->sql[data->pos] = foldername; data->type[data->pos] = TYPE_STRING; data->pos++;
@ -167,12 +167,12 @@ int get_folder_id(struct session_data *sdata, struct __data *data, char *foldern
} }
int add_new_folder(struct session_data *sdata, struct __data *data, char *foldername, int parent_id){ int add_new_folder(struct session_data *sdata, struct __data *data, char *foldername, int parent_id, struct __config *cfg){
int id=ERR_FOLDER; int id=ERR_FOLDER;
if(foldername == NULL) return id; if(foldername == NULL) return id;
if(prepare_sql_statement(sdata, &(data->stmt_insert_into_folder_table), SQL_PREPARED_STMT_INSERT_INTO_FOLDER_TABLE) == ERR) return id; if(prepare_sql_statement(sdata, &(data->stmt_insert_into_folder_table), SQL_PREPARED_STMT_INSERT_INTO_FOLDER_TABLE, cfg) == ERR) return id;
p_bind_init(data); p_bind_init(data);
data->sql[data->pos] = foldername; data->type[data->pos] = TYPE_STRING; data->pos++; data->sql[data->pos] = foldername; data->type[data->pos] = TYPE_STRING; data->pos++;

View File

@ -25,7 +25,7 @@ int store_index_data(struct session_data *sdata, struct _state *state, struct __
if(*subj == ' ') subj++; if(*subj == ' ') subj++;
if(prepare_sql_statement(sdata, &(data->stmt_insert_into_sphinx_table), SQL_PREPARED_STMT_INSERT_INTO_SPHINX_TABLE) == ERR) return rc; if(prepare_sql_statement(sdata, &(data->stmt_insert_into_sphinx_table), SQL_PREPARED_STMT_INSERT_INTO_SPHINX_TABLE, cfg) == ERR) return rc;
fix_email_address_for_sphinx(state->b_from); fix_email_address_for_sphinx(state->b_from);
@ -63,7 +63,7 @@ int store_index_data(struct session_data *sdata, struct _state *state, struct __
uint64 get_metaid_by_messageid(struct session_data *sdata, struct __data *data, char *message_id, struct __config *cfg){ uint64 get_metaid_by_messageid(struct session_data *sdata, struct __data *data, char *message_id, struct __config *cfg){
uint64 id=0; uint64 id=0;
if(prepare_sql_statement(sdata, &(data->stmt_get_meta_id_by_message_id), SQL_PREPARED_STMT_GET_META_ID_BY_MESSAGE_ID) == ERR) return id; if(prepare_sql_statement(sdata, &(data->stmt_get_meta_id_by_message_id), SQL_PREPARED_STMT_GET_META_ID_BY_MESSAGE_ID, cfg) == ERR) return id;
p_bind_init(data); p_bind_init(data);
data->sql[data->pos] = message_id; data->type[data->pos] = TYPE_STRING; data->pos++; data->sql[data->pos] = message_id; data->type[data->pos] = TYPE_STRING; data->pos++;
@ -91,7 +91,7 @@ int store_recipients(struct session_data *sdata, struct __data *data, char *to,
int ret=OK, n=0; int ret=OK, n=0;
char *p, *q, puf[SMALLBUFSIZE]; char *p, *q, puf[SMALLBUFSIZE];
if(prepare_sql_statement(sdata, &(data->stmt_insert_into_rcpt_table), SQL_PREPARED_STMT_INSERT_INTO_RCPT_TABLE) == ERR) return ret; if(prepare_sql_statement(sdata, &(data->stmt_insert_into_rcpt_table), SQL_PREPARED_STMT_INSERT_INTO_RCPT_TABLE, cfg) == ERR) return ret;
p = to; p = to;
do { do {
@ -128,7 +128,7 @@ int store_recipients(struct session_data *sdata, struct __data *data, char *to,
int update_metadata_reference(struct session_data *sdata, struct _state *state, struct __data *data, char *ref, struct __config *cfg){ int update_metadata_reference(struct session_data *sdata, struct _state *state, struct __data *data, char *ref, struct __config *cfg){
int ret = ERR; int ret = ERR;
if(prepare_sql_statement(sdata, &(data->stmt_update_metadata_reference), SQL_PREPARED_STMT_UPDATE_METADATA_REFERENCE) == ERR) return ret; if(prepare_sql_statement(sdata, &(data->stmt_update_metadata_reference), SQL_PREPARED_STMT_UPDATE_METADATA_REFERENCE, cfg) == ERR) return ret;
p_bind_init(data); p_bind_init(data);
@ -165,7 +165,7 @@ int store_meta_data(struct session_data *sdata, struct _state *state, struct __d
} }
if(prepare_sql_statement(sdata, &(data->stmt_insert_into_meta_table), SQL_PREPARED_STMT_INSERT_INTO_META_TABLE) == ERR) return ERR; if(prepare_sql_statement(sdata, &(data->stmt_insert_into_meta_table), SQL_PREPARED_STMT_INSERT_INTO_META_TABLE, cfg) == ERR) return ERR;
memset(s2, 0, sizeof(s2)); memset(s2, 0, sizeof(s2));

View File

@ -17,7 +17,7 @@ void load_mydomains(struct session_data *sdata, struct __data *data, struct __co
memset(s, 0, sizeof(s)); memset(s, 0, sizeof(s));
if(prepare_sql_statement(sdata, &(data->stmt_generic), SQL_PREPARED_STMT_GET_DOMAINS) == ERR) return; if(prepare_sql_statement(sdata, &(data->stmt_generic), SQL_PREPARED_STMT_GET_DOMAINS, cfg) == ERR) return;
p_bind_init(data); p_bind_init(data);

View File

@ -208,7 +208,9 @@ int p_get_affected_rows(MYSQL_STMT *stmt){
} }
int prepare_sql_statement(struct session_data *sdata, MYSQL_STMT **stmt, char *s){ int prepare_sql_statement(struct session_data *sdata, MYSQL_STMT **stmt, char *s, struct __config *cfg){
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: sql=%s", sdata->ttmpfile, s);
*stmt = mysql_stmt_init(&(sdata->mysql)); *stmt = mysql_stmt_init(&(sdata->mysql));
if(!*stmt){ if(!*stmt){

View File

@ -333,8 +333,8 @@ void initialise_configuration(){
return; return;
} }
load_rules(&sdata, &data, data.archiving_rules, SQL_ARCHIVING_RULE_TABLE); load_rules(&sdata, &data, data.archiving_rules, SQL_ARCHIVING_RULE_TABLE, &cfg);
load_rules(&sdata, &data, data.retention_rules, SQL_RETENTION_RULE_TABLE); load_rules(&sdata, &data, data.retention_rules, SQL_RETENTION_RULE_TABLE, &cfg);
load_mydomains(&sdata, &data, &cfg); load_mydomains(&sdata, &data, &cfg);

View File

@ -54,8 +54,8 @@ int retrieve_email_from_archive(struct session_data *sdata, struct __data *data,
int file_from_archive_to_network(char *filename, int sd, int tls_enable, struct __data *data, struct __config *cfg); int file_from_archive_to_network(char *filename, int sd, int tls_enable, struct __data *data, struct __config *cfg);
int import_message(char *filename, struct session_data *sdata, struct __data *data, struct __config *cfg); int import_message(char *filename, struct session_data *sdata, struct __data *data, struct __config *cfg);
int get_folder_id(struct session_data *sdata, struct __data *data, char *foldername, int parent_id); int get_folder_id(struct session_data *sdata, struct __data *data, char *foldername, int parent_id, struct __config *cfg);
int add_new_folder(struct session_data *sdata, struct __data *data, char *foldername, int parent_id); int add_new_folder(struct session_data *sdata, struct __data *data, char *foldername, int parent_id, struct __config *cfg);
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);

View File

@ -144,7 +144,7 @@ int export_emails_matching_to_query(struct session_data *sdata, struct __data *d
int rc=0; int rc=0;
if(prepare_sql_statement(sdata, &(data->stmt_generic), s) == ERR) return ERR; if(prepare_sql_statement(sdata, &(data->stmt_generic), s, cfg) == ERR) return ERR;
p_bind_init(data); p_bind_init(data);

View File

@ -134,9 +134,9 @@ int import_mbox_from_dir(char *directory, struct session_data *sdata, struct __d
if(S_ISREG(st.st_mode)){ if(S_ISREG(st.st_mode)){
if(i == 0 && data->recursive_folder_names == 1){ if(i == 0 && data->recursive_folder_names == 1){
folder = get_folder_id(sdata, data, fname, data->folder); folder = get_folder_id(sdata, data, fname, data->folder, cfg);
if(folder == ERR_FOLDER){ if(folder == ERR_FOLDER){
folder = add_new_folder(sdata, data, fname, data->folder); folder = add_new_folder(sdata, data, fname, data->folder, cfg);
if(folder == ERR_FOLDER){ if(folder == ERR_FOLDER){
printf("error: cannot get/add folder '%s' to parent id: %d\n", fname, data->folder); printf("error: cannot get/add folder '%s' to parent id: %d\n", fname, data->folder);
@ -210,9 +210,9 @@ int import_from_maildir(char *directory, struct session_data *sdata, struct __da
return ERR; return ERR;
} }
folder = get_folder_id(sdata, data, p, data->folder); folder = get_folder_id(sdata, data, p, data->folder, cfg);
if(folder == ERR_FOLDER){ if(folder == ERR_FOLDER){
folder = add_new_folder(sdata, data, p, data->folder); folder = add_new_folder(sdata, data, p, data->folder, cfg);
if(folder == ERR_FOLDER){ if(folder == ERR_FOLDER){
printf("error: cannot get/add folder '%s' to parent id: %d\n", p, data->folder); printf("error: cannot get/add folder '%s' to parent id: %d\n", p, data->folder);
@ -415,7 +415,7 @@ int read_gui_import_data(struct session_data *sdata, struct __data *data, char *
memset(s_password, 0, sizeof(s_password)); memset(s_password, 0, sizeof(s_password));
memset(s_server, 0, sizeof(s_server)); memset(s_server, 0, sizeof(s_server));
if(prepare_sql_statement(sdata, &(data->stmt_generic), SQL_PREPARED_STMT_GET_GUI_IMPORT_JOBS) == ERR) return ERR; if(prepare_sql_statement(sdata, &(data->stmt_generic), SQL_PREPARED_STMT_GET_GUI_IMPORT_JOBS, cfg) == ERR) return ERR;
p_bind_init(data); p_bind_init(data);
@ -689,10 +689,10 @@ int main(int argc, char **argv){
#endif #endif
if(folder){ if(folder){
data.folder = get_folder_id(&sdata, &data, folder, 0); data.folder = get_folder_id(&sdata, &data, folder, 0, &cfg);
if(data.folder == ERR_FOLDER){ if(data.folder == ERR_FOLDER){
data.folder = add_new_folder(&sdata, &data, folder, 0); data.folder = add_new_folder(&sdata, &data, folder, 0, &cfg);
} }
if(data.folder == ERR_FOLDER){ if(data.folder == ERR_FOLDER){
@ -703,8 +703,8 @@ int main(int argc, char **argv){
} }
load_rules(&sdata, &data, data.archiving_rules, SQL_ARCHIVING_RULE_TABLE); load_rules(&sdata, &data, data.archiving_rules, SQL_ARCHIVING_RULE_TABLE, &cfg);
load_rules(&sdata, &data, data.retention_rules, SQL_RETENTION_RULE_TABLE); load_rules(&sdata, &data, data.retention_rules, SQL_RETENTION_RULE_TABLE, &cfg);
load_mydomains(&sdata, &data, &cfg); load_mydomains(&sdata, &data, &cfg);

View File

@ -33,7 +33,7 @@ unsigned long purged_size=0;
int is_purge_allowed(struct session_data *sdata, struct __data *data, struct __config *cfg){ int is_purge_allowed(struct session_data *sdata, struct __data *data, struct __config *cfg){
int rc=0; int rc=0;
if(prepare_sql_statement(sdata, &(data->stmt_generic), SQL_STMT_SELECT_PURGE_FROM_OPTION_TABLE) == ERR) return rc; if(prepare_sql_statement(sdata, &(data->stmt_generic), SQL_STMT_SELECT_PURGE_FROM_OPTION_TABLE, cfg) == ERR) return rc;
p_bind_init(data); p_bind_init(data);
@ -124,7 +124,7 @@ int remove_attachments(char *in, struct session_data *sdata, struct __data *data
in[strlen(in)-1] = '\0'; in[strlen(in)-1] = '\0';
snprintf(a, len-1, "%s%s", SQL_STMT_SELECT_NON_REFERENCED_ATTACHMENTS, in); snprintf(a, len-1, "%s%s", SQL_STMT_SELECT_NON_REFERENCED_ATTACHMENTS, in);
if(prepare_sql_statement(sdata, &(data->stmt_select_non_referenced_attachments), a) == ERR){ free(a); return n; } if(prepare_sql_statement(sdata, &(data->stmt_select_non_referenced_attachments), a, cfg) == ERR){ free(a); return n; }
if(dryrun == 1) printf("running sql query: *%s*\n\n", a); if(dryrun == 1) printf("running sql query: *%s*\n\n", a);
@ -248,7 +248,7 @@ int purge_messages_round1(struct session_data *sdata, struct __data *data, char
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "purge sql: *%s*", s); if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "purge sql: *%s*", s);
if(prepare_sql_statement(sdata, &(data->stmt_select_from_meta_table), s) == ERR) return purged; if(prepare_sql_statement(sdata, &(data->stmt_select_from_meta_table), s, cfg) == ERR) return purged;
p_bind_init(data); p_bind_init(data);
@ -308,7 +308,7 @@ int purge_messages_with_attachments(struct session_data *sdata, struct __data *d
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "purge sql: *%s*", s); if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "purge sql: *%s*", s);
if(prepare_sql_statement(sdata, &(data->stmt_select_from_meta_table), s) == ERR) return purged; if(prepare_sql_statement(sdata, &(data->stmt_select_from_meta_table), s, cfg) == ERR) return purged;
p_bind_init(data); p_bind_init(data);
if(p_exec_query(sdata, data->stmt_select_from_meta_table, data) == ERR) goto ENDE; if(p_exec_query(sdata, data->stmt_select_from_meta_table, data) == ERR) goto ENDE;

View File

@ -42,14 +42,14 @@ void p_clean_exit(char *msg, int rc){
} }
uint64 get_max_meta_id(struct session_data *sdata, struct __data *data){ uint64 get_max_meta_id(struct session_data *sdata, struct __data *data, struct __config *cfg){
char s[SMALLBUFSIZE]; char s[SMALLBUFSIZE];
uint64 id=0; uint64 id=0;
snprintf(s, sizeof(s)-1, "SELECT MAX(`id`) FROM %s", SQL_METADATA_TABLE); snprintf(s, sizeof(s)-1, "SELECT MAX(`id`) FROM %s", SQL_METADATA_TABLE);
if(prepare_sql_statement(sdata, &(data->stmt_generic), s) == ERR) return id; if(prepare_sql_statement(sdata, &(data->stmt_generic), s, cfg) == ERR) return id;
p_bind_init(data); p_bind_init(data);
@ -85,7 +85,7 @@ uint64 retrieve_email_by_metadata_id(struct session_data *sdata, struct __data *
snprintf(s, sizeof(s)-1, "SELECT `id`, `piler_id`, `arrived`, `sent` FROM %s WHERE (id BETWEEN %llu AND %llu) AND `deleted`=0", SQL_METADATA_TABLE, from_id, to_id); snprintf(s, sizeof(s)-1, "SELECT `id`, `piler_id`, `arrived`, `sent` FROM %s WHERE (id BETWEEN %llu AND %llu) AND `deleted`=0", SQL_METADATA_TABLE, from_id, to_id);
if(prepare_sql_statement(sdata, &(data->stmt_generic), s) == ERR) return reindexed; if(prepare_sql_statement(sdata, &(data->stmt_generic), s, cfg) == ERR) return reindexed;
p_bind_init(data); p_bind_init(data);
@ -233,7 +233,7 @@ int main(int argc, char **argv){
} }
if(folder){ if(folder){
data.folder = get_folder_id(&sdata, &data, folder, 0); data.folder = get_folder_id(&sdata, &data, folder, 0, &cfg);
if(data.folder == 0){ if(data.folder == 0){
printf("error: could not get folder id for '%s'\n", folder); printf("error: could not get folder id for '%s'\n", folder);
return 0; return 0;
@ -245,7 +245,7 @@ int main(int argc, char **argv){
if(all == 1){ if(all == 1){
from_id = 1; from_id = 1;
to_id = get_max_meta_id(&sdata, &data); to_id = get_max_meta_id(&sdata, &data, &cfg);
} }
n = retrieve_email_by_metadata_id(&sdata, &data, from_id, to_id, &cfg); n = retrieve_email_by_metadata_id(&sdata, &data, from_id, to_id, &cfg);

View File

@ -10,7 +10,7 @@
#include "rules.h" #include "rules.h"
void load_rules(struct session_data *sdata, struct __data *data, struct node *xhash[], char *table){ void load_rules(struct session_data *sdata, struct __data *data, struct node *xhash[], char *table, struct __config *cfg){
char s[SMALLBUFSIZE]; char s[SMALLBUFSIZE];
char domain[SMALLBUFSIZE], from[SMALLBUFSIZE], to[SMALLBUFSIZE], subject[SMALLBUFSIZE], body[SMALLBUFSIZE], _size[SMALLBUFSIZE], attachment_name[SMALLBUFSIZE], attachment_type[SMALLBUFSIZE], _attachment_size[SMALLBUFSIZE]; char domain[SMALLBUFSIZE], from[SMALLBUFSIZE], to[SMALLBUFSIZE], subject[SMALLBUFSIZE], body[SMALLBUFSIZE], _size[SMALLBUFSIZE], attachment_name[SMALLBUFSIZE], attachment_type[SMALLBUFSIZE], _attachment_size[SMALLBUFSIZE];
int size=0, attachment_size=0, spam=0, days=0; int size=0, attachment_size=0, spam=0, days=0;
@ -28,7 +28,7 @@ void load_rules(struct session_data *sdata, struct __data *data, struct node *xh
snprintf(s, sizeof(s)-1, "SELECT `domain`, `from`, `to`, `subject`, `body`, `_size`, `size`, `attachment_name`, `attachment_type`, `_attachment_size`, `attachment_size`, `spam`, `days` FROM `%s`", table); snprintf(s, sizeof(s)-1, "SELECT `domain`, `from`, `to`, `subject`, `body`, `_size`, `size`, `attachment_name`, `attachment_type`, `_attachment_size`, `attachment_size`, `spam`, `days` FROM `%s`", table);
if(prepare_sql_statement(sdata, &(data->stmt_generic), s) == ERR) return; if(prepare_sql_statement(sdata, &(data->stmt_generic), s, cfg) == ERR) return;
p_bind_init(data); p_bind_init(data);

View File

@ -7,7 +7,7 @@
#include "defs.h" #include "defs.h"
void load_rules(struct session_data *sdata, struct __data *data, struct node *xhash[], char *table); void load_rules(struct session_data *sdata, struct __data *data, struct node *xhash[], char *table, struct __config *cfg);
int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *subject, char *body, char *_size, int size, char *attachment_name, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days, struct __data *data); int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *subject, char *body, char *_size, int size, char *attachment_name, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days, struct __data *data);
struct rule *create_rule_item(char *domain, char *from, char *to, char *subject, char *body, char *_size, int size, char *attachment_name, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days, struct __data *data); struct rule *create_rule_item(char *domain, char *from, char *to, char *subject, char *body, char *_size, int size, char *attachment_name, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days, struct __data *data);
char *check_againt_ruleset(struct node *xhash[], struct _state *state, int size, int spam); char *check_againt_ruleset(struct node *xhash[], struct _state *state, int size, int spam);

View File

@ -8,7 +8,7 @@
int open_database(struct session_data *sdata, struct __config *cfg); int open_database(struct session_data *sdata, struct __config *cfg);
void close_database(struct session_data *sdata); void close_database(struct session_data *sdata);
int prepare_sql_statement(struct session_data *sdata, MYSQL_STMT **stmt, char *s); int prepare_sql_statement(struct session_data *sdata, MYSQL_STMT **stmt, char *s, struct __config *cfg);
void p_query(struct session_data *sdata, char *s); void p_query(struct session_data *sdata, char *s);
int p_exec_query(struct session_data *sdata, MYSQL_STMT *stmt, struct __data *data); int p_exec_query(struct session_data *sdata, MYSQL_STMT *stmt, struct __data *data);
int p_store_results(struct session_data *sdata, MYSQL_STMT *stmt, struct __data *data); int p_store_results(struct session_data *sdata, MYSQL_STMT *stmt, struct __data *data);

View File

@ -66,8 +66,8 @@ int main(int argc, char **argv){
load_mydomains(&sdata, &data, &cfg); load_mydomains(&sdata, &data, &cfg);
load_rules(&sdata, &data, data.archiving_rules, SQL_ARCHIVING_RULE_TABLE); load_rules(&sdata, &data, data.archiving_rules, SQL_ARCHIVING_RULE_TABLE, &cfg);
load_rules(&sdata, &data, data.retention_rules, SQL_RETENTION_RULE_TABLE); load_rules(&sdata, &data, data.retention_rules, SQL_RETENTION_RULE_TABLE, &cfg);
init_session_data(&sdata, &cfg); init_session_data(&sdata, &cfg);