diff --git a/src/message.c b/src/message.c index 7715480..2b0dc20 100644 --- a/src/message.c +++ b/src/message.c @@ -207,7 +207,7 @@ 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 @@ 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 @@ CLOSE: mysql_stmt_close(stmt); + if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: added %d recipients", sdata->ttmpfile, n); + return ret; } diff --git a/src/parser.c b/src/parser.c index 397f141..7d08acf 100644 --- a/src/parser.c +++ b/src/parser.c @@ -49,14 +49,16 @@ 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 @@ 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'; }