Lines 99-104
Link Here
|
99 |
guint i; |
99 |
guint i; |
100 |
|
100 |
|
101 |
if (how & RSPAMD_MILTER_RESET_IO) { |
101 |
if (how & RSPAMD_MILTER_RESET_IO) { |
|
|
102 |
msg_debug_milter ("cleanup IO on abort"); |
103 |
|
102 |
DL_FOREACH_SAFE (priv->out_chain, obuf, obuf_tmp) { |
104 |
DL_FOREACH_SAFE (priv->out_chain, obuf, obuf_tmp) { |
103 |
rspamd_milter_obuf_free (obuf); |
105 |
rspamd_milter_obuf_free (obuf); |
104 |
} |
106 |
} |
Lines 111-118
Link Here
|
111 |
} |
113 |
} |
112 |
|
114 |
|
113 |
if (how & RSPAMD_MILTER_RESET_COMMON) { |
115 |
if (how & RSPAMD_MILTER_RESET_COMMON) { |
|
|
116 |
msg_debug_milter ("cleanup common data on abort"); |
117 |
|
114 |
if (session->message) { |
118 |
if (session->message) { |
115 |
session->message->len = 0; |
119 |
session->message->len = 0; |
|
|
120 |
msg_debug_milter ("cleanup message on abort"); |
116 |
} |
121 |
} |
117 |
|
122 |
|
118 |
if (session->rcpts) { |
123 |
if (session->rcpts) { |
Lines 120-149
Link Here
|
120 |
rspamd_email_address_unref (cur); |
125 |
rspamd_email_address_unref (cur); |
121 |
} |
126 |
} |
122 |
|
127 |
|
|
|
128 |
msg_debug_milter ("cleanup %d recipients on abort", |
129 |
(gint)session->rcpts->len); |
130 |
|
123 |
g_ptr_array_free (session->rcpts, TRUE); |
131 |
g_ptr_array_free (session->rcpts, TRUE); |
124 |
session->rcpts = NULL; |
132 |
session->rcpts = NULL; |
125 |
} |
133 |
} |
126 |
|
134 |
|
127 |
if (session->from) { |
135 |
if (session->from) { |
|
|
136 |
msg_debug_milter ("cleanup from"); |
128 |
rspamd_email_address_unref (session->from); |
137 |
rspamd_email_address_unref (session->from); |
129 |
session->from = NULL; |
138 |
session->from = NULL; |
130 |
} |
139 |
} |
131 |
|
140 |
|
132 |
if (session->helo) { |
141 |
if (session->helo) { |
|
|
142 |
msg_debug_milter ("cleanup helo"); |
133 |
session->helo->len = 0; |
143 |
session->helo->len = 0; |
134 |
} |
144 |
} |
135 |
|
145 |
|
136 |
if (session->hostname) { |
146 |
if (session->hostname) { |
|
|
147 |
msg_debug_milter ("cleanup hostname"); |
137 |
session->hostname->len = 0; |
148 |
session->hostname->len = 0; |
138 |
} |
149 |
} |
139 |
|
150 |
|
140 |
if (priv->headers) { |
151 |
if (priv->headers) { |
|
|
152 |
msg_debug_milter ("cleanup headers"); |
141 |
g_hash_table_remove_all (priv->headers); |
153 |
g_hash_table_remove_all (priv->headers); |
142 |
} |
154 |
} |
143 |
} |
155 |
} |
144 |
|
156 |
|
145 |
if (how & RSPAMD_MILTER_RESET_ADDR) { |
157 |
if (how & RSPAMD_MILTER_RESET_ADDR) { |
146 |
if (session->addr) { |
158 |
if (session->addr) { |
|
|
159 |
msg_debug_milter ("cleanup addr"); |
147 |
rspamd_inet_address_free (session->addr); |
160 |
rspamd_inet_address_free (session->addr); |
148 |
session->addr = NULL; |
161 |
session->addr = NULL; |
149 |
} |
162 |
} |
Lines 151-156
Link Here
|
151 |
|
164 |
|
152 |
if (how & RSPAMD_MILTER_RESET_MACRO) { |
165 |
if (how & RSPAMD_MILTER_RESET_MACRO) { |
153 |
if (session->macros) { |
166 |
if (session->macros) { |
|
|
167 |
msg_debug_milter ("cleanup macros"); |
154 |
g_hash_table_unref (session->macros); |
168 |
g_hash_table_unref (session->macros); |
155 |
session->macros = NULL; |
169 |
session->macros = NULL; |
156 |
} |
170 |
} |
Lines 1612-1618
Link Here
|
1612 |
msg_err_milter ("cannot find scan results, tempfail"); |
1626 |
msg_err_milter ("cannot find scan results, tempfail"); |
1613 |
rspamd_milter_send_action (session, RSPAMD_MILTER_TEMPFAIL); |
1627 |
rspamd_milter_send_action (session, RSPAMD_MILTER_TEMPFAIL); |
1614 |
|
1628 |
|
1615 |
return; |
1629 |
goto cleanup; |
1616 |
} |
1630 |
} |
1617 |
|
1631 |
|
1618 |
elt = ucl_object_lookup (results, "action"); |
1632 |
elt = ucl_object_lookup (results, "action"); |
Lines 1621-1627
Link Here
|
1621 |
msg_err_milter ("cannot find action in results, tempfail"); |
1635 |
msg_err_milter ("cannot find action in results, tempfail"); |
1622 |
rspamd_milter_send_action (session, RSPAMD_MILTER_TEMPFAIL); |
1636 |
rspamd_milter_send_action (session, RSPAMD_MILTER_TEMPFAIL); |
1623 |
|
1637 |
|
1624 |
return; |
1638 |
goto cleanup; |
1625 |
} |
1639 |
} |
1626 |
|
1640 |
|
1627 |
rspamd_action_from_str (ucl_object_tostring (elt), &action); |
1641 |
rspamd_action_from_str (ucl_object_tostring (elt), &action); |
Lines 1681-1687
Link Here
|
1681 |
} |
1695 |
} |
1682 |
|
1696 |
|
1683 |
rspamd_milter_set_reply (session, rcode, xcode, reply); |
1697 |
rspamd_milter_set_reply (session, rcode, xcode, reply); |
1684 |
rspamd_milter_send_action (session, RSPAMD_MILTER_REJECT); |
|
|
1685 |
} |
1698 |
} |
1686 |
break; |
1699 |
break; |
1687 |
case METRIC_ACTION_SOFT_REJECT: |
1700 |
case METRIC_ACTION_SOFT_REJECT: |
Lines 1696-1702
Link Here
|
1696 |
} |
1709 |
} |
1697 |
|
1710 |
|
1698 |
rspamd_milter_set_reply (session, rcode, xcode, reply); |
1711 |
rspamd_milter_set_reply (session, rcode, xcode, reply); |
1699 |
rspamd_milter_send_action (session, RSPAMD_MILTER_REJECT); |
|
|
1700 |
break; |
1712 |
break; |
1701 |
|
1713 |
|
1702 |
case METRIC_ACTION_REWRITE_SUBJECT: |
1714 |
case METRIC_ACTION_REWRITE_SUBJECT: |
Lines 1741-1746
Link Here
|
1741 |
rspamd_fstring_free (rcode); |
1753 |
rspamd_fstring_free (rcode); |
1742 |
rspamd_fstring_free (xcode); |
1754 |
rspamd_fstring_free (xcode); |
1743 |
rspamd_fstring_free (reply); |
1755 |
rspamd_fstring_free (reply); |
|
|
1756 |
|
1757 |
rspamd_milter_session_reset (session, RSPAMD_MILTER_RESET_ABORT); |
1744 |
} |
1758 |
} |
1745 |
|
1759 |
|
1746 |
void |
1760 |
void |