Skip to content

Commit

Permalink
fixing a segfault issue when starting piler
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuto committed Oct 31, 2013
1 parent 2409397 commit cdce840
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#define VERSION "0.1.25-master-branch"

#define BUILD 847
#define BUILD 848

#define HOSTID "mailarchiver"

Expand Down
3 changes: 3 additions & 0 deletions src/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ struct __data {
char *sql[MAX_SQL_VARS];
int type[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;

#ifdef HAVE_TRE
Expand Down
9 changes: 3 additions & 6 deletions src/mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ int p_exec_query(struct session_data *sdata, MYSQL_STMT *stmt, struct __data *da

int p_store_results(struct session_data *sdata, MYSQL_STMT *stmt, struct __data *data){
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;

memset(bind, 0, sizeof(bind));
Expand Down Expand Up @@ -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].is_null = &is_null[i];
bind[i].length = &length[i];
bind[i].error = &error[i];
bind[i].is_null = &(data->is_null[i]);
bind[i].length = &(data->length[i]);
bind[i].error = &(data->error[i]);

}
else { break; }
Expand Down
10 changes: 5 additions & 5 deletions src/rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

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(from, 0, sizeof(from));
Expand All @@ -75,7 +75,7 @@ void load_rules(struct session_data *sdata, struct __data *data, struct node *xh
}


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 rule *rule;
int rc=0;
Expand All @@ -85,7 +85,7 @@ int append_rule(struct node *xhash[], char *domain, char *from, char *to, char *
memset(node, 0, sizeof(struct node));
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){
free(node);
Expand All @@ -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;
char empty = '\0';
int len;
Expand All @@ -124,7 +124,7 @@ struct rule *create_rule_item(char *domain, char *from, char *to, char *subject,
h->compiled = 1;

h->domain = NULL;
h->domainlen = strlen(domain);
h->domainlen = data->length[0];

if(h->domainlen > 2){
h->domain = malloc(h->domainlen+2);
Expand Down
4 changes: 2 additions & 2 deletions src/rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include "defs.h"

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);
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);
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 __data *data);
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);
int check_size_rule(int message_size, int size, char *_size);
Expand Down

0 comments on commit cdce840

Please sign in to comment.