fixed a parser bug

This commit is contained in:
SJ 2012-09-04 14:49:56 +02:00
parent 36e395426f
commit e3bd0b987a
2 changed files with 14 additions and 9 deletions

View File

@ -207,7 +207,7 @@ CLOSE:
int store_recipients(struct session_data *sdata, char *to, uint64 id, struct __config *cfg){
int ret=OK;
int ret=OK, n=0;
char *p, *q, s[SMALLBUFSIZE], puf[SMALLBUFSIZE];
MYSQL_STMT *stmt;
@ -252,6 +252,7 @@ int store_recipients(struct session_data *sdata, char *to, uint64 id, struct __c
syslog(LOG_PRIORITY, "%s: %s.mysql_stmt_execute error: *%s*", sdata->ttmpfile, SQL_RECIPIENT_TABLE, mysql_error(&(sdata->mysql)));
ret = ERR;
}
else n++;
}
} while(p);
@ -260,6 +261,8 @@ int store_recipients(struct session_data *sdata, char *to, uint64 id, struct __c
CLOSE:
mysql_stmt_close(stmt);
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: added %d recipients", sdata->ttmpfile, n);
return ret;
}

View File

@ -49,14 +49,16 @@ struct _state parse_message(struct session_data *sdata, int take_into_pieces, st
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: processing rcpt to address: *%s*", sdata->ttmpfile, puf);
if(strlen(state.b_to) < MAXBUFSIZE-len-1){
if(state.tolen < MAXBUFSIZE-len-1){
if(is_string_on_list(state.rcpt, puf) == 0){
append_list(&(state.rcpt), puf);
memcpy(&(state.b_to[strlen(state.b_to)]), puf, len);
memcpy(&(state.b_to[state.tolen]), puf, len);
state.tolen += len;
if(strlen(state.b_to) < MAXBUFSIZE-len-1){
if(state.tolen < MAXBUFSIZE-len-1){
split_email_address(puf);
memcpy(&(state.b_to[strlen(state.b_to)]), puf, len);
memcpy(&(state.b_to[state.tolen]), puf, len);
state.tolen += len;
}
}
}
@ -136,11 +138,11 @@ void post_parse(struct session_data *sdata, struct _state *state, struct __confi
else snprintf(state->message_id, SMALLBUFSIZE-1, "null");
}
len = strlen(state->b_from);
if(state->b_from[len-1] == ' ') state->b_from[len-1] = '\0';
//len = strlen(state->b_from);
//if(state->b_from[len-1] == ' ') state->b_from[len-1] = '\0';
len = strlen(state->b_to);
if(state->b_to[len-1] == ' ') state->b_to[len-1] = '\0';
//len = strlen(state->b_to);
//if(state->b_to[len-1] == ' ') state->b_to[len-1] = '\0';
}