diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-12-15 17:38:11 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-12-15 17:38:11 +0300 |
commit | b7046a0e6667e9c840b83acaf08f9ac117508eaa (patch) | |
tree | 0e0ffa0df321bae6b72c68fd4e7792a439af6189 /src/spf.c | |
parent | 1cf238549b8a2626f537f00b215e75eb19621570 (diff) | |
download | rspamd-b7046a0e6667e9c840b83acaf08f9ac117508eaa.tar.gz rspamd-b7046a0e6667e9c840b83acaf08f9ac117508eaa.zip |
* Fix inserting one list to another in spf parser (include border elements)
Diffstat (limited to 'src/spf.c')
-rw-r--r-- | src/spf.c | 29 |
1 files changed, 20 insertions, 9 deletions
@@ -285,18 +285,29 @@ spf_record_dns_callback (int result, char type, int count, int ttl, void *addres /* Insert new list in place of include element */ last = g_list_last (cb->rec->addrs); - if (elt->prev) { - elt->prev->next = cb->rec->addrs; - } - if (elt->next) { - elt->next->prev = last; + if (elt->prev == NULL && elt->next == NULL) { + g_list_free1 (elt); } - cb->rec->addrs->prev = elt->prev; - last->next = elt->next; + else { + + if (elt->prev) { + elt->prev->next = cb->rec->addrs; + } + else { + /* Elt is the first element, so we need to shift temporary list */ + tmp = elt->next; + } + if (elt->next) { + elt->next->prev = last; + last->next = elt->next; + } - cb->rec->addrs = tmp; - g_list_free1 (elt); + cb->rec->addrs->prev = elt->prev; + + cb->rec->addrs = tmp; + g_list_free1 (elt); + } } } } |