masqmail

changeset 413:7c5e51c53f72

Finally found the newline that was to much in spool_read_header().
author markus schnalke <meillo@marmaro.de>
date Wed, 29 Feb 2012 14:22:44 +0100
parents 8a62bebda631
children 309935f59820
files src/parse.c
diffstat 1 files changed, 17 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/src/parse.c	Wed Feb 29 13:33:40 2012 +0100
     1.2 +++ b/src/parse.c	Wed Feb 29 14:22:44 2012 +0100
     1.3 @@ -390,6 +390,12 @@
     1.4  	gchar *addr_end;
     1.5  	gboolean ret;
     1.6  
     1.7 +	if (!string) {
     1.8 +		return NULL;
     1.9 +	}
    1.10 +	while (isspace(*string)) {
    1.11 +		string++;
    1.12 +	}
    1.13  	/* TODO: what about (string == NULL)? */
    1.14  	if (string && (string[0] == '\0')) {
    1.15  		address *addr = g_malloc(sizeof(address));
    1.16 @@ -411,21 +417,20 @@
    1.17  	if (!ret) {
    1.18  		return NULL;
    1.19  	}
    1.20 -
    1.21 -	address *addr = g_malloc(sizeof(address));
    1.22 -	gchar *p = addr_end;
    1.23 -
    1.24 -	memset(addr, 0, sizeof(address));
    1.25 -
    1.26 -	if (loc_beg[0] == '|') {
    1.27 +	if (*loc_beg == '|') {
    1.28  		parse_error = g_strdup("no pipe allowed for RFC 822/821 address");
    1.29  		return NULL;
    1.30  	}
    1.31  
    1.32 +	address *addr = g_malloc(sizeof(address));
    1.33 +	memset(addr, 0, sizeof(address));
    1.34 +
    1.35 +	gchar *p = addr_end;
    1.36  	while (*p && (*p != ',')) {
    1.37 +		/* it seems as if we do this for the code in rewrite.c */
    1.38  		p++;
    1.39  	}
    1.40 -	addr->address = g_strndup(string, p - string);
    1.41 +	addr->address = g_strstrip(g_strndup(string, p - string));
    1.42  	addr->local_part = g_strndup(loc_beg, loc_end - loc_beg);
    1.43  
    1.44  #ifdef PARSE_TEST
    1.45 @@ -448,6 +453,10 @@
    1.46  		*end = p;
    1.47  	}
    1.48  
    1.49 +	DEBUG(6) debugf("_create_address(): address: `%s'\n", addr->address);
    1.50 +	DEBUG(6) debugf("_create_address(): local_part: `%s'\n", addr->local_part);
    1.51 +	DEBUG(6) debugf("_create_address(): domain: `%s'\n", addr->domain);
    1.52 +
    1.53  #ifndef PARSE_TEST
    1.54  	addr_unmark_delivered(addr);
    1.55  #endif