# HG changeset patch # User markus schnalke # Date 1330513593 -3600 # Node ID 9b93c0a3bd8cf57ce59b53cb90d2c67bf7542169 # Parent cff967b2f51ea24f220f47a3f09926e7777e967f Ensure lvals, rvals and components of address strucs are stripped. diff -r cff967b2f51e -r 9b93c0a3bd8c src/accept.c --- a/src/accept.c Wed Feb 29 12:05:47 2012 +0100 +++ b/src/accept.c Wed Feb 29 12:06:33 2012 +0100 @@ -199,8 +199,7 @@ DEBUG(5) debugf("hdr->value = '%s'\n", hdr->value); - addr = g_strdup(hdr->value); - g_strchomp(addr); + addr = g_strstrip(g_strdup(hdr->value)); msg->return_path = create_address_qualified(addr, FALSE, msg->received_host); if (msg->return_path) { diff -r cff967b2f51e -r 9b93c0a3bd8c src/address.c --- a/src/address.c Wed Feb 29 12:05:47 2012 +0100 +++ b/src/address.c Wed Feb 29 12:06:33 2012 +0100 @@ -37,7 +37,7 @@ address *addr = create_address(path, is_rfc821); if (addr && !addr->domain) { - addr->domain = g_strdup(domain); + addr->domain = g_strstrip(g_strdup(domain)); } return addr; } @@ -50,8 +50,8 @@ if (addr) { memset(addr, 0, sizeof(address)); - addr->address = g_strchomp(g_strdup(path)); - addr->local_part = g_strdup(addr->address); + addr->address = g_strstrip(g_strdup(path)); + addr->local_part = g_strstrip(g_strdup(addr->address)); addr->domain = g_strdup("localhost"); /* quick hack */ } return addr; @@ -78,10 +78,11 @@ if (!(addr = g_malloc(sizeof(address)))) { return NULL; } - addr->address = g_strdup(orig->address); - addr->local_part = l_part ? g_strdup(l_part) : - g_strdup(orig->local_part); - addr->domain = dom ? g_strdup(dom) : g_strdup(orig->domain); + addr->address = g_strstrip(g_strdup(orig->address)); + addr->local_part = g_strstrip(l_part ? g_strdup(l_part) : + g_strdup(orig->local_part)); + addr->domain = g_strstrip(dom ? g_strdup(dom) : + g_strdup(orig->domain)); addr->flags = 0; addr->children = NULL; addr->parent = NULL; @@ -164,14 +165,12 @@ { static gchar *buffer = NULL; - if (!addr) { - g_free(buffer); - buffer = NULL; - return NULL; - } if (buffer) { g_free(buffer); } + if (!addr) { + return NULL; + } if (!*addr->local_part) { buffer = g_strdup("<>"); } else { diff -r cff967b2f51e -r 9b93c0a3bd8c src/conf.c --- a/src/conf.c Wed Feb 29 12:05:47 2012 +0100 +++ b/src/conf.c Wed Feb 29 12:06:33 2012 +0100 @@ -380,8 +380,8 @@ if (!read_lval(in, lval, lsize)) { return FALSE; } - - DEBUG(9) fprintf(stderr, " lval = %s\n", lval); + g_strstrip(lval); + DEBUG(9) fprintf(stderr, " lval = `%s'\n", lval); if ((c = fgetc(in) != '=')) { fprintf(stderr, "'=' expected after %s, char was '%c'\n", lval, c); @@ -389,7 +389,8 @@ if (!read_rval(in, rval, rsize)) { return FALSE; } - DEBUG(9) fprintf(stderr, " rval = %s\n", rval); + g_strstrip(rval); + DEBUG(9) fprintf(stderr, " rval = `%s'\n", rval); return TRUE; }