fixing a segfault issue when starting piler

This commit is contained in:
SJ 2013-11-01 00:41:39 +01:00
parent 2409397548
commit cdce84052f
5 changed files with 14 additions and 14 deletions

View File

@ -14,7 +14,7 @@
#define VERSION "0.1.25-master-branch" #define VERSION "0.1.25-master-branch"
#define BUILD 847 #define BUILD 848
#define HOSTID "mailarchiver" #define HOSTID "mailarchiver"

View File

@ -285,6 +285,9 @@ struct __data {
char *sql[MAX_SQL_VARS]; char *sql[MAX_SQL_VARS];
int type[MAX_SQL_VARS]; int type[MAX_SQL_VARS];
int len[MAX_SQL_VARS]; int len[MAX_SQL_VARS];
unsigned long length[MAX_SQL_VARS];
my_bool is_null[MAX_SQL_VARS];
my_bool error[MAX_SQL_VARS];
int pos; int pos;
#ifdef HAVE_TRE #ifdef HAVE_TRE

View File

@ -123,9 +123,6 @@ CLOSE:
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){
MYSQL_BIND bind[MAX_SQL_VARS]; MYSQL_BIND bind[MAX_SQL_VARS];
my_bool is_null[MAX_SQL_VARS];
unsigned long length[MAX_SQL_VARS];
my_bool error[MAX_SQL_VARS];
int i, ret=ERR; int i, ret=ERR;
memset(bind, 0, sizeof(bind)); memset(bind, 0, sizeof(bind));
@ -160,9 +157,9 @@ int p_store_results(struct session_data *sdata, MYSQL_STMT *stmt, struct __data
bind[i].buffer = (char *)data->sql[i]; bind[i].buffer = (char *)data->sql[i];
bind[i].is_null = &is_null[i]; bind[i].is_null = &(data->is_null[i]);
bind[i].length = &length[i]; bind[i].length = &(data->length[i]);
bind[i].error = &error[i]; bind[i].error = &(data->error[i]);
} }
else { break; } else { break; }

View File

@ -54,7 +54,7 @@ void load_rules(struct session_data *sdata, struct __data *data, struct node *xh
p_store_results(sdata, data->stmt_generic, data); p_store_results(sdata, data->stmt_generic, data);
while(p_fetch_results(data->stmt_generic) == OK){ while(p_fetch_results(data->stmt_generic) == OK){
append_rule(xhash, domain, from, to, subject, _size, size, attachment_type, _attachment_size, attachment_size, spam, days); append_rule(xhash, domain, from, to, subject, _size, size, attachment_type, _attachment_size, attachment_size, spam, days, data);
memset(domain, 0, sizeof(domain)); memset(domain, 0, sizeof(domain));
memset(from, 0, sizeof(from)); memset(from, 0, sizeof(from));
@ -75,7 +75,7 @@ ENDE:
} }
int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *subject, char *_size, int size, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days){ int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *subject, char *_size, int size, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days, struct __data *data){
struct node *q, *Q=NULL, *node; struct node *q, *Q=NULL, *node;
struct rule *rule; struct rule *rule;
int rc=0; int rc=0;
@ -85,7 +85,7 @@ int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *
memset(node, 0, sizeof(struct node)); memset(node, 0, sizeof(struct node));
node->r = NULL; node->r = NULL;
rule = create_rule_item(domain, from, to, subject, _size, size, attachment_type, _attachment_size, attachment_size, spam, days); rule = create_rule_item(domain, from, to, subject, _size, size, attachment_type, _attachment_size, attachment_size, spam, days, data);
if(rule == NULL){ if(rule == NULL){
free(node); free(node);
@ -112,7 +112,7 @@ int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *
} }
struct rule *create_rule_item(char *domain, char *from, char *to, char *subject, char *_size, int size, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days){ struct rule *create_rule_item(char *domain, char *from, char *to, char *subject, char *_size, int size, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days, struct __data *data){
struct rule *h=NULL; struct rule *h=NULL;
char empty = '\0'; char empty = '\0';
int len; int len;
@ -124,7 +124,7 @@ struct rule *create_rule_item(char *domain, char *from, char *to, char *subject,
h->compiled = 1; h->compiled = 1;
h->domain = NULL; h->domain = NULL;
h->domainlen = strlen(domain); h->domainlen = data->length[0];
if(h->domainlen > 2){ if(h->domainlen > 2){
h->domain = malloc(h->domainlen+2); h->domain = malloc(h->domainlen+2);

View File

@ -8,8 +8,8 @@
#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);
int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *subject, char *_size, int size, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days); int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *subject, char *_size, int size, 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 *_size, int size, char *attachment_type, char *_attachment_size, int attachment_size, int spam, int days); struct rule *create_rule_item(char *domain, char *from, char *to, char *subject, char *_size, int size, 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);
unsigned long query_retain_period(struct __data *data, struct _state *state, int size, int spam, struct __config *cfg); unsigned long query_retain_period(struct __data *data, struct _state *state, int size, int spam, struct __config *cfg);
int check_size_rule(int message_size, int size, char *_size); int check_size_rule(int message_size, int size, char *_size);